Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/9] avcodec/vlc: merge lost 16bit end of array check
@ 2023-10-22 21:51 Michael Niedermayer
  2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 2/9] avcodec/vlc: dont pass nb_elems into multi vlc code Michael Niedermayer
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Michael Niedermayer @ 2023-10-22 21:51 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Also cleanup related code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vlc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
index e4bbf2945e1..4f62eddf0fb 100644
--- a/libavcodec/vlc.c
+++ b/libavcodec/vlc.c
@@ -358,8 +358,8 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems,
                       const int minlen, const int max,
                       unsigned* levelcnt, VLC_MULTI_ELEM *info)
 {
-    if (nb_elems > 256 && curlevel > 2)
-        return; // No room
+    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++) {
             int newlimit, sym;
@@ -373,7 +373,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems,
             code = curcode + (buf[t].code >> curlen);
             newlimit = curlimit - l;
             l  += curlen;
-            if (nb_elems>256) AV_WN16(info->val+2*curlevel, sym);
+            if (is16bit) AV_WN16(info->val+2*curlevel, sym);
             else info->val[curlevel] = sym&0xFF;
 
             if (curlevel) { // let's not add single entries
@@ -386,7 +386,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems,
                 levelcnt[curlevel-1]++;
             }
 
-            if (curlevel+1 < VLC_MULTI_MAX_SYMBOLS && newlimit >= minlen) {
+            if (curlevel+1 < max_symbols && newlimit >= minlen) {
                 add_level(table, nb_elems, num, numbits, buf,
                           code, l, newlimit, curlevel+1,
                           minlen, max, levelcnt, info);
-- 
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".

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-10-31 22:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [FFmpeg-devel] [PATCH 2/9] avcodec/vlc: dont pass nb_elems into multi vlc code Michael Niedermayer
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

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