From: Hubert Mazur <hum@semihalf.com> To: ffmpeg-devel@ffmpeg.org Cc: gjb@semihalf.com, upstream@semihalf.com, jswinney@amazon.com, Hubert Mazur <hum@semihalf.com>, martin@martin.st, mw@semihalf.com, spop@amazon.com Subject: [FFmpeg-devel] [PATCH 2/4] tests/sw_scale: Add test cases for input sizes 16 Date: Mon, 17 Oct 2022 13:07:13 +0000 Message-ID: <20221017130715.30896-3-hum@semihalf.com> (raw) In-Reply-To: <20221017130715.30896-1-hum@semihalf.com> Previously test cases handled only input sizes equal to 8. Add support for input size 16 which is used by scaling routines hscale16To15 and hscale16To19. Pass SwsContext pointer to each function as some of them make use of it. Signed-off-by: Hubert Mazur <hum@semihalf.com> --- tests/checkasm/sw_scale.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c index 3b8dd310ec..2e4b698f88 100644 --- a/tests/checkasm/sw_scale.c +++ b/tests/checkasm/sw_scale.c @@ -262,23 +262,31 @@ static void check_hscale(void) #define FILTER_SIZES 6 static const int filter_sizes[FILTER_SIZES] = { 4, 8, 12, 16, 32, 40 }; -#define HSCALE_PAIRS 2 +#define HSCALE_PAIRS 4 static const int hscale_pairs[HSCALE_PAIRS][2] = { { 8, 14 }, { 8, 18 }, + { 16, 14 }, + { 16, 18 } }; +#define DST_WIDTH(x) ( (x) == (14) ? sizeof(int16_t) : sizeof(int32_t)) #define LARGEST_INPUT_SIZE 512 #define INPUT_SIZES 6 static const int input_sizes[INPUT_SIZES] = {8, 24, 128, 144, 256, 512}; int i, j, fsi, hpi, width, dstWi; struct SwsContext *ctx; + void *(*_dst)[2]; + void *_src; // padded LOCAL_ALIGNED_32(uint8_t, src, [FFALIGN(SRC_PIXELS + MAX_FILTER_WIDTH - 1, 4)]); - LOCAL_ALIGNED_32(uint32_t, dst0, [SRC_PIXELS]); - LOCAL_ALIGNED_32(uint32_t, dst1, [SRC_PIXELS]); + LOCAL_ALIGNED_32(uint16_t, src1, [FFALIGN(SRC_PIXELS + MAX_FILTER_WIDTH - 1, 4)]); + LOCAL_ALIGNED_32(int16_t, dst_ref_16, [SRC_PIXELS]); + LOCAL_ALIGNED_32(int16_t, dst_new_16, [SRC_PIXELS]); + LOCAL_ALIGNED_32(int32_t, dst_ref_32, [SRC_PIXELS]); + LOCAL_ALIGNED_32(int32_t, dst_new_32, [SRC_PIXELS]); // padded LOCAL_ALIGNED_32(int16_t, filter, [SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH]); @@ -286,6 +294,9 @@ static void check_hscale(void) LOCAL_ALIGNED_32(int16_t, filterAvx2, [SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH]); LOCAL_ALIGNED_32(int32_t, filterPosAvx, [SRC_PIXELS]); + void *_dst_16[2] = {dst_ref_16, dst_new_16}; + void *_dst_32[2] = {dst_ref_32, dst_new_32}; + // The dst parameter here is either int16_t or int32_t but we use void* to // just cover both cases. declare_func_emms(AV_CPU_FLAG_MMX, void, void *c, void *dst, int dstW, @@ -297,6 +308,7 @@ static void check_hscale(void) fail(); randomize_buffers(src, SRC_PIXELS + MAX_FILTER_WIDTH - 1); + randomize_buffers(src1, SRC_PIXELS + MAX_FILTER_WIDTH - 1); for (hpi = 0; hpi < HSCALE_PAIRS; hpi++) { for (fsi = 0; fsi < FILTER_SIZES; fsi++) { @@ -306,6 +318,8 @@ static void check_hscale(void) ctx->srcBpc = hscale_pairs[hpi][0]; ctx->dstBpc = hscale_pairs[hpi][1]; ctx->hLumFilterSize = ctx->hChrFilterSize = width; + _src = ctx->srcBpc == 8 ? (void *)src : (void *)src1; + _dst = ctx->dstBpc == 14 ? (void*)_dst_16 : (void*)_dst_32; for (i = 0; i < SRC_PIXELS; i++) { filterPos[i] = i; @@ -343,14 +357,15 @@ static void check_hscale(void) ff_shuffle_filter_coefficients(ctx, filterPosAvx, width, filterAvx2, ctx->dstW); if (check_func(ctx->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", ctx->srcBpc, ctx->dstBpc + 1, width, ctx->dstW)) { - memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0])); - memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0])); + memset((*_dst)[0], 0, SRC_PIXELS * DST_WIDTH(ctx->dstBpc)); + memset((*_dst)[1], 0, SRC_PIXELS * DST_WIDTH(ctx->dstBpc)); + + call_ref(ctx, (*_dst)[0], ctx->dstW, src, filter, filterPos, width); + call_new(ctx, (*_dst)[1], ctx->dstW, src, filterAvx2, filterPosAvx, width); - call_ref(NULL, dst0, ctx->dstW, src, filter, filterPos, width); - call_new(NULL, dst1, ctx->dstW, src, filterAvx2, filterPosAvx, width); - if (memcmp(dst0, dst1, ctx->dstW * sizeof(dst0[0]))) + if (memcmp((*_dst)[0], (*_dst)[1], ctx->dstW * DST_WIDTH(ctx->dstBpc))) fail(); - bench_new(NULL, dst0, ctx->dstW, src, filter, filterPosAvx, width); + bench_new(ctx, (*_dst)[1], ctx->dstW, _src, filter, filterPosAvx, width); } } } @@ -358,6 +373,8 @@ static void check_hscale(void) sws_freeContext(ctx); } +#undef DST_WIDTH + void checkasm_check_sw_scale(void) { check_hscale(); -- 2.37.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-10-17 13:08 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-17 13:07 [FFmpeg-devel] [PATCH 0/4] Provide neon implementations for hscale functions Hubert Mazur 2022-10-17 13:07 ` [FFmpeg-devel] [PATCH 1/4] sw_scale: Add specializations for hscale 8 to 19 Hubert Mazur 2022-10-24 12:31 ` Martin Storsjö 2022-10-17 13:07 ` Hubert Mazur [this message] 2022-10-17 13:07 ` [FFmpeg-devel] [PATCH 3/4] sw_scale: Add specializations for hscale 16 to 15 Hubert Mazur 2022-10-17 13:07 ` [FFmpeg-devel] [PATCH 4/4] sw_scale: Add specializations for hscale 16 to 19 Hubert Mazur 2022-10-24 13:19 ` Martin Storsjö 2022-10-25 7:14 ` Hubert Mazur
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221017130715.30896-3-hum@semihalf.com \ --to=hum@semihalf.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=gjb@semihalf.com \ --cc=jswinney@amazon.com \ --cc=martin@martin.st \ --cc=mw@semihalf.com \ --cc=spop@amazon.com \ --cc=upstream@semihalf.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git