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.
Unified · Split
| @@ -104,7 +104,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 103 unmodified lines | |||
| 104 | height = v->s.mb_height >> v->field_mode; | 104 | height = v->s.mb_height >> v->field_mode; |
| 105 | stride = v->s.mb_stride; | 105 | stride = v->s.mb_stride; |
| 106 | invert = get_bits1(gb); | 106 | 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); |
| 108 | 108 | ||
| 109 | *raw_flag = 0; | 109 | *raw_flag = 0; |
| 110 | switch (imode) { | 110 | switch (imode) { |
| @@ -126,7 +126,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 15 unmodified lines | |||
| 126 | y = offset = 0; | 126 | y = offset = 0; |
| 127 | // decode bitplane as one long line | 127 | // decode bitplane as one long line |
| 128 | for (; y < height * width; y += 2) { | 128 | 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); |
| 130 | *planep++ = code & 1; | 130 | *planep++ = code & 1; |
| 131 | offset++; | 131 | offset++; |
| 132 | if (offset == width) { | 132 | if (offset == width) { |
| @@ -146,7 +146,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 13 unmodified lines | |||
| 146 | if (!(height % 3) && (width % 3)) { // use 2x3 decoding | 146 | if (!(height % 3) && (width % 3)) { // use 2x3 decoding |
| 147 | for (y = 0; y < height; y += 3) { | 147 | for (y = 0; y < height; y += 3) { |
| 148 | for (x = width & 1; x < width; x += 2) { | 148 | 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); |
| 150 | if (code < 0) { | 150 | if (code < 0) { |
| 151 | av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n"); | 151 | av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n"); |
| 152 | return -1; | 152 | return -1; |
| @@ -166,7 +166,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) · 13 unmodified lines | |||
| 166 | planep += (height & 1) * stride; | 166 | planep += (height & 1) * stride; |
| 167 | for (y = height & 1; y < height; y += 2) { | 167 | for (y = height & 1; y < height; y += 2) { |
| 168 | for (x = width % 3; x < width; x += 3) { | 168 | 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); |
| 170 | if (code < 0) { | 170 | if (code < 0) { |
| 171 | av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n"); | 171 | av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n"); |
| 172 | return -1; | 172 | return -1; |
| @@ -765,7 +765,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) · 592 unmodified lines | |||
| 765 | /* Hopefully this is correct for P-frames */ | 765 | /* Hopefully this is correct for P-frames */ |
| 766 | v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables | 766 | v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables |
| 767 | v->cbptab = get_bits(gb, 2); | 767 | 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]; |
| 769 | 769 | ||
| 770 | if (v->dquant) { | 770 | if (v->dquant) { |
| 771 | av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); | 771 | 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 | |||
| 804 | 804 | ||
| 805 | v->s.mv_table_index = get_bits(gb, 2); | 805 | v->s.mv_table_index = get_bits(gb, 2); |
| 806 | v->cbptab = get_bits(gb, 2); | 806 | 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]; |
| 808 | 808 | ||
| 809 | if (v->dquant) { | 809 | if (v->dquant) { |
| 810 | av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); | 810 | 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 | |||
| 1061 | "Imode: %i, Invert: %i\n", status>>1, status&1); | 1061 | "Imode: %i, Invert: %i\n", status>>1, status&1); |
| 1062 | v->mbmodetab = get_bits(gb, 2); | 1062 | v->mbmodetab = get_bits(gb, 2); |
| 1063 | if (v->fourmvswitch) | 1063 | 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]; |
| 1065 | else | 1065 | 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]; |
| 1067 | v->imvtab = get_bits(gb, 2); | 1067 | 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]; |
| 1069 | // interlaced p-picture cbpcy range is [1, 63] | 1069 | // interlaced p-picture cbpcy range is [1, 63] |
| 1070 | v->icbptab = get_bits(gb, 3); | 1070 | 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]; |
| 1072 | v->twomvbptab = get_bits(gb, 2); | 1072 | 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]; |
| 1074 | if (v->fourmvswitch) { | 1074 | if (v->fourmvswitch) { |
| 1075 | v->fourmvbptab = get_bits(gb, 2); | 1075 | 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]; |
| 1077 | } | 1077 | } |
| 1078 | } | 1078 | } |
| 1079 | } | 1079 | } |
| @@ -1158,7 +1158,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 78 unmodified lines | |||
| 1158 | /* Hopefully this is correct for P-frames */ | 1158 | /* Hopefully this is correct for P-frames */ |
| 1159 | v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables | 1159 | v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables |
| 1160 | v->cbptab = get_bits(gb, 2); | 1160 | 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]; |
| 1162 | } else if (v->fcm == ILACE_FRAME) { // frame interlaced | 1162 | } else if (v->fcm == ILACE_FRAME) { // frame interlaced |
| 1163 | v->qs_last = v->s.quarter_sample; | 1163 | v->qs_last = v->s.quarter_sample; |
| 1164 | v->s.quarter_sample = 1; | 1164 | v->s.quarter_sample = 1; |
| @@ -1167,18 +1167,18 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 2 unmodified lines | |||
| 1167 | v->mbmodetab = get_bits(gb, 3); | 1167 | v->mbmodetab = get_bits(gb, 3); |
| 1168 | v->imvtab = get_bits(gb, 2 + v->numref); | 1168 | v->imvtab = get_bits(gb, 2 + v->numref); |
| 1169 | if (!v->numref) | 1169 | 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]; |
| 1171 | else | 1171 | else |
| 1172 | v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[v->imvtab]; | 1172 | v->imv_vlc = ff_vc1_2ref_mvdata_vlc[v->imvtab]; |
| 1173 | v->icbptab = get_bits(gb, 3); | 1173 | 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]; |
| 1175 | if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && | 1175 | if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && |
| 1176 | v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { | 1176 | v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { |
| 1177 | v->fourmvbptab = get_bits(gb, 2); | 1177 | v->fourmvbptab = get_bits(gb, 2); |
| 1178 | v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab]; | 1178 | v->fourmvbp_vlc = ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab]; |
| 1179 | v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[v->mbmodetab]; | 1179 | v->mbmode_vlc = ff_vc1_if_mmv_mbmode_vlc[v->mbmodetab]; |
| 1180 | } else { | 1180 | } 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]; |
| 1182 | } | 1182 | } |
| 1183 | } | 1183 | } |
| 1184 | if (v->dquant) { | 1184 | if (v->dquant) { |
| @@ -1234,16 +1234,16 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 49 unmodified lines | |||
| 1234 | "Imode: %i, Invert: %i\n", status>>1, status&1); | 1234 | "Imode: %i, Invert: %i\n", status>>1, status&1); |
| 1235 | v->mbmodetab = get_bits(gb, 3); | 1235 | v->mbmodetab = get_bits(gb, 3); |
| 1236 | if (v->mv_mode == MV_PMODE_MIXED_MV) | 1236 | 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]; |
| 1238 | else | 1238 | 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]; |
| 1240 | v->imvtab = get_bits(gb, 3); | 1240 | 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]; |
| 1242 | v->icbptab = get_bits(gb, 3); | 1242 | 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]; |
| 1244 | if (v->mv_mode == MV_PMODE_MIXED_MV) { | 1244 | if (v->mv_mode == MV_PMODE_MIXED_MV) { |
| 1245 | v->fourmvbptab = get_bits(gb, 2); | 1245 | 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]; |
| 1247 | } | 1247 | } |
| 1248 | v->numref = 1; // interlaced field B pictures are always 2-ref | 1248 | v->numref = 1; // interlaced field B pictures are always 2-ref |
| 1249 | } else if (v->fcm == ILACE_FRAME) { | 1249 | } else if (v->fcm == ILACE_FRAME) { |
| @@ -1268,16 +1268,16 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) · 18 unmodified lines | |||
| 1268 | av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " | 1268 | av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " |
| 1269 | "Imode: %i, Invert: %i\n", status>>1, status&1); | 1269 | "Imode: %i, Invert: %i\n", status>>1, status&1); |
| 1270 | v->mbmodetab = get_bits(gb, 2); | 1270 | 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]; |
| 1272 | v->imvtab = get_bits(gb, 2); | 1272 | 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]; |
| 1274 | // interlaced p/b-picture cbpcy range is [1, 63] | 1274 | // interlaced p/b-picture cbpcy range is [1, 63] |
| 1275 | v->icbptab = get_bits(gb, 3); | 1275 | 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]; |
| 1277 | v->twomvbptab = get_bits(gb, 2); | 1277 | 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]; |
| 1279 | v->fourmvbptab = get_bits(gb, 2); | 1279 | 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]; |
| 1281 | } else { | 1281 | } else { |
| 1282 | v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; | 1282 | v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; |
| 1283 | v->qs_last = v->s.quarter_sample; | 1283 | 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 | |||
| 1295 | "Imode: %i, Invert: %i\n", status>>1, status&1); | 1295 | "Imode: %i, Invert: %i\n", status>>1, status&1); |
| 1296 | v->s.mv_table_index = get_bits(gb, 2); | 1296 | v->s.mv_table_index = get_bits(gb, 2); |
| 1297 | v->cbptab = get_bits(gb, 2); | 1297 | 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]; |
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | if (v->dquant) { | 1301 | if (v->dquant) { |
| @@ -279,7 +279,7 @@ typedef struct VC1Context{ · 278 unmodified lines | |||
| 279 | */ | 279 | */ |
| 280 | uint8_t mvrange; ///< Extended MV range flag | 280 | uint8_t mvrange; ///< Extended MV range flag |
| 281 | uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use | 281 | uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use |
| 282 | VLC *cbpcy_vlc; ///< CBPCY VLC table | 282 | const VLCElem *cbpcy_vlc; ///< CBPCY VLC table |
| 283 | int tt_index; ///< Index for Transform Type tables (to decode TTMB) | 283 | int tt_index; ///< Index for Transform Type tables (to decode TTMB) |
| 284 | uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) | 284 | uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) |
| 285 | uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs | 285 | uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs |
| @@ -334,10 +334,10 @@ typedef struct VC1Context{ · 48 unmodified lines | |||
| 334 | int intcomp; | 334 | int intcomp; |
| 335 | uint8_t lumscale2; ///< for interlaced field P picture | 335 | uint8_t lumscale2; ///< for interlaced field P picture |
| 336 | uint8_t lumshift2; | 336 | uint8_t lumshift2; |
| 337 | VLC* mbmode_vlc; | 337 | const VLCElem *mbmode_vlc; |
| 338 | VLC* imv_vlc; | 338 | const VLCElem *imv_vlc; |
| 339 | VLC* twomvbp_vlc; | 339 | const VLCElem *twomvbp_vlc; |
| 340 | VLC* fourmvbp_vlc; | 340 | const VLCElem *fourmvbp_vlc; |
| 341 | uint8_t twomvbp; | 341 | uint8_t twomvbp; |
| 342 | uint8_t fourmvbp; | 342 | uint8_t fourmvbp; |
| 343 | uint8_t* fieldtx_plane; | 343 | uint8_t* fieldtx_plane; |
| @@ -227,7 +227,7 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed) · 226 unmodified lines | |||
| 227 | * @param _dmv_y Vertical differential for decoded MV | 227 | * @param _dmv_y Vertical differential for decoded MV |
| 228 | */ | 228 | */ |
| 229 | #define GET_MVDATA(_dmv_x, _dmv_y) \ | 229 | #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], \ |
| 231 | VC1_MV_DIFF_VLC_BITS, 2); \ | 231 | VC1_MV_DIFF_VLC_BITS, 2); \ |
| 232 | if (index > 36) { \ | 232 | if (index > 36) { \ |
| 233 | mb_has_coeffs = 1; \ | 233 | mb_has_coeffs = 1; \ |
| @@ -282,7 +282,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, · 48 unmodified lines | |||
| 282 | } | 282 | } |
| 283 | extend_x = v->dmvrange & 1; | 283 | extend_x = v->dmvrange & 1; |
| 284 | extend_y = (v->dmvrange >> 1) & 1; | 284 | 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); |
| 286 | if (index == esc) { | 286 | if (index == esc) { |
| 287 | *dmv_x = get_bits(gb, v->k_x); | 287 | *dmv_x = get_bits(gb, v->k_x); |
| 288 | *dmv_y = get_bits(gb, v->k_y); | 288 | *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 | |||
| 519 | GetBitContext *gb = &v->s.gb; | 519 | GetBitContext *gb = &v->s.gb; |
| 520 | int index, run, level, lst, sign; | 520 | int index, run, level, lst, sign; |
| 521 | 521 | ||
| 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); |
| 523 | if (index < 0) | 523 | if (index < 0) |
| 524 | return index; | 524 | return index; |
| 525 | if (index != ff_vc1_ac_sizes[codingset] - 1) { | 525 | 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 | |||
| 530 | } else { | 530 | } else { |
| 531 | int escape = decode210(gb); | 531 | int escape = decode210(gb); |
| 532 | if (escape != 2) { | 532 | 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); |
| 534 | if (index >= ff_vc1_ac_sizes[codingset] - 1U) | 534 | if (index >= ff_vc1_ac_sizes[codingset] - 1U) |
| 535 | return AVERROR_INVALIDDATA; | 535 | return AVERROR_INVALIDDATA; |
| 536 | run = vc1_index_decode_table[codingset][index][0]; | 536 | 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 | |||
| 1124 | s->bdsp.clear_block(block); | 1124 | s->bdsp.clear_block(block); |
| 1125 | 1125 | ||
| 1126 | if (ttmb == -1) { | 1126 | 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)]; |
| 1128 | } | 1128 | } |
| 1129 | if (ttblk == TT_4X4) { | 1129 | 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); |
| 1131 | } | 1131 | } |
| 1132 | if ((ttblk != TT_8X8 && ttblk != TT_4X4) | 1132 | if ((ttblk != TT_8X8 && ttblk != TT_4X4) |
| 1133 | && ((v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block)) | 1133 | && ((v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block)) |
| @@ -1328,7 +1328,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 194 unmodified lines | |||
| 1328 | } else if (mb_has_coeffs) { | 1328 | } else if (mb_has_coeffs) { |
| 1329 | if (s->mb_intra) | 1329 | if (s->mb_intra) |
| 1330 | s->ac_pred = get_bits1(gb); | 1330 | 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); |
| 1332 | GET_MQUANT(); | 1332 | GET_MQUANT(); |
| 1333 | } else { | 1333 | } else { |
| 1334 | mquant = v->pq; | 1334 | mquant = v->pq; |
| @@ -1337,7 +1337,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 2 unmodified lines | |||
| 1337 | s->current_picture.qscale_table[mb_pos] = mquant; | 1337 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 1338 | 1338 | ||
| 1339 | if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) | 1339 | 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], |
| 1341 | VC1_TTMB_VLC_BITS, 2); | 1341 | VC1_TTMB_VLC_BITS, 2); |
| 1342 | if (!s->mb_intra) ff_vc1_mc_1mv(v, 0); | 1342 | if (!s->mb_intra) ff_vc1_mc_1mv(v, 0); |
| 1343 | dst_idx = 0; | 1343 | dst_idx = 0; |
| @@ -1393,7 +1393,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 49 unmodified lines | |||
| 1393 | int intra_count = 0, coded_inter = 0; | 1393 | int intra_count = 0, coded_inter = 0; |
| 1394 | int is_intra[6], is_coded[6]; | 1394 | int is_intra[6], is_coded[6]; |
| 1395 | /* Get CBPCY */ | 1395 | /* 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); |
| 1397 | for (i = 0; i < 6; i++) { | 1397 | for (i = 0; i < 6; i++) { |
| 1398 | val = ((cbp >> (5 - i)) & 1); | 1398 | val = ((cbp >> (5 - i)) & 1); |
| 1399 | s->dc_val[0][s->block_index[i]] = 0; | 1399 | s->dc_val[0][s->block_index[i]] = 0; |
| @@ -1445,7 +1445,7 @@ static int vc1_decode_p_mb(VC1Context *v) · 45 unmodified lines | |||
| 1445 | s->ac_pred = 0; | 1445 | s->ac_pred = 0; |
| 1446 | } | 1446 | } |
| 1447 | if (!v->ttmbf && coded_inter) | 1447 | 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); |
| 1449 | for (i = 0; i < 6; i++) { | 1449 | for (i = 0; i < 6; i++) { |
| 1450 | dst_idx += i >> 2; | 1450 | dst_idx += i >> 2; |
| 1451 | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); | 1451 | 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 | |||
| 1539 | skipped = v->s.mbskip_table[mb_pos]; | 1539 | skipped = v->s.mbskip_table[mb_pos]; |
| 1540 | if (!skipped) { | 1540 | if (!skipped) { |
| 1541 | if (v->fourmvswitch) | 1541 | 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 |
| 1543 | else | 1543 | 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 |
| 1545 | switch (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0]) { | 1545 | switch (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0]) { |
| 1546 | /* store the motion vector type in a flag (useful later) */ | 1546 | /* store the motion vector type in a flag (useful later) */ |
| 1547 | case MV_PMODE_INTFR_4MV: | 1547 | case MV_PMODE_INTFR_4MV: |
| @@ -1583,7 +1583,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 35 unmodified lines | |||
| 1583 | fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); | 1583 | fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); |
| 1584 | mb_has_coeffs = get_bits1(gb); | 1584 | mb_has_coeffs = get_bits1(gb); |
| 1585 | if (mb_has_coeffs) | 1585 | 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); |
| 1587 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); | 1587 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); |
| 1588 | GET_MQUANT(); | 1588 | GET_MQUANT(); |
| 1589 | s->current_picture.qscale_table[mb_pos] = mquant; | 1589 | s->current_picture.qscale_table[mb_pos] = mquant; |
| @@ -1617,13 +1617,13 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 27 unmodified lines | |||
| 1617 | } else { // inter MB | 1617 | } else { // inter MB |
| 1618 | mb_has_coeffs = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][3]; | 1618 | mb_has_coeffs = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][3]; |
| 1619 | if (mb_has_coeffs) | 1619 | 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); |
| 1621 | if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) { | 1621 | 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); |
| 1623 | } else { | 1623 | } else { |
| 1624 | if ((ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV) | 1624 | if ((ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV) |
| 1625 | || (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV_FIELD)) { | 1625 | || (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); |
| 1627 | } | 1627 | } |
| 1628 | } | 1628 | } |
| 1629 | s->mb_intra = v->is_intra[s->mb_x] = 0; | 1629 | 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 | |||
| 1672 | GET_MQUANT(); // p. 227 | 1672 | GET_MQUANT(); // p. 227 |
| 1673 | s->current_picture.qscale_table[mb_pos] = mquant; | 1673 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 1674 | if (!v->ttmbf && cbp) | 1674 | 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); |
| 1676 | for (i = 0; i < 6; i++) { | 1676 | for (i = 0; i < 6; i++) { |
| 1677 | s->dc_val[0][s->block_index[i]] = 0; | 1677 | s->dc_val[0][s->block_index[i]] = 0; |
| 1678 | dst_idx += i >> 2; | 1678 | dst_idx += i >> 2; |
| @@ -1742,7 +1742,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 63 unmodified lines | |||
| 1742 | 1742 | ||
| 1743 | mquant = v->pq; /* Lossy initialization */ | 1743 | mquant = v->pq; /* Lossy initialization */ |
| 1744 | 1744 | ||
| 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); |
| 1746 | if (idx_mbmode <= 1) { // intra MB | 1746 | if (idx_mbmode <= 1) { // intra MB |
| 1747 | v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. | 1747 | v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. |
| 1748 | s->mb_intra = 1; | 1748 | s->mb_intra = 1; |
| @@ -1757,7 +1757,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 8 unmodified lines | |||
| 1757 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); | 1757 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); |
| 1758 | mb_has_coeffs = idx_mbmode & 1; | 1758 | mb_has_coeffs = idx_mbmode & 1; |
| 1759 | if (mb_has_coeffs) | 1759 | 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); |
| 1761 | dst_idx = 0; | 1761 | dst_idx = 0; |
| 1762 | for (i = 0; i < 6; i++) { | 1762 | for (i = 0; i < 6; i++) { |
| 1763 | v->a_avail = v->c_avail = 0; | 1763 | v->a_avail = v->c_avail = 0; |
| @@ -1792,7 +1792,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 28 unmodified lines | |||
| 1792 | ff_vc1_mc_1mv(v, 0); | 1792 | ff_vc1_mc_1mv(v, 0); |
| 1793 | mb_has_coeffs = !(idx_mbmode & 2); | 1793 | mb_has_coeffs = !(idx_mbmode & 2); |
| 1794 | } else { // 4-MV | 1794 | } 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); |
| 1796 | for (i = 0; i < 4; i++) { | 1796 | for (i = 0; i < 4; i++) { |
| 1797 | dmv_x = dmv_y = pred_flag = 0; | 1797 | dmv_x = dmv_y = pred_flag = 0; |
| 1798 | if (v->fourmvbp & (8 >> i)) | 1798 | if (v->fourmvbp & (8 >> i)) |
| @@ -1804,13 +1804,13 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 5 unmodified lines | |||
| 1804 | mb_has_coeffs = idx_mbmode & 1; | 1804 | mb_has_coeffs = idx_mbmode & 1; |
| 1805 | } | 1805 | } |
| 1806 | if (mb_has_coeffs) | 1806 | 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); |
| 1808 | if (cbp) { | 1808 | if (cbp) { |
| 1809 | GET_MQUANT(); | 1809 | GET_MQUANT(); |
| 1810 | } | 1810 | } |
| 1811 | s->current_picture.qscale_table[mb_pos] = mquant; | 1811 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 1812 | if (!v->ttmbf && cbp) { | 1812 | 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); |
| 1814 | } | 1814 | } |
| 1815 | dst_idx = 0; | 1815 | dst_idx = 0; |
| 1816 | for (i = 0; i < 6; i++) { | 1816 | for (i = 0; i < 6; i++) { |
| @@ -1914,12 +1914,12 @@ static int vc1_decode_b_mb(VC1Context *v) · 97 unmodified lines | |||
| 1914 | return 0; | 1914 | return 0; |
| 1915 | } | 1915 | } |
| 1916 | if (direct) { | 1916 | 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); |
| 1918 | GET_MQUANT(); | 1918 | GET_MQUANT(); |
| 1919 | s->mb_intra = 0; | 1919 | s->mb_intra = 0; |
| 1920 | s->current_picture.qscale_table[mb_pos] = mquant; | 1920 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 1921 | if (!v->ttmbf) | 1921 | 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); |
| 1923 | dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; | 1923 | dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; |
| 1924 | ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); | 1924 | ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); |
| 1925 | vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); | 1925 | 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 | |||
| 1952 | } | 1952 | } |
| 1953 | if (s->mb_intra) | 1953 | if (s->mb_intra) |
| 1954 | s->ac_pred = get_bits1(gb); | 1954 | 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); |
| 1956 | GET_MQUANT(); | 1956 | GET_MQUANT(); |
| 1957 | s->current_picture.qscale_table[mb_pos] = mquant; | 1957 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 1958 | if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) | 1958 | 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); |
| 1960 | } | 1960 | } |
| 1961 | } | 1961 | } |
| 1962 | dst_idx = 0; | 1962 | dst_idx = 0; |
| @@ -2025,7 +2025,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 62 unmodified lines | |||
| 2025 | mquant = v->pq; /* Lossy initialization */ | 2025 | mquant = v->pq; /* Lossy initialization */ |
| 2026 | s->mb_intra = 0; | 2026 | s->mb_intra = 0; |
| 2027 | 2027 | ||
| 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); |
| 2029 | if (idx_mbmode <= 1) { // intra MB | 2029 | if (idx_mbmode <= 1) { // intra MB |
| 2030 | v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. | 2030 | v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. |
| 2031 | s->mb_intra = 1; | 2031 | s->mb_intra = 1; |
| @@ -2040,7 +2040,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 8 unmodified lines | |||
| 2040 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); | 2040 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); |
| 2041 | mb_has_coeffs = idx_mbmode & 1; | 2041 | mb_has_coeffs = idx_mbmode & 1; |
| 2042 | if (mb_has_coeffs) | 2042 | 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); |
| 2044 | dst_idx = 0; | 2044 | dst_idx = 0; |
| 2045 | for (i = 0; i < 6; i++) { | 2045 | for (i = 0; i < 6; i++) { |
| 2046 | v->a_avail = v->c_avail = 0; | 2046 | v->a_avail = v->c_avail = 0; |
| @@ -2118,7 +2118,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) · 71 unmodified lines | |||
| 2118 | if (fwd) | 2118 | if (fwd) |
| 2119 | bmvtype = BMV_TYPE_FORWARD; | 2119 | bmvtype = BMV_TYPE_FORWARD; |
| 2120 | v->bmvtype = bmvtype; | 2120 | 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); |
| 2122 | for (i = 0; i < 4; i++) { | 2122 | for (i = 0; i < 4; i++) { |
| 2123 | dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; | 2123 | dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; |
| 2124 | dmv_x[1] = dmv_y[1] = pred_flag[1] = 0; | 2124 | 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 | |||
| 2134 | mb_has_coeffs = idx_mbmode & 1; | 2134 | mb_has_coeffs = idx_mbmode & 1; |
| 2135 | } | 2135 | } |
| 2136 | if (mb_has_coeffs) | 2136 | 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); |
| 2138 | if (cbp) { | 2138 | if (cbp) { |
| 2139 | GET_MQUANT(); | 2139 | GET_MQUANT(); |
| 2140 | } | 2140 | } |
| 2141 | s->current_picture.qscale_table[mb_pos] = mquant; | 2141 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 2142 | if (!v->ttmbf && cbp) { | 2142 | 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); |
| 2144 | } | 2144 | } |
| 2145 | dst_idx = 0; | 2145 | dst_idx = 0; |
| 2146 | for (i = 0; i < 6; i++) { | 2146 | for (i = 0; i < 6; i++) { |
| @@ -2200,7 +2200,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 53 unmodified lines | |||
| 2200 | skipped = v->s.mbskip_table[mb_pos]; | 2200 | skipped = v->s.mbskip_table[mb_pos]; |
| 2201 | 2201 | ||
| 2202 | if (!skipped) { | 2202 | 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); |
| 2204 | if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) { | 2204 | if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) { |
| 2205 | twomv = 1; | 2205 | twomv = 1; |
| 2206 | v->blk_mv_type[s->block_index[0]] = 1; | 2206 | 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 | |||
| 2228 | fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); | 2228 | fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); |
| 2229 | mb_has_coeffs = get_bits1(gb); | 2229 | mb_has_coeffs = get_bits1(gb); |
| 2230 | if (mb_has_coeffs) | 2230 | 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); |
| 2232 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); | 2232 | v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); |
| 2233 | GET_MQUANT(); | 2233 | GET_MQUANT(); |
| 2234 | s->current_picture.qscale_table[mb_pos] = mquant; | 2234 | s->current_picture.qscale_table[mb_pos] = mquant; |
| @@ -2323,12 +2323,12 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 88 unmodified lines | |||
| 2323 | if (!skipped) { // inter MB | 2323 | if (!skipped) { // inter MB |
| 2324 | mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3]; | 2324 | mb_has_coeffs = ff_vc1_mbmode_intfrp[0][idx_mbmode][3]; |
| 2325 | if (mb_has_coeffs) | 2325 | 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); |
| 2327 | if (!direct) { | 2327 | if (!direct) { |
| 2328 | if (bmvtype == BMV_TYPE_INTERPOLATED && twomv) { | 2328 | 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); |
| 2330 | } else if (bmvtype == BMV_TYPE_INTERPOLATED || twomv) { | 2330 | } 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); |
| 2332 | } | 2332 | } |
| 2333 | } | 2333 | } |
| 2334 | 2334 | ||
| @@ -2438,7 +2438,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 103 unmodified lines | |||
| 2438 | GET_MQUANT(); // p. 227 | 2438 | GET_MQUANT(); // p. 227 |
| 2439 | s->current_picture.qscale_table[mb_pos] = mquant; | 2439 | s->current_picture.qscale_table[mb_pos] = mquant; |
| 2440 | if (!v->ttmbf && cbp) | 2440 | 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); |
| 2442 | for (i = 0; i < 6; i++) { | 2442 | for (i = 0; i < 6; i++) { |
| 2443 | s->dc_val[0][s->block_index[i]] = 0; | 2443 | s->dc_val[0][s->block_index[i]] = 0; |
| 2444 | dst_idx += i >> 2; | 2444 | dst_idx += i >> 2; |
| @@ -102,26 +102,26 @@ const uint8_t ff_vc1_pquant_table[3][32] = { · 101 unmodified lines | |||
| 102 | * @todo TODO move this into the context | 102 | * @todo TODO move this into the context |
| 103 | */ | 103 | */ |
| 104 | //@{ | 104 | //@{ |
| 105 | VLC ff_vc1_imode_vlc; | 105 | VLCElem ff_vc1_imode_vlc[1 << VC1_IMODE_VLC_BITS]; |
| 106 | VLC ff_vc1_norm2_vlc; | 106 | VLCElem ff_vc1_norm2_vlc[1 << VC1_NORM2_VLC_BITS]; |
| 107 | VLC ff_vc1_norm6_vlc; | 107 | VLCElem ff_vc1_norm6_vlc[556]; |
| 108 | /* Could be optimized, one table only needs 8 bits */ | 108 | /* Could be optimized, one table only needs 8 bits */ |
| 109 | VLC ff_vc1_ttmb_vlc[3]; | 109 | const VLCElem *ff_vc1_ttmb_vlc[3]; |
| 110 | VLC ff_vc1_mv_diff_vlc[4]; | 110 | const VLCElem *ff_vc1_mv_diff_vlc[4]; |
| 111 | VLC ff_vc1_cbpcy_p_vlc[4]; | 111 | const VLCElem *ff_vc1_cbpcy_p_vlc[4]; |
| 112 | VLC ff_vc1_icbpcy_vlc[8]; | 112 | const VLCElem *ff_vc1_icbpcy_vlc[8]; |
| 113 | VLC ff_vc1_4mv_block_pattern_vlc[4]; | 113 | const VLCElem *ff_vc1_4mv_block_pattern_vlc[4]; |
| 114 | VLC ff_vc1_2mv_block_pattern_vlc[4]; | 114 | const VLCElem *ff_vc1_2mv_block_pattern_vlc[4]; |
| 115 | VLC ff_vc1_ttblk_vlc[3]; | 115 | const VLCElem *ff_vc1_ttblk_vlc[3]; |
| 116 | VLC ff_vc1_subblkpat_vlc[3]; | 116 | const VLCElem *ff_vc1_subblkpat_vlc[3]; |
| 117 | VLC ff_vc1_intfr_4mv_mbmode_vlc[4]; | 117 | const VLCElem *ff_vc1_intfr_4mv_mbmode_vlc[4]; |
| 118 | VLC ff_vc1_intfr_non4mv_mbmode_vlc[4]; | 118 | const VLCElem *ff_vc1_intfr_non4mv_mbmode_vlc[4]; |
| 119 | VLC ff_vc1_if_mmv_mbmode_vlc[8]; | 119 | const VLCElem *ff_vc1_if_mmv_mbmode_vlc[8]; |
| 120 | VLC ff_vc1_if_1mv_mbmode_vlc[8]; | 120 | const VLCElem *ff_vc1_if_1mv_mbmode_vlc[8]; |
| 121 | VLC ff_vc1_1ref_mvdata_vlc[4]; | 121 | const VLCElem *ff_vc1_1ref_mvdata_vlc[4]; |
| 122 | VLC ff_vc1_2ref_mvdata_vlc[8]; | 122 | const VLCElem *ff_vc1_2ref_mvdata_vlc[8]; |
| 123 | 123 | ||
| 124 | VLC ff_vc1_ac_coeff_table[8]; | 124 | const VLCElem *ff_vc1_ac_coeff_table[8]; |
| 125 | 125 | ||
| 126 | //@} | 126 | //@} |
| 127 | 127 | ||
| @@ -56,42 +56,42 @@ extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4]; · 55 unmodified lines | |||
| 56 | */ | 56 | */ |
| 57 | //@{ | 57 | //@{ |
| 58 | #define VC1_IMODE_VLC_BITS 4 | 58 | #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]; |
| 60 | #define VC1_NORM2_VLC_BITS 3 | 60 | #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]; |
| 62 | #define VC1_NORM6_VLC_BITS 9 | 62 | #define VC1_NORM6_VLC_BITS 9 |
| 63 | extern VLC ff_vc1_norm6_vlc; | 63 | extern VLCElem ff_vc1_norm6_vlc[556]; |
| 64 | /* Could be optimized, one table only needs 8 bits */ | 64 | /* Could be optimized, one table only needs 8 bits */ |
| 65 | #define VC1_TTMB_VLC_BITS 9 //12 | 65 | #define VC1_TTMB_VLC_BITS 9 //12 |
| 66 | extern VLC ff_vc1_ttmb_vlc[3]; | 66 | extern const VLCElem *ff_vc1_ttmb_vlc[3]; |
| 67 | #define VC1_MV_DIFF_VLC_BITS 9 //15 | 67 | #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]; |
| 69 | #define VC1_CBPCY_P_VLC_BITS 9 //14 | 69 | #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]; |
| 71 | #define VC1_ICBPCY_VLC_BITS 9 | 71 | #define VC1_ICBPCY_VLC_BITS 9 |
| 72 | extern VLC ff_vc1_icbpcy_vlc[8]; | 72 | extern const VLCElem *ff_vc1_icbpcy_vlc[8]; |
| 73 | #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6 | 73 | #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]; |
| 75 | #define VC1_2MV_BLOCK_PATTERN_VLC_BITS 3 | 75 | #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]; |
| 77 | #define VC1_TTBLK_VLC_BITS 5 | 77 | #define VC1_TTBLK_VLC_BITS 5 |
| 78 | extern VLC ff_vc1_ttblk_vlc[3]; | 78 | extern const VLCElem *ff_vc1_ttblk_vlc[3]; |
| 79 | #define VC1_SUBBLKPAT_VLC_BITS 6 | 79 | #define VC1_SUBBLKPAT_VLC_BITS 6 |
| 80 | extern VLC ff_vc1_subblkpat_vlc[3]; | 80 | extern const VLCElem *ff_vc1_subblkpat_vlc[3]; |
| 81 | #define VC1_INTFR_4MV_MBMODE_VLC_BITS 9 | 81 | #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]; |
| 83 | #define VC1_INTFR_NON4MV_MBMODE_VLC_BITS 6 | 83 | #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]; |
| 85 | #define VC1_IF_MMV_MBMODE_VLC_BITS 5 | 85 | #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]; |
| 87 | #define VC1_IF_1MV_MBMODE_VLC_BITS 5 | 87 | #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]; |
| 89 | #define VC1_1REF_MVDATA_VLC_BITS 9 | 89 | #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]; |
| 91 | #define VC1_2REF_MVDATA_VLC_BITS 9 | 91 | #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]; |
| 93 | 93 | ||
| 94 | extern VLC ff_vc1_ac_coeff_table[8]; | 94 | extern const VLCElem *ff_vc1_ac_coeff_table[8]; |
| 95 | 95 | ||
| 96 | #define VC1_IF_MBMODE_VLC_BITS 5 // as a placeholder for VC1_IF_MMV_MBMODE_VLC_BITS | 96 | #define VC1_IF_MBMODE_VLC_BITS 5 // as a placeholder for VC1_IF_MMV_MBMODE_VLC_BITS |
| 97 | // or VC1_IF_1MV_MBMODE_VLC_BITS since they are the same | 97 | // or VC1_IF_1MV_MBMODE_VLC_BITS since they are the same |
| @@ -469,122 +469,92 @@ av_cold void ff_vc1_init_transposed_scantables(VC1Context *v) · 468 unmodified lines | |||
| 469 | v->top_blk_sh = 3; | 469 | v->top_blk_sh = 3; |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 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 | |||
| 482 | static av_cold void vc1_init_static(void) | 472 | static av_cold void vc1_init_static(void) |
| 483 | { | 473 | { |
| 484 | static VLCElem vlc_table[32372]; | 474 | static VLCElem vlc_table[32372]; |
| 485 | 475 | VLCInitState state = VLC_INIT_STATE(vlc_table); | |
| 486 | VLC_INIT_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, | 476 | |
| 487 | vc1_norm2_bits, 1, 1, | 477 | VLC_INIT_STATIC_TABLE(ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, |
| 488 | vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); | 478 | vc1_norm2_bits, 1, 1, |
| 489 | VLC_INIT_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64, | 479 | vc1_norm2_codes, 1, 1, 0); |
| 490 | vc1_norm6_bits, 1, 1, | 480 | VLC_INIT_STATIC_TABLE(ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64, |
| 491 | vc1_norm6_codes, 2, 2, 556); | 481 | vc1_norm6_bits, 1, 1, |
| 492 | VLC_INIT_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7, | 482 | vc1_norm6_codes, 2, 2, 0); |
| 493 | vc1_imode_bits, 1, 1, | 483 | VLC_INIT_STATIC_TABLE(ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7, |
| 494 | vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS); | 484 | vc1_imode_bits, 1, 1, |
| 485 | vc1_imode_codes, 1, 1, 0); | ||
| 495 | for (int i = 0; i < 3; i++) { | 486 | for (int i = 0; i < 3; i++) { |
| 496 | ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 0]]; | 487 | ff_vc1_ttmb_vlc[i] = |
| 497 | ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0]; | 488 | ff_vlc_init_tables(&state, VC1_TTMB_VLC_BITS, 16, |
| 498 | vlc_init(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16, | 489 | vc1_ttmb_bits[i], 1, 1, |
| 499 | vc1_ttmb_bits[i], 1, 1, | 490 | vc1_ttmb_codes[i], 2, 2, 0); |
| 500 | vc1_ttmb_codes[i], 2, 2, VLC_INIT_USE_STATIC); | 491 | ff_vc1_ttblk_vlc[i] = |
| 501 | ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 1]]; | 492 | ff_vlc_init_tables(&state, VC1_TTBLK_VLC_BITS, 8, |
| 502 | ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1]; | 493 | vc1_ttblk_bits[i], 1, 1, |
| 503 | vlc_init(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8, | 494 | vc1_ttblk_codes[i], 1, 1, 0); |
| 504 | vc1_ttblk_bits[i], 1, 1, | 495 | ff_vc1_subblkpat_vlc[i] = |
| 505 | vc1_ttblk_codes[i], 1, 1, VLC_INIT_USE_STATIC); | 496 | ff_vlc_init_tables(&state, VC1_SUBBLKPAT_VLC_BITS, 15, |
| 506 | ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 2]]; | 497 | vc1_subblkpat_bits[i], 1, 1, |
| 507 | ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i * 3 + 3] - vlc_offs[i * 3 + 2]; | 498 | vc1_subblkpat_codes[i], 1, 1, 0); |
| 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); | ||
| 541 | } | 499 | } |
| 542 | for (int i = 0; i < 4; i++) { | 500 | 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); | ||
| 543 | /* initialize 4MV MBMODE VLC tables for interlaced frame P picture */ | 513 | /* 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]]; | 514 | ff_vc1_intfr_4mv_mbmode_vlc[i] = |
| 545 | ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 38] - vlc_offs[i * 3 + 37]; | 515 | ff_vlc_init_tables(&state, VC1_INTFR_4MV_MBMODE_VLC_BITS, 15, |
| 546 | vlc_init(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15, | 516 | vc1_intfr_4mv_mbmode_bits[i], 1, 1, |
| 547 | vc1_intfr_4mv_mbmode_bits[i], 1, 1, | 517 | vc1_intfr_4mv_mbmode_codes[i], 2, 2, 0); |
| 548 | vc1_intfr_4mv_mbmode_codes[i], 2, 2, VLC_INIT_USE_STATIC); | ||
| 549 | /* initialize NON-4MV MBMODE VLC tables for the same */ | 518 | /* 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]]; | 519 | ff_vc1_intfr_non4mv_mbmode_vlc[i] = |
| 551 | ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 39] - vlc_offs[i * 3 + 38]; | 520 | ff_vlc_init_tables(&state, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9, |
| 552 | vlc_init(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9, | 521 | vc1_intfr_non4mv_mbmode_bits[i], 1, 1, |
| 553 | vc1_intfr_non4mv_mbmode_bits[i], 1, 1, | 522 | vc1_intfr_non4mv_mbmode_codes[i], 1, 1, 0); |
| 554 | vc1_intfr_non4mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC); | ||
| 555 | /* initialize interlaced MVDATA tables (1-Ref) */ | 523 | /* initialize interlaced MVDATA tables (1-Ref) */ |
| 556 | ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 39]]; | 524 | ff_vc1_1ref_mvdata_vlc[i] = |
| 557 | ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 3 + 40] - vlc_offs[i * 3 + 39]; | 525 | ff_vlc_init_tables(&state, VC1_1REF_MVDATA_VLC_BITS, 72, |
| 558 | vlc_init(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72, | 526 | vc1_1ref_mvdata_bits[i], 1, 1, |
| 559 | vc1_1ref_mvdata_bits[i], 1, 1, | 527 | vc1_1ref_mvdata_codes[i], 4, 4, 0); |
| 560 | vc1_1ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC); | ||
| 561 | } | ||
| 562 | for (int i = 0; i < 4; i++) { | ||
| 563 | /* Initialize 2MV Block pattern VLC tables */ | 528 | /* Initialize 2MV Block pattern VLC tables */ |
| 564 | ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i + 49]]; | 529 | ff_vc1_2mv_block_pattern_vlc[i] = |
| 565 | ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i + 50] - vlc_offs[i + 49]; | 530 | ff_vlc_init_tables(&state, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4, |
| 566 | vlc_init(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4, | 531 | vc1_2mv_block_pattern_bits[i], 1, 1, |
| 567 | vc1_2mv_block_pattern_bits[i], 1, 1, | 532 | vc1_2mv_block_pattern_codes[i], 1, 1, 0); |
| 568 | vc1_2mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC); | ||
| 569 | } | 533 | } |
| 570 | for (int i = 0; i < 8; i++) { | 534 | 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); | ||
| 571 | /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */ | 544 | /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */ |
| 572 | ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 53]]; | 545 | ff_vc1_icbpcy_vlc[i] = |
| 573 | ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53]; | 546 | ff_vlc_init_tables(&state, VC1_ICBPCY_VLC_BITS, 63, |
| 574 | vlc_init(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63, | 547 | vc1_icbpcy_p_bits[i], 1, 1, |
| 575 | vc1_icbpcy_p_bits[i], 1, 1, | 548 | vc1_icbpcy_p_codes[i], 2, 2, 0); |
| 576 | vc1_icbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC); | ||
| 577 | /* Initialize interlaced field picture MBMODE VLC tables */ | 549 | /* Initialize interlaced field picture MBMODE VLC tables */ |
| 578 | ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 54]]; | 550 | ff_vc1_if_mmv_mbmode_vlc[i] = |
| 579 | ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54]; | 551 | ff_vlc_init_tables(&state, VC1_IF_MMV_MBMODE_VLC_BITS, 8, |
| 580 | vlc_init(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8, | 552 | vc1_if_mmv_mbmode_bits[i], 1, 1, |
| 581 | vc1_if_mmv_mbmode_bits[i], 1, 1, | 553 | vc1_if_mmv_mbmode_codes[i], 1, 1, 0); |
| 582 | vc1_if_mmv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC); | 554 | ff_vc1_if_1mv_mbmode_vlc[i] = |
| 583 | ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 55]]; | 555 | ff_vlc_init_tables(&state, VC1_IF_1MV_MBMODE_VLC_BITS, 6, |
| 584 | ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 56] - vlc_offs[i * 3 + 55]; | 556 | vc1_if_1mv_mbmode_bits[i], 1, 1, |
| 585 | vlc_init(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6, | 557 | vc1_if_1mv_mbmode_codes[i], 1, 1, 0); |
| 586 | vc1_if_1mv_mbmode_bits[i], 1, 1, | ||
| 587 | vc1_if_1mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC); | ||
| 588 | } | 558 | } |
| 589 | ff_msmp4_vc1_vlcs_init_once(); | 559 | ff_msmp4_vc1_vlcs_init_once(); |
| 590 | } | 560 | } |