]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpeg12: Reduce size of motion-vector VLC
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 8 Oct 2020 14:59:40 +0000 (16:59 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 12 Oct 2020 00:00:08 +0000 (02:00 +0200)
It currently uses 9 bits per table, but there are no codes with
nine bits at all, while there are codes with eight, ten and eleven bits.
So reducing the table size to eight bits will not reduce the amount of
codes that can be parsed in the first step, but it allows to reduce the
size of the motion-vector VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/mpeg12.c
libavcodec/mpeg12vlc.h

index ab6c19c6151590026dd625f90cd608f4d97b679d..e4f007aec575a15b07df57cabdb40964f0950509 100644 (file)
@@ -149,7 +149,7 @@ av_cold void ff_mpeg12_init_vlcs(void)
                         ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514);
         INIT_VLC_STATIC(&ff_mv_vlc, MV_VLC_BITS, 17,
                         &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1,
-                        &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 518);
+                        &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 266);
         INIT_VLC_STATIC(&ff_mbincr_vlc, MBINCR_VLC_BITS, 36,
                         &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1,
                         &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538);
index c5abae96b66f5b07141b7701213c3ba759d1fbcb..70aca645cb9bcfc4b97f49a0f0b5457d140e7604 100644 (file)
@@ -31,7 +31,7 @@
 #include "vlc.h"
 
 #define DC_VLC_BITS 9
-#define MV_VLC_BITS 9
+#define MV_VLC_BITS 8
 #define TEX_VLC_BITS 9
 
 #define MBINCR_VLC_BITS 9