From patchwork Fri Sep 8 14:07:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 43665 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4e27:b0:149:dfde:5c0a with SMTP id gk39csp502492pzb; Fri, 8 Sep 2023 07:06:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAUibQfA/zHnJ79LdwK0PFGjSNVp/hCV2Kq4xGxCRjAM5BLpFCatq1C27C1+kaz68KFwFy X-Received: by 2002:a05:6512:10d1:b0:500:86cf:1249 with SMTP id k17-20020a05651210d100b0050086cf1249mr2342198lfg.61.1694182014902; Fri, 08 Sep 2023 07:06: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 s14-20020a170906354e00b0099ced4e20b2si1490690eja.457.2023.09.08.07.06.47; Fri, 08 Sep 2023 07:06: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=Ph81chRl; 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 A92F168C78A; Fri, 8 Sep 2023 17:06:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2081.outbound.protection.outlook.com [40.92.90.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA6FB68C861 for ; Fri, 8 Sep 2023 17:06:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUiIS11jUxL5+6tahdYekbMA5vnLXrw9UJzAKisVoJ3kbO7H4ER3CvLXUveBVf1k1S5Qb+cnq7H1J0t3mA1R3zup7MeG6EzUKDaLoOuIUziHHnwGwIkKeaMUaSd8tW5wz3rYGUuHHIDeHbQf31txvr4RwWwXSoAr8pa35KcyI5rukV32xiwDMLLVaHF2DuOd3Z/aD760hHyANPnzsuV6at3w3sy7wKlApbYisklML900uIo2DhcFkHcuv5upx8EGMPFp2+fiLMf+dWW0hcNFKvXgS56r5foqAZwsCxtxz3MQLDJh6lZugFFW+yxVR3kiCjtlUl0kjbOtmkvWboBSKQ== 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=MzvsrGK2cSnAPeM3dqGkVsM3sNWwCaYTE10eg0CtzbM=; b=CPW8cotEiVhkAM8KuccpFPbBkUtai8fzXHH46n4NCU4PkLPk1FI5z4QGtQLj0FA5NnZIwP0mHc/ZyeEH55a/q5g33uhCL0ezwMFbn26LVSjo4QhDH31xV4cF2Y7ikAJ2c5zY9zcejhvHskiEsSZQaNGuskTT7LqGa1yWABlGtBJWTG7Ja8vCuR/I4MociR56C3uMYSXoy5Ln5CSgCJ3jLBlxjuqXtU1nObULXRG+bY0lcV7VRQ9l5pwt7lssNXuZf9uV2+4I2R/obocdU2UeoacinHM2lX/a31DpfkZgksUFoVhwJDddHKewHFliugnDuIFVpy+eegFhx0WmqoI4/g== 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=MzvsrGK2cSnAPeM3dqGkVsM3sNWwCaYTE10eg0CtzbM=; b=Ph81chRlQs69gUGEc4UDtAScpN+Zt2Ke3S9pzRua8e/2qLM1V5c2kl8+/wHrmyNorjOJM6K8ZQ7KBkNvx5+fvfHzx3XQqLr7/WoZVLXaP/Pck9Q61zHRoQIxgdFRKLAGJ6t403AsR2JPLLmLpiBCHmZaQbqaxUaYbsVA/zy6lltO7QifQZT3tANdwfG8ErqxlVZEuph61Ddy+B/waq3cShLAs94NgLS4h8pVMzhxTViFm46+eOoRQuyOVKKM6TDgY1Yu4VLpWBKCoG50Q+4Uvz3oQqIXFaHllka03kd4dTRaKvShmLS8J1YnUwyZ8Gyytivwf1mwmsg7UmI9Vwf6BQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0206.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:277::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 8 Sep 2023 14:06:24 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa%3]) with mapi id 15.20.6768.029; Fri, 8 Sep 2023 14:06:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Sep 2023 16:07:24 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [h4WTptbPgz/fczN6Rok5UH4ITi7M9mmd] X-ClientProxiedBy: ZR2P278CA0069.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:52::15) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20230908140727.2150730-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0206:EE_ X-MS-Office365-Filtering-Correlation-Id: fd908d7c-38f9-40fb-4b0f-08dbb074c952 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hzAQZGVW2IsEwU3nwd54rzUCVLZinGhFmHObDw9LDxZdBBtQcoo+2qJUVcJ6VgggU+G8lL1R5ZqDGrKkIQwexFLWq15FChrA+lbkXrBYl0Rh3d7ke586aLLMDn0omXokQaT7L3JQnvZw258mEnNnJIGPxgkrwR2w3eRDh4awvQPt47TlWiZzCliPrLPuHSwvF/SgtkU/j0/LJXIEFTXi3yQFW7f3UQU77ZDN68xddqPuoi/dXp+mN92x1BXvHKwq1SjgiQ4+CvTNjQ/hvcxKD1NcL56sob0WD44nAVG6koA3i9aWeWuTTipLMBQQEcHv6cth8mAuxj4KJAShJ6VIY2Qsx1xcD/iFujkos7iRys78OuEi7QxnYeqBOdvRTSXwDe8fcfuTOCnWaLzjfgNbq6JS2H6/FxWN28CZ4lWT39HseNstP1UUUVsMw3C8e7YE9qpYEO/Ygqxgn3gAZz3wPHkTStBDEuE2WffGWIUcLXJ3P2oQOUV8LizscnVAUV7K5DNxFcZbMxPhqv7HwdCGNZuB7qDx8WrzKTf+NxXcT8M9XHeq15ofnRAJASXOaboO3qBjKKJwUMnHw7S4TlP7BZ67GiH+MbrwyQztHGu8s7CFw9P4csD6qL6ksWdtbYLg X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +c9A8aVeW23oak1P+hL+wkp+3Qrji9MiJSioqhQpMMMrVzC+K5Y6WrYBt5bDUI6tnFkmkYV2L1gp08l8l6IK9UiNmj9EyGL6McQFGIG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ZhJ4Khk3472o1ItQ+4PgfCvHBLx9Wejk8MNkt7YymahZG9sfxohpUTtCGaF6MKPRl0AX2ZBUThHKD104u1t+Ws+9dpxG X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd908d7c-38f9-40fb-4b0f-08dbb074c952 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2023 14:06:24.5659 (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: DU2P250MB0206 Subject: [FFmpeg-devel] [PATCH 4/7] avcodec/vlc: Add documentation for ff_init_vlc_sparse() 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: cJETh3QgjLM2 Mostly taken from the documentation for ff_init_vlc_from_lengths(); also remove the documentation in vlc.c. Signed-off-by: Andreas Rheinhardt --- libavcodec/vlc.c | 23 ----------------------- libavcodec/vlc.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c index 9656a9472c..1740b2f80f 100644 --- a/libavcodec/vlc.c +++ b/libavcodec/vlc.c @@ -247,29 +247,6 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes, return 0; } -/* Build VLC decoding tables suitable for use with get_vlc(). - - 'nb_bits' sets the decoding table size (2^nb_bits) entries. The - bigger it is, the faster is the decoding. But it should not be too - big to save memory and L1 cache. '9' is a good compromise. - - 'nb_codes' : number of vlcs codes - - 'bits' : table which gives the size (in bits) of each vlc code. - - 'codes' : table which gives the bit pattern of of each vlc code. - - 'symbols' : table which gives the values to be returned from get_vlc(). - - 'xxx_wrap' : give the number of bytes between each entry of the - 'bits' or 'codes' tables. - - 'xxx_size' : gives the number of bytes of each entry of the 'bits' - or 'codes' tables. Currently 1,2 and 4 are supported. - - 'wrap' and 'size' make it possible to use any memory configuration and types - (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables. -*/ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, diff --git a/libavcodec/vlc.h b/libavcodec/vlc.h index 46063862f6..8f2f478f9b 100644 --- a/libavcodec/vlc.h +++ b/libavcodec/vlc.h @@ -62,6 +62,35 @@ typedef struct RL_VLC_ELEM { codes, codes_wrap, codes_size, \ NULL, 0, 0, flags) +/** + * Build VLC decoding tables suitable for use with get_vlc2(). + * + * @param[in,out] vlc The VLC to be initialized; table and table_allocated + * must have been set when initializing a static VLC, + * otherwise this will be treated as uninitialized. + * @param[in] nb_bits The number of bits to use for the VLC table; + * higher values take up more memory and cache, but + * allow to read codes with fewer reads. + * Corresponds to the `bits` parameter of get_vlc2(). + * @param[in] nb_codes The number of provided bits, codes and (if supplied) + * symbol entries. + * @param[in] bits The lengths (in bits) of the codes. Entries > 0 + * correspond to valid codes; entries == 0 will be skipped. + * @param[in] bits_wrap Stride (in bytes) of the bits table. + * @param[in] codes_size Size of the bits. 1, 2 and 4 are supported. + * @param[in] codes Table which gives the bit pattern of of each vlc code. + * @param[in] codes_wrap Stride (in bytes) of the codes table. + * @param[in] codes_size Size of the codes. 1, 2 and 4 are supported. + * @param[in] symbols The symbols, i.e. what is returned from get_vlc2() + * when the corresponding code is encountered. + * May be NULL, then 0, 1, 2, 3, 4,... will be used. + * @param[in] symbols_wrap Stride (in bytes) of the symbols table. + * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. + * @param[in] flags A combination of the INIT_VLC_* flags. + * + * 'wrap' and 'size' make it possible to use any memory configuration and types + * (byte/word/int) to store the 'bits', 'codes', and 'symbols' tables. + */ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size,