- if (v->pq < 5) v->tt_index = 0;
- else if(v->pq < 13) v->tt_index = 1;
- else v->tt_index = 2;
-
- v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;
- v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
- v->s.mspel = v->s.quarter_sample;
-
- status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v);
- if (status < 0) return -1;
- av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
- "Imode: %i, Invert: %i\n", status>>1, status&1);
- status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
- if (status < 0) return -1;
- av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
- "Imode: %i, Invert: %i\n", status>>1, status&1);
-
- v->s.mv_table_index = get_bits(gb, 2);
- v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
+ if (v->pq < 5)
+ v->tt_index = 0;
+ else if (v->pq < 13)
+ v->tt_index = 1;
+ else
+ v->tt_index = 2;
+
+ if (v->field_mode) {
+ int mvmode;
+ if (v->extended_dmv)
+ v->dmvrange = get_unary(gb, 0, 3);
+ mvmode = get_unary(gb, 1, 3);
+ lowquant = (v->pq > 12) ? 0 : 1;
+ v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode];
+ v->qs_last = v->s.quarter_sample;
+ v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV);
+ v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || v->mv_mode == MV_PMODE_1MV_HPEL);
+ status = bitplane_decoding(v->forward_mb_plane, &v->fmb_is_raw, v);
+ if (status < 0)
+ return -1;
+ av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: "
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
+ mbmodetab = get_bits(gb, 3);
+ if (v->mv_mode == MV_PMODE_MIXED_MV)
+ v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab];
+ else
+ v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab];
+ imvtab = get_bits(gb, 3);
+ v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab];
+ icbptab = get_bits(gb, 3);
+ v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab];
+ if (v->mv_mode == MV_PMODE_MIXED_MV) {
+ fourmvbptab = get_bits(gb, 2);
+ v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab];
+ }
+ v->numref = 1; // interlaced field B pictures are always 2-ref
+ } else {
+ v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;
+ v->qs_last = v->s.quarter_sample;
+ v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
+ v->s.mspel = v->s.quarter_sample;
+ status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v);
+ if (status < 0)
+ return -1;
+ av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
+ status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
+ if (status < 0)
+ return -1;
+ av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
+ v->s.mv_table_index = get_bits(gb, 2);
+ v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
+ }