History

avcodec/vc1: Avoid superfluous VLC structures

For all VLCs here, the number of bits of the VLC is write-only, because it is hardcoded at the call site. Therefore one can replace these VLC structures with the only thing that is actually used: The pointer to the VLCElem table. And in some cases one can even avoid this.

Andreas Rheinhardt committed 3 years ago

Commit e5dcde61 parent fd4cb6e6 files · +180 −210Browse files

Unified · Split

6 files
  1. libavcodec/vc1.c +30 −30
  2. libavcodec/vc1.h +5 −5
  3. libavcodec/vc1_block.c +37 −37
  4. libavcodec/vc1data.c +18 −18
  5. libavcodec/vc1data.h +18 −18
  6. libavcodec/vc1dec.c +72 −102
libavcodec/vc1.c+30−30
@@ -104,7 +104,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 103 unmodified lines
104104 height = v->s.mb_height >> v->field_mode;
105105 stride = v->s.mb_stride;
106106 invert = get_bits1(gb);
107− imode = get_vlc2(gb, ff_vc1_imode_vlc.table, VC1_IMODE_VLC_BITS, 1);
107+ imode = get_vlc2(gb, ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 1);
108108
109109 *raw_flag = 0;
110110 switch (imode) {
@@ -126,7 +126,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 15 unmodified lines
126126 y = offset = 0;
127127 // decode bitplane as one long line
128128 for (; y < height * width; y += 2) {
129− code = get_vlc2(gb, ff_vc1_norm2_vlc.table, VC1_NORM2_VLC_BITS, 1);
129+ code = get_vlc2(gb, ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 1);
130130 *planep++ = code & 1;
131131 offset++;
132132 if (offset == width) {
@@ -146,7 +146,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 13 unmodified lines
146146 if (!(height % 3) && (width % 3)) { // use 2x3 decoding
147147 for (y = 0; y < height; y += 3) {
148148 for (x = width & 1; x < width; x += 2) {
149− code = get_vlc2(gb, ff_vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
149+ code = get_vlc2(gb, ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 2);
150150 if (code < 0) {
151151 av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
152152 return -1;
@@ -166,7 +166,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 13 unmodified lines
166166 planep += (height & 1) * stride;
167167 for (y = height & 1; y < height; y += 2) {
168168 for (x = width % 3; x < width; x += 3) {
169− code = get_vlc2(gb, ff_vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
169+ code = get_vlc2(gb, ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 2);
170170 if (code < 0) {
171171 av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
172172 return -1;
@@ -765,7 +765,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) · 592 unmodified lines
765765 /* Hopefully this is correct for P-frames */
766766 v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
767767 v->cbptab = get_bits(gb, 2);
768− v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[v->cbptab];
768+ v->cbpcy_vlc = ff_vc1_cbpcy_p_vlc[v->cbptab];
769769
770770 if (v->dquant) {
771771 av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
@@ -804,7 +804,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) · 32 unmodified lines
804804
805805 v->s.mv_table_index = get_bits(gb, 2);
806806 v->cbptab = get_bits(gb, 2);
807− v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[v->cbptab];
807+ v->cbpcy_vlc = ff_vc1_cbpcy_p_vlc[v->cbptab];
808808
809809 if (v->dquant) {
810810 av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
@@ -1061,19 +1061,19 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 250 unmodified lines
10611061 "Imode: %i, Invert: %i\n", status>>1, status&1);
10621062 v->mbmodetab = get_bits(gb, 2);
10631063 if (v->fourmvswitch)
1064− v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[v->mbmodetab];
1064+ v->mbmode_vlc = ff_vc1_intfr_4mv_mbmode_vlc[v->mbmodetab];
10651065 else
1066− v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[v->mbmodetab];
1066+ v->mbmode_vlc = ff_vc1_intfr_non4mv_mbmode_vlc[v->mbmodetab];
10671067 v->imvtab = get_bits(gb, 2);
1068− v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[v->imvtab];
1068+ v->imv_vlc = ff_vc1_1ref_mvdata_vlc[v->imvtab];
10691069 // interlaced p-picture cbpcy range is [1, 63]
10701070 v->icbptab = get_bits(gb, 3);
1071− v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[v->icbptab];
1071+ v->cbpcy_vlc = ff_vc1_icbpcy_vlc[v->icbptab];
10721072 v->twomvbptab = get_bits(gb, 2);
1073− v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[v->twomvbptab];
1073+ v->twomvbp_vlc = ff_vc1_2mv_block_pattern_vlc[v->twomvbptab];
10741074 if (v->fourmvswitch) {
10751075 v->fourmvbptab = get_bits(gb, 2);
1076− v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
1076+ v->fourmvbp_vlc = ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
10771077 }
10781078 }
10791079 }
@@ -1158,7 +1158,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 78 unmodified lines
11581158 /* Hopefully this is correct for P-frames */
11591159 v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
11601160 v->cbptab = get_bits(gb, 2);
1161− v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[v->cbptab];
1161+ v->cbpcy_vlc = ff_vc1_cbpcy_p_vlc[v->cbptab];
11621162 } else if (v->fcm == ILACE_FRAME) { // frame interlaced
11631163 v->qs_last = v->s.quarter_sample;
11641164 v->s.quarter_sample = 1;
@@ -1167,18 +1167,18 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 2 unmodified lines
11671167 v->mbmodetab = get_bits(gb, 3);
11681168 v->imvtab = get_bits(gb, 2 + v->numref);
11691169 if (!v->numref)
1170− v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[v->imvtab];
1170+ v->imv_vlc = ff_vc1_1ref_mvdata_vlc[v->imvtab];
11711171 else
1172− v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[v->imvtab];
1172+ v->imv_vlc = ff_vc1_2ref_mvdata_vlc[v->imvtab];
11731173 v->icbptab = get_bits(gb, 3);
1174− v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[v->icbptab];
1174+ v->cbpcy_vlc = ff_vc1_icbpcy_vlc[v->icbptab];
11751175 if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
11761176 v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) {
11771177 v->fourmvbptab = get_bits(gb, 2);
1178− v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
1179− v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[v->mbmodetab];
1178+ v->fourmvbp_vlc = ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
1179+ v->mbmode_vlc = ff_vc1_if_mmv_mbmode_vlc[v->mbmodetab];
11801180 } else {
1181− v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[v->mbmodetab];
1181+ v->mbmode_vlc = ff_vc1_if_1mv_mbmode_vlc[v->mbmodetab];
11821182 }
11831183 }
11841184 if (v->dquant) {
@@ -1234,16 +1234,16 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 49 unmodified lines
12341234 "Imode: %i, Invert: %i\n", status>>1, status&1);
12351235 v->mbmodetab = get_bits(gb, 3);
12361236 if (v->mv_mode == MV_PMODE_MIXED_MV)
1237− v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[v->mbmodetab];
1237+ v->mbmode_vlc = ff_vc1_if_mmv_mbmode_vlc[v->mbmodetab];
12381238 else
1239− v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[v->mbmodetab];
1239+ v->mbmode_vlc = ff_vc1_if_1mv_mbmode_vlc[v->mbmodetab];
12401240 v->imvtab = get_bits(gb, 3);
1241− v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[v->imvtab];
1241+ v->imv_vlc = ff_vc1_2ref_mvdata_vlc[v->imvtab];
12421242 v->icbptab = get_bits(gb, 3);
1243− v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[v->icbptab];
1243+ v->cbpcy_vlc = ff_vc1_icbpcy_vlc[v->icbptab];
12441244 if (v->mv_mode == MV_PMODE_MIXED_MV) {
12451245 v->fourmvbptab = get_bits(gb, 2);
1246− v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
1246+ v->fourmvbp_vlc = ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
12471247 }
12481248 v->numref = 1; // interlaced field B pictures are always 2-ref
12491249 } else if (v->fcm == ILACE_FRAME) {
@@ -1268,16 +1268,16 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 18 unmodified lines
12681268 av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
12691269 "Imode: %i, Invert: %i\n", status>>1, status&1);
12701270 v->mbmodetab = get_bits(gb, 2);
1271− v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[v->mbmodetab];
1271+ v->mbmode_vlc = ff_vc1_intfr_non4mv_mbmode_vlc[v->mbmodetab];
12721272 v->imvtab = get_bits(gb, 2);
1273− v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[v->imvtab];
1273+ v->imv_vlc = ff_vc1_1ref_mvdata_vlc[v->imvtab];
12741274 // interlaced p/b-picture cbpcy range is [1, 63]
12751275 v->icbptab = get_bits(gb, 3);
1276− v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[v->icbptab];
1276+ v->cbpcy_vlc = ff_vc1_icbpcy_vlc[v->icbptab];
12771277 v->twomvbptab = get_bits(gb, 2);
1278− v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[v->twomvbptab];
1278+ v->twomvbp_vlc = ff_vc1_2mv_block_pattern_vlc[v->twomvbptab];
12791279 v->fourmvbptab = get_bits(gb, 2);
1280− v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
1280+ v->fourmvbp_vlc = ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab];
12811281 } else {
12821282 v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;
12831283 v->qs_last = v->s.quarter_sample;
@@ -1295,7 +1295,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 11 unmodified lines
12951295 "Imode: %i, Invert: %i\n", status>>1, status&1);
12961296 v->s.mv_table_index = get_bits(gb, 2);
12971297 v->cbptab = get_bits(gb, 2);
1298− v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[v->cbptab];
1298+ v->cbpcy_vlc = ff_vc1_cbpcy_p_vlc[v->cbptab];
12991299 }
13001300
13011301 if (v->dquant) {
libavcodec/vc1.h+5−5
@@ -279,7 +279,7 @@ typedef struct VC1Context{ · 278 unmodified lines
279279 */
280280 uint8_t mvrange; ///< Extended MV range flag
281281 uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use
282− VLC *cbpcy_vlc; ///< CBPCY VLC table
282+ const VLCElem *cbpcy_vlc; ///< CBPCY VLC table
283283 int tt_index; ///< Index for Transform Type tables (to decode TTMB)
284284 uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV)
285285 uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs
@@ -334,10 +334,10 @@ typedef struct VC1Context{ · 48 unmodified lines
334334 int intcomp;
335335 uint8_t lumscale2; ///< for interlaced field P picture
336336 uint8_t lumshift2;
337− VLC* mbmode_vlc;
338− VLC* imv_vlc;
339− VLC* twomvbp_vlc;
340− VLC* fourmvbp_vlc;
337+ const VLCElem *mbmode_vlc;
338+ const VLCElem *imv_vlc;
339+ const VLCElem *twomvbp_vlc;
340+ const VLCElem *fourmvbp_vlc;
341341 uint8_t twomvbp;
342342 uint8_t fourmvbp;
343343 uint8_t* fieldtx_plane;
libavcodec/vc1_block.c+37−37
@@ -227,7 +227,7 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed) · 226 unmodified lines
227227 * @param _dmv_y Vertical differential for decoded MV
228228 */
229229 #define GET_MVDATA(_dmv_x, _dmv_y) \
230− index = 1 + get_vlc2(gb, ff_vc1_mv_diff_vlc[s->mv_table_index].table, \
230+ index = 1 + get_vlc2(gb, ff_vc1_mv_diff_vlc[s->mv_table_index], \
231231 VC1_MV_DIFF_VLC_BITS, 2); \
232232 if (index > 36) { \
233233 mb_has_coeffs = 1; \
@@ -282,7 +282,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, · 48 unmodified lines
282282 }
283283 extend_x = v->dmvrange & 1;
284284 extend_y = (v->dmvrange >> 1) & 1;
285− index = get_vlc2(gb, v->imv_vlc->table, bits, 3);
285+ index = get_vlc2(gb, v->imv_vlc, bits, 3);
286286 if (index == esc) {
287287 *dmv_x = get_bits(gb, v->k_x);
288288 *dmv_y = get_bits(gb, v->k_y);
@@ -519,7 +519,7 @@ static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, · 230 unmodified lines
519519 GetBitContext *gb = &v->s.gb;
520520 int index, run, level, lst, sign;
521521
522− index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
522+ index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset], AC_VLC_BITS, 3);
523523 if (index < 0)
524524 return index;
525525 if (index != ff_vc1_ac_sizes[codingset] - 1) {
@@ -530,7 +530,7 @@ static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, · 4 unmodified lines
530530 } else {
531531 int escape = decode210(gb);
532532 if (escape != 2) {
533− index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
533+ index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset], AC_VLC_BITS, 3);
534534 if (index >= ff_vc1_ac_sizes[codingset] - 1U)
535535 return AVERROR_INVALIDDATA;
536536 run = vc1_index_decode_table[codingset][index][0];
@@ -1124,10 +1124,10 @@ static int vc1_decode_p_block(VC1Context *v, int16_t block[64], int n, · 587 unmodified lines
11241124 s->bdsp.clear_block(block);
11251125
11261126 if (ttmb == -1) {
1127− ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)];
1127+ ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index], VC1_TTBLK_VLC_BITS, 1)];
11281128 }
11291129 if (ttblk == TT_4X4) {
1130− subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1);
1130+ subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index], VC1_SUBBLKPAT_VLC_BITS, 1) + 1);
11311131 }
11321132 if ((ttblk != TT_8X8 && ttblk != TT_4X4)
11331133 && ((v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))
@@ -1328,7 +1328,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 194 unmodified lines
13281328 } else if (mb_has_coeffs) {
13291329 if (s->mb_intra)
13301330 s->ac_pred = get_bits1(gb);
1331− cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1331+ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
13321332 GET_MQUANT();
13331333 } else {
13341334 mquant = v->pq;
@@ -1337,7 +1337,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 2 unmodified lines
13371337 s->current_picture.qscale_table[mb_pos] = mquant;
13381338
13391339 if (!v->ttmbf && !s->mb_intra && mb_has_coeffs)
1340− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table,
1340+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index],
13411341 VC1_TTMB_VLC_BITS, 2);
13421342 if (!s->mb_intra) ff_vc1_mc_1mv(v, 0);
13431343 dst_idx = 0;
@@ -1393,7 +1393,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 49 unmodified lines
13931393 int intra_count = 0, coded_inter = 0;
13941394 int is_intra[6], is_coded[6];
13951395 /* Get CBPCY */
1396− cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1396+ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
13971397 for (i = 0; i < 6; i++) {
13981398 val = ((cbp >> (5 - i)) & 1);
13991399 s->dc_val[0][s->block_index[i]] = 0;
@@ -1445,7 +1445,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 45 unmodified lines
14451445 s->ac_pred = 0;
14461446 }
14471447 if (!v->ttmbf && coded_inter)
1448− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
1448+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
14491449 for (i = 0; i < 6; i++) {
14501450 dst_idx += i >> 2;
14511451 off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
@@ -1539,9 +1539,9 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 87 unmodified lines
15391539 skipped = v->s.mbskip_table[mb_pos];
15401540 if (!skipped) {
15411541 if (v->fourmvswitch)
1542− idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_4MV_MBMODE_VLC_BITS, 2); // try getting this done
1542+ idx_mbmode = get_vlc2(gb, v->mbmode_vlc, VC1_INTFR_4MV_MBMODE_VLC_BITS, 2); // try getting this done
15431543 else
1544− idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); // in a single line
1544+ idx_mbmode = get_vlc2(gb, v->mbmode_vlc, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); // in a single line
15451545 switch (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0]) {
15461546 /* store the motion vector type in a flag (useful later) */
15471547 case MV_PMODE_INTFR_4MV:
@@ -1583,7 +1583,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 35 unmodified lines
15831583 fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb);
15841584 mb_has_coeffs = get_bits1(gb);
15851585 if (mb_has_coeffs)
1586− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1586+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
15871587 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
15881588 GET_MQUANT();
15891589 s->current_picture.qscale_table[mb_pos] = mquant;
@@ -1617,13 +1617,13 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 27 unmodified lines
16171617 } else { // inter MB
16181618 mb_has_coeffs = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][3];
16191619 if (mb_has_coeffs)
1620− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1620+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
16211621 if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) {
1622− v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
1622+ v->twomvbp = get_vlc2(gb, v->twomvbp_vlc, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
16231623 } else {
16241624 if ((ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV)
16251625 || (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV_FIELD)) {
1626− v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
1626+ v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
16271627 }
16281628 }
16291629 s->mb_intra = v->is_intra[s->mb_x] = 0;
@@ -1672,7 +1672,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 42 unmodified lines
16721672 GET_MQUANT(); // p. 227
16731673 s->current_picture.qscale_table[mb_pos] = mquant;
16741674 if (!v->ttmbf && cbp)
1675− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
1675+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
16761676 for (i = 0; i < 6; i++) {
16771677 s->dc_val[0][s->block_index[i]] = 0;
16781678 dst_idx += i >> 2;
@@ -1742,7 +1742,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 63 unmodified lines
17421742
17431743 mquant = v->pq; /* Lossy initialization */
17441744
1745− idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2);
1745+ idx_mbmode = get_vlc2(gb, v->mbmode_vlc, VC1_IF_MBMODE_VLC_BITS, 2);
17461746 if (idx_mbmode <= 1) { // intra MB
17471747 v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1.
17481748 s->mb_intra = 1;
@@ -1757,7 +1757,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 8 unmodified lines
17571757 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
17581758 mb_has_coeffs = idx_mbmode & 1;
17591759 if (mb_has_coeffs)
1760− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2);
1760+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_ICBPCY_VLC_BITS, 2);
17611761 dst_idx = 0;
17621762 for (i = 0; i < 6; i++) {
17631763 v->a_avail = v->c_avail = 0;
@@ -1792,7 +1792,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 28 unmodified lines
17921792 ff_vc1_mc_1mv(v, 0);
17931793 mb_has_coeffs = !(idx_mbmode & 2);
17941794 } else { // 4-MV
1795− v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
1795+ v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
17961796 for (i = 0; i < 4; i++) {
17971797 dmv_x = dmv_y = pred_flag = 0;
17981798 if (v->fourmvbp & (8 >> i))
@@ -1804,13 +1804,13 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 5 unmodified lines
18041804 mb_has_coeffs = idx_mbmode & 1;
18051805 }
18061806 if (mb_has_coeffs)
1807− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1807+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
18081808 if (cbp) {
18091809 GET_MQUANT();
18101810 }
18111811 s->current_picture.qscale_table[mb_pos] = mquant;
18121812 if (!v->ttmbf && cbp) {
1813− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
1813+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
18141814 }
18151815 dst_idx = 0;
18161816 for (i = 0; i < 6; i++) {
@@ -1914,12 +1914,12 @@ static int vc1_decode_b_mb(VC1Context *v) · 97 unmodified lines
19141914 return 0;
19151915 }
19161916 if (direct) {
1917− cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1917+ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
19181918 GET_MQUANT();
19191919 s->mb_intra = 0;
19201920 s->current_picture.qscale_table[mb_pos] = mquant;
19211921 if (!v->ttmbf)
1922− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
1922+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
19231923 dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0;
19241924 ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
19251925 vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
@@ -1952,11 +1952,11 @@ static int vc1_decode_b_mb(VC1Context *v) · 26 unmodified lines
19521952 }
19531953 if (s->mb_intra)
19541954 s->ac_pred = get_bits1(gb);
1955− cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
1955+ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
19561956 GET_MQUANT();
19571957 s->current_picture.qscale_table[mb_pos] = mquant;
19581958 if (!v->ttmbf && !s->mb_intra && mb_has_coeffs)
1959− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
1959+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
19601960 }
19611961 }
19621962 dst_idx = 0;
@@ -2025,7 +2025,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 62 unmodified lines
20252025 mquant = v->pq; /* Lossy initialization */
20262026 s->mb_intra = 0;
20272027
2028− idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2);
2028+ idx_mbmode = get_vlc2(gb, v->mbmode_vlc, VC1_IF_MBMODE_VLC_BITS, 2);
20292029 if (idx_mbmode <= 1) { // intra MB
20302030 v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1.
20312031 s->mb_intra = 1;
@@ -2040,7 +2040,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 8 unmodified lines
20402040 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
20412041 mb_has_coeffs = idx_mbmode & 1;
20422042 if (mb_has_coeffs)
2043− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2);
2043+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_ICBPCY_VLC_BITS, 2);
20442044 dst_idx = 0;
20452045 for (i = 0; i < 6; i++) {
20462046 v->a_avail = v->c_avail = 0;
@@ -2118,7 +2118,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 71 unmodified lines
21182118 if (fwd)
21192119 bmvtype = BMV_TYPE_FORWARD;
21202120 v->bmvtype = bmvtype;
2121− v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
2121+ v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
21222122 for (i = 0; i < 4; i++) {
21232123 dmv_x[0] = dmv_y[0] = pred_flag[0] = 0;
21242124 dmv_x[1] = dmv_y[1] = pred_flag[1] = 0;
@@ -2134,13 +2134,13 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 9 unmodified lines
21342134 mb_has_coeffs = idx_mbmode & 1;
21352135 }
21362136 if (mb_has_coeffs)
2137− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
2137+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
21382138 if (cbp) {
21392139 GET_MQUANT();
21402140 }
21412141 s->current_picture.qscale_table[mb_pos] = mquant;
21422142 if (!v->ttmbf && cbp) {
2143− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
2143+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
21442144 }
21452145 dst_idx = 0;
21462146 for (i = 0; i < 6; i++) {
@@ -2200,7 +2200,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 53 unmodified lines
22002200 skipped = v->s.mbskip_table[mb_pos];
22012201
22022202 if (!skipped) {
2203− idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);
2203+ idx_mbmode = get_vlc2(gb, v->mbmode_vlc, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2);
22042204 if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) {
22052205 twomv = 1;
22062206 v->blk_mv_type[s->block_index[0]] = 1;
@@ -2228,7 +2228,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 21 unmodified lines
22282228 fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb);
22292229 mb_has_coeffs = get_bits1(gb);
22302230 if (mb_has_coeffs)
2231− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
2231+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
22322232 v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
22332233 GET_MQUANT();
22342234 s->current_picture.qscale_table[mb_pos] = mquant;
@@ -2323,12 +2323,12 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 88 unmodified lines
23232323 if (!skipped) { // inter MB
23242324 mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3];
23252325 if (mb_has_coeffs)
2326− cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
2326+ cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2);
23272327 if (!direct) {
23282328 if (bmvtype == BMV_TYPE_INTERPOLATED && twomv) {
2329− v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
2329+ v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
23302330 } else if (bmvtype == BMV_TYPE_INTERPOLATED || twomv) {
2331− v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
2331+ v->twomvbp = get_vlc2(gb, v->twomvbp_vlc, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1);
23322332 }
23332333 }
23342334
@@ -2438,7 +2438,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 103 unmodified lines
24382438 GET_MQUANT(); // p. 227
24392439 s->current_picture.qscale_table[mb_pos] = mquant;
24402440 if (!v->ttmbf && cbp)
2441− ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
2441+ ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2);
24422442 for (i = 0; i < 6; i++) {
24432443 s->dc_val[0][s->block_index[i]] = 0;
24442444 dst_idx += i >> 2;
libavcodec/vc1data.c+18−18
@@ -102,26 +102,26 @@ const uint8_t ff_vc1_pquant_table[3][32] = { · 101 unmodified lines
102102 * @todo TODO move this into the context
103103 */
104104 //@{
105−VLC ff_vc1_imode_vlc;
106−VLC ff_vc1_norm2_vlc;
107−VLC ff_vc1_norm6_vlc;
105+VLCElem ff_vc1_imode_vlc[1 << VC1_IMODE_VLC_BITS];
106+VLCElem ff_vc1_norm2_vlc[1 << VC1_NORM2_VLC_BITS];
107+VLCElem ff_vc1_norm6_vlc[556];
108108 /* Could be optimized, one table only needs 8 bits */
109−VLC ff_vc1_ttmb_vlc[3];
110−VLC ff_vc1_mv_diff_vlc[4];
111−VLC ff_vc1_cbpcy_p_vlc[4];
112−VLC ff_vc1_icbpcy_vlc[8];
113−VLC ff_vc1_4mv_block_pattern_vlc[4];
114−VLC ff_vc1_2mv_block_pattern_vlc[4];
115−VLC ff_vc1_ttblk_vlc[3];
116−VLC ff_vc1_subblkpat_vlc[3];
117−VLC ff_vc1_intfr_4mv_mbmode_vlc[4];
118−VLC ff_vc1_intfr_non4mv_mbmode_vlc[4];
119−VLC ff_vc1_if_mmv_mbmode_vlc[8];
120−VLC ff_vc1_if_1mv_mbmode_vlc[8];
121−VLC ff_vc1_1ref_mvdata_vlc[4];
122−VLC ff_vc1_2ref_mvdata_vlc[8];
109+const VLCElem *ff_vc1_ttmb_vlc[3];
110+const VLCElem *ff_vc1_mv_diff_vlc[4];
111+const VLCElem *ff_vc1_cbpcy_p_vlc[4];
112+const VLCElem *ff_vc1_icbpcy_vlc[8];
113+const VLCElem *ff_vc1_4mv_block_pattern_vlc[4];
114+const VLCElem *ff_vc1_2mv_block_pattern_vlc[4];
115+const VLCElem *ff_vc1_ttblk_vlc[3];
116+const VLCElem *ff_vc1_subblkpat_vlc[3];
117+const VLCElem *ff_vc1_intfr_4mv_mbmode_vlc[4];
118+const VLCElem *ff_vc1_intfr_non4mv_mbmode_vlc[4];
119+const VLCElem *ff_vc1_if_mmv_mbmode_vlc[8];
120+const VLCElem *ff_vc1_if_1mv_mbmode_vlc[8];
121+const VLCElem *ff_vc1_1ref_mvdata_vlc[4];
122+const VLCElem *ff_vc1_2ref_mvdata_vlc[8];
123123
124−VLC ff_vc1_ac_coeff_table[8];
124+const VLCElem *ff_vc1_ac_coeff_table[8];
125125
126126 //@}
127127
libavcodec/vc1data.h+18−18
@@ -56,42 +56,42 @@ extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4]; · 55 unmodified lines
5656 */
5757 //@{
5858 #define VC1_IMODE_VLC_BITS 4
59−extern VLC ff_vc1_imode_vlc;
59+extern VLCElem ff_vc1_imode_vlc[1 << VC1_IMODE_VLC_BITS];
6060 #define VC1_NORM2_VLC_BITS 3
61−extern VLC ff_vc1_norm2_vlc;
61+extern VLCElem ff_vc1_norm2_vlc[1 << VC1_NORM2_VLC_BITS];
6262 #define VC1_NORM6_VLC_BITS 9
63−extern VLC ff_vc1_norm6_vlc;
63+extern VLCElem ff_vc1_norm6_vlc[556];
6464 /* Could be optimized, one table only needs 8 bits */
6565 #define VC1_TTMB_VLC_BITS 9 //12
66−extern VLC ff_vc1_ttmb_vlc[3];
66+extern const VLCElem *ff_vc1_ttmb_vlc[3];
6767 #define VC1_MV_DIFF_VLC_BITS 9 //15
68−extern VLC ff_vc1_mv_diff_vlc[4];
68+extern const VLCElem *ff_vc1_mv_diff_vlc[4];
6969 #define VC1_CBPCY_P_VLC_BITS 9 //14
70−extern VLC ff_vc1_cbpcy_p_vlc[4];
70+extern const VLCElem *ff_vc1_cbpcy_p_vlc[4];
7171 #define VC1_ICBPCY_VLC_BITS 9
72−extern VLC ff_vc1_icbpcy_vlc[8];
72+extern const VLCElem *ff_vc1_icbpcy_vlc[8];
7373 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
74−extern VLC ff_vc1_4mv_block_pattern_vlc[4];
74+extern const VLCElem *ff_vc1_4mv_block_pattern_vlc[4];
7575 #define VC1_2MV_BLOCK_PATTERN_VLC_BITS 3
76−extern VLC ff_vc1_2mv_block_pattern_vlc[4];
76+extern const VLCElem *ff_vc1_2mv_block_pattern_vlc[4];
7777 #define VC1_TTBLK_VLC_BITS 5
78−extern VLC ff_vc1_ttblk_vlc[3];
78+extern const VLCElem *ff_vc1_ttblk_vlc[3];
7979 #define VC1_SUBBLKPAT_VLC_BITS 6
80−extern VLC ff_vc1_subblkpat_vlc[3];
80+extern const VLCElem *ff_vc1_subblkpat_vlc[3];
8181 #define VC1_INTFR_4MV_MBMODE_VLC_BITS 9
82−extern VLC ff_vc1_intfr_4mv_mbmode_vlc[4];
82+extern const VLCElem *ff_vc1_intfr_4mv_mbmode_vlc[4];
8383 #define VC1_INTFR_NON4MV_MBMODE_VLC_BITS 6
84−extern VLC ff_vc1_intfr_non4mv_mbmode_vlc[4];
84+extern const VLCElem *ff_vc1_intfr_non4mv_mbmode_vlc[4];
8585 #define VC1_IF_MMV_MBMODE_VLC_BITS 5
86−extern VLC ff_vc1_if_mmv_mbmode_vlc[8];
86+extern const VLCElem *ff_vc1_if_mmv_mbmode_vlc[8];
8787 #define VC1_IF_1MV_MBMODE_VLC_BITS 5
88−extern VLC ff_vc1_if_1mv_mbmode_vlc[8];
88+extern const VLCElem *ff_vc1_if_1mv_mbmode_vlc[8];
8989 #define VC1_1REF_MVDATA_VLC_BITS 9
90−extern VLC ff_vc1_1ref_mvdata_vlc[4];
90+extern const VLCElem *ff_vc1_1ref_mvdata_vlc[4];
9191 #define VC1_2REF_MVDATA_VLC_BITS 9
92−extern VLC ff_vc1_2ref_mvdata_vlc[8];
92+extern const VLCElem *ff_vc1_2ref_mvdata_vlc[8];
9393
94−extern VLC ff_vc1_ac_coeff_table[8];
94+extern const VLCElem *ff_vc1_ac_coeff_table[8];
9595
9696 #define VC1_IF_MBMODE_VLC_BITS 5 // as a placeholder for VC1_IF_MMV_MBMODE_VLC_BITS
9797 // or VC1_IF_1MV_MBMODE_VLC_BITS since they are the same
libavcodec/vc1dec.c+72−102
@@ -469,122 +469,92 @@ av_cold void ff_vc1_init_transposed_scantables(VC1Context *v) · 468 unmodified lines
469469 v->top_blk_sh = 3;
470470 }
471471
472−static const uint16_t vlc_offs[] = {
473− 0, 520, 552, 616, 1128, 1160, 1224, 1740, 1772, 1836, 1900, 2436,
474− 2986, 3050, 3610, 4154, 4218, 4746, 5326, 5390, 5902, 6554, 7658, 8342,
475− 9304, 9988, 10630, 11234, 12174, 13006, 13560, 14232, 14786, 15432, 16350, 17522,
476− 20372, 21818, 22330, 22394, 23166, 23678, 23742, 24820, 25332, 25396, 26460, 26980,
477− 27048, 27592, 27600, 27608, 27616, 27624, 28224, 28258, 28290, 28802, 28834, 28866,
478− 29378, 29412, 29444, 29960, 29994, 30026, 30538, 30572, 30604, 31120, 31154, 31186,
479− 31714, 31746, 31778, 32306, 32340, 32372
480−};
481−
482472 static av_cold void vc1_init_static(void)
483473 {
484474 static VLCElem vlc_table[32372];
485−
486− VLC_INIT_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
487− vc1_norm2_bits, 1, 1,
488− vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS);
489− VLC_INIT_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
490− vc1_norm6_bits, 1, 1,
491− vc1_norm6_codes, 2, 2, 556);
492− VLC_INIT_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
493− vc1_imode_bits, 1, 1,
494− vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS);
475+ VLCInitState state = VLC_INIT_STATE(vlc_table);
476+
477+ VLC_INIT_STATIC_TABLE(ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
478+ vc1_norm2_bits, 1, 1,
479+ vc1_norm2_codes, 1, 1, 0);
480+ VLC_INIT_STATIC_TABLE(ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
481+ vc1_norm6_bits, 1, 1,
482+ vc1_norm6_codes, 2, 2, 0);
483+ VLC_INIT_STATIC_TABLE(ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
484+ vc1_imode_bits, 1, 1,
485+ vc1_imode_codes, 1, 1, 0);
495486 for (int i = 0; i < 3; i++) {
496− ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 0]];
497− ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0];
498− vlc_init(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
499− vc1_ttmb_bits[i], 1, 1,
500− vc1_ttmb_codes[i], 2, 2, VLC_INIT_USE_STATIC);
501− ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 1]];
502− ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1];
503− vlc_init(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8,
504− vc1_ttblk_bits[i], 1, 1,
505− vc1_ttblk_codes[i], 1, 1, VLC_INIT_USE_STATIC);
506− ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 2]];
507− ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i * 3 + 3] - vlc_offs[i * 3 + 2];
508− vlc_init(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15,
509− vc1_subblkpat_bits[i], 1, 1,
510− vc1_subblkpat_codes[i], 1, 1, VLC_INIT_USE_STATIC);
511− }
512− for (int i = 0; i < 4; i++) {
513− ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 9]];
514− ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i * 3 + 10] - vlc_offs[i * 3 + 9];
515− vlc_init(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16,
516− vc1_4mv_block_pattern_bits[i], 1, 1,
517− vc1_4mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC);
518− ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 10]];
519− ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i * 3 + 11] - vlc_offs[i * 3 + 10];
520− vlc_init(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
521− vc1_cbpcy_p_bits[i], 1, 1,
522− vc1_cbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC);
523− ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 11]];
524− ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i * 3 + 12] - vlc_offs[i * 3 + 11];
525− vlc_init(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73,
526− vc1_mv_diff_bits[i], 1, 1,
527− vc1_mv_diff_codes[i], 2, 2, VLC_INIT_USE_STATIC);
528− }
529− for (int i = 0; i < 8; i++) {
530− ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i * 2 + 21]];
531− ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i * 2 + 22] - vlc_offs[i * 2 + 21];
532− vlc_init(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, ff_vc1_ac_sizes[i],
533− &vc1_ac_tables[i][0][1], 8, 4,
534− &vc1_ac_tables[i][0][0], 8, 4, VLC_INIT_USE_STATIC);
535− /* initialize interlaced MVDATA tables (2-Ref) */
536− ff_vc1_2ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 2 + 22]];
537− ff_vc1_2ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 2 + 23] - vlc_offs[i * 2 + 22];
538− vlc_init(&ff_vc1_2ref_mvdata_vlc[i], VC1_2REF_MVDATA_VLC_BITS, 126,
539− vc1_2ref_mvdata_bits[i], 1, 1,
540− vc1_2ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC);
487+ ff_vc1_ttmb_vlc[i] =
488+ ff_vlc_init_tables(&state, VC1_TTMB_VLC_BITS, 16,
489+ vc1_ttmb_bits[i], 1, 1,
490+ vc1_ttmb_codes[i], 2, 2, 0);
491+ ff_vc1_ttblk_vlc[i] =
492+ ff_vlc_init_tables(&state, VC1_TTBLK_VLC_BITS, 8,
493+ vc1_ttblk_bits[i], 1, 1,
494+ vc1_ttblk_codes[i], 1, 1, 0);
495+ ff_vc1_subblkpat_vlc[i] =
496+ ff_vlc_init_tables(&state, VC1_SUBBLKPAT_VLC_BITS, 15,
497+ vc1_subblkpat_bits[i], 1, 1,
498+ vc1_subblkpat_codes[i], 1, 1, 0);
541499 }
542500 for (int i = 0; i < 4; i++) {
501+ ff_vc1_4mv_block_pattern_vlc[i] =
502+ ff_vlc_init_tables(&state, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16,
503+ vc1_4mv_block_pattern_bits[i], 1, 1,
504+ vc1_4mv_block_pattern_codes[i], 1, 1, 0);
505+ ff_vc1_cbpcy_p_vlc[i] =
506+ ff_vlc_init_tables(&state, VC1_CBPCY_P_VLC_BITS, 64,
507+ vc1_cbpcy_p_bits[i], 1, 1,
508+ vc1_cbpcy_p_codes[i], 2, 2, 0);
509+ ff_vc1_mv_diff_vlc[i] =
510+ ff_vlc_init_tables(&state, VC1_MV_DIFF_VLC_BITS, 73,
511+ vc1_mv_diff_bits[i], 1, 1,
512+ vc1_mv_diff_codes[i], 2, 2, 0);
543513 /* initialize 4MV MBMODE VLC tables for interlaced frame P picture */
544− ff_vc1_intfr_4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 37]];
545− ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 38] - vlc_offs[i * 3 + 37];
546− vlc_init(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15,
547− vc1_intfr_4mv_mbmode_bits[i], 1, 1,
548− vc1_intfr_4mv_mbmode_codes[i], 2, 2, VLC_INIT_USE_STATIC);
514+ ff_vc1_intfr_4mv_mbmode_vlc[i] =
515+ ff_vlc_init_tables(&state, VC1_INTFR_4MV_MBMODE_VLC_BITS, 15,
516+ vc1_intfr_4mv_mbmode_bits[i], 1, 1,
517+ vc1_intfr_4mv_mbmode_codes[i], 2, 2, 0);
549518 /* initialize NON-4MV MBMODE VLC tables for the same */
550− ff_vc1_intfr_non4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 38]];
551− ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 39] - vlc_offs[i * 3 + 38];
552− vlc_init(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9,
553− vc1_intfr_non4mv_mbmode_bits[i], 1, 1,
554− vc1_intfr_non4mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC);
519+ ff_vc1_intfr_non4mv_mbmode_vlc[i] =
520+ ff_vlc_init_tables(&state, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9,
521+ vc1_intfr_non4mv_mbmode_bits[i], 1, 1,
522+ vc1_intfr_non4mv_mbmode_codes[i], 1, 1, 0);
555523 /* initialize interlaced MVDATA tables (1-Ref) */
556− ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 39]];
557− ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 3 + 40] - vlc_offs[i * 3 + 39];
558− vlc_init(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72,
559− vc1_1ref_mvdata_bits[i], 1, 1,
560− vc1_1ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC);
561− }
562− for (int i = 0; i < 4; i++) {
524+ ff_vc1_1ref_mvdata_vlc[i] =
525+ ff_vlc_init_tables(&state, VC1_1REF_MVDATA_VLC_BITS, 72,
526+ vc1_1ref_mvdata_bits[i], 1, 1,
527+ vc1_1ref_mvdata_codes[i], 4, 4, 0);
563528 /* Initialize 2MV Block pattern VLC tables */
564− ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i + 49]];
565− ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i + 50] - vlc_offs[i + 49];
566− vlc_init(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4,
567− vc1_2mv_block_pattern_bits[i], 1, 1,
568− vc1_2mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC);
529+ ff_vc1_2mv_block_pattern_vlc[i] =
530+ ff_vlc_init_tables(&state, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4,
531+ vc1_2mv_block_pattern_bits[i], 1, 1,
532+ vc1_2mv_block_pattern_codes[i], 1, 1, 0);
569533 }
570534 for (int i = 0; i < 8; i++) {
535+ ff_vc1_ac_coeff_table[i] =
536+ ff_vlc_init_tables(&state, AC_VLC_BITS, ff_vc1_ac_sizes[i],
537+ &vc1_ac_tables[i][0][1], 8, 4,
538+ &vc1_ac_tables[i][0][0], 8, 4, 0);
539+ /* initialize interlaced MVDATA tables (2-Ref) */
540+ ff_vc1_2ref_mvdata_vlc[i] =
541+ ff_vlc_init_tables(&state, VC1_2REF_MVDATA_VLC_BITS, 126,
542+ vc1_2ref_mvdata_bits[i], 1, 1,
543+ vc1_2ref_mvdata_codes[i], 4, 4, 0);
571544 /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */
572− ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 53]];
573− ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53];
574− vlc_init(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63,
575− vc1_icbpcy_p_bits[i], 1, 1,
576− vc1_icbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC);
545+ ff_vc1_icbpcy_vlc[i] =
546+ ff_vlc_init_tables(&state, VC1_ICBPCY_VLC_BITS, 63,
547+ vc1_icbpcy_p_bits[i], 1, 1,
548+ vc1_icbpcy_p_codes[i], 2, 2, 0);
577549 /* Initialize interlaced field picture MBMODE VLC tables */
578− ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 54]];
579− ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54];
580− vlc_init(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8,
581− vc1_if_mmv_mbmode_bits[i], 1, 1,
582− vc1_if_mmv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC);
583− ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 55]];
584− ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 56] - vlc_offs[i * 3 + 55];
585− vlc_init(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6,
586− vc1_if_1mv_mbmode_bits[i], 1, 1,
587− vc1_if_1mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC);
550+ ff_vc1_if_mmv_mbmode_vlc[i] =
551+ ff_vlc_init_tables(&state, VC1_IF_MMV_MBMODE_VLC_BITS, 8,
552+ vc1_if_mmv_mbmode_bits[i], 1, 1,
553+ vc1_if_mmv_mbmode_codes[i], 1, 1, 0);
554+ ff_vc1_if_1mv_mbmode_vlc[i] =
555+ ff_vlc_init_tables(&state, VC1_IF_1MV_MBMODE_VLC_BITS, 6,
556+ vc1_if_1mv_mbmode_bits[i], 1, 1,
557+ vc1_if_1mv_mbmode_codes[i], 1, 1, 0);
588558 }
589559 ff_msmp4_vc1_vlcs_init_once();
590560 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t