diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-30 00:37:55 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-11-06 19:41:25 +0300 |
commit | eb28ddf8fca8f16bf3c4d90b220fd59c27cce446 (patch) | |
tree | 0734f7a1761b2ae3df88fdfdbcb4dfc0117c62ee | |
parent | 2e2b404a2d349def27a0436b325e5ff6769f817b (diff) |
avcodec/vc1: Don't use VLC to read bfraction
The VLC here is very simple, so that it can just be read
by two get_bits().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/vc1.c | 8 | ||||
-rw-r--r-- | libavcodec/vc1data.c | 21 | ||||
-rw-r--r-- | libavcodec/vc1data.h | 4 |
3 files changed, 4 insertions, 29 deletions
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 9b4e951baa..f6468b54c7 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -613,7 +613,10 @@ static void rotate_luts(VC1Context *v) } static int read_bfraction(VC1Context *v, GetBitContext* gb) { - int bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); + int bfraction_lut_index = get_bits(gb, 3); + + if (bfraction_lut_index == 7) + bfraction_lut_index = 7 + get_bits(gb, 4); if (bfraction_lut_index == 21) { av_log(v->s.avctx, AV_LOG_ERROR, "bfraction invalid\n"); @@ -1582,9 +1585,6 @@ static av_cold void vc1_init_static(void) { static VLCElem vlc_table[32372]; - INIT_VLC_STATIC(&ff_vc1_bfraction_vlc, VC1_BFRACTION_VLC_BITS, 23, - ff_vc1_bfraction_bits, 1, 1, - ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS); INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, ff_vc1_norm2_bits, 1, 1, ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); diff --git a/libavcodec/vc1data.c b/libavcodec/vc1data.c index 844bc0f5c5..01a9767d51 100644 --- a/libavcodec/vc1data.c +++ b/libavcodec/vc1data.c @@ -102,8 +102,6 @@ const uint8_t ff_vc1_pquant_table[3][32] = { * @todo TODO move this into the context */ //@{ -#define VC1_BFRACTION_VLC_BITS 7 -VLC ff_vc1_bfraction_vlc; #define VC1_IMODE_VLC_BITS 4 VLC ff_vc1_imode_vlc; #define VC1_NORM2_VLC_BITS 3 @@ -171,25 +169,6 @@ const int16_t ff_vc1_bfraction_lut[23] = { }; #endif -const uint8_t ff_vc1_bfraction_bits[23] = { - 3, 3, 3, 3, - 3, 3, 3, - 7, 7, 7, 7, - 7, 7, 7, 7, - 7, 7, 7, 7, - 7, 7, - 7, 7 -}; -const uint8_t ff_vc1_bfraction_codes[23] = { - 0, 1, 2, 3, - 4, 5, 6, - 112, 113, 114, 115, - 116, 117, 118, 119, - 120, 121, 122, 123, - 124, 125, - 126, 127 -}; - //Same as H.264 const AVRational ff_vc1_pixel_aspect[16] = { { 0, 1 }, diff --git a/libavcodec/vc1data.h b/libavcodec/vc1data.h index 90dd8baf61..3e45ef1e79 100644 --- a/libavcodec/vc1data.h +++ b/libavcodec/vc1data.h @@ -53,8 +53,6 @@ extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4]; * @todo TODO move this into the context */ //@{ -#define VC1_BFRACTION_VLC_BITS 7 -extern VLC ff_vc1_bfraction_vlc; #define VC1_IMODE_VLC_BITS 4 extern VLC ff_vc1_imode_vlc; #define VC1_NORM2_VLC_BITS 3 @@ -100,8 +98,6 @@ extern VLC ff_vc1_ac_coeff_table[8]; /* pre-computed scales for all bfractions and base=256 */ extern const int16_t ff_vc1_bfraction_lut[23]; -extern const uint8_t ff_vc1_bfraction_bits[23]; -extern const uint8_t ff_vc1_bfraction_codes[23]; //Same as H.264 extern const AVRational ff_vc1_pixel_aspect[16]; |