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

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


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Sep 24 15:34:16 2023 +0200| [99ed510d4b0076a3d809f364109d627c106ec11f] | committer: Andreas Rheinhardt

avcodec/mv30: 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=99ed510d4b0076a3d809f364109d627c106ec11f
---

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

diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c
index 9c72c0080d..8c45c8304b 100644
--- a/libavcodec/mv30.c
+++ b/libavcodec/mv30.c
@@ -59,7 +59,7 @@ typedef struct MV30Context {
     AVFrame *prev_frame;
 } MV30Context;
 
-static VLC cbp_tab;
+static VLCElem cbp_tab[1 << CBP_VLC_BITS];
 
 static const uint8_t luma_tab[] = {
     12, 12, 15, 19, 25, 34, 40, 48,
@@ -379,7 +379,7 @@ static int decode_coeffs(GetBitContext *gb, int16_t *coeffs, int nb_codes)
     memset(coeffs, 0, nb_codes * sizeof(*coeffs));
 
     for (int i = 0; i < nb_codes;) {
-        int value = get_vlc2(gb, cbp_tab.table, CBP_VLC_BITS, 1);
+        int value = get_vlc2(gb, cbp_tab, CBP_VLC_BITS, 1);
 
         if (value > 0) {
             int x = get_bits(gb, value);
@@ -657,8 +657,9 @@ static const uint8_t cbp_bits[] = {
 
 static av_cold void init_static_data(void)
 {
-    VLC_INIT_STATIC_FROM_LENGTHS(&cbp_tab, CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_bits),
-                                 cbp_bits, 1, NULL, 0, 0, 0, 0, 1 << CBP_VLC_BITS);
+    VLC_INIT_STATIC_TABLE_FROM_LENGTHS(cbp_tab, CBP_VLC_BITS,
+                                       FF_ARRAY_ELEMS(cbp_bits),
+                                       cbp_bits, 1, NULL, 0, 0, 0, 0);
 }
 
 static av_cold int decode_init(AVCodecContext *avctx)



More information about the ffmpeg-cvslog mailing list