From patchwork Sun Oct 22 15:39:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44316 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1b28:b0:15d:8365:d4b8 with SMTP id ch40csp942456pzb; Sun, 22 Oct 2023 08:40:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7fy+8z2Dc6Fu0N3cTVZgcUhujrrTTDghG+PEUjGoWcuATNX4MyLXzBTQe+cPJM7M+dstR X-Received: by 2002:a50:f699:0:b0:53d:fd46:41ce with SMTP id d25-20020a50f699000000b0053dfd4641cemr5903049edn.19.1697989202655; Sun, 22 Oct 2023 08:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697989202; cv=none; d=google.com; s=arc-20160816; b=jxMxGsw6AKiXA9ozpcNpkO46aEsQWrMsk0qJvrXsivL89DSF611PFo2aeKsA3C5Fux MgZmfbJzbdcvM6lEdfHgDNZ0C3XbCds4IS3+eTATlqAHmpDYTIlzt8006QFSSNQmE9de LwJuRrPMsTF/jobGQHVU/Wxpqb8nbE9y8mLiISfiL58G3bYLzO97Y/oHfz21lKWxzTCE numkFl6YnqXeQJvXPW7+MWrqGHE85QOlV1SZFzZlBXgaBuP3aCxiHF6fKcy9C0mfwDij C/JimbyNcSgByOdjpUQ6ywWev36WLbyx/7oes2ozFNYM2hKVprtwrcGShd18HjNeBVmX LDYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=2iP0ER7Ga38jF7bPTTxWp/9TjUF3AHYX73tpG0NvHj0=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=JIR/c4+CEN7u59FEd5aZMoLwGy8oo1M767yBd5Fx0UhF0MNTGILyDuPq6MLM7pfWjz 2q6wS2vaOCzvPkV4EnmrAY3mvRMByMm9rue8YdEAnuCHiIirr+EBQAw16Q5sin2lRiWA yU/4T4tookYavvoMJYrkJkfTdjxqz6xGLUDHsTlaBFp7wUtc5b3O0j9uIEzKWyQr6Ptk Cubovyj+Up0JrfO4q8XxyH3/bK8CAS0gFcVUgE3rT48sNe7qhM8+6AFYc7v6hzm+1yba I96mAOnI0asSkbTpC8V70Ir8/EVbfGBq+wSVGSkrGl9w1gHLBtPi09/UHcstJdU9bVVz 29GQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j17-20020a508a91000000b0053fa5260784si2478946edj.499.2023.10.22.08.40.02; Sun, 22 Oct 2023 08:40:02 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0500468C4D0; Sun, 22 Oct 2023 18:40:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1474768C4D0 for ; Sun, 22 Oct 2023 18:39:53 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6DB9F1C0003 for ; Sun, 22 Oct 2023 15:39:52 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 22 Oct 2023 17:39:49 +0200 Message-Id: <20231022153951.11381-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: d8zM3rHTtJHt Signed-off-by: Michael Niedermayer --- libavcodec/bitstream_template.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/bitstream_template.h b/libavcodec/bitstream_template.h index cf4aeff4feb..4f3d07275fb 100644 --- a/libavcodec/bitstream_template.h +++ b/libavcodec/bitstream_template.h @@ -520,7 +520,20 @@ static inline int BS_FUNC(read_vlc)(BSCTX *bc, const VLCElem *table, return code; } -static inline int BS_FUNC(read_vlc_multi)(BSCTX *bc, uint8_t *dst, +/** + * Parse a vlc / vlc_multi code. + * @param bits is the number of bits which will be read at once, must be + * identical to nb_bits in vlc_init() + * @param max_depth is the number of times bits bits must be read to completely + * read the longest vlc code + * = (max_vlc_length + bits - 1) / bits + * @param dst the parsed symbol(s) will be stored here. Up to 8 bytes are written + * @returns number of symbols parsed + * If the vlc code is invalid and max_depth=1, then no bits will be removed. + * If the vlc code is invalid and max_depth>1, then the number of bits removed + * is undefined. + */ +static inline int BS_FUNC(read_vlc_multi)(BSCTX *bc, uint8_t dst[8], const VLC_MULTI_ELEM *const Jtable, const VLCElem *const table, const int bits, const int max_depth)