From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2031C45B7A for ; Sun, 22 Oct 2023 21:51:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3EC2268CA28; Mon, 23 Oct 2023 00:51:22 +0300 (EEST) 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 9C70F68C65F for ; Mon, 23 Oct 2023 00:51:15 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id ED6011C0004 for ; Sun, 22 Oct 2023 21:51:14 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 22 Oct 2023 23:51:06 +0200 Message-Id: <20231022215113.3469-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231022215113.3469-1-michael@niedermayer.cc> References: <20231022215113.3469-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/9] avcodec/vlc: dont pass nb_elems into multi vlc code 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Michael Niedermayer --- libavcodec/vlc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c index 4f62eddf0fb..77860430861 100644 --- a/libavcodec/vlc.c +++ b/libavcodec/vlc.c @@ -350,7 +350,7 @@ fail: return AVERROR_INVALIDDATA; } -static void add_level(VLC_MULTI_ELEM *table, const int nb_elems, +static void add_level(VLC_MULTI_ELEM *table, const int is16bit, const int num, const int numbits, const VLCcode *buf, uint32_t curcode, int curlen, @@ -358,7 +358,6 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems, const int minlen, const int max, unsigned* levelcnt, VLC_MULTI_ELEM *info) { - int is16bit = nb_elems>256; int max_symbols = VLC_MULTI_MAX_SYMBOLS >> is16bit; for (int i = num-1; i > max; i--) { for (int j = 0; j < 2; j++) { @@ -387,7 +386,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems, } if (curlevel+1 < max_symbols && newlimit >= minlen) { - add_level(table, nb_elems, num, numbits, buf, + add_level(table, is16bit, num, numbits, buf, code, l, newlimit, curlevel+1, minlen, max, levelcnt, info); } @@ -396,7 +395,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems, } static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, - const int nb_elems, const int nb_codes, const int numbits, + const int is16bit, const int nb_codes, const int numbits, VLCcode *buf, void *logctx) { int minbits, maxbits, max = nb_codes-1; @@ -424,7 +423,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, AV_WN16(table[j].val, single->table[j].sym); } - add_level(table, nb_elems, nb_codes, numbits, buf, + add_level(table, is16bit, nb_codes, numbits, buf, 0, 0, FFMIN(maxbits, numbits), 0, minbits, max, count, &info); av_log(logctx, AV_LOG_DEBUG, "Joint: %d/%d/%d/%d/%d codes min=%ubits max=%u\n", @@ -480,7 +479,7 @@ int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int ret = vlc_common_end(vlc, nb_bits, j, buf, flags, buf); if (ret < 0) goto fail; - ret = vlc_multi_gen(multi->table, vlc, nb_elems, j, nb_bits, buf, logctx); + ret = vlc_multi_gen(multi->table, vlc, nb_elems > 256, j, nb_bits, buf, logctx); if (buf != localbuf) av_free(buf); return ret; -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".