From patchwork Tue Sep 13 11:33:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37888 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp628017pzh; Tue, 13 Sep 2022 04:33:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4z2LGNzzY5bTeGrkj2b21Le9HHsgFTSnAUtM8TA17Mi0mIVWlEurRvbeuE3yMT9T6cXZRB X-Received: by 2002:a17:907:968c:b0:77c:c5c7:26b7 with SMTP id hd12-20020a170907968c00b0077cc5c726b7mr7527335ejc.171.1663068834131; Tue, 13 Sep 2022 04:33:54 -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 q17-20020aa7da91000000b0044d9f1406b7si7769871eds.157.2022.09.13.04.33.53; Tue, 13 Sep 2022 04:33:54 -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=USwAMSDe; 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 C17E568BB5E; Tue, 13 Sep 2022 14:33:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067064.outbound.protection.outlook.com [40.92.67.64]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0BE7268BB3C for ; Tue, 13 Sep 2022 14:33:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KzBkRzKqpQ7TWbkGt/EzP3hNRdS81KmiAr14a1pJZQMd6gwutbRblHjv3QU0pie4TIkCdimNIL1Uu+CU1ANISRIBQY1tKse8i5KzmnBasx7vyvSNZVU9beRXB3sYPwCtezOOSq/7D2tzemJCA6nflaB1mK/Wzp4pMUrUe2gfU28uUmEld6P2ekmmm44Doa2Tcx0gzTq4O/ZfqGj79BYRcUcjlznUk6NdamimIvbkOEpBglyu9uBj0yUJGeAnlIjxptG2/NvbXhzkJdZkazMYVaOhDogrnsqweQm6LGtYumVM7Eu+2OXNnWP8fW0XcO12qCfvP/h14PU7XRppkzXcHA== 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=LdpJ91eCiOnNB37+KWXFiweUR82BKy3UJDumMMqepDM=; b=VZlT1Qqpkkyy3PuZt9QR7afCF/4RYCmkCZLSTyhsfdO+DTC7Vg4YmUEBy/qtoohZD8aZGXuAE4ffQaPCTtgdpJjT1G4Z8wUHTMJ6JgprOE5xKsrGndSdvyCXuvwu8TcalqDN/tJGK7PdEOX5AGVRawNJzpFmOBmVsbr3n0QNt0JwsLbQq8Aw/lF0CE+51WfVTi+9GIHPUERUgCvbd43oJAmDLzUCEOkmCkyhJ+m2PUsbHvo4JLk7gYgaleZS9TZSeplph12OF5Ysow8PlRD8O8YPpysZwAIjdkEtlr2K5SOPNzfWV2hG/Phl7TJtR/hhmj/z7oKdkQTCYVdObBpW5w== 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=LdpJ91eCiOnNB37+KWXFiweUR82BKy3UJDumMMqepDM=; b=USwAMSDeWLc5eVYeyzMHG4YfOCOwHJh0joY/OUOtunZmdqScUR0eKITmyft+PtdeV0teXGB6Ybjyq9S9YVzK45c1f4oCiT2ACkMeVUhSz9Gbz1P908qk+IZbQyxuYx+bfNKGW/3VhGi2ElS/iSuHVX9KRGa/z3pt1SAkMmTiUJTDzdglI39E6Tk8J2LVggcoi36tcHjMM+lLHYobslpZhCdf2/tLHczzBOscsN/exxpCUEa/ij7q5vgC+IJB4i/RllP82is1e1n4l1ItjiY53xCiZQlTejH6/BA1bUSL9ObGYhBBEzUrPwpeHr4y8Fy1ZZHZ1wwFFIW3iE52BwNueQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0072.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:374::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Tue, 13 Sep 2022 11:33:20 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb%7]) with mapi id 15.20.5612.022; Tue, 13 Sep 2022 11:33:20 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Sep 2022 13:33:02 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [djQztqHbWrGvQcVhgrohkBbyuEQtvlQmoZL+lvWmQiM=] X-ClientProxiedBy: AS9PR06CA0296.eurprd06.prod.outlook.com (2603:10a6:20b:45a::16) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220913113310.451876-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0072:EE_ X-MS-Office365-Filtering-Correlation-Id: bb6f21d3-b0d6-457d-7b5c-08da957bc2b4 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmpEumVcsW5Tnf3Q/Hh5f4HAwybIMDUr2GjUJyQKiKktUVV77axRLzfygfQ9jnlx4BTPEjWrErS9S6MvKvqfJ9FFp/CGU7C1JslPqKiePdsnM5gUdy2E5m90uBbapOX9qYfqibnHuV3llWCbQBpsZIryf13QxSnZGSTGXb6oQ/iIzBMAPMQF6unBMRkyNxJo/sJrlVRCM4qnQtZGxkg5J+Y8syzmTUM8TBJ1jnZUcUY4AejT2789D3wL6BpN8d0Jv0JBujesYEbdZnfjvRcNqai63MWVDdrsLGP2I5TNZjrasL/GdIu2LHYwXx63nb4ec1UBlKgKf4QKURQ6uRAkIUzn1Vo0Nd32Ct0DNbgG8H2/7672ixQ6ABLbLibUcgVZf8QnuZMyqGOumGg4EgU2QQ6YsZvy6N7ylbeCVO4NkvzoaFJVrlmJ/wCCpZvxDOUkDOq9SF2hsvTeUuHIZ0feCbR1RDlYcbc9RYI8gHb8YeDdwf8hPqsNeKbVAYWZfrm64yWd2SW1IMWlBBwwT5G0C8Nw8ya6yDegmFZo7vAmU3v1ZXK3LDfJmSo+wFEkJqzEOy1afemgp1Fcv4hrxjqau4pBYRp5G4aZqQSz1zJU6YQ8oI+082+ye1Oq8Wra/kZdT1/bkcVa9Tw7jUlcIBsiI4J78OvQNALehiijjcM1PDNKlJr33kwrU60K6F2BjjqQ8BAwB33PykpnvwA6VEEn2dKwtcuGL5eVzdVtVOHiw2d16Vu+Ts1yHYLrxsv7MRj84s4= X-Microsoft-Antispam: B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HQffWe3eLg9yQRT/S3hTwm7Fb8wVzEuiIjzhwACCqrQHN8wUlVpznTBQw89lBHQVQWJEO2plb79YL5+89TN+/zo9J0m1jGOjEY0nBs98h8PwJV0noIPvJNK822rfcleGaxOhZvotwbB8THeNsHu93OKSJTR/MRqNItWrGvmfWIbD+AHaJA09uO9h9J9A1pRtnFBxLPNSg6e77tqTq/i9b1F2qVDj36Iur216/GP9TokzX9Vt+5HaA1VktS0ZBysQx0CmdDtF4Mi0j4/2/XfAeDhk4bEuauel7ja7KCYQR276eDNg7BwkEIWqi4irXP7BANZTn6GA4+r99GL805ewoIcyzWRdP9dIH6CBUFMCyPc/ftCe7QVAcUs7a+kyGA6L8sh6oUxeMileBiOJojUJfHpGxTLuUdxOomWtvCZu2yQyv5XDS0VmbwjpegHKXq67WmCOLWiK9Aqbu5Xc/911RItHynusUmxGzAiuD+Pst8HgiCEhwxc9edzRj6dp8ecnhov0p17JendE0q5qcdGVJFhTct2Qqs+OmoooN+SF+aSw8JbAp69WHbziAWzkG2zGwhIkKB+nIjTVxb23mmhDrln3Rdgn83hQVkF0fCEA5udSu757xDvYpif0Efe6p+HwlCZaAPHNst0hyYTOuEgKqx28Cv5iKUojI7kEvxvKx/+LF4BP8T7puI4aqDl4VYworkjIdV8WmjnZ9ZG2ranUklCsvNkqfR9jlfi/mQxmSLH5asUaH7Q+IyjVaEiLNE363Gy8dF0rNXg/XhlSsY8rTn1SD8aT/243WuGO2LiPjcXNJ/OqnF+gFDWQwjRCzFlIsLuOduxLqB4aM9miLSVP36RwVPAHnjX55G2AchKJk5MbO1B/DMLZKswhN9+dl2ISdDc2LL8ehwn0u8WoxHZ3RaJEm9ecC376fIx5nWmqFhJuiG2uTjphywLO6bH1Iy9vYWYYBmX+mCBFZXixggJiQKFol8nuCoZaONBemf8wKGlQnSLTQ/82GKHv+vC X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb6f21d3-b0d6-457d-7b5c-08da957bc2b4 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2022 11:33:20.8189 (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: AS8P250MB0072 Subject: [FFmpeg-devel] [PATCH 05/13] avcodec/dcahuff: Always use three bits for transition mode VLCs 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: +u2PDR3HEtkR It increases the size of one VLC from two to three bits, thereby requiring four more VLCEntries (16 bytes .bss), but it allows to inline the number of bits used when reading them. Signed-off-by: Andreas Rheinhardt --- libavcodec/dca_core.c | 2 +- libavcodec/dcahuff.c | 5 ++--- libavcodec/dcahuff.h | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c index 499afc8204..069d428fff 100644 --- a/libavcodec/dca_core.c +++ b/libavcodec/dca_core.c @@ -457,7 +457,7 @@ static int parse_subframe_header(DCACoreDecoder *s, int sf, for (band = 0; band < s->subband_vq_start[ch]; band++) if (s->bit_allocation[ch][band]) s->transition_mode[sf][ch][band] = get_vlc2(&s->gb, ff_dca_vlc_transition_mode[sel].table, - ff_dca_vlc_transition_mode[sel].bits,1); + DCA_TMODE_VLC_BITS, 1); } } diff --git a/libavcodec/dcahuff.c b/libavcodec/dcahuff.c index 49fb06eeb4..842b1401dd 100644 --- a/libavcodec/dcahuff.c +++ b/libavcodec/dcahuff.c @@ -29,7 +29,6 @@ #include "put_bits.h" #define TMODE_COUNT 4 -static const uint8_t tmode_vlc_bits[TMODE_COUNT] = { 3, 3, 3, 2 }; static const uint16_t tmode_codes[TMODE_COUNT][4] = { { 0x0000, 0x0002, 0x0006, 0x0007 }, { 0x0002, 0x0006, 0x0007, 0x0000 }, @@ -1252,7 +1251,7 @@ VLC ff_dca_vlc_rsd; av_cold void ff_dca_init_vlcs(void) { - static VLCElem dca_table[30214]; + static VLCElem dca_table[30218]; unsigned offset = 0; int i, j; @@ -1277,7 +1276,7 @@ av_cold void ff_dca_init_vlcs(void) scales_bits[i], scales_codes[i]); for (unsigned i = 0; i < FF_ARRAY_ELEMS(ff_dca_vlc_transition_mode); i++) - DCA_INIT_VLC(ff_dca_vlc_transition_mode[i], tmode_vlc_bits[i], 4, + DCA_INIT_VLC(ff_dca_vlc_transition_mode[i], DCA_TMODE_VLC_BITS, 4, tmode_bits[i], tmode_codes[i]); for (i = 0; i < DCA_CODE_BOOKS; i++) { diff --git a/libavcodec/dcahuff.h b/libavcodec/dcahuff.h index 87e1fd1cea..1f13b6f443 100644 --- a/libavcodec/dcahuff.h +++ b/libavcodec/dcahuff.h @@ -40,6 +40,7 @@ typedef struct DCAVLC { } DCAVLC; extern DCAVLC ff_dca_vlc_bit_allocation; +#define DCA_TMODE_VLC_BITS 3 extern VLC ff_dca_vlc_transition_mode[4]; extern DCAVLC ff_dca_vlc_scale_factor; extern DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS];