From patchwork Mon Jul 1 19:13:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50265 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp2009086vqv; Mon, 1 Jul 2024 12:13:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUI1BYMn+Yx9FPkH/E1PXWH+iGCL7xkGfeC2oKjoYjvRdAWuCpg5finvbHZJeHWPxwSqYK1y6p7wIv9A2d/c/lpRbJvUufnHp4xvw== X-Google-Smtp-Source: AGHT+IHNUUGjE9jPdSYctsSYZuH8oO+0LimPusPF9MvYIyk9MjixVuFRP7i4xBDkFWYP5zbEMHAv X-Received: by 2002:a05:6512:12cc:b0:52c:9e51:c3f with SMTP id 2adb3069b0e04-52e8270fc8fmr4690399e87.42.1719861237810; Mon, 01 Jul 2024 12:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719861237; cv=none; d=google.com; s=arc-20160816; b=P7QpAcvKQGaFWvMOn5uyID2Z7AOQ4NLfOWXKh4+tWA9hYho+DRhvP5glQKii6IK/1U HbVQ8kT15yW6etFOPPGrrpnfEymdiLUaA/0MVLldMcN7HC1aLGNtdbzPkNRB0t9EIu6z tKPs3huV0S5oGuiD8Hh/wyWq/X3ScFKRU11qDJUpk1d0B4rqiIcuH1QwiEeosWgaCk9T nR1WqPKroghdf412w+LaUM2isdX9ZMiRQnExjS1dhgfIhtceuhJbkGKZyvpaDPZNJYmE v5JuUs16gRqny0IwYwzVEXWN33xFWB5IKVx6Jh37YJ/IdUQyuQus/eOzp937KddcTvXS cn9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=kUqyRWqYY//id+aMFhPa9BTaD2b+XiEIVlk3dvnvhsY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=pTRG5KhDeDF4CKhlzz7LJDeQz9DjERw+NwatYigUTnmavQNdA/wuBBx/EypOg0MJxG Rqyxp2hAudgk3YS/voLAXDTdQUAUnm1pruX4Kf/L/h1F0NZiB1v3ijAFKtDqjgEP3mnv A2f5TG45O69jPH/ICHx8eFa/Suc5+PmV7NuKJnOXVF4VL+caeR3/AeZsTwe0t7a5QE9Z SrV1hry+2mEMFu3sYaPYywpFzfS2niI7m8D1zd4IaX+UcYLUqxiYY2kDnxhv3ac+fNqu kBB3bqoYEBRez74GC4+9EiUU1QrPj4dJCg1wezfMXB9I3F8PIogE/CxnPMKy7BgMQx0z Lp2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52e7ab31ca3si2421624e87.525.2024.07.01.12.13.57; Mon, 01 Jul 2024 12:13:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7D24A68D84B; Mon, 1 Jul 2024 22:13:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9AFA768D5BD for ; Mon, 1 Jul 2024 22:13:29 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 3DF1FC02F8 for ; Mon, 1 Jul 2024 22:13:29 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jul 2024 22:13:27 +0300 Message-ID: <20240701191328.466433-3-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240701191328.466433-1-remi@remlab.net> References: <20240701191328.466433-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: EtOFLIR0nBB1 --- tests/checkasm/h263dsp.c | 57 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/h263dsp.c b/tests/checkasm/h263dsp.c index 2d0957a90b..26020211dc 100644 --- a/tests/checkasm/h263dsp.c +++ b/tests/checkasm/h263dsp.c @@ -18,13 +18,65 @@ * 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 *, ptrdiff_t, int, int); + +static void check_dct_unquantize(unquantizer func, bool inter) +{ + const char *name = inter ? "inter" : "intra"; +#define LEN 64 + LOCAL_ALIGNED_16(int16_t, block0, [LEN]); + LOCAL_ALIGNED_16(int16_t, block1, [LEN]); + size_t len = 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 *, ptrdiff_t, int, int); + + for (size_t i = 0; i < LEN; i++) { + int r = rnd(); + + block1[i] = block0[i] = (r & 1) ? (r >> 1) : 0; + } + + if (check_func(func, "h263dsp.dct_unquantize_%s", name)) { + call_ref(block0, 0, qmul, qadd); + call_new(block1, 0, qmul, qadd); + + if (memcmp(block0, block1, LEN * sizeof (int16_t))) + fail(); + + av_assert0(len < LEN); + call_ref(block0, len, qmul, qadd); + call_new(block1, len, qmul, qadd); + + if (memcmp(block0, block1, LEN * sizeof (int16_t))) + fail(); + + bench_new(block1, LEN, qmul, qadd); + } +} typedef void (*filter)(uint8_t *src, int stride, int qscale); @@ -56,6 +108,9 @@ void checkasm_check_h263dsp(void) H263DSPContext ctx; ff_h263dsp_init(&ctx); + check_dct_unquantize(ctx.h263_dct_unquantize_intra, false); + check_dct_unquantize(ctx.h263_dct_unquantize_inter, true); + report("dct_unquantize"); check_loop_filter('h', ctx.h263_h_loop_filter); check_loop_filter('v', ctx.h263_v_loop_filter); report("loop_filter");