[FFmpeg-cvslog] avcodec/mss4: Partially inline max_depth and nb_bits of VLC

Andreas Rheinhardt git at videolan.org
Tue Oct 31 22:15:55 EET 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Sep 24 17:47:47 2023 +0200| [8c39b2bca75c8615080709cf209ce58c5c595dc4] | committer: Andreas Rheinhardt

avcodec/mss4: Partially inline max_depth and nb_bits of VLC

It is known at compile-time for the vec_entry_vlcs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c39b2bca75c8615080709cf209ce58c5c595dc4
---

 libavcodec/mss4.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index 0e7cc3e124..8ae4f152c6 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -156,9 +156,10 @@ static av_always_inline int get_coeff_bits(GetBitContext *gb, int nbits)
     return val;
 }
 
-static inline int get_coeff(GetBitContext *gb, VLC *vlc)
+static inline int get_coeff(GetBitContext *gb, const VLC *vlc,
+                            int nb_bits, int max_depth)
 {
-    int val = get_vlc2(gb, vlc->table, vlc->bits, 2);
+    int val = get_vlc2(gb, vlc->table, nb_bits, max_depth);
 
     return get_coeff_bits(gb, val);
 }
@@ -171,7 +172,7 @@ static int mss4_decode_dct(GetBitContext *gb, VLC *dc_vlc, VLC *ac_vlc,
 
     memset(block, 0, sizeof(*block) * 64);
 
-    dc = get_coeff(gb, dc_vlc);
+    dc = get_coeff(gb, dc_vlc, dc_vlc->bits, 2);
     // DC prediction is the same as in MSS3
     if (by) {
         if (bx) {
@@ -337,7 +338,7 @@ static int mss4_decode_image_block(MSS4Context *ctx, GetBitContext *gb,
     for (i = 0; i < 3; i++) {
         vec_len[i] = vec_len_syms[!!i][get_unary(gb, 0, 3)];
         for (j = 0; j < vec_len[i]; j++) {
-            vec[i][j]  = get_coeff(gb, &vec_entry_vlc[!!i]);
+            vec[i][j]  = get_coeff(gb, &vec_entry_vlc[!!i], 5, 1);
             vec[i][j] += ctx->prev_vec[i][j];
             ctx->prev_vec[i][j] = vec[i][j];
         }



More information about the ffmpeg-cvslog mailing list