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>
pull/388/head
Andreas Rheinhardt 2 years ago
parent 2e2b404a2d
commit eb28ddf8fc
  1. 8
      libavcodec/vc1.c
  2. 21
      libavcodec/vc1data.c
  3. 4
      libavcodec/vc1data.h

@ -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);

@ -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 },

@ -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];

Loading…
Cancel
Save