MB_TYPE_L[01] is based upon H.264 terminology (it stands for list); yet the mpegvideo based decoders don't have lists of reference frames, they have at most one forward and one backward reference. So use terminology based upon this. This also has a second advantage: MB_TYPE_L[01] is actually an OR of two flags (which are set independently for H.264, but aren't for mpegvideo). Switching to different flags makes the flags fit into an int16_t, which will be useful in future commits. The only downside to this is a very small amount of code in error_resilience.c and mpegutils.c (the only code shared between the H.264 decoder and mpegvideo).
Showing the changes to libavcodec (12 of 12 files). Show all
Unified · Split
| @@ -902,6 +902,7 @@ void ff_er_frame_end(ERContext *s, int *decode_error_flags) · 901 unmodified lines | ||
| 902 | 902 | int threshold = 50; |
| 903 | 903 | int is_intra_likely; |
| 904 | 904 | int size = s->b8_stride * 2 * s->mb_height; |
| 905 | + int guessed_mb_type; | |
| 905 | 906 | |
| 906 | 907 | /* We do not support ER of field pictures yet, |
| 907 | 908 | * though it should not crash if enabled. */ |
| @@ -1117,16 +1118,15 @@ void ff_er_frame_end(ERContext *s, int *decode_error_flags) · 209 unmodified lines | ||
| 1117 | 1118 | is_intra_likely = is_intra_more_likely(s); |
| 1118 | 1119 | |
| 1119 | 1120 | /* set unknown mb-type to most likely */ |
| 1121 | + guessed_mb_type = is_intra_likely ? MB_TYPE_INTRA4x4 : | |
| 1122 | + (MB_TYPE_16x16 | (s->avctx->codec_id == AV_CODEC_ID_H264 ? MB_TYPE_L0 : MB_TYPE_FORWARD_MV)); | |
| 1120 | 1123 | for (i = 0; i < s->mb_num; i++) { |
| 1121 | 1124 | const int mb_xy = s->mb_index2xy[i]; |
| 1122 | 1125 | int error = s->error_status_table[mb_xy]; |
| 1123 | 1126 | if (!((error & ER_DC_ERROR) && (error & ER_MV_ERROR))) |
| 1124 | 1127 | continue; |
| 1125 | 1128 | |
| 1126 | − if (is_intra_likely) | |
| 1127 | − s->cur_pic.mb_type[mb_xy] = MB_TYPE_INTRA4x4; | |
| 1128 | − else | |
| 1129 | − s->cur_pic.mb_type[mb_xy] = MB_TYPE_16x16 | MB_TYPE_L0; | |
| 1129 | + s->cur_pic.mb_type[mb_xy] = guessed_mb_type; | |
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | 1132 | // change inter to intra blocks if no reference frames are available |
| @@ -232,7 +232,7 @@ static int h261_decode_mb_skipped(H261DecContext *h, int mba1, int mba2) · 231 unmodified lines | ||
| 232 | 232 | |
| 233 | 233 | s->mv_dir = MV_DIR_FORWARD; |
| 234 | 234 | s->mv_type = MV_TYPE_16X16; |
| 235 | − s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 235 | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 236 | 236 | s->mv[0][0][0] = 0; |
| 237 | 237 | s->mv[0][0][1] = 0; |
| 238 | 238 | s->mb_skipped = 1; |
| @@ -460,7 +460,7 @@ static int h261_decode_mb(H261DecContext *h) · 221 unmodified lines | ||
| 460 | 460 | //set motion vectors |
| 461 | 461 | s->mv_dir = MV_DIR_FORWARD; |
| 462 | 462 | s->mv_type = MV_TYPE_16X16; |
| 463 | − s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; | |
| 463 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 464 | 464 | s->mv[0][0][0] = h->current_mv_x * 2; // gets divided by 2 in motion compensation |
| 465 | 465 | s->mv[0][0][1] = h->current_mv_y * 2; |
| 466 | 466 | |
| @@ -60,18 +60,18 @@ · 59 unmodified lines | ||
| 60 | 60 | #define CBPC_B_VLC_BITS 3 |
| 61 | 61 | |
| 62 | 62 | static const int h263_mb_type_b_map[15]= { |
| 63 | − MB_TYPE_DIRECT2 | MB_TYPE_L0L1, | |
| 64 | − MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP, | |
| 65 | − MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT, | |
| 66 | − MB_TYPE_L0 | MB_TYPE_16x16, | |
| 67 | − MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_16x16, | |
| 68 | − MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, | |
| 69 | − MB_TYPE_L1 | MB_TYPE_16x16, | |
| 70 | − MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_16x16, | |
| 71 | − MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, | |
| 72 | − MB_TYPE_L0L1 | MB_TYPE_16x16, | |
| 73 | − MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_16x16, | |
| 74 | − MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, | |
| 63 | + MB_TYPE_DIRECT2 | MB_TYPE_BIDIR_MV, | |
| 64 | + MB_TYPE_DIRECT2 | MB_TYPE_BIDIR_MV | MB_TYPE_CBP, | |
| 65 | + MB_TYPE_DIRECT2 | MB_TYPE_BIDIR_MV | MB_TYPE_CBP | MB_TYPE_QUANT, | |
| 66 | + MB_TYPE_FORWARD_MV | MB_TYPE_16x16, | |
| 67 | + MB_TYPE_FORWARD_MV | MB_TYPE_CBP | MB_TYPE_16x16, | |
| 68 | + MB_TYPE_FORWARD_MV | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, | |
| 69 | + MB_TYPE_BACKWARD_MV | MB_TYPE_16x16, | |
| 70 | + MB_TYPE_BACKWARD_MV | MB_TYPE_CBP | MB_TYPE_16x16, | |
| 71 | + MB_TYPE_BACKWARD_MV | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, | |
| 72 | + MB_TYPE_BIDIR_MV | MB_TYPE_16x16, | |
| 73 | + MB_TYPE_BIDIR_MV | MB_TYPE_CBP | MB_TYPE_16x16, | |
| 74 | + MB_TYPE_BIDIR_MV | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16, | |
| 75 | 75 | 0, //stuffing |
| 76 | 76 | MB_TYPE_INTRA4x4 | MB_TYPE_CBP, |
| 77 | 77 | MB_TYPE_INTRA4x4 | MB_TYPE_CBP | MB_TYPE_QUANT, |
| @@ -363,7 +363,7 @@ static void preview_obmc(MpegEncContext *s){ · 285 unmodified lines | ||
| 363 | 363 | mot_val[1 ]= mot_val[3 ]= |
| 364 | 364 | mot_val[1+stride]= mot_val[3+stride]= 0; |
| 365 | 365 | |
| 366 | − s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 366 | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 367 | 367 | goto end; |
| 368 | 368 | } |
| 369 | 369 | cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); |
| @@ -382,7 +382,7 @@ static void preview_obmc(MpegEncContext *s){ · 12 unmodified lines | ||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | if ((cbpc & 16) == 0) { |
| 385 | − s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; | |
| 385 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 386 | 386 | /* 16x16 motion prediction */ |
| 387 | 387 | mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
| 388 | 388 | if (s->umvplus) |
| @@ -400,7 +400,7 @@ static void preview_obmc(MpegEncContext *s){ · 11 unmodified lines | ||
| 400 | 400 | mot_val[1 ]= mot_val[3 ]= |
| 401 | 401 | mot_val[1+stride]= mot_val[3+stride]= my; |
| 402 | 402 | } else { |
| 403 | − s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; | |
| 403 | + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_FORWARD_MV; | |
| 404 | 404 | for(i=0;i<4;i++) { |
| 405 | 405 | mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
| 406 | 406 | if (s->umvplus) |
| @@ -763,7 +763,7 @@ static int set_direct_mv(MpegEncContext *s) · 356 unmodified lines | ||
| 763 | 763 | s->mv_type = MV_TYPE_8X8; |
| 764 | 764 | for (i = 0; i < 4; i++) |
| 765 | 765 | set_one_direct_mv(s, p, i); |
| 766 | − return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_L0L1; | |
| 766 | + return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_BIDIR_MV; | |
| 767 | 767 | } else { |
| 768 | 768 | set_one_direct_mv(s, p, 0); |
| 769 | 769 | s->mv[0][1][0] = |
| @@ -780,7 +780,7 @@ static int set_direct_mv(MpegEncContext *s) · 10 unmodified lines | ||
| 780 | 780 | s->mv[1][3][1] = s->mv[1][0][1]; |
| 781 | 781 | s->mv_type = MV_TYPE_8X8; |
| 782 | 782 | // Note see prev line |
| 783 | − return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1; | |
| 783 | + return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_BIDIR_MV; | |
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | |
| @@ -803,7 +803,7 @@ int ff_h263_decode_mb(MpegEncContext *s, · 16 unmodified lines | ||
| 803 | 803 | s->block_last_index[i] = -1; |
| 804 | 804 | s->mv_dir = MV_DIR_FORWARD; |
| 805 | 805 | s->mv_type = MV_TYPE_16X16; |
| 806 | − s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 806 | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 807 | 807 | s->mv[0][0][0] = 0; |
| 808 | 808 | s->mv[0][0][1] = 0; |
| 809 | 809 | s->mb_skipped = !(s->obmc | s->loop_filter); |
| @@ -841,7 +841,7 @@ int ff_h263_decode_mb(MpegEncContext *s, · 31 unmodified lines | ||
| 841 | 841 | |
| 842 | 842 | s->mv_dir = MV_DIR_FORWARD; |
| 843 | 843 | if ((cbpc & 16) == 0) { |
| 844 | − s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; | |
| 844 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 845 | 845 | /* 16x16 motion prediction */ |
| 846 | 846 | s->mv_type = MV_TYPE_16X16; |
| 847 | 847 | ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
| @@ -866,7 +866,7 @@ int ff_h263_decode_mb(MpegEncContext *s, · 18 unmodified lines | ||
| 866 | 866 | if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) |
| 867 | 867 | skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ |
| 868 | 868 | } else { |
| 869 | − s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; | |
| 869 | + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_FORWARD_MV; | |
| 870 | 870 | s->mv_type = MV_TYPE_8X8; |
| 871 | 871 | for(i=0;i<4;i++) { |
| 872 | 872 | mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
| @@ -952,7 +952,7 @@ int ff_h263_decode_mb(MpegEncContext *s, · 79 unmodified lines | ||
| 952 | 952 | s->mv_type= MV_TYPE_16X16; |
| 953 | 953 | //FIXME UMV |
| 954 | 954 | |
| 955 | − if(USES_LIST(mb_type, 0)){ | |
| 955 | + if (HAS_FORWARD_MV(mb_type)) { | |
| 956 | 956 | int16_t *mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
| 957 | 957 | s->mv_dir = MV_DIR_FORWARD; |
| 958 | 958 | |
| @@ -979,7 +979,7 @@ int ff_h263_decode_mb(MpegEncContext *s, · 20 unmodified lines | ||
| 979 | 979 | mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | − if(USES_LIST(mb_type, 1)){ | |
| 982 | + if (HAS_BACKWARD_MV(mb_type)) { | |
| 983 | 983 | int16_t *mot_val= ff_h263_pred_motion(s, 0, 1, &pred_x, &pred_y); |
| 984 | 984 | s->mv_dir |= MV_DIR_BACKWARD; |
| 985 | 985 | |
| @@ -697,11 +697,11 @@ void ff_h263_update_mb(MpegEncContext *s) · 696 unmodified lines | ||
| 697 | 697 | s->cur_pic.mbskip_table[mb_xy] = s->mb_skipped; |
| 698 | 698 | |
| 699 | 699 | if (s->mv_type == MV_TYPE_8X8) |
| 700 | − s->cur_pic.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; | |
| 700 | + s->cur_pic.mb_type[mb_xy] = MB_TYPE_FORWARD_MV | MB_TYPE_8x8; | |
| 701 | 701 | else if(s->mb_intra) |
| 702 | 702 | s->cur_pic.mb_type[mb_xy] = MB_TYPE_INTRA; |
| 703 | 703 | else |
| 704 | − s->cur_pic.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16; | |
| 704 | + s->cur_pic.mb_type[mb_xy] = MB_TYPE_FORWARD_MV | MB_TYPE_16x16; | |
| 705 | 705 | |
| 706 | 706 | ff_h263_update_motion_val(s); |
| 707 | 707 | } |
| @@ -97,26 +97,26 @@ typedef struct Mpeg1Context { · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | static const uint32_t ptype2mb_type[7] = { |
| 99 | 99 | MB_TYPE_INTRA, |
| 100 | − MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16, | |
| 101 | − MB_TYPE_L0, | |
| 102 | − MB_TYPE_L0 | MB_TYPE_CBP, | |
| 100 | + MB_TYPE_FORWARD_MV | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16, | |
| 101 | + MB_TYPE_FORWARD_MV, | |
| 102 | + MB_TYPE_FORWARD_MV | MB_TYPE_CBP, | |
| 103 | 103 | MB_TYPE_QUANT | MB_TYPE_INTRA, |
| 104 | − MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16, | |
| 105 | − MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP, | |
| 104 | + MB_TYPE_QUANT | MB_TYPE_FORWARD_MV | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16, | |
| 105 | + MB_TYPE_QUANT | MB_TYPE_FORWARD_MV | MB_TYPE_CBP, | |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | 108 | static const uint32_t btype2mb_type[11] = { |
| 109 | 109 | MB_TYPE_INTRA, |
| 110 | − MB_TYPE_L1, | |
| 111 | − MB_TYPE_L1 | MB_TYPE_CBP, | |
| 112 | − MB_TYPE_L0, | |
| 113 | − MB_TYPE_L0 | MB_TYPE_CBP, | |
| 114 | − MB_TYPE_L0L1, | |
| 115 | − MB_TYPE_L0L1 | MB_TYPE_CBP, | |
| 110 | + MB_TYPE_BACKWARD_MV, | |
| 111 | + MB_TYPE_BACKWARD_MV | MB_TYPE_CBP, | |
| 112 | + MB_TYPE_FORWARD_MV, | |
| 113 | + MB_TYPE_FORWARD_MV | MB_TYPE_CBP, | |
| 114 | + MB_TYPE_BIDIR_MV, | |
| 115 | + MB_TYPE_BIDIR_MV | MB_TYPE_CBP, | |
| 116 | 116 | MB_TYPE_QUANT | MB_TYPE_INTRA, |
| 117 | − MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP, | |
| 118 | − MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP, | |
| 119 | − MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP, | |
| 117 | + MB_TYPE_QUANT | MB_TYPE_BACKWARD_MV | MB_TYPE_CBP, | |
| 118 | + MB_TYPE_QUANT | MB_TYPE_FORWARD_MV | MB_TYPE_CBP, | |
| 119 | + MB_TYPE_QUANT | MB_TYPE_BIDIR_MV | MB_TYPE_CBP, | |
| 120 | 120 | }; |
| 121 | 121 | |
| 122 | 122 | /* as H.263, but only 17 codes */ |
| @@ -438,7 +438,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 315 unmodified lines | ||
| 438 | 438 | if (s->pict_type == AV_PICTURE_TYPE_P) { |
| 439 | 439 | s->mb_skipped = 1; |
| 440 | 440 | s->cur_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride] = |
| 441 | − MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; | |
| 441 | + MB_TYPE_SKIP | MB_TYPE_FORWARD_MV | MB_TYPE_16x16; | |
| 442 | 442 | } else { |
| 443 | 443 | int mb_type; |
| 444 | 444 | |
| @@ -579,7 +579,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 134 unmodified lines | ||
| 579 | 579 | s->mv[0][0][0] = 0; |
| 580 | 580 | s->mv[0][0][1] = 0; |
| 581 | 581 | } else { |
| 582 | − av_assert2(mb_type & MB_TYPE_L0L1); | |
| 582 | + av_assert2(mb_type & MB_TYPE_BIDIR_MV); | |
| 583 | 583 | // FIXME decide if MBs in field pictures are MB_TYPE_INTERLACED |
| 584 | 584 | /* get additional motion vector type */ |
| 585 | 585 | if (s->picture_structure == PICT_FRAME && s->frame_pred_frame_dct) { |
| @@ -594,7 +594,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 8 unmodified lines | ||
| 594 | 594 | s->qscale = mpeg_get_qscale(s); |
| 595 | 595 | |
| 596 | 596 | /* motion vectors */ |
| 597 | − s->mv_dir = (mb_type >> 13) & 3; | |
| 597 | + s->mv_dir = MB_TYPE_MV_2_MV_DIR(mb_type); | |
| 598 | 598 | ff_tlog(s->avctx, "motion_type=%d\n", motion_type); |
| 599 | 599 | switch (motion_type) { |
| 600 | 600 | case MT_FRAME: /* or MT_16X8 */ |
| @@ -602,7 +602,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 1 unmodified line | ||
| 602 | 602 | mb_type |= MB_TYPE_16x16; |
| 603 | 603 | s->mv_type = MV_TYPE_16X16; |
| 604 | 604 | for (i = 0; i < 2; i++) { |
| 605 | − if (USES_LIST(mb_type, i)) { | |
| 605 | + if (HAS_MV(mb_type, i)) { | |
| 606 | 606 | /* MT_FRAME */ |
| 607 | 607 | s->mv[i][0][0] = |
| 608 | 608 | s->last_mv[i][0][0] = |
| @@ -625,7 +625,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 16 unmodified lines | ||
| 625 | 625 | mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; |
| 626 | 626 | s->mv_type = MV_TYPE_16X8; |
| 627 | 627 | for (i = 0; i < 2; i++) { |
| 628 | − if (USES_LIST(mb_type, i)) { | |
| 628 | + if (HAS_MV(mb_type, i)) { | |
| 629 | 629 | /* MT_16X8 */ |
| 630 | 630 | for (j = 0; j < 2; j++) { |
| 631 | 631 | s->field_select[i][j] = get_bits1(&s->gb); |
| @@ -645,7 +645,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 13 unmodified lines | ||
| 645 | 645 | if (s->picture_structure == PICT_FRAME) { |
| 646 | 646 | mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; |
| 647 | 647 | for (i = 0; i < 2; i++) { |
| 648 | − if (USES_LIST(mb_type, i)) { | |
| 648 | + if (HAS_MV(mb_type, i)) { | |
| 649 | 649 | for (j = 0; j < 2; j++) { |
| 650 | 650 | s->field_select[i][j] = get_bits1(&s->gb); |
| 651 | 651 | val = mpeg_decode_motion(s, s->mpeg_f_code[i][0], |
| @@ -665,7 +665,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 13 unmodified lines | ||
| 665 | 665 | av_assert0(!s->progressive_sequence); |
| 666 | 666 | mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; |
| 667 | 667 | for (i = 0; i < 2; i++) { |
| 668 | − if (USES_LIST(mb_type, i)) { | |
| 668 | + if (HAS_MV(mb_type, i)) { | |
| 669 | 669 | s->field_select[i][0] = get_bits1(&s->gb); |
| 670 | 670 | for (k = 0; k < 2; k++) { |
| 671 | 671 | val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], |
| @@ -685,7 +685,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) · 13 unmodified lines | ||
| 685 | 685 | } |
| 686 | 686 | s->mv_type = MV_TYPE_DMV; |
| 687 | 687 | for (i = 0; i < 2; i++) { |
| 688 | − if (USES_LIST(mb_type, i)) { | |
| 688 | + if (HAS_MV(mb_type, i)) { | |
| 689 | 689 | int dmx, dmy, mx, my, m; |
| 690 | 690 | const int my_shift = s->picture_structure == PICT_FRAME; |
| 691 | 691 | |
| @@ -141,7 +141,7 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my) · 140 unmodified lines | ||
| 141 | 141 | s->mv_type = MV_TYPE_8X8; |
| 142 | 142 | for (i = 0; i < 4; i++) |
| 143 | 143 | ff_mpeg4_set_one_direct_mv(s, mx, my, i); |
| 144 | − return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_L0L1; | |
| 144 | + return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_BIDIR_MV; | |
| 145 | 145 | } else if (IS_INTERLACED(colocated_mb_type)) { |
| 146 | 146 | s->mv_type = MV_TYPE_FIELD; |
| 147 | 147 | for (i = 0; i < 2; i++) { |
| @@ -169,7 +169,7 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my) · 21 unmodified lines | ||
| 169 | 169 | (time_pb - time_pp) / time_pp; |
| 170 | 170 | } |
| 171 | 171 | return MB_TYPE_DIRECT2 | MB_TYPE_16x8 | |
| 172 | − MB_TYPE_L0L1 | MB_TYPE_INTERLACED; | |
| 172 | + MB_TYPE_BIDIR_MV | MB_TYPE_INTERLACED; | |
| 173 | 173 | } else { |
| 174 | 174 | ff_mpeg4_set_one_direct_mv(s, mx, my, 0); |
| 175 | 175 | s->mv[0][1][0] = |
| @@ -190,6 +190,6 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my) · 14 unmodified lines | ||
| 190 | 190 | else |
| 191 | 191 | s->mv_type = MV_TYPE_8X8; |
| 192 | 192 | // Note see prev line |
| 193 | − return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1; | |
| 193 | + return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_BIDIR_MV; | |
| 194 | 194 | } |
| 195 | 195 | } |
| @@ -68,10 +68,10 @@ static VLCElem studio_chroma_dc[528]; · 67 unmodified lines | ||
| 68 | 68 | static const uint8_t mpeg4_block_count[4] = { 0, 6, 8, 12 }; |
| 69 | 69 | |
| 70 | 70 | static const int mb_type_b_map[4] = { |
| 71 | − MB_TYPE_DIRECT2 | MB_TYPE_L0L1, | |
| 72 | − MB_TYPE_L0L1 | MB_TYPE_16x16, | |
| 73 | − MB_TYPE_L1 | MB_TYPE_16x16, | |
| 74 | − MB_TYPE_L0 | MB_TYPE_16x16, | |
| 71 | + MB_TYPE_DIRECT2 | MB_TYPE_BIDIR_MV, | |
| 72 | + MB_TYPE_BIDIR_MV | MB_TYPE_16x16, | |
| 73 | + MB_TYPE_BACKWARD_MV | MB_TYPE_16x16, | |
| 74 | + MB_TYPE_FORWARD_MV | MB_TYPE_16x16, | |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | 77 | static void gmc1_motion(MpegEncContext *s, const Mpeg4DecContext *ctx, |
| @@ -1010,13 +1010,13 @@ try_again: · 932 unmodified lines | ||
| 1010 | 1010 | s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | |
| 1011 | 1011 | MB_TYPE_16x16 | |
| 1012 | 1012 | MB_TYPE_GMC | |
| 1013 | − MB_TYPE_L0; | |
| 1013 | + MB_TYPE_FORWARD_MV; | |
| 1014 | 1014 | mx = get_amv(ctx, 0); |
| 1015 | 1015 | my = get_amv(ctx, 1); |
| 1016 | 1016 | } else { |
| 1017 | 1017 | s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | |
| 1018 | 1018 | MB_TYPE_16x16 | |
| 1019 | − MB_TYPE_L0; | |
| 1019 | + MB_TYPE_FORWARD_MV; | |
| 1020 | 1020 | mx = my = 0; |
| 1021 | 1021 | } |
| 1022 | 1022 | mot_val[0] = |
| @@ -1081,13 +1081,13 @@ try_again: · 58 unmodified lines | ||
| 1081 | 1081 | if (my >= 0xffff) |
| 1082 | 1082 | return AVERROR_INVALIDDATA; |
| 1083 | 1083 | s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | |
| 1084 | − MB_TYPE_L0; | |
| 1084 | + MB_TYPE_FORWARD_MV; | |
| 1085 | 1085 | } else { |
| 1086 | 1086 | mx = get_amv(ctx, 0); |
| 1087 | 1087 | my = get_amv(ctx, 1); |
| 1088 | 1088 | s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | |
| 1089 | 1089 | MB_TYPE_GMC | |
| 1090 | − MB_TYPE_L0; | |
| 1090 | + MB_TYPE_FORWARD_MV; | |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | mot_val[0] = |
| @@ -1101,7 +1101,7 @@ try_again: · 7 unmodified lines | ||
| 1101 | 1101 | } else { |
| 1102 | 1102 | int i; |
| 1103 | 1103 | s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | |
| 1104 | − MB_TYPE_L0; | |
| 1104 | + MB_TYPE_FORWARD_MV; | |
| 1105 | 1105 | for (i = 0; i < 4; i++) { |
| 1106 | 1106 | int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
| 1107 | 1107 | mx = ff_h263_decode_motion(s, pred_x, s->f_code); |
| @@ -1675,16 +1675,15 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 567 unmodified lines | ||
| 1675 | 1675 | s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | |
| 1676 | 1676 | MB_TYPE_GMC | |
| 1677 | 1677 | MB_TYPE_16x16 | |
| 1678 | − MB_TYPE_L0; | |
| 1678 | + MB_TYPE_FORWARD_MV; | |
| 1679 | 1679 | s->mcsel = 1; |
| 1680 | 1680 | s->mv[0][0][0] = get_amv(ctx, 0); |
| 1681 | 1681 | s->mv[0][0][1] = get_amv(ctx, 1); |
| 1682 | 1682 | s->cur_pic.mbskip_table[xy] = 0; |
| 1683 | 1683 | s->mb_skipped = 0; |
| 1684 | 1684 | } else { |
| 1685 | − s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | | |
| 1686 | − MB_TYPE_16x16 | | |
| 1687 | − MB_TYPE_L0; | |
| 1685 | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | | |
| 1686 | + MB_TYPE_FORWARD_MV; | |
| 1688 | 1687 | s->mcsel = 0; |
| 1689 | 1688 | s->mv[0][0][0] = 0; |
| 1690 | 1689 | s->mv[0][0][1] = 0; |
| @@ -1729,9 +1728,8 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 38 unmodified lines | ||
| 1729 | 1728 | s->mv_dir = MV_DIR_FORWARD; |
| 1730 | 1729 | if ((cbpc & 16) == 0) { |
| 1731 | 1730 | if (s->mcsel) { |
| 1732 | − s->cur_pic.mb_type[xy] = MB_TYPE_GMC | | |
| 1733 | − MB_TYPE_16x16 | | |
| 1734 | − MB_TYPE_L0; | |
| 1731 | + s->cur_pic.mb_type[xy] = MB_TYPE_GMC | MB_TYPE_16x16 | | |
| 1732 | + MB_TYPE_FORWARD_MV; | |
| 1735 | 1733 | /* 16x16 global motion prediction */ |
| 1736 | 1734 | s->mv_type = MV_TYPE_16X16; |
| 1737 | 1735 | mx = get_amv(ctx, 0); |
| @@ -1739,8 +1737,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 1 unmodified line | ||
| 1739 | 1737 | s->mv[0][0][0] = mx; |
| 1740 | 1738 | s->mv[0][0][1] = my; |
| 1741 | 1739 | } else if ((!s->progressive_sequence) && get_bits1(&s->gb)) { |
| 1742 | − s->cur_pic.mb_type[xy] = MB_TYPE_16x8 | | |
| 1743 | − MB_TYPE_L0 | | |
| 1740 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x8 | MB_TYPE_FORWARD_MV | | |
| 1744 | 1741 | MB_TYPE_INTERLACED; |
| 1745 | 1742 | /* 16x8 field motion prediction */ |
| 1746 | 1743 | s->mv_type = MV_TYPE_FIELD; |
| @@ -1763,7 +1760,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 16 unmodified lines | ||
| 1763 | 1760 | s->mv[0][i][1] = my; |
| 1764 | 1761 | } |
| 1765 | 1762 | } else { |
| 1766 | − s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; | |
| 1763 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 1767 | 1764 | /* 16x16 motion prediction */ |
| 1768 | 1765 | s->mv_type = MV_TYPE_16X16; |
| 1769 | 1766 | ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
| @@ -1780,7 +1777,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 10 unmodified lines | ||
| 1780 | 1777 | s->mv[0][0][1] = my; |
| 1781 | 1778 | } |
| 1782 | 1779 | } else { |
| 1783 | − s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; | |
| 1780 | + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_FORWARD_MV; | |
| 1784 | 1781 | s->mv_type = MV_TYPE_8X8; |
| 1785 | 1782 | for (i = 0; i < 4; i++) { |
| 1786 | 1783 | int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
| @@ -1832,14 +1829,14 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 45 unmodified lines | ||
| 1832 | 1829 | s->mv[1][0][1] = 0; |
| 1833 | 1830 | s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | |
| 1834 | 1831 | MB_TYPE_16x16 | |
| 1835 | − MB_TYPE_L0; | |
| 1832 | + MB_TYPE_FORWARD_MV; | |
| 1836 | 1833 | goto end; |
| 1837 | 1834 | } |
| 1838 | 1835 | |
| 1839 | 1836 | modb1 = get_bits1(&s->gb); |
| 1840 | 1837 | if (modb1) { |
| 1841 | 1838 | // like MB_TYPE_B_DIRECT but no vectors coded |
| 1842 | − mb_type = MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; | |
| 1839 | + mb_type = MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_BIDIR_MV; | |
| 1843 | 1840 | cbp = 0; |
| 1844 | 1841 | } else { |
| 1845 | 1842 | modb2 = get_bits1(&s->gb); |
| @@ -1869,11 +1866,11 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 23 unmodified lines | ||
| 1869 | 1866 | mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; |
| 1870 | 1867 | mb_type &= ~MB_TYPE_16x16; |
| 1871 | 1868 | |
| 1872 | − if (USES_LIST(mb_type, 0)) { | |
| 1869 | + if (HAS_FORWARD_MV(mb_type)) { | |
| 1873 | 1870 | s->field_select[0][0] = get_bits1(&s->gb); |
| 1874 | 1871 | s->field_select[0][1] = get_bits1(&s->gb); |
| 1875 | 1872 | } |
| 1876 | − if (USES_LIST(mb_type, 1)) { | |
| 1873 | + if (HAS_BACKWARD_MV(mb_type)) { | |
| 1877 | 1874 | s->field_select[1][0] = get_bits1(&s->gb); |
| 1878 | 1875 | s->field_select[1][1] = get_bits1(&s->gb); |
| 1879 | 1876 | } |
| @@ -1884,7 +1881,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 4 unmodified lines | ||
| 1884 | 1881 | if ((mb_type & (MB_TYPE_DIRECT2 | MB_TYPE_INTERLACED)) == 0) { |
| 1885 | 1882 | s->mv_type = MV_TYPE_16X16; |
| 1886 | 1883 | |
| 1887 | − if (USES_LIST(mb_type, 0)) { | |
| 1884 | + if (HAS_FORWARD_MV(mb_type)) { | |
| 1888 | 1885 | s->mv_dir = MV_DIR_FORWARD; |
| 1889 | 1886 | |
| 1890 | 1887 | mx = ff_h263_decode_motion(s, s->last_mv[0][0][0], s->f_code); |
| @@ -1897,7 +1894,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 6 unmodified lines | ||
| 1897 | 1894 | s->mv[0][0][1] = my; |
| 1898 | 1895 | } |
| 1899 | 1896 | |
| 1900 | − if (USES_LIST(mb_type, 1)) { | |
| 1897 | + if (HAS_BACKWARD_MV(mb_type)) { | |
| 1901 | 1898 | s->mv_dir |= MV_DIR_BACKWARD; |
| 1902 | 1899 | |
| 1903 | 1900 | mx = ff_h263_decode_motion(s, s->last_mv[1][0][0], s->b_code); |
| @@ -1912,7 +1909,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 8 unmodified lines | ||
| 1912 | 1909 | } else if (!IS_DIRECT(mb_type)) { |
| 1913 | 1910 | s->mv_type = MV_TYPE_FIELD; |
| 1914 | 1911 | |
| 1915 | − if (USES_LIST(mb_type, 0)) { | |
| 1912 | + if (HAS_FORWARD_MV(mb_type)) { | |
| 1916 | 1913 | s->mv_dir = MV_DIR_FORWARD; |
| 1917 | 1914 | |
| 1918 | 1915 | for (i = 0; i < 2; i++) { |
| @@ -1924,7 +1921,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 5 unmodified lines | ||
| 1924 | 1921 | } |
| 1925 | 1922 | } |
| 1926 | 1923 | |
| 1927 | − if (USES_LIST(mb_type, 1)) { | |
| 1924 | + if (HAS_BACKWARD_MV(mb_type)) { | |
| 1928 | 1925 | s->mv_dir |= MV_DIR_BACKWARD; |
| 1929 | 1926 | |
| 1930 | 1927 | for (i = 0; i < 2; i++) { |
| @@ -104,7 +104,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx, · 103 unmodified lines | ||
| 104 | 104 | y, picture_structure, h); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | −static char get_type_mv_char(int mb_type) | |
| 107 | +#define HAS_MV_EXT(mb_type, flags, dir) ((mb_type) & flags[(dir)]) | |
| 108 | + | |
| 109 | +static char get_type_mv_char(int mb_type, const int mb_type_mv_flags[2]) | |
| 108 | 110 | { |
| 109 | 111 | // Type & MV direction |
| 110 | 112 | if (IS_PCM(mb_type)) |
| @@ -125,12 +127,12 @@ static char get_type_mv_char(int mb_type) · 14 unmodified lines | ||
| 125 | 127 | return 'G'; |
| 126 | 128 | else if (IS_SKIP(mb_type)) |
| 127 | 129 | return 'S'; |
| 128 | − else if (!USES_LIST(mb_type, 1)) | |
| 130 | + else if (!HAS_MV_EXT(mb_type, 1, mb_type_mv_flags)) | |
| 129 | 131 | return '>'; |
| 130 | − else if (!USES_LIST(mb_type, 0)) | |
| 132 | + else if (!HAS_MV_EXT(mb_type, 0, mb_type_mv_flags)) | |
| 131 | 133 | return '<'; |
| 132 | 134 | else { |
| 133 | − av_assert2(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); | |
| 135 | + av_assert2(HAS_MV_EXT(mb_type, 0, mb_type_mv_flags) && HAS_MV_EXT(mb_type, 1, mb_type_mv_flags)); | |
| 134 | 136 | return 'X'; |
| 135 | 137 | } |
| 136 | 138 | } |
| @@ -162,12 +164,15 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, · 25 unmodified lines | ||
| 162 | 164 | const int8_t *qscale_table, int16_t (*const motion_val[2])[2], |
| 163 | 165 | int mb_width, int mb_height, int mb_stride, int quarter_sample) |
| 164 | 166 | { |
| 167 | + const int is_h264 = avctx->codec_id == AV_CODEC_ID_H264; | |
| 168 | + const int mb_type_mv_flags[2] = { is_h264 ? MB_TYPE_L0 : MB_TYPE_FORWARD_MV, | |
| 169 | + is_h264 ? MB_TYPE_L1 : MB_TYPE_BACKWARD_MV }; | |
| 170 | + | |
| 165 | 171 | if ((avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS) && mbtype_table && motion_val[0]) { |
| 166 | 172 | const int shift = 1 + quarter_sample; |
| 167 | 173 | const int scale = 1 << shift; |
| 168 | − const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 ? 2 : 1; | |
| 169 | − const int mv_stride = (mb_width << mv_sample_log2) + | |
| 170 | − (avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1); | |
| 174 | + const int mv_sample_log2 = is_h264 ? 2 : 1; | |
| 175 | + const int mv_stride = (mb_width << mv_sample_log2) + !is_h264; | |
| 171 | 176 | int mb_x, mb_y, mbcount = 0; |
| 172 | 177 | |
| 173 | 178 | /* size is width * height * 2 * 4 where 2 is for directions and 4 is |
| @@ -180,7 +185,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, · 6 unmodified lines | ||
| 180 | 185 | for (mb_x = 0; mb_x < mb_width; mb_x++) { |
| 181 | 186 | int i, direction, mb_type = mbtype_table[mb_x + mb_y * mb_stride]; |
| 182 | 187 | for (direction = 0; direction < 2; direction++) { |
| 183 | − if (!USES_LIST(mb_type, direction)) | |
| 188 | + if (!HAS_MV_EXT(mb_type, direction, mb_type_mv_flags)) | |
| 184 | 189 | continue; |
| 185 | 190 | if (IS_8X8(mb_type)) { |
| 186 | 191 | for (i = 0; i < 4; i++) { |
| @@ -299,7 +304,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, · 112 unmodified lines | ||
| 299 | 304 | int mb_type = mbtype_table[x + y * mb_stride]; |
| 300 | 305 | |
| 301 | 306 | av_bprintf(&buf, "%c%c%c", |
| 302 | − get_type_mv_char(mb_type), | |
| 307 | + get_type_mv_char(mb_type, mb_type_mv_flags), | |
| 303 | 308 | get_segmentation_char(mb_type), |
| 304 | 309 | get_interlacement_char(mb_type)); |
| 305 | 310 | } |
| @@ -47,6 +47,10 @@ · 46 unmodified lines | ||
| 47 | 47 | #define MB_TYPE_DIRECT2 (1 << 8) // FIXME |
| 48 | 48 | #define MB_TYPE_CBP (1 << 10) |
| 49 | 49 | #define MB_TYPE_QUANT (1 << 11) |
| 50 | +#define MB_TYPE_FORWARD_MV (1 << 12) | |
| 51 | +#define MB_TYPE_BACKWARD_MV (1 << 13) | |
| 52 | +#define MB_TYPE_BIDIR_MV (MB_TYPE_FORWARD_MV | MB_TYPE_BACKWARD_MV) | |
| 53 | +// MB_TYPE_P[01]L[01], MB_TYPE_L[01] and MB_TYPE_L0L1 are H.264 only. | |
| 50 | 54 | #define MB_TYPE_P0L0 (1 << 12) |
| 51 | 55 | #define MB_TYPE_P1L0 (1 << 13) |
| 52 | 56 | #define MB_TYPE_P0L1 (1 << 14) |
| @@ -90,6 +94,12 @@ · 37 unmodified lines | ||
| 90 | 94 | #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0 | MB_TYPE_P1L0) << (2 * (list)))) |
| 91 | 95 | |
| 92 | 96 | #define HAS_CBP(a) ((a) & MB_TYPE_CBP) |
| 97 | +#define HAS_FORWARD_MV(a) ((a) & MB_TYPE_FORWARD_MV) | |
| 98 | +#define HAS_BACKWARD_MV(a) ((a) & MB_TYPE_BACKWARD_MV) | |
| 99 | +// dir == 0 means forward, dir == 1 is backward | |
| 100 | +#define HAS_MV(a, dir) ((a) & (MB_TYPE_FORWARD_MV << (dir))) | |
| 101 | + | |
| 102 | +#define MB_TYPE_MV_2_MV_DIR(a) (((a) >> 12) & (MV_DIR_FORWARD | MV_DIR_BACKWARD)) | |
| 93 | 103 | |
| 94 | 104 | /** |
| 95 | 105 | * Draw a horizontal band if supported. |
| @@ -120,7 +120,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 119 unmodified lines | ||
| 120 | 120 | s->mv[0][0][0] = 0; |
| 121 | 121 | s->mv[0][0][1] = 0; |
| 122 | 122 | s->mb_skipped = 1; |
| 123 | − *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; | |
| 123 | + *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_FORWARD_MV | MB_TYPE_16x16; | |
| 124 | 124 | return 0; |
| 125 | 125 | } |
| 126 | 126 | } |
| @@ -170,7 +170,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 43 unmodified lines | ||
| 170 | 170 | s->mv_type = MV_TYPE_16X16; |
| 171 | 171 | s->mv[0][0][0] = mx; |
| 172 | 172 | s->mv[0][0][1] = my; |
| 173 | − *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; | |
| 173 | + *mb_type_ptr = MB_TYPE_FORWARD_MV | MB_TYPE_16x16; | |
| 174 | 174 | } else { |
| 175 | 175 | int v; |
| 176 | 176 | if (s->msmpeg4_version == MSMP4_V2) { |
| @@ -226,7 +226,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 49 unmodified lines | ||
| 226 | 226 | s->mv[0][0][0] = 0; |
| 227 | 227 | s->mv[0][0][1] = 0; |
| 228 | 228 | s->mb_skipped = 1; |
| 229 | − *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; | |
| 229 | + *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_FORWARD_MV | MB_TYPE_16x16; | |
| 230 | 230 | |
| 231 | 231 | return 0; |
| 232 | 232 | } |
| @@ -265,7 +265,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 32 unmodified lines | ||
| 265 | 265 | s->mv_type = MV_TYPE_16X16; |
| 266 | 266 | s->mv[0][0][0] = mx; |
| 267 | 267 | s->mv[0][0][1] = my; |
| 268 | − *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; | |
| 268 | + *mb_type_ptr = MB_TYPE_FORWARD_MV | MB_TYPE_16x16; | |
| 269 | 269 | } else { |
| 270 | 270 | ff_dlog(s, "I at %d %d %d %06X\n", s->mb_x, s->mb_y, |
| 271 | 271 | ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0), |
| @@ -59,16 +59,16 @@ static inline void ZERO8x2(void* dst, int stride) · 58 unmodified lines | ||
| 59 | 59 | static const int rv34_mb_type_to_lavc[12] = { |
| 60 | 60 | MB_TYPE_INTRA, |
| 61 | 61 | MB_TYPE_INTRA16x16 | MB_TYPE_SEPARATE_DC, |
| 62 | − MB_TYPE_16x16 | MB_TYPE_L0, | |
| 63 | − MB_TYPE_8x8 | MB_TYPE_L0, | |
| 64 | − MB_TYPE_16x16 | MB_TYPE_L0, | |
| 65 | − MB_TYPE_16x16 | MB_TYPE_L1, | |
| 62 | + MB_TYPE_16x16 | MB_TYPE_FORWARD_MV, | |
| 63 | + MB_TYPE_8x8 | MB_TYPE_FORWARD_MV, | |
| 64 | + MB_TYPE_16x16 | MB_TYPE_FORWARD_MV, | |
| 65 | + MB_TYPE_16x16 | MB_TYPE_BACKWARD_MV, | |
| 66 | 66 | MB_TYPE_SKIP, |
| 67 | 67 | MB_TYPE_DIRECT2 | MB_TYPE_16x16, |
| 68 | − MB_TYPE_16x8 | MB_TYPE_L0, | |
| 69 | − MB_TYPE_8x16 | MB_TYPE_L0, | |
| 70 | − MB_TYPE_16x16 | MB_TYPE_L0L1, | |
| 71 | − MB_TYPE_16x16 | MB_TYPE_L0 | MB_TYPE_SEPARATE_DC | |
| 68 | + MB_TYPE_16x8 | MB_TYPE_FORWARD_MV, | |
| 69 | + MB_TYPE_8x16 | MB_TYPE_FORWARD_MV, | |
| 70 | + MB_TYPE_16x16 | MB_TYPE_BIDIR_MV, | |
| 71 | + MB_TYPE_16x16 | MB_TYPE_FORWARD_MV | MB_TYPE_SEPARATE_DC | |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | |
| @@ -568,7 +568,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) · 493 unmodified lines | ||
| 568 | 568 | int mx, my; |
| 569 | 569 | int i, j; |
| 570 | 570 | MPVWorkPicture *cur_pic = &s->cur_pic; |
| 571 | − const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0; | |
| 571 | + const int mask = dir ? MB_TYPE_BACKWARD_MV : MB_TYPE_FORWARD_MV; | |
| 572 | 572 | int type = cur_pic->mb_type[mb_pos]; |
| 573 | 573 | |
| 574 | 574 | if((r->avail_cache[6-1] & type) & mask){ |
| @@ -112,7 +112,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 111 unmodified lines | ||
| 112 | 112 | for (mb_y = 0; mb_y < s->mb_height; mb_y++) |
| 113 | 113 | for (mb_x = 0; mb_x < s->mb_width; mb_x++) |
| 114 | 114 | mb_type[mb_y * s->mb_stride + mb_x] = |
| 115 | − MB_TYPE_16x16 | MB_TYPE_L0; | |
| 115 | + MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 116 | 116 | break; |
| 117 | 117 | case SKIP_TYPE_MPEG: |
| 118 | 118 | if (get_bits_left(&s->gb) < s->mb_height * s->mb_width) |
| @@ -120,7 +120,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 1 unmodified line | ||
| 120 | 120 | for (mb_y = 0; mb_y < s->mb_height; mb_y++) |
| 121 | 121 | for (mb_x = 0; mb_x < s->mb_width; mb_x++) |
| 122 | 122 | mb_type[mb_y * s->mb_stride + mb_x] = |
| 123 | − (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 123 | + (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 124 | 124 | break; |
| 125 | 125 | case SKIP_TYPE_ROW: |
| 126 | 126 | for (mb_y = 0; mb_y < s->mb_height; mb_y++) { |
| @@ -129,11 +129,11 @@ static int parse_mb_skip(WMV2DecContext *w) · 2 unmodified lines | ||
| 129 | 129 | if (get_bits1(&s->gb)) { |
| 130 | 130 | for (mb_x = 0; mb_x < s->mb_width; mb_x++) |
| 131 | 131 | mb_type[mb_y * s->mb_stride + mb_x] = |
| 132 | − MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 132 | + MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 133 | 133 | } else { |
| 134 | 134 | for (mb_x = 0; mb_x < s->mb_width; mb_x++) |
| 135 | 135 | mb_type[mb_y * s->mb_stride + mb_x] = |
| 136 | − (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 136 | + (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | break; |
| @@ -144,11 +144,11 @@ static int parse_mb_skip(WMV2DecContext *w) · 4 unmodified lines | ||
| 144 | 144 | if (get_bits1(&s->gb)) { |
| 145 | 145 | for (mb_y = 0; mb_y < s->mb_height; mb_y++) |
| 146 | 146 | mb_type[mb_y * s->mb_stride + mb_x] = |
| 147 | − MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 147 | + MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 148 | 148 | } else { |
| 149 | 149 | for (mb_y = 0; mb_y < s->mb_height; mb_y++) |
| 150 | 150 | mb_type[mb_y * s->mb_stride + mb_x] = |
| 151 | − (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; | |
| 151 | + (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV; | |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | break; |