From patchwork Sun Sep 4 21:58:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37655 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2274557pzh; Sun, 4 Sep 2022 14:59:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5K0Wvugq9bp2rZwiI4pvJZtlQTztBplDH0J7qxmght4kTWTqxqpx1Z0ln8TBUi0ZCJ38Qs X-Received: by 2002:aa7:cc97:0:b0:445:afab:2634 with SMTP id p23-20020aa7cc97000000b00445afab2634mr42110053edt.54.1662328750356; Sun, 04 Sep 2022 14:59:10 -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 g11-20020a056402090b00b0044884549409si7889792edz.356.2022.09.04.14.59.10; Sun, 04 Sep 2022 14:59:10 -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=ggKFlKdZ; 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 67CD968B85C; Mon, 5 Sep 2022 00:59:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069046.outbound.protection.outlook.com [40.92.69.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4609068B864 for ; Mon, 5 Sep 2022 00:59:00 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCHwmZ1+YzSQEDPhHCmsI5+NgeFhYdmEk0LTCbkui5GNnB54AKwm7VCjYxjING9BWxntbYgAy91sX9HxarN/jHJvgeZhp2wuJZTa/Mfq3jzdNbgSZp29+FJFhE1rGOSrceIJHAOHKSbPepj9Ssy12dUbNflCbgeJaQp0KKXG/+4ZH+HJI19EqlyAuHTm8h6gYWAtZAaZMD2JKDgdl4PV0gWsJtCjjkwMxSL/MoJxT3FW53jUwrxBDisxTsO7uMxl4DKnXcujS7dM+klu6XZBO+4UUfvm/fCeRaE4JHMhsT/g+G8yQdnmdBoeZ6fabG+yHDErP3/ht7aT3/GeRc5vpw== 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=bJ4btNdvlgoKrPhicAf3i7eKHNc8rMxOhNKNYqO1O0g=; b=Gz1PjNIBoq41wwn603GypKreQ976O1qwdaGwZVSYysr9JKOcSwlh8WyRIJkzyU1gzSvZnZqr1u9lcUsgUIVXSLGPfRGh88dll82/MIWEBxEAvM0/xPQHvlTNclEkzSQJ8Zs2x9c5AkB1L6zXQajnnoZAIK+ezE7fWJfofxdGHihOm5liVvqBqoY0v4yBvSJiZQTg9z3GfRqTXhAmutRErdls1joTFuEp0UtS0N21lZzw+jhYhyIQtSluYf0yxw2NpDKD4Zvj+FiH6GQWl7h/ERxHugumHJGNOzYA7EzbTd5JBYickBDCxrVq+aZhz43zo7MezRT0c/KzMdu7EbBpcQ== 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=bJ4btNdvlgoKrPhicAf3i7eKHNc8rMxOhNKNYqO1O0g=; b=ggKFlKdZdD+b+0TtSJE2HewclXQDjQpSAJgppBAZ1FsZUbSwK17/6knR19xR96pSsZJbOn2TAXj7OM+Jh6INFRw78Sugs03XYfGVZIoRmI0NnjUqzKhiSrIVDheoK3ayrq8Uw55o6P4NwYOnZBudlHe4Mzry2PeRcNjSVxTh1Yuk9GWtWjJa6+xIS/5X8x9s/00t2UYPISuhHlIghR6bQBBsFj6bambQbZD82fcVjnIrz8SLRLPUrWeD3FIjDLLARi+/XA5luh4Xpul17COP/DA0O98jhtoovS9LIGa8wUU4HmNwVGdRYhnW7l35mTEgIm0psIYx1KGYmjpDnFSPLg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU0P250MB0746.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3ca::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.15; Sun, 4 Sep 2022 21:58:59 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f85a:9a02:f8be:7c47]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f85a:9a02:f8be:7c47%2]) with mapi id 15.20.5588.010; Sun, 4 Sep 2022 21:58:59 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 4 Sep 2022 23:58:44 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [EwNbIp06dBdZomTMl86F3vcmQrex2P5R6MiMPQjpDbs=] X-ClientProxiedBy: ZR0P278CA0037.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::6) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20220904215851.4164981-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0cabf6cd-7120-47e8-953a-08da8ec0ab73 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmpOESH07gTfyFtwl3n8uZhu52FjHdiGs3SIvo1opaJReB7IK8y7GHMP2lHYYtM07om0bqt1ZkP5DoNLwtKnfpAXUh5YIHpbyyJtp+750YwebTm24li5dNko5MmhK3qcfk2zuN4NnbzUk6qdRMB+Wz+f3GnODVJ/Dj7uM9vz0bi1REfuQxgX+yLC6uXRpNjqEB30+RJJ6IcpdjQMJELYziIvpLmjFgf+cQqL2DETImSdyfXWWLkUEVVEcowOHm6cHTOJecVT3Sg0RiCNgrWc9R0+1zSzsD7plJLXax825y75Gm/aDWqGukd9yEEZNDrlqu9PrKPmzzS6fZWFMG+/p6ZJKMmf5NQV3QqQ2ntNFTTz1+qaRuRKe4u2P3Qigf8Eeeln+1KaIcI6k7xBmDxzinOVF6z7kySNV5hWTNrIu10iC9rrs8p/Hqpb/SmQjCebzpRglPY6bG5RvoVtVOCDMT2vvh7DkAMEUsOLLk7HuK0sd4ooqixhpOh4Db8aYbgkGr8dEZR+NLSfcBC+v+RiAXOpNv+DajmAjXP+xMXOPywJqnUR3NWKcDi54S7dCP2bjhxpIGrl3kUovDtvQTAfj64CZhcgnzoolfPtcu+z7wE2O0D/lTHltkB4jo2PC5BDfptlIK71P32kxLRnAj9iqSHDJ6zVS6XJq/vBYBhsdbjLyB/mlNKGLfqJqFZDfzb2gS2kiX3JPOJb9LobMHeyDzRt4tLEo41Dui1Xoqdn+/XxJStiykW2lTjmV20UQyELvvY= X-MS-TrafficTypeDiagnostic: DU0P250MB0746:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gQ4aFuO1JTT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MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2022 21:58:58.9877 (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: DU0P250MB0746 Subject: [FFmpeg-devel] [PATCH 2/9] avcodec/dvdec: Use ff_init_vlc_from_lengths() 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: U0Yj5dxD1pt5 This is possible because the codes are already ordered from left to right in the tree. It avoids having to create the codes ourselves and will enable the codes table to be removed altogether once the encoder stops using it. Signed-off-by: Andreas Rheinhardt --- libavcodec/dvdec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 3af3e82eab..8f68d2715d 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -137,7 +137,6 @@ static void dv_init_static(void) { VLCElem vlc_buf[FF_ARRAY_ELEMS(dv_rl_vlc)] = { 0 }; VLC dv_vlc = { .table = vlc_buf, .table_allocated = FF_ARRAY_ELEMS(vlc_buf) }; - uint16_t new_dv_vlc_bits[NB_DV_VLC * 2]; uint8_t new_dv_vlc_len[NB_DV_VLC * 2]; uint8_t new_dv_vlc_run[NB_DV_VLC * 2]; int16_t new_dv_vlc_level[NB_DV_VLC * 2]; @@ -145,17 +144,14 @@ static void dv_init_static(void) /* it's faster to include sign bit in a generic VLC parsing scheme */ for (i = 0, j = 0; i < NB_DV_VLC; i++, j++) { - new_dv_vlc_bits[j] = ff_dv_vlc_bits[i]; new_dv_vlc_len[j] = ff_dv_vlc_len[i]; new_dv_vlc_run[j] = ff_dv_vlc_run[i]; new_dv_vlc_level[j] = ff_dv_vlc_level[i]; if (ff_dv_vlc_level[i]) { - new_dv_vlc_bits[j] <<= 1; new_dv_vlc_len[j]++; j++; - new_dv_vlc_bits[j] = (ff_dv_vlc_bits[i] << 1) | 1; new_dv_vlc_len[j] = ff_dv_vlc_len[i] + 1; new_dv_vlc_run[j] = ff_dv_vlc_run[i]; new_dv_vlc_level[j] = -ff_dv_vlc_level[i]; @@ -164,8 +160,9 @@ static void dv_init_static(void) /* NOTE: as a trick, we use the fact the no codes are unused * to accelerate the parsing of partial codes */ - init_vlc(&dv_vlc, TEX_VLC_BITS, j, new_dv_vlc_len, - 1, 1, new_dv_vlc_bits, 2, 2, INIT_VLC_USE_NEW_STATIC); + ff_init_vlc_from_lengths(&dv_vlc, TEX_VLC_BITS, j, + new_dv_vlc_len, 1, + NULL, 0, 0, 0, INIT_VLC_USE_NEW_STATIC, NULL); av_assert1(dv_vlc.table_size == 1664); for (int i = 0; i < dv_vlc.table_size; i++) {