From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5D1AB4B7C4 for ; Sat, 13 Jul 2024 18:03:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1E86668DBC2; Sat, 13 Jul 2024 21:03:38 +0300 (EEST) Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 328FF68D6BC for ; Sat, 13 Jul 2024 21:03:32 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id B1F80C013E for ; Sat, 13 Jul 2024 21:03:31 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 13 Jul 2024 21:03:31 +0300 Message-ID: <20240713180331.94988-1-remi@remlab.net> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] checkasm/h264: test weight and biweight X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- 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".