From patchwork Tue Sep 13 11:33:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37891 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp628282pzh; Tue, 13 Sep 2022 04:34:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6iQN5dx00gipa0rsdfbDdJu7v6ghwY33W2fkCYfOzz8op22vt5QQSfnxLOZ4vuQ8d7lcX8 X-Received: by 2002:a05:6402:5ca:b0:445:c80a:3c2 with SMTP id n10-20020a05640205ca00b00445c80a03c2mr25747599edx.247.1663068866154; Tue, 13 Sep 2022 04:34:26 -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 gs37-20020a1709072d2500b0073beb58e98dsi11593726ejc.276.2022.09.13.04.34.25; Tue, 13 Sep 2022 04:34:26 -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=erRuejks; 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 E5B0668B9B4; Tue, 13 Sep 2022 14:33:38 +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 6887768BB3C for ; Tue, 13 Sep 2022 14:33:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JjdPRoH7gnxti5vA9uqRPELzqPm6kgmzI+3mt+G/+ZneOqkkV4hRp//VBGMdJx/2W3SVnf+ksUd67DqrADqU6ELtcbfqPRPkiOIbyc7wIxhbq7BP1cf0P9w8WmOJUBzVIWB9JoLFz2l3TpU2WuZ8VelELADz4nbZloW21SBKKiSklg7kTRHPwLdOIeu6wPK5BlQh7+l2kahmxFubTLV87gGSg1E6WAtY0ExuesROYx/NsXE4cvft35RVcr6qOS79PZM0xn3YRLFkUdioPaucPrThWayK50eGF4po65uVJzcVEN3V/aIOMf3Vc/Eu5OW/KkIK0hVvfAa233mj2yljHA== 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=scrtERpf/Nq2RBDgrcyLpAwbLh0rhycF0lQJm5VhWDs=; b=K2wv2Lb38BskntMh8RHqiLZWgCvqPAW01RyImMGhl5rMcXpJpBy9aOBHk3Oyv222xjrnhWpggWdOJYH0Qa6eQYlnL5dLKdWTrT4D3O6DKAF00KSHaR7Zpl4iKi+hqFeYVZm3CS2avetYPzuQ9Y+Uf/8c4nQSnrM50uwhc/YcUJanvAQY5RtKfuoYjf7Kjun2gdo+31t/UkodElxyklz8CRILbUOVwZ/E2l1+o86cSwURKRjdzkroAZKL3RXinS9MEx/tBKvcRPQurys7iDr6mkX+vcPQcwSAC7EWWRAejUBqce7M7EtYwHjXB6S3azD2sRw/ieoN0U8sm7axRCyGJg== 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=scrtERpf/Nq2RBDgrcyLpAwbLh0rhycF0lQJm5VhWDs=; b=erRuejksLi4kSZ7wVWPmOvKFWZD2DyBJzQLuSQUaA0mreM54cOO4LJjI+TopM09C+Kl+/Vo0GDheqj0B4Bn0SSuLxl+y4RcGU4FhgUNDyFm6+80fpGpyXNPGyePJaD1+iDZhPi8dH4FxeSym/MUIa69G+m/KU2iQmkWhob1zPPePsj3/+dnOxPHdd8MDCv+haiRpxfjMDDCtghhhnEZsVLvBMrIJW5e7eqiiaeZMuDOjYfk18JvJr47TeL8w5E0HxJpvS9vi4TwDg/3RYtE9EU0pWctMcnf9TiX+N1kolUgxqYlWe1jA4aWkArjdBs7pQBGYoiU78LlhMUpnSvxJcA== 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:27 +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:27 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Sep 2022 13:33:06 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [+oNjBZIcDOza7Tx0mvDwFBNQvpaN6BaSW7o8sNH/x/A=] 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-8-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: 5378387b-c7c1-437b-3a6a-08da957bc662 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmpEumVcsW5Tnf3Q/Hh5f4HAwXLVZjdtb8NY6wd54xJBoHIpUlL5t8+XdqgON/tLewWGdqcqMgsGT7+vWmhPYxQJHpv1IdkxqK3M1FbeWkmQraEFAxxMRGEcoTrq6mvs7XDPVjYEuCoRuMEVoXYMuxejy2HcXatQgwaIwdeLw5Yl0dbMLeH0jDqJaxA3AiwhRnZozM/cSyEZI6pqce5u05O6wgPuKdrPG07jEaLoDyD/enMu1o71p/bFxCF/R+ULdmL+ux74VDxPstKuU+WFo26sHVm1Dc93hULgpoOc5sHwVrztUCE6hn/QqcWH3SSJHIzUAyFenvkfpqYPpAk3ljIT8shCt/6EP0+8CWjgSrvI/6gf1zBLNCUwnaZPjBamCEJugIzAZr0KZCu7em2Q4ywDMqLGIcjf7poxJZ/jc5IIP6zgYBk0MQkSurxNONX99K89V74q6I4HaKL0QbszIFetsCit5mlw//2iiYvMxOzdwrV/DjzlKIBc0sSniCYNsTRLbEn5msHOr5vJBuJe95OcWxIbepT0bVGxqxYu3NIqUxc9AkuENdTxfaLWvvNeIxsKeLxWG8Mi0bxd8lDxQx5P0vriFVIzCgB1MRhjtSHEGG+uJCThXCwF1RlwtOwQ71aruMJS3VETTScGU/tmvqzJEYFl+hPLrAXQ8+EIaNAHQlIoVqEUiciWdtpxWdfyufFIvCu7NTU6Ot+78E+H5Gt/sA7LvWJ6ZroXCrSCTxwgPk1RUOGZOsVnneEn3sdcf1E= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info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hQvP+USINwOC41LEHwm7Nb4+jGiByJRDEmFWzgTcuxC2clvfoksacqiLazntFEz7mz6iDXQqzbjNR3mzJsG9rAZjOklaLLrW5MvzCfXsCQi/s8gkpwCWzUjs9CgZUCrwknIRsELeMfJvVq71SuibKnB1SlQNRmKeSr2R/mFSBMqFxfIYg5Jf29x8SZThvtch7sBfTZrVxuEgjkWYJ2KQjgrblwlpCyhJ7X4WVXXJMrwIIdWCa7JKRvF0mCB0KPPpJ9XRgBfposLciKqm9y3P8aW1Px9cvq+JXlADgMrRMTKLxAwoZNDQizOAqWDfC1zVHPOtphnmDMBh4E7mWwURaOSFpubuvKIynlUdJS1O3zdCRouOpUURkpGfNVYe+OUz/UgPTKzblNPtVBPjMY47pfJRPUf+9IpdwwgRnPu5mMOwKX4VFicoaSldE/oURTeEt1d/mlGGI5FVF7F5KTbZcYhOh+yxiH6Pd1gRu05aumUhdJtoDoCemhqFqid1F4sRDAhy1XrJOeQZCqHgJmI8liHNWWDxp+V3Oqp7jvoS8cvmWJ8INvhzqFgqdSehUIFj62gcGdkVt4DAg3spJbKV1qQk85qAroB1KlVtf2k+vhhFLsHBPNLApAX5hYaeL57c3wbdauoBBJ0F6TIv+/nKTozsd4wQR+2oUyOw8Jw4QmnhZBgEmuGxAFCk6vus/3jMHTuTgXUHlvSvtb4+uDJTtggvBUfHMDwg/vpQw6i2G5YbK283mZfUK4PSxApXuJLs4hjyJ7S/dL93BE/OnPbVxybY5m2giyHuXuDGPZVpRlzb/cdWYim3sHBpLVD3ZI5NI3Hv/qsOfXJJyq9yeEnu/x7arSvbYUz1Q6HQgY932hahMxfyb71irz4gVlUiM/zmoQ6JpheB0cx0Wu0WU0IeaUFqsy6daqo8F70oJf2KdQNsitsCxyIFI1zuSJuHpA/V2bvjeO9P0SxGQ/ X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5378387b-c7c1-437b-3a6a-08da957bc662 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:26.9906 (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 09/13] avcodec/dca_core: Inline number of bits of scale factor 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: 7E7qttI2KWe9 Signed-off-by: Andreas Rheinhardt --- libavcodec/dca_core.c | 6 ++++-- libavcodec/dcahuff.c | 7 +++---- libavcodec/dcahuff.h | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c index 96787fe95d..7dff6633df 100644 --- a/libavcodec/dca_core.c +++ b/libavcodec/dca_core.c @@ -362,7 +362,8 @@ static inline int parse_scale(DCACoreDecoder *s, int *scale_index, int sel) // If Huffman code was used, the difference of scales was encoded if (sel < 5) - *scale_index += dca_get_vlc(&s->gb, &ff_dca_vlc_scale_factor, sel); + *scale_index += get_vlc2(&s->gb, ff_dca_vlc_scale_factor[sel].table, + DCA_SCALES_VLC_BITS, 2); else *scale_index = get_bits(&s->gb, sel + 1); @@ -381,7 +382,8 @@ static inline int parse_joint_scale(DCACoreDecoder *s, int sel) // Absolute value was encoded even when Huffman code was used if (sel < 5) - scale_index = dca_get_vlc(&s->gb, &ff_dca_vlc_scale_factor, sel); + scale_index = get_vlc2(&s->gb, ff_dca_vlc_scale_factor[sel].table, + DCA_SCALES_VLC_BITS, 2); else scale_index = get_bits(&s->gb, sel + 1); diff --git a/libavcodec/dcahuff.c b/libavcodec/dcahuff.c index 7a5b054dd5..a7518aded8 100644 --- a/libavcodec/dcahuff.c +++ b/libavcodec/dcahuff.c @@ -770,7 +770,7 @@ const uint8_t ff_dca_vlc_src_tables[][2] = { DCAVLC ff_dca_vlc_bit_allocation; VLC ff_dca_vlc_transition_mode[4]; -DCAVLC ff_dca_vlc_scale_factor; +VLC ff_dca_vlc_scale_factor[5]; DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS]; VLC ff_dca_vlc_tnl_grp[5]; @@ -815,9 +815,8 @@ av_cold void ff_dca_init_vlcs(void) for (i = 0; i < 5; i++) DCA_INIT_VLC(ff_dca_vlc_bit_allocation.vlc[i], bitalloc_12_vlc_bits[i], 12, 1); - ff_dca_vlc_scale_factor.max_depth = 2; - for (i = 0; i < 5; i++) - DCA_INIT_VLC(ff_dca_vlc_scale_factor.vlc[i], SCALES_VLC_BITS, 129, -64); + for (unsigned i = 0; i < FF_ARRAY_ELEMS(ff_dca_vlc_scale_factor); i++) + DCA_INIT_VLC(ff_dca_vlc_scale_factor[i], DCA_SCALES_VLC_BITS, 129, -64); for (unsigned i = 0; i < FF_ARRAY_ELEMS(ff_dca_vlc_transition_mode); i++) DCA_INIT_VLC(ff_dca_vlc_transition_mode[i], DCA_TMODE_VLC_BITS, 4, 0); diff --git a/libavcodec/dcahuff.h b/libavcodec/dcahuff.h index a50d49d6dd..8663f8ba12 100644 --- a/libavcodec/dcahuff.h +++ b/libavcodec/dcahuff.h @@ -43,7 +43,8 @@ typedef struct 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; +#define DCA_SCALES_VLC_BITS 9 +extern VLC ff_dca_vlc_scale_factor[5]; extern DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS]; extern VLC ff_dca_vlc_tnl_grp[5];