Revision ce5e49b0 libavcodec/vc1.c
libavcodec/vc1.c | ||
---|---|---|
612 | 612 |
v->s.pict_type = get_bits1(gb); |
613 | 613 |
if (v->s.avctx->max_b_frames) { |
614 | 614 |
if (!v->s.pict_type) { |
615 |
if (get_bits1(gb)) v->s.pict_type = FF_I_TYPE;
|
|
616 |
else v->s.pict_type = FF_B_TYPE;
|
|
617 |
} else v->s.pict_type = FF_P_TYPE;
|
|
618 |
} else v->s.pict_type = v->s.pict_type ? FF_P_TYPE : FF_I_TYPE;
|
|
615 |
if (get_bits1(gb)) v->s.pict_type = AV_PICTURE_TYPE_I;
|
|
616 |
else v->s.pict_type = AV_PICTURE_TYPE_B;
|
|
617 |
} else v->s.pict_type = AV_PICTURE_TYPE_P;
|
|
618 |
} else v->s.pict_type = v->s.pict_type ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
|
|
619 | 619 |
|
620 | 620 |
v->bi_type = 0; |
621 |
if(v->s.pict_type == FF_B_TYPE) {
|
|
621 |
if(v->s.pict_type == AV_PICTURE_TYPE_B) {
|
|
622 | 622 |
v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); |
623 | 623 |
v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; |
624 | 624 |
if(v->bfraction == 0) { |
625 |
v->s.pict_type = FF_BI_TYPE;
|
|
625 |
v->s.pict_type = AV_PICTURE_TYPE_BI;
|
|
626 | 626 |
} |
627 | 627 |
} |
628 |
if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
|
|
628 |
if(v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)
|
|
629 | 629 |
skip_bits(gb, 7); // skip buffer fullness |
630 | 630 |
|
631 | 631 |
if(v->parse_only) |
632 | 632 |
return 0; |
633 | 633 |
|
634 | 634 |
/* calculate RND */ |
635 |
if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
|
|
635 |
if(v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)
|
|
636 | 636 |
v->rnd = 1; |
637 |
if(v->s.pict_type == FF_P_TYPE)
|
|
637 |
if(v->s.pict_type == AV_PICTURE_TYPE_P)
|
|
638 | 638 |
v->rnd ^= 1; |
639 | 639 |
|
640 | 640 |
/* Quantizer stuff */ |
... | ... | |
661 | 661 |
v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 |
662 | 662 |
v->range_x = 1 << (v->k_x - 1); |
663 | 663 |
v->range_y = 1 << (v->k_y - 1); |
664 |
if (v->multires && v->s.pict_type != FF_B_TYPE) v->respic = get_bits(gb, 2);
|
|
664 |
if (v->multires && v->s.pict_type != AV_PICTURE_TYPE_B) v->respic = get_bits(gb, 2);
|
|
665 | 665 |
|
666 |
if(v->res_x8 && (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)){
|
|
666 |
if(v->res_x8 && (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)){
|
|
667 | 667 |
v->x8_type = get_bits1(gb); |
668 | 668 |
}else v->x8_type = 0; |
669 | 669 |
//av_log(v->s.avctx, AV_LOG_INFO, "%c Frame: QP=[%i]%i (+%i/2) %i\n", |
670 |
// (v->s.pict_type == FF_P_TYPE) ? 'P' : ((v->s.pict_type == FF_I_TYPE) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm);
|
|
670 |
// (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm);
|
|
671 | 671 |
|
672 |
if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_P_TYPE) v->use_ic = 0;
|
|
672 |
if(v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) v->use_ic = 0;
|
|
673 | 673 |
|
674 | 674 |
switch(v->s.pict_type) { |
675 |
case FF_P_TYPE:
|
|
675 |
case AV_PICTURE_TYPE_P:
|
|
676 | 676 |
if (v->pq < 5) v->tt_index = 0; |
677 | 677 |
else if(v->pq < 13) v->tt_index = 1; |
678 | 678 |
else v->tt_index = 2; |
... | ... | |
755 | 755 |
v->ttfrm = TT_8X8; |
756 | 756 |
} |
757 | 757 |
break; |
758 |
case FF_B_TYPE:
|
|
758 |
case AV_PICTURE_TYPE_B:
|
|
759 | 759 |
if (v->pq < 5) v->tt_index = 0; |
760 | 760 |
else if(v->pq < 13) v->tt_index = 1; |
761 | 761 |
else v->tt_index = 2; |
... | ... | |
801 | 801 |
{ |
802 | 802 |
/* AC Syntax */ |
803 | 803 |
v->c_ac_table_index = decode012(gb); |
804 |
if (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
|
|
804 |
if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)
|
|
805 | 805 |
{ |
806 | 806 |
v->y_ac_table_index = decode012(gb); |
807 | 807 |
} |
... | ... | |
809 | 809 |
v->s.dc_table_index = get_bits1(gb); |
810 | 810 |
} |
811 | 811 |
|
812 |
if(v->s.pict_type == FF_BI_TYPE) {
|
|
813 |
v->s.pict_type = FF_B_TYPE;
|
|
812 |
if(v->s.pict_type == AV_PICTURE_TYPE_BI) {
|
|
813 |
v->s.pict_type = AV_PICTURE_TYPE_B;
|
|
814 | 814 |
v->bi_type = 1; |
815 | 815 |
} |
816 | 816 |
return 0; |
... | ... | |
833 | 833 |
} |
834 | 834 |
switch(get_unary(gb, 0, 4)) { |
835 | 835 |
case 0: |
836 |
v->s.pict_type = FF_P_TYPE;
|
|
836 |
v->s.pict_type = AV_PICTURE_TYPE_P;
|
|
837 | 837 |
break; |
838 | 838 |
case 1: |
839 |
v->s.pict_type = FF_B_TYPE;
|
|
839 |
v->s.pict_type = AV_PICTURE_TYPE_B;
|
|
840 | 840 |
break; |
841 | 841 |
case 2: |
842 |
v->s.pict_type = FF_I_TYPE;
|
|
842 |
v->s.pict_type = AV_PICTURE_TYPE_I;
|
|
843 | 843 |
break; |
844 | 844 |
case 3: |
845 |
v->s.pict_type = FF_BI_TYPE;
|
|
845 |
v->s.pict_type = AV_PICTURE_TYPE_BI;
|
|
846 | 846 |
break; |
847 | 847 |
case 4: |
848 |
v->s.pict_type = FF_P_TYPE; // skipped pic
|
|
848 |
v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic
|
|
849 | 849 |
v->p_frame_skipped = 1; |
850 | 850 |
return 0; |
851 | 851 |
} |
... | ... | |
867 | 867 |
if(v->interlace) |
868 | 868 |
v->uvsamp = get_bits1(gb); |
869 | 869 |
if(v->finterpflag) v->interpfrm = get_bits1(gb); |
870 |
if(v->s.pict_type == FF_B_TYPE) {
|
|
870 |
if(v->s.pict_type == AV_PICTURE_TYPE_B) {
|
|
871 | 871 |
v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); |
872 | 872 |
v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; |
873 | 873 |
if(v->bfraction == 0) { |
874 |
v->s.pict_type = FF_BI_TYPE; /* XXX: should not happen here */
|
|
874 |
v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
|
|
875 | 875 |
} |
876 | 876 |
} |
877 | 877 |
pqindex = get_bits(gb, 5); |
... | ... | |
895 | 895 |
if(v->postprocflag) |
896 | 896 |
v->postproc = get_bits(gb, 2); |
897 | 897 |
|
898 |
if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_P_TYPE) v->use_ic = 0;
|
|
898 |
if(v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) v->use_ic = 0;
|
|
899 | 899 |
|
900 | 900 |
if(v->parse_only) |
901 | 901 |
return 0; |
902 | 902 |
|
903 | 903 |
switch(v->s.pict_type) { |
904 |
case FF_I_TYPE:
|
|
905 |
case FF_BI_TYPE:
|
|
904 |
case AV_PICTURE_TYPE_I:
|
|
905 |
case AV_PICTURE_TYPE_BI:
|
|
906 | 906 |
status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v); |
907 | 907 |
if (status < 0) return -1; |
908 | 908 |
av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " |
... | ... | |
918 | 918 |
} |
919 | 919 |
} |
920 | 920 |
break; |
921 |
case FF_P_TYPE:
|
|
921 |
case AV_PICTURE_TYPE_P:
|
|
922 | 922 |
if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); |
923 | 923 |
else v->mvrange = 0; |
924 | 924 |
v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 |
... | ... | |
1007 | 1007 |
v->ttfrm = TT_8X8; |
1008 | 1008 |
} |
1009 | 1009 |
break; |
1010 |
case FF_B_TYPE:
|
|
1010 |
case AV_PICTURE_TYPE_B:
|
|
1011 | 1011 |
if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); |
1012 | 1012 |
else v->mvrange = 0; |
1013 | 1013 |
v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 |
... | ... | |
1058 | 1058 |
|
1059 | 1059 |
/* AC Syntax */ |
1060 | 1060 |
v->c_ac_table_index = decode012(gb); |
1061 |
if (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
|
|
1061 |
if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)
|
|
1062 | 1062 |
{ |
1063 | 1063 |
v->y_ac_table_index = decode012(gb); |
1064 | 1064 |
} |
1065 | 1065 |
/* DC Syntax */ |
1066 | 1066 |
v->s.dc_table_index = get_bits1(gb); |
1067 |
if ((v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE) && v->dquant) {
|
|
1067 |
if ((v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) && v->dquant) {
|
|
1068 | 1068 |
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); |
1069 | 1069 |
vop_dquant_decoding(v); |
1070 | 1070 |
} |
1071 | 1071 |
|
1072 | 1072 |
v->bi_type = 0; |
1073 |
if(v->s.pict_type == FF_BI_TYPE) {
|
|
1074 |
v->s.pict_type = FF_B_TYPE;
|
|
1073 |
if(v->s.pict_type == AV_PICTURE_TYPE_BI) {
|
|
1074 |
v->s.pict_type = AV_PICTURE_TYPE_B;
|
|
1075 | 1075 |
v->bi_type = 1; |
1076 | 1076 |
} |
1077 | 1077 |
return 0; |
Also available in: Unified diff