changeset 5445:5581a40c673a libavcodec

exchange the values of MV_DIR_FORWARD and MV_DIR_BACKWARD (this is more sane, matches the order of some other stuff and allows some simplifications)
author michael
date Wed, 01 Aug 2007 22:12:52 +0000
parents 38517a9edb50
children 9af99d2cce0f
files h263.c mpeg12.c mpeg12enc.c mpegvideo.h
diffstat 4 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/h263.c	Wed Aug 01 21:17:26 2007 +0000
+++ b/h263.c	Wed Aug 01 22:12:52 2007 +0000
@@ -910,7 +910,7 @@
         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){
--- a/mpeg12.c	Wed Aug 01 21:17:26 2007 +0000
+++ b/mpeg12.c	Wed Aug 01 22:12:52 2007 +0000
@@ -383,7 +383,7 @@
                     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 @@
                     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 @@
                     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 @@
                     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 @@
                 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;
--- a/mpeg12enc.c	Wed Aug 01 21:17:26 2007 +0000
+++ b/mpeg12enc.c	Wed Aug 01 22:12:52 2007 +0000
@@ -562,7 +562,7 @@
             }
             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
--- a/mpegvideo.h	Wed Aug 01 21:17:26 2007 +0000
+++ b/mpegvideo.h	Wed Aug 01 22:12:52 2007 +0000
@@ -368,8 +368,8 @@
     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