From patchwork Tue Nov 10 10:47:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23477 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8D24E449B06 for ; Tue, 10 Nov 2020 12:49:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 789EA68BE03; Tue, 10 Nov 2020 12:49:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C8E4D68BB3A for ; Tue, 10 Nov 2020 12:49:36 +0200 (EET) Received: by mail-wr1-f68.google.com with SMTP id b8so12145983wrn.0 for ; Tue, 10 Nov 2020 02:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=zpH0i6OAVPOCc0vsVvLBSUDqLFu7MRqi/UiHqyfF4As=; b=ezThJeEZbnKzMn0BWyE6EASJoLKYUPqiwyPVFYGDGsof8Y3Sxzxusa9lakTbsPyt23 bvYSQfqP3b2sO/8829Z7iCaxfVTtcBRQLBs2IAMJnjAOhdheFxuiCmyzCJOCjJ+dmoWn ve1mxctHiJhpNfNFYA5WoET75Lbo8LAwaYldFjufOUkC7Rlgw2PO4TKWr9qQFr5GgA7H zdmLgXCa43LIqfe/0Q+bVqdWjXuJD4vvngy2XgidQe+hftxjwLrFiIvMf1B+w/pvTcOG cWovOnVa7ZQzVPOvnyZFKTzzrRBWnZ3eum9nz/DMY7jJv951ymQhh0AXwSH9AZzlo62Y DreA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=zpH0i6OAVPOCc0vsVvLBSUDqLFu7MRqi/UiHqyfF4As=; b=NgxRUllFKzkne89qFL3Lvul1MJEaxaXI6hr8tterl9rwXETmIEgDuAMIarTqVND/FN 3fTnTqFXWMoMbSouK4qtAPhfzsANpVl+tWr0HN3Uqoud2e/ecX7WwQRMFCNMiW83oeMr zW33n6MTzcfRdaMCUJKxrPyl4IDFBfmWDejaEB1wXaAYr3FgVwWOQpxKIN+4DbmixwRo DNa50dUXRQoO8mJ3jkDToG1adi6OPl5I7uDLw6F8rj14p0XQjYfjHfHT4Oshy6Pfl4ng qJbLMXvYpo8V5tAinaN11fXKNCSEAK1QXUMaH7Azs6pLia9tW2WJ4cL9R0fgMhqQt4Ff qwsw== X-Gm-Message-State: AOAM533DcoN4aB63ewmT8iml2xXWnuuz/Xn4Fb5KAjWNBR9vJnGDgydl BT6hkr4geUvIZjmdBOKvGrMTTf5h7Mk= X-Google-Smtp-Source: ABdhPJzqI9JgsWf7fXCoz8UzffOwUMgiHsyibTx00WvB0C837mwpH6MCSqSpjdtB7UmPUGV7vf1Jbg== X-Received: by 2002:a5d:5701:: with SMTP id a1mr603700wrv.120.1605005375959; Tue, 10 Nov 2020 02:49:35 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id l24sm2572543wmi.7.2020.11.10.02.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:49:35 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Nov 2020 11:47:13 +0100 Message-Id: <20201110104851.321029-17-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> References: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 016/114] avcodec/clearvideo: Inline constants X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 162dc13ce7..dd5720bda4 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -32,6 +32,8 @@ #include "mathops.h" #include "clearvideodata.h" +#define CLV_VLC_BITS 9 + typedef struct LevelCodes { uint16_t mv_esc; uint16_t bias_esc; @@ -87,14 +89,14 @@ static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac, int idx = 1, last = 0, val, skip; memset(blk, 0, sizeof(*blk) * 64); - blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3); + blk[0] = get_vlc2(gb, ctx->dc_vlc.table, CLV_VLC_BITS, 3); blk[0] -= 63; if (!has_ac) return 0; while (idx < 64 && !last) { - val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2); + val = get_vlc2(gb, ctx->ac_vlc.table, CLV_VLC_BITS, 2); if (val < 0) return AVERROR_INVALIDDATA; if (val != 0x1BFF) { @@ -365,11 +367,11 @@ static TileInfo* decode_tile_info(GetBitContext *gb, LevelCodes *lc, int level) MV mv = { 0 }; if (lc[level].flags_cb.table) { - flags = get_vlc2(gb, lc[level].flags_cb.table, lc[level].flags_cb.bits, 2); + flags = get_vlc2(gb, lc[level].flags_cb.table, CLV_VLC_BITS, 2); } if (lc[level].mv_cb.table) { - uint16_t mv_code = get_vlc2(gb, lc[level].mv_cb.table, lc[level].mv_cb.bits, 3); + uint16_t mv_code = get_vlc2(gb, lc[level].mv_cb.table, CLV_VLC_BITS, 3); if (mv_code != lc[level].mv_esc) { mv.x = (int8_t)(mv_code & 0xff); @@ -381,7 +383,7 @@ static TileInfo* decode_tile_info(GetBitContext *gb, LevelCodes *lc, int level) } if (lc[level].bias_cb.table) { - uint16_t bias_val = get_vlc2(gb, lc[level].bias_cb.table, lc[level].bias_cb.bits, 2); + uint16_t bias_val = get_vlc2(gb, lc[level].bias_cb.table, CLV_VLC_BITS, 2); if (bias_val != lc[level].bias_esc) { bias = (int16_t)(bias_val); @@ -660,7 +662,8 @@ static av_cold int build_vlc(VLC *vlc, const uint8_t counts[16], for (count += num; num < count; num++) lens[num] = i + 1; } - ret = ff_init_vlc_from_lengths(vlc, 9, num, lens, 1, *syms, 2, 2, 0, 0); + ret = ff_init_vlc_from_lengths(vlc, CLV_VLC_BITS, num, lens, 1, + *syms, 2, 2, 0, 0); if (ret < 0) return ret; *syms += num; @@ -712,14 +715,14 @@ static av_cold int clv_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); ff_idctdsp_init(&c->idsp, avctx); - ret = init_vlc(&c->dc_vlc, 9, NUM_DC_CODES, + ret = init_vlc(&c->dc_vlc, CLV_VLC_BITS, NUM_DC_CODES, clv_dc_bits, 1, 1, clv_dc_codes, 1, 1, 0); if (ret) { av_log(avctx, AV_LOG_ERROR, "Error initialising DC VLC\n"); return ret; } - ret = ff_init_vlc_from_lengths(&c->ac_vlc, 9, NUM_AC_CODES, + ret = ff_init_vlc_from_lengths(&c->ac_vlc, CLV_VLC_BITS, NUM_AC_CODES, clv_ac_bits, 1, clv_ac_syms, 2, 2, 0, 0); if (ret) { @@ -738,7 +741,7 @@ static av_cold int clv_decode_init(AVCodecContext *avctx) if (i == FF_ARRAY_ELEMS(has_flags)) break; if (has_flags[i]) { - ret = ff_init_vlc_from_lengths(&c->lev[i].flags_cb, 9, 16, + ret = ff_init_vlc_from_lengths(&c->lev[i].flags_cb, CLV_VLC_BITS, 16, clv_flags_bits[j], 1, clv_flags_syms[j], 1, 1, 0, 0); if (ret < 0)