[FFmpeg-devel] [PATCH 10/13] avcodec/dca_core: Don't use too big max_depth in get_vlc2()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 13 14:33:07 EEST 2022


Most of the VLCs used here have a max_depth of two;
some have a max_depth of one. Therefore one can just use two
and avoid the runtime check for whether one should
perform another round of LUT lookup in case the first read
did not read a complete codeword.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/dca_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index 7dff6633df..7b23a40df4 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.c
@@ -69,7 +69,7 @@ static const uint8_t block_code_nbits[7] = {
 
 static int dca_get_vlc(GetBitContext *s, DCAVLC *v, int i)
 {
-    return get_vlc2(s, v->vlc[i].table, v->vlc[i].bits, v->max_depth);
+    return get_vlc2(s, v->vlc[i].table, v->vlc[i].bits, 2);
 }
 
 static void get_array(GetBitContext *s, int32_t *array, int size, int n)
-- 
2.34.1



More information about the ffmpeg-devel mailing list