[FFmpeg-cvslog] avcodec/mimic: Avoid unnecessary VLC structure

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


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

avcodec/mimic: Avoid unnecessary VLC structure

Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

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

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

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

diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index ac71a2c149..cd5d0d7e3e 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -67,7 +67,7 @@ typedef struct MimicContext {
     int             next_prev_index;
 } MimicContext;
 
-static VLC block_vlc;
+static VLCElem block_vlc[4368];
 
 static const uint8_t huffsyms[] = {
     0x10, 0x20, 0x30, 0x00, 0x11, 0x40, 0x50, 0x12, 0x13, 0x21, 0x31, 0x60,
@@ -120,8 +120,9 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx)
 
 static av_cold void mimic_init_static(void)
 {
-    VLC_INIT_STATIC_FROM_LENGTHS(&block_vlc, MIMIC_VLC_BITS, FF_ARRAY_ELEMS(huffbits),
-                                 huffbits, 1, huffsyms, 1, 1, 0, 0, 4368);
+    VLC_INIT_STATIC_TABLE_FROM_LENGTHS(block_vlc, MIMIC_VLC_BITS,
+                                       FF_ARRAY_ELEMS(huffbits),
+                                       huffbits, 1, huffsyms, 1, 1, 0, 0);
 }
 
 static av_cold int mimic_decode_init(AVCodecContext *avctx)
@@ -226,7 +227,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
         int value;
         int coeff;
 
-        vlc = get_vlc2(&ctx->gb, block_vlc.table, MIMIC_VLC_BITS, 3);
+        vlc = get_vlc2(&ctx->gb, block_vlc, MIMIC_VLC_BITS, 3);
         if (!vlc) /* end-of-block code */
             return 0;
         if (vlc == -1)



More information about the ffmpeg-cvslog mailing list