From patchwork Sat Jun 8 20:09:18 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: 49705 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1736009vqo; Sat, 8 Jun 2024 13:09:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXdUhfRFqagtvJuqDQMTt5gXoGUpBELJDI8W6FAXRhNScMcSGyk7mPqaI6iKQdkboEZmrOvRWK4ipDzgy61H/SgfW3vjRXYwtHJwA== X-Google-Smtp-Source: AGHT+IHzY3+behG+wf4I06MNtMZQJ8HwQGK8bcShnnVVvLUNyxHu/GyWjNaNX7RAiGXtCYjCVE1J X-Received: by 2002:a17:906:3c4b:b0:a68:5b05:bdea with SMTP id a640c23a62f3a-a6cbcccc786mr391386466b.37.1717877371705; Sat, 08 Jun 2024 13:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717877371; cv=none; d=google.com; s=arc-20160816; b=eXL7BIiaXaFNXDDx7X3EuJAisluHWH2v9V/Y3GgIx6vx1/vsSMg/9GhWndcT3R9ZQz zN32zzIG9//DfOybsmlywc96YHgRwf3H5ziR0OamWB1yMkPk86BFzdiLkeShqOfX7hd6 9GmiA8vaqqk603MDj4eqRewbFrHDLNM/ncV+CNJkdz2xPQU7v3xSTbnQT9SRhgp7ERYM dMwDEo85rs7+s+wJAEdZ263Xu3Hsk05sbMi4GQHrg7uPEypExkW5YnWj2erR4Edof+7v sl4ZFc+aQf5WFQ+k4HioIGYfY6qvetT8RAd15A2s2OTq+An3qXu/M0BZoASKO1p9xesQ DhwA== 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:message-id:date:to:from :delivered-to; bh=tGbgPOMlp7xE7fJQ66yXnAPFwXND0LQmPhgg8wswrbw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=BHEyC8DL7uuFADgqdl3+DEq7c9SoStGxixa1tW1iOjjg+ya6I9A7F7IfHUrW+ePjJ3 xJ3m+JqCOIsyJA2ufkMCO94EQwF+mmdchbvZR+SD/gH8e1eTxnEN7A7FaosVOYBOTM9N zd0YbIrOuCLrJxgucLzSbCtp/pUtUYTkjOJ09XJavtisX9QSRw5jOUn38QtqmqSrmvkw 2x53Xwuwo0IlXQu+pepikJ+8gUrNCZyW0tV6VAWW+YEVc6LHddP9Cn+M7wgUeX4zfoSm SZ0V7PhUiOF2oNjMq0y7pfogO6kLnG8xYCbg/aHS43lX1PMOVQ7LZzXOi5KJj4xbBJ8V XzDA==; 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 a640c23a62f3a-a6c80727db4si315032666b.777.2024.06.08.13.09.31; Sat, 08 Jun 2024 13:09:31 -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 17C8168D6FD; Sat, 8 Jun 2024 23:09:28 +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 B177068D60D for ; Sat, 8 Jun 2024 23:09:20 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id DB365C006B for ; Sat, 8 Jun 2024 23:09:19 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Jun 2024 23:09:18 +0300 Message-ID: <20240608200919.2362726-1-remi@remlab.net> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavc/mpegvideo: use H263DSP dequant function 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: 2eGmSJvb+anG --- libavcodec/mpegvideo.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 7af823b8bd..0eb4a1a865 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -201,7 +201,7 @@ static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, static void dct_unquantize_h263_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale) { - int i, level, qmul, qadd; + int qmul, qadd; int nCoeffs; av_assert2(s->block_last_index[n]>=0 || s->h263_aic); @@ -219,23 +219,13 @@ static void dct_unquantize_h263_intra_c(MpegEncContext *s, else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]; - for(i=1; i<=nCoeffs; i++) { - level = block[i]; - if (level) { - if (level < 0) { - level = level * qmul - qadd; - } else { - level = level * qmul + qadd; - } - block[i] = level; - } - } + s->h263dsp.h263_dct_unquantize(block, 1, nCoeffs, qmul, qadd); } static void dct_unquantize_h263_inter_c(MpegEncContext *s, int16_t *block, int n, int qscale) { - int i, level, qmul, qadd; + int qmul, qadd; int nCoeffs; av_assert2(s->block_last_index[n]>=0); @@ -244,18 +234,7 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s, qmul = qscale << 1; nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; - - for(i=0; i<=nCoeffs; i++) { - level = block[i]; - if (level) { - if (level < 0) { - level = level * qmul - qadd; - } else { - level = level * qmul + qadd; - } - block[i] = level; - } - } + s->h263dsp.h263_dct_unquantize(block, 0, nCoeffs, qmul, qadd); } From patchwork Sat Jun 8 20:09:19 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: 49706 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1736053vqo; Sat, 8 Jun 2024 13:09:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU24sxMz2wJ3yFWMpP9CG52B5PUYO52kWF4vBUp+noqnFcZ/2oxgdf0wEnTl/7KmDoL+VqXzopg0mTFGXrFzlLJHkbknl+q+y2rWA== X-Google-Smtp-Source: AGHT+IFUJRKrdRim5QgpK8Ec8arxMixS6bj8Rb/qO4zX0z3q0V1SLy51Sn/aLOoBGrttKP+cFGze X-Received: by 2002:a17:906:c0d4:b0:a69:67e3:57f6 with SMTP id a640c23a62f3a-a6cd5613786mr386712366b.5.1717877380343; Sat, 08 Jun 2024 13:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717877380; cv=none; d=google.com; s=arc-20160816; b=ax56DbIdy9YKCHivlxJqgoS3JI6yX3mlyY9KjHWpHz2ZObN5Vpzb/O7yD/1jDA++4E BFXDftJaqhFLjUOvdT+aNGpFQOuvbXtOT1tc7/yo8n8MRn9H9q8yun/T4/XF+lfT2qbp K4cQdYFeFO8ukq2ztpL/VNfr+lFVLW8Vj91BlsYcEw0GzHIvUXSsvvQVeTxXzvgMXOXL dlTcl/rS1tPB4sBCLEXtbfZQihZ6NlUjXKr3k6z5kVPXWx6VhrNMUMnkRuX5Wn6hbgQI fFKxW5xNrSRPLD67xy7BbnbRDEVbF7E+IohpkFk1cU6xPbuWF9PjegMoa8wTnrp0u1a/ /DKg== 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=3UGhUx/awdki6xeovzaJ0Sea5ZNUQHeFKZl88yM8ArM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=ksKQDcpAANu3XDziLEJPx2wSC7nGhhec5EIJW066EfPytArjhWmtXTfrQa+/skxhWq zl12px0BhXdY4JE0S+CuFOp/thUH9VAs3YXY9uuHrx2Bos+xJJaE0At1GZ6hj7uSAdH7 HagZTpRhmBKnH1Oz/Yegujya5yUakbMwvdc7TOMIgmCUwxeXgN3ycnJYtjpBZB6bJB1Z 1tM9y1mN8l33EA0w7LdtRCc1feyss1Tafb7JhdHV1rq+9LAy9Yz5PEu/ECSU0y6okOMs WL25f4PHwlMrd1XuH76PIIxtY80sEmKdz1e1CI6pxi+20j6YGPLbJ7cZ6e78Vvkrya12 B/OQ==; 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 a640c23a62f3a-a6f12dff288si19277166b.859.2024.06.08.13.09.40; Sat, 08 Jun 2024 13:09:40 -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 3D56068D702; Sat, 8 Jun 2024 23:09:29 +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 B525D68D6E1 for ; Sat, 8 Jun 2024 23:09:20 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 182AAC006C for ; Sat, 8 Jun 2024 23:09:20 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Jun 2024 23:09:19 +0300 Message-ID: <20240608200919.2362726-2-remi@remlab.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240608200919.2362726-1-remi@remlab.net> References: <20240608200919.2362726-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] checkasm/h263dsp: test dct_unquantize 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: bN1MQO8RvxlW --- tests/checkasm/h263dsp.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/checkasm/h263dsp.c b/tests/checkasm/h263dsp.c index 2d0957a90b..fea5923f2e 100644 --- a/tests/checkasm/h263dsp.c +++ b/tests/checkasm/h263dsp.c @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include #include "checkasm.h" @@ -26,6 +27,31 @@ #include "libavutil/mem.h" #include "libavutil/mem_internal.h" +static void check_dct_unquantize(H263DSPContext *ctx, bool intra) +{ + LOCAL_ALIGNED_16(int16_t, block0, [64]); + LOCAL_ALIGNED_16(int16_t, block1, [64]); + size_t end = intra + 1 + rnd() % (62 - intra); + int qmul = rnd(); + int qadd = rnd(); + + declare_func(void, int16_t *, size_t, size_t, int, int); + + for (size_t i = 0; i < 64; i++) + block1[i] = block0[i] = (rnd() & 1) ? rnd() : 0; + + if (check_func(ctx->h263_dct_unquantize, "h263dsp.dct_unquantize_int%s", + intra ? "ra" : "er")) { + call_ref(block0, intra, end, qmul, qadd); + call_new(block1, intra, end, qmul, qadd); + + if (memcmp(block0, block1, 64 * 2)) + fail(); + + bench_new(block1, intra, 63, qmul, qadd); + } +} + typedef void (*filter)(uint8_t *src, int stride, int qscale); static void check_loop_filter(char dim, filter func) @@ -56,6 +82,8 @@ void checkasm_check_h263dsp(void) H263DSPContext ctx; ff_h263dsp_init(&ctx); + check_dct_unquantize(&ctx, false); + check_dct_unquantize(&ctx, true); check_loop_filter('h', ctx.h263_h_loop_filter); check_loop_filter('v', ctx.h263_v_loop_filter); report("loop_filter");