diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 0498624c6e..7dbdd5ad8e 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -910,7 +910,7 @@ void mpeg4_encode_mb(MpegEncContext * s, int i, cbp; if(s->pict_type==B_TYPE){ - static const int mb_type_table[8]= {-1, 2, 3, 1,-1,-1,-1, 0}; /* convert from mv_dir to type */ + static const int mb_type_table[8]= {-1, 3, 2, 1,-1,-1,-1, 0}; /* convert from mv_dir to type */ int mb_type= mb_type_table[s->mv_dir]; if(s->mb_x==0){ diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 73f3a85b9d..afc3ed4044 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -383,7 +383,7 @@ static int mpeg_decode_mb(MpegEncContext *s, s->mv_type = MV_TYPE_16X16; for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { - s->mv_dir |= (MV_DIR_FORWARD >> i); + s->mv_dir |= (MV_DIR_FORWARD << i); /* MT_FRAME */ s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); @@ -401,7 +401,7 @@ static int mpeg_decode_mb(MpegEncContext *s, s->mv_type = MV_TYPE_16X8; for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { - s->mv_dir |= (MV_DIR_FORWARD >> i); + s->mv_dir |= (MV_DIR_FORWARD << i); /* MT_16X8 */ for(j=0;j<2;j++) { s->field_select[i][j] = get_bits1(&s->gb); @@ -422,7 +422,7 @@ static int mpeg_decode_mb(MpegEncContext *s, mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { - s->mv_dir |= (MV_DIR_FORWARD >> i); + s->mv_dir |= (MV_DIR_FORWARD << i); for(j=0;j<2;j++) { s->field_select[i][j] = get_bits1(&s->gb); val = mpeg_decode_motion(s, s->mpeg_f_code[i][0], @@ -442,7 +442,7 @@ static int mpeg_decode_mb(MpegEncContext *s, mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { - s->mv_dir |= (MV_DIR_FORWARD >> i); + s->mv_dir |= (MV_DIR_FORWARD << i); s->field_select[i][0] = get_bits1(&s->gb); for(k=0;k<2;k++) { val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], @@ -460,7 +460,7 @@ static int mpeg_decode_mb(MpegEncContext *s, for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { int dmx, dmy, mx, my, m; - s->mv_dir |= (MV_DIR_FORWARD >> i); + s->mv_dir |= (MV_DIR_FORWARD << i); mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); s->last_mv[i][0][0] = mx; diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 79d7b22a51..a0be12ff0f 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -562,7 +562,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, } s->f_count++; } else{ - static const int mb_type_len[4]={0,3,4,2}; //bak,for,bi + static const int mb_type_len[4]={0,4,3,2}; //bak,for,bi if(s->mv_type == MV_TYPE_16X16){ if (cbp){ // With coded bloc pattern diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index fde3aaeacd..86cd39e638 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -368,8 +368,8 @@ typedef struct MpegEncContext { uint8_t (*b_field_select_table[2][2]); int me_method; ///< ME algorithm int mv_dir; -#define MV_DIR_BACKWARD 1 -#define MV_DIR_FORWARD 2 +#define MV_DIR_FORWARD 1 +#define MV_DIR_BACKWARD 2 #define MV_DIRECT 4 ///< bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4) int mv_type; #define MV_TYPE_16X16 0 ///< 1 vector for the whole mb