From patchwork Mon Jun 10 20:23:20 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: 49783 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp2771635vqo; Mon, 10 Jun 2024 13:23:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXOnZq6y7RS9218RX4FBQFKEMeRPJmbbcEB0SHpbYPIrDjNcYaBXuOqs5v6o7fsbw0ekdWinPpmF1vFicVckWdnyBViViEUrmhtoA== X-Google-Smtp-Source: AGHT+IFedI0+b4KBCUlhbFi241vvknGR+RgGMe2RM34CbL2ZfxA+paLwEPYirjOqYJXiU4UWkJiU X-Received: by 2002:a50:f695:0:b0:57c:612e:6ded with SMTP id 4fb4d7f45d1cf-57c612e6ec9mr5160632a12.0.1718051019024; Mon, 10 Jun 2024 13:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718051019; cv=none; d=google.com; s=arc-20160816; b=KiA50xJUUWaiSZIFFyk/2SesLu0DzKB1kTl+SwBQMp14Rx/al+jr8jEadtMpPrOXmp PA2BK3X13VLNLl3LbC9RZRMDhvr6aLKBlxRGIAlLhZtp6Gdnt4eaQ/4cseCQdGnFBKpf hnlzSzOas86mA/sLY3jP4Al9Pj/niixNZoXHd0MFlFN/BGwXw9iBGViPboQp5XG/TZm5 wq7y9yDVP1CLbz90SIFdWaaNtEcDs6zid6ODWobZJimqZdRaqG6+Leyj8ay/XJK4qWPj X/kWbfmC4u5tLTnnrc9dgPFu6praFO1Q/Tg0MPdmxljIf3FWYFwE0MfOfOeGt/uhifwl 0z1Q== 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=e3FyWGrRxsNmZvfC61Clhr1JoAwfyH3jgnyu5hV6oR0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=hgFn8D9dJQ3IQ7cI3gGUCTwLvghKgPK0YDMhma+1LnkimPwV3Bj0g2MJn4gwWGdoiU tcxS+pu5iVpFjcZBqZEvZebTfKjrA2zGZro/Y8JrE3t/IPcGyK29UbWT6NJEH+SAEqj0 ChzvEEdPSRNdp5XrqTNKDELcgiXoEcs0qwLZ+bq9A+mNiFG82o+J7rGNNcUZuZOVdhI9 8PybSWn2MfJKs5KFA0TXEUwOJh2hNUHngYb0aVZt99OEvKyLvAnxE2TaxhKiD/I0Ajt+ YX4637VvYgdJ/ajhQrkOr4bjBcTKrwhjd0uiesY4mlkByyI1YDVWyr7bCs51Xrr8/H9t l9Ig==; 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 4fb4d7f45d1cf-57c84a5146bsi1115802a12.137.2024.06.10.13.23.35; Mon, 10 Jun 2024 13:23:39 -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 1F5BC68D7D8; Mon, 10 Jun 2024 23:23:30 +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 3911C68CDEA 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 A3B95C0186 for ; Mon, 10 Jun 2024 23:23:22 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 10 Jun 2024 23:23:20 +0300 Message-ID: <20240610202322.786800-2-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 2/4] 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: T5sJEswFpiX9 --- libavcodec/mpegvideo.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 7af823b8bd..810888fc47 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -201,13 +201,11 @@ 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 nCoeffs; + int qmul = qscale << 1; + int qadd, nCoeffs; av_assert2(s->block_last_index[n]>=0 || s->h263_aic); - qmul = qscale << 1; - if (!s->h263_aic) { block[0] *= n < 4 ? s->y_dc_scale : s->c_dc_scale; qadd = (qscale - 1) | 1; @@ -219,43 +217,20 @@ 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_intra(block, 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 = qscale << 1; + int qadd = (qscale - 1) | 1; int nCoeffs; av_assert2(s->block_last_index[n]>=0); - qadd = (qscale - 1) | 1; - 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_inter(block, nCoeffs, qmul, qadd); } @@ -275,6 +250,9 @@ static void gray8(uint8_t *dst, const uint8_t *src, ptrdiff_t linesize, int h) static av_cold int dct_init(MpegEncContext *s) { ff_blockdsp_init(&s->bdsp); +#if CONFIG_H263DSP + ff_h263dsp_init(&s->h263dsp); +#endif ff_hpeldsp_init(&s->hdsp, s->avctx->flags); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);