[primitives] update benchmark

test all available primitives types now
This commit is contained in:
akallabeth
2025-01-10 12:24:32 +01:00
parent 3a6994cd38
commit 4a7de1360a
2 changed files with 36 additions and 71 deletions

View File

@@ -203,78 +203,49 @@ int main(int argc, char* argv[])
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
primitives_YUV_benchmark bench = primitives_YUV_benchmark_init();
primitives_t* opt = primitives_get();
primitives_t* generic = primitives_get_generic();
if (!generic || !opt)
{
(void)fprintf(stderr, "failed to get primitives: generic=%p, opt=%p\n", (void*)generic,
(void*)opt);
goto fail;
}
printf("Running YUV420 -> RGB benchmark on generic implementation:\n");
if (!primitives_YUV420_benchmark_run(&bench, generic))
for (primitive_hints hint = PRIMITIVES_PURE_SOFT; hint < PRIMITIVES_AUTODETECT; hint++)
{
(void)fprintf(stderr, "YUV420 -> RGB benchmark failed\n");
goto fail;
}
printf("\n");
const char* hintstr = primtives_hint_str(hint);
primitives_t* prim = primitives_get_by_type(hint);
if (!prim)
{
(void)fprintf(stderr, "failed to get primitives: %s\n", hintstr);
goto fail;
}
printf("Running YUV420 benchmark on optimized implementation:\n");
if (!primitives_YUV420_benchmark_run(&bench, opt))
{
(void)fprintf(stderr, "YUV420 benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running YUV420 -> RGB benchmark on %s implementation:\n", hintstr);
if (!primitives_YUV420_benchmark_run(&bench, prim))
{
(void)fprintf(stderr, "YUV420 -> RGB benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running RGB -> YUV420 benchmark on generic implementation:\n");
if (!primitives_RGB2420_benchmark_run(&bench, generic))
{
(void)fprintf(stderr, "RGB -> YUV420 benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running RGB -> YUV420 benchmark on %s implementation:\n", hintstr);
if (!primitives_RGB2420_benchmark_run(&bench, prim))
{
(void)fprintf(stderr, "RGB -> YUV420 benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running RGB -> YUV420 benchmark on optimized implementation:\n");
if (!primitives_RGB2420_benchmark_run(&bench, opt))
{
(void)fprintf(stderr, "RGB -> YUV420 benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running YUV444 -> RGB benchmark on %s implementation:\n", hintstr);
if (!primitives_YUV444_benchmark_run(&bench, prim))
{
(void)fprintf(stderr, "YUV444 -> RGB benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running YUV444 -> RGB benchmark on generic implementation:\n");
if (!primitives_YUV444_benchmark_run(&bench, generic))
{
(void)fprintf(stderr, "YUV444 -> RGB benchmark failed\n");
goto fail;
printf("Running RGB -> YUV444 benchmark on %s implementation:\n", hintstr);
if (!primitives_RGB2444_benchmark_run(&bench, prim))
{
(void)fprintf(stderr, "RGB -> YUV444 benchmark failed\n");
goto fail;
}
printf("\n");
}
printf("\n");
printf("Running YUV444 -> RGB benchmark on optimized implementation:\n");
if (!primitives_YUV444_benchmark_run(&bench, opt))
{
(void)fprintf(stderr, "YUV444 -> RGB benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running RGB -> YUV444 benchmark on generic implementation:\n");
if (!primitives_RGB2444_benchmark_run(&bench, generic))
{
(void)fprintf(stderr, "RGB -> YUV444 benchmark failed\n");
goto fail;
}
printf("\n");
printf("Running RGB -> YUV444 benchmark on optimized implementation:\n");
if (!primitives_RGB2444_benchmark_run(&bench, opt))
{
(void)fprintf(stderr, "RGB -> YUV444 benchmark failed\n");
goto fail;
}
printf("\n");
fail:
primitives_YUV_benchmark_free(&bench);
return 0;

View File

@@ -34,12 +34,6 @@
#include <emmintrin.h>
#include <immintrin.h>
static INLINE pstatus_t sse_image_copy_no_overlap_convert(
BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette,
SSIZE_T srcVMultiplier, SSIZE_T srcVOffset, SSIZE_T dstVMultiplier, SSIZE_T dstVOffset);
static INLINE pstatus_t sse_image_copy_bgr24_bgrx32(BYTE* WINPR_RESTRICT pDstData, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight,