From patchwork Tue Sep 26 22:16:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 43925 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:2a18:b0:15d:8365:d4b8 with SMTP id e24csp2208248pzh; Tue, 26 Sep 2023 15:17:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGySYMj8A8AdODt4Nj+cXU+OVGkLjjpy5nCcjXp/e7vLWRFW9U3UMQiFWH05Qbg65ECSDPF X-Received: by 2002:a17:906:51c9:b0:9aa:e08:9fb7 with SMTP id v9-20020a17090651c900b009aa0e089fb7mr24542ejk.76.1695766639082; Tue, 26 Sep 2023 15:17:19 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y12-20020a170906070c00b009a5e1811764si11945599ejb.267.2023.09.26.15.17.18; Tue, 26 Sep 2023 15:17:19 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=K3fCOFD7; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AD40968CA88; Wed, 27 Sep 2023 01:16:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2085.outbound.protection.outlook.com [40.92.73.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 31F1168CA75 for ; Wed, 27 Sep 2023 01:16:46 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T708YeqMhI43p60zSRd6K1dcw0NVC3soiNnRB8q/fTh6WfF0BKpWls2uun1mA2fiAQ6RXd0UTrxeJLXbdk1kNN0NlFJlivaK7OlN1+xFAAszhMCuVdygcUHJKwKkU4NSrFPmmnembMuOfZWHao/auVB0G5+XVrp0NK26Jsdlg4xOCXsKJhE4dK1ZNVPcBzkf7fnc9X9oo2jDy87psuWTDfamCNx0SsdBNPXFM1R6R8OyQRJuPvwUwhUSIBZKxeP6k8f8SxOuvHeqXWPpM/EPEH1eCi5c3nZ+nHCDNq+f+sPQVplyMdH9Nv/ZMJedZkE6S23mj3cIwSkqnUo3N/Ck4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z1X+5PalUAUcXgYRJkSn6QnTljVD2cmeNuschIkkmGE=; b=MewblLs/I7tvwqIxqSrUS8aRMCUuM5csf+2r1AD2an/svLI5f6Rbxr4/whND3pnstV8Jr0NaDzQpKmsSLOPasSPL+E2jIw1am7pEsJDYY0UNGF8wvq40YemtjUEfIMZ8ZPhmKOXTlZW1BO/SdWO2aIdbViR9PI4z+SaMfo2KhGtFtGXM7LUjKeiwgcDmrcudvH/ln+bl7zS6KEqf9ncH8uCXwIY3WMmUEPaLac1SfMIjMNZoFoWtchEbxtZi2OhZVbejv6mz7gUFYslzsV70RPckhtiwP000Kn66pIFWg3tUGVyAJWhqMXVugTsnLtBEX7KDGpQ1flLGhf8Sh2dwbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z1X+5PalUAUcXgYRJkSn6QnTljVD2cmeNuschIkkmGE=; b=K3fCOFD7N1NWz5RcsWKU6tCiJAKdW0py2s21UEW+S748bOVzEz5OJQHFmKYGyFehpc/J3JD49JlpsYa0lc+mbqXyE5TbX48BSRbtd82e2yCcajv2t360oYg0s2+opjYdREcHo0tz3ZefWzHP1GVAE/L13y2uqdg7QXl/9Z7tc7RjWvL5vDZwJPTZAeOMLJvvOIvLVIRtG5q3ZSGbkAtxG3nPgFblvnfon+YwXZlS57Ey1Z/5BzkQ59v9Q61e/N9GODLUI3vDNmFgAgdQYdWTOfdJlFUWaYKHW4wxEudYXhIrU/FuMCNVTTaY0WmaRDNZ9NkXUMRRa8+gx+hd7J646w== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS4P250MB0413.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4c0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Tue, 26 Sep 2023 22:16:44 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::9d42:7b4f:71ef:c76a]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::9d42:7b4f:71ef:c76a%3]) with mapi id 15.20.6813.027; Tue, 26 Sep 2023 22:16:44 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Sep 2023 00:16:38 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [r49u8lqO/Ewtl0kHnIi0hC9Wk+I7NDVF] X-ClientProxiedBy: FR3P281CA0019.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20230926221732.3711507-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS4P250MB0413:EE_ X-MS-Office365-Filtering-Correlation-Id: 24e97a14-a558-4828-6f2e-08dbbede4456 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sDy3TTcP+SrJYCtUHPjPzQZ2pXGdB8kDPPh2D72MzwP01TVWAJg66UfUpeG05Xj5GusC5FMYMss7g9UNyBIwhjxOkdpjehHV1jLxEZ3XEIXet5nFo24VjNLt0rl4joPzVw59I9/0ZLddUUTSiRmE1NcTWzQwrRmV5hoheHnal7ErHWvcX2fn7HznRj7fsofE6FLsLbKvp5WqoHqs3A+5rcyOzvBYGPB0+5A6flyInOpImnUDQWMLdoz2ZflDbO+of1/P0zkE1we8OeVzr3Gx5tLrXq9YKDEKjjarx39Wh9yfZkT6RfD/gPmp3EaRhKju0KL8Fmyo4vULgy0FwXaLJq0Nw7EyHpgTvAtQbHnj+r2M0F0fx7v//0h0tf6XUlLEfVX5KEXDTY7mTXOnnz4MPEFrByrx2s8NgQr30YXCXOB6stNoCQzSgDfHvMtCgGRqtKS60LbYOWAem2JqxszkPdDrxFpAr4OUDYzCP/Uf9kMZ3qcMTJ95NurUDydYWqIwybV9GUQXPWM8JFkdI4GbIzZ4LMYRhBj8gmlOwizWbAjaG8GjaMqJ7IG1MrAWsZZoMgFnUb40g8vZYAk6/bNZJkSo3aGzW+GD0pE+bBQ/tcIo/g4p5FmmOalpVOg2/js6 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s/2EW2wKHVvALH3gMI2bpbCHuaDxUk1+F7IHMocBbjIjmGBnlWkboFTSLXc99C19tIddwIMyaJyCR8JDQXFn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JQlfbt6WombiW4d1cUjVyr2QMMhvmgPjj+T+0/XnEIVsfDA1NUwTPQc0VBq6sqPgzMLOnk7pepI4oRhzngfjUykFNJyKsvBUOutskSm02+365BNKAoz9Vq79J/7rZ X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24e97a14-a558-4828-6f2e-08dbbede4456 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2023 22:16:44.3877 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4P250MB0413 Subject: [FFmpeg-devel] [PATCH 07/61] avcodec/asvdec: Avoid superfluous VLC structures 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7ECyypwALwT2 Of all these VLCs here, only VLC.table was really used after init, so use the ff_vlc_init_tables API to get rid of them. Signed-off-by: Andreas Rheinhardt --- libavcodec/asvdec.c | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 7ad4faebf9..568881ccd2 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -45,11 +45,11 @@ #define ASV1_LEVEL_VLC_BITS 4 #define ASV2_LEVEL_VLC_BITS 10 -static VLC ccp_vlc; -static VLC level_vlc; -static VLC dc_ccp_vlc; -static VLC ac_ccp_vlc; -static VLC asv2_level_vlc; +static VLCElem ccp_vlc[32]; +static VLCElem level_vlc[16]; +static VLCElem dc_ccp_vlc[16]; +static VLCElem ac_ccp_vlc[64]; +static VLCElem asv2_level_vlc[1024]; typedef struct ASVDecContext { ASVCommonContext c; @@ -67,26 +67,26 @@ typedef struct ASVDecContext { static av_cold void init_vlcs(void) { - VLC_INIT_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, - &ff_asv_ccp_tab[0][1], 2, 1, - &ff_asv_ccp_tab[0][0], 2, 1, 32); - VLC_INIT_LE_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, - &ff_asv_dc_ccp_tab[0][1], 2, 1, - &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); - VLC_INIT_LE_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, - &ff_asv_ac_ccp_tab[0][1], 2, 1, - &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); - VLC_INIT_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, - &ff_asv_level_tab[0][1], 2, 1, - &ff_asv_level_tab[0][0], 2, 1, 16); - VLC_INIT_LE_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, - &ff_asv2_level_tab[0][1], 4, 2, - &ff_asv2_level_tab[0][0], 4, 2, 1024); + VLC_INIT_STATIC_TABLE(ccp_vlc, CCP_VLC_BITS, 17, + &ff_asv_ccp_tab[0][1], 2, 1, + &ff_asv_ccp_tab[0][0], 2, 1, 0); + VLC_INIT_STATIC_TABLE(dc_ccp_vlc, DC_CCP_VLC_BITS, 8, + &ff_asv_dc_ccp_tab[0][1], 2, 1, + &ff_asv_dc_ccp_tab[0][0], 2, 1, VLC_INIT_LE); + VLC_INIT_STATIC_TABLE(ac_ccp_vlc, AC_CCP_VLC_BITS, 16, + &ff_asv_ac_ccp_tab[0][1], 2, 1, + &ff_asv_ac_ccp_tab[0][0], 2, 1, VLC_INIT_LE); + VLC_INIT_STATIC_TABLE(level_vlc, ASV1_LEVEL_VLC_BITS, 7, + &ff_asv_level_tab[0][1], 2, 1, + &ff_asv_level_tab[0][0], 2, 1, 0); + VLC_INIT_STATIC_TABLE(asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, + &ff_asv2_level_tab[0][1], 4, 2, + &ff_asv2_level_tab[0][0], 4, 2, VLC_INIT_LE); } static inline int asv1_get_level(GetBitContext *gb) { - int code = get_vlc2(gb, level_vlc.table, ASV1_LEVEL_VLC_BITS, 1); + int code = get_vlc2(gb, level_vlc, ASV1_LEVEL_VLC_BITS, 1); if (code == 3) return get_sbits(gb, 8); @@ -115,7 +115,7 @@ static inline int asv2_get_vlc2(GetBitContext *gb, const VLCElem *table, int bit static inline int asv2_get_level(GetBitContext *gb) { - int code = asv2_get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS); + int code = asv2_get_vlc2(gb, asv2_level_vlc, ASV2_LEVEL_VLC_BITS); if (code == 31) return (int8_t) get_bits_le(gb, 8); @@ -130,7 +130,7 @@ static inline int asv1_decode_block(ASVDecContext *a, int16_t block[64]) block[0] = 8 * get_bits(&a->gb, 8); for (i = 0; i < 11; i++) { - const int ccp = get_vlc2(&a->gb, ccp_vlc.table, CCP_VLC_BITS, 1); + const int ccp = get_vlc2(&a->gb, ccp_vlc, CCP_VLC_BITS, 1); if (ccp) { if (ccp == 16) @@ -162,7 +162,7 @@ static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64]) block[0] = 8 * get_bits_le(&a->gb, 8); - ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc.table, DC_CCP_VLC_BITS); + ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc, DC_CCP_VLC_BITS); if (ccp) { if (ccp & 4) block[a->permutated_scantable[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4; @@ -173,7 +173,7 @@ static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64]) } for (i = 1; i < count + 1; i++) { - const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc.table, AC_CCP_VLC_BITS); + const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc, AC_CCP_VLC_BITS); if (ccp) { if (ccp & 8)