diff mbox series

[FFmpeg-devel,1/3] avcodec/mpeg12: Reduce size of motion-vector VLC

Message ID 20201008195313.471755-1-andreas.rheinhardt@gmail.com
State Accepted
Commit c4990409f2edf5ec034e47aa79e8b9f5cc798d3a
Headers show
Series [FFmpeg-devel,1/3] avcodec/mpeg12: Reduce size of motion-vector VLC | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 8, 2020, 7:53 p.m. UTC
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    | 2 +-
 libavcodec/mpeg12vlc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index ab6c19c615..e4f007aec5 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -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);
diff --git a/libavcodec/mpeg12vlc.h b/libavcodec/mpeg12vlc.h
index c5abae96b6..70aca645cb 100644
--- a/libavcodec/mpeg12vlc.h
+++ b/libavcodec/mpeg12vlc.h
@@ -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