From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/9] avcodec/vlc: dont pass nb_elems into multi vlc code
Date: Sun, 22 Oct 2023 23:51:06 +0200
Message-ID: <20231022215113.3469-2-michael@niedermayer.cc> (raw)
In-Reply-To: <20231022215113.3469-1-michael@niedermayer.cc>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
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".
next prev parent reply other threads:[~2023-10-22 21:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-22 21:51 [FFmpeg-devel] [PATCH 1/9] avcodec/vlc: merge lost 16bit end of array check Michael Niedermayer
2023-10-22 21:51 ` Michael Niedermayer [this message]
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 3/9] avcodec/vlc: Skip subtable entries in multi VLC Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 4/9] avcodec/vlc: Replace mysterious max computation code in multi vlc Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 5/9] avcodec/vlc: Pass VLC_MULTI_ELEM directly not by pointer Michael Niedermayer
2023-10-23 6:10 ` Leo Izen
2023-10-23 16:04 ` Michael Niedermayer
2023-10-24 9:54 ` Leo Izen
2023-10-31 22:22 ` Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 6/9] avcodec/vlc: Remove mysterious jitter loop in multi VLC Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 7/9] Revert "avcodec/vlc: add correct upper limit for recursive function" Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 8/9] Revert "avcodec/vlc: fix off by one in limit check for multi" Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 9/9] avcodec/vlc: simplify min/maxbits in multi VLC Michael Niedermayer
2023-10-22 23:02 ` [FFmpeg-devel] [PATCH 1/9] avcodec/vlc: merge lost 16bit end of array check Paul B Mahol
2023-10-23 16:05 ` Michael Niedermayer
2023-10-26 22:35 ` Michael Niedermayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231022215113.3469-2-michael@niedermayer.cc \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git