From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] checkasm/h264: test weight and biweight Date: Sat, 13 Jul 2024 21:03:31 +0300 Message-ID: <20240713180331.94988-1-remi@remlab.net> (raw) --- tests/checkasm/h264dsp.c | 79 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c index d1228ed985..39397f77e1 100644 --- a/tests/checkasm/h264dsp.c +++ b/tests/checkasm/h264dsp.c @@ -29,6 +29,81 @@ static const uint32_t pixel_mask[5] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff, 0x0fff0fff, 0x3fff3fff }; static const uint32_t pixel_mask_lf[3] = { 0xff0fff0f, 0x01ff000f, 0x03ff000f }; +static const int depths[5] = { 8, 9, 10, 12, 14 }; + +static void check_weight(void) +{ +#define HEIGHT 128 + for (int d = 0; d < FF_ARRAY_ELEMS(depths); d++) { + const int bit_depth = depths[d]; + const int offset = rnd() & 0; + const int log_denom = rnd() & 7; + const int wa = rnd() & ((1 << log_denom) - 1); + const int wb = rnd() & ((1 << log_denom) - 1); + uint16_t ref[HEIGHT * 128 * 2], src[HEIGHT * 128 * 2]; + uint16_t out0[HEIGHT * 128 * 2], out1[HEIGHT * 128 * 2]; + uint8_t *const pref = (void *)ref; + uint8_t *const psrc = (void *)src; + uint8_t *const pout0 = (void *)out0; + uint8_t *const pout1 = (void *)out1; + H264DSPContext h; + + ff_h264dsp_init(&h, bit_depth, 1); + + for (size_t i = 0; i < FF_ARRAY_ELEMS(ref); i++) + if (bit_depth == 8) { + pref[i] = rnd(); + psrc[i] = rnd(); + } else { + ref[i] = rnd() & (0xffff >> (16 - d)); + src[i] = rnd() & (0xffff >> (16 - d)); + } + + for (int w = 0; w < 4; w++) { + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *block, + ptrdiff_t stride, int height, int log2_denom, + int weight, int offset); + + if (check_func(h.weight_h264_pixels_tab[w], "h264_weight%d_%d", + 16 >> w, bit_depth)) { + memcpy(out0, ref, sizeof (out0)); + memcpy(out1, ref, sizeof (out1)); + + call_ref(pout0, 32 >> w, HEIGHT, log_denom, wa, offset); + call_new(pout1, 32 >> w, HEIGHT, log_denom, wa, offset); + + if (memcmp(out0, out1, sizeof (ref))) + fail(); + + bench_new(pout1, 32 >> w, HEIGHT, log_denom, wa, offset); + } + } + + for (int w = 0; w < 4; w++) { + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, + const uint8_t *src, ptrdiff_t stride, int height, + int log2_denom, int wd, int ws, int offset); + + if (check_func(h.biweight_h264_pixels_tab[w], "h264_biweight%d_%d", + 16 >> w, bit_depth)) { + memcpy(out0, ref, sizeof (out0)); + memcpy(out1, ref, sizeof (out1)); + + call_ref(pout0, psrc, 32 >> w, HEIGHT, log_denom, wa, wb, + offset); + call_new(pout1, psrc, 32 >> w, HEIGHT, log_denom, wa, wb, + offset); + + if (memcmp(out0, out1, sizeof (ref))) + fail(); + + bench_new(pout1, psrc, 32 >> w, HEIGHT, log_denom, wa, wb, + offset); + } + } + } +#undef HEIGHT +} #define SIZEOF_PIXEL ((bit_depth + 7) / 8) #define SIZEOF_COEF (2 * ((bit_depth + 7) / 8)) @@ -173,7 +248,6 @@ static void dct8x8(int16_t *coef, int bit_depth) static void check_idct(void) { - static const int depths[5] = { 8, 9, 10, 12, 14 }; LOCAL_ALIGNED_16(uint8_t, src, [8 * 8 * 2]); LOCAL_ALIGNED_16(uint8_t, dst, [8 * 8 * 2]); LOCAL_ALIGNED_16(uint8_t, dst0, [8 * 8 * 2]); @@ -451,6 +525,9 @@ static void check_loop_filter_intra(void) void checkasm_check_h264dsp(void) { + check_weight(); + report("weight"); + check_idct(); check_idct_multiple(); report("idct"); -- 2.45.2 _______________________________________________ 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".
reply other threads:[~2024-07-13 18:03 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240713180331.94988-1-remi@remlab.net \ --to=remi@remlab.net \ --cc=ffmpeg-devel@ffmpeg.org \ /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