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 E43BE4B660 for ; Mon, 10 Jun 2024 20:23:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2407268D7CE; Mon, 10 Jun 2024 23:23:32 +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 A7F6E68D64B for ; Mon, 10 Jun 2024 23:23:23 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id D4D1AC02F8 for ; Mon, 10 Jun 2024 23:23:22 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 10 Jun 2024 23:23:21 +0300 Message-ID: <20240610202322.786800-3-remi@remlab.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240610202322.786800-1-remi@remlab.net> References: <20240610202322.786800-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCHv4 3/4] checkasm/h263dsp: test dct_unquantize_{intra, inter} 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/h263dsp.c | 53 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/h263dsp.c b/tests/checkasm/h263dsp.c index 2d0957a90b..a8530403ee 100644 --- a/tests/checkasm/h263dsp.c +++ b/tests/checkasm/h263dsp.c @@ -18,13 +18,61 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include #include "checkasm.h" -#include "libavcodec/h263dsp.h" +#include "libavutil/avassert.h" #include "libavutil/mem.h" #include "libavutil/mem_internal.h" +#include "libavcodec/h263dsp.h" +#include "libavcodec/mpegvideodata.h" + +static uint_fast8_t mpeg_qscale_rnd(void) +{ + int n = rnd(), q = (n >> 1) & 31; + + if (n & 1) + return ff_mpeg2_non_linear_qscale[q]; + else + return q << 1; +} + +typedef void (*unquantizer)(int16_t *, size_t, int, int); + +static void check_dct_unquantize(unquantizer func, const char *name) +{ +#define LEN 64 + LOCAL_ALIGNED_16(int16_t, block0, [LEN]); + LOCAL_ALIGNED_16(int16_t, block1, [LEN]); + size_t coeffs = rnd() % LEN; + const int qscale = mpeg_qscale_rnd(); + const int qmul = qscale << 1; + const int qadd = (rnd() & 1) ? (qscale - 1) | 1 : 0; + + declare_func(void, int16_t *, size_t, int, int); + + for (size_t i = 0; i < LEN; i++) + block1[i] = block0[i] = (rnd() & 1) ? rnd() : 0; + + if (check_func(func, "h263dsp.dct_unquantize_%s", name)) { + call_ref(block0, 0, qmul, qadd); + call_new(block1, 0, qmul, qadd); + + if (block0[0] != block1[0]) + fail(); + + av_assert0(coeffs < LEN); + call_ref(block0, coeffs, qmul, qadd); + call_new(block1, coeffs, qmul, qadd); + + if (memcmp(block0, block1, (coeffs + 1) * sizeof (int16_t))) + fail(); + + bench_new(block1, LEN - 1, qmul, qadd); + } +} typedef void (*filter)(uint8_t *src, int stride, int qscale); @@ -56,6 +104,9 @@ void checkasm_check_h263dsp(void) H263DSPContext ctx; ff_h263dsp_init(&ctx); + check_dct_unquantize(ctx.h263_dct_unquantize_intra, "intra"); + check_dct_unquantize(ctx.h263_dct_unquantize_inter, "inter"); + report("dct_unquantize"); check_loop_filter('h', ctx.h263_h_loop_filter); check_loop_filter('v', ctx.h263_v_loop_filter); report("loop_filter"); -- 2.45.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".