[FFmpeg-cvslog] avcodec/h261enc: dont use current_mv_x/y

Michael Niedermayer git at videolan.org
Wed Nov 20 15:47:37 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 20 15:28:46 2013 +0100| [6c04c5f733d3b484ef75fc3af00c391d8db30363] | committer: Michael Niedermayer

avcodec/h261enc: dont use current_mv_x/y

Fixes -mbd rd
Fixes Ticket3151

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c04c5f733d3b484ef75fc3af00c391d8db30363
---

 libavcodec/h261enc.c |   25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index f66de4f..e185f5e 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -99,20 +99,19 @@ static void h261_encode_gob_header(MpegEncContext *s, int mb_line)
     put_bits(&s->pb, 5, s->qscale);     /* GQUANT */
     put_bits(&s->pb, 1, 0);             /* no GEI */
     s->mb_skip_run = 0;
-    h->current_mv_x = 0;
-    h->current_mv_y = 0;
+    s->last_mv[0][0][0] = 0;
+    s->last_mv[0][0][1] = 0;
 }
 
 void ff_h261_reorder_mb_index(MpegEncContext *s)
 {
-    H261Context *h = (H261Context *)s;
     int index = s->mb_x + s->mb_y * s->mb_width;
 
     if (index % 11 == 0) {
         if (index % 33 == 0)
             h261_encode_gob_header(s, 0);
-        h->current_mv_x = 0;
-        h->current_mv_y = 0;
+        s->last_mv[0][0][0] = 0;
+        s->last_mv[0][0][1] = 0;
     }
 
     /* for CIF the GOB's are fragmented in the middle of a scanline
@@ -254,8 +253,8 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
             /* skip macroblock */
             s->skip_count++;
             s->mb_skip_run++;
-            h->current_mv_x = 0;
-            h->current_mv_y = 0;
+            s->last_mv[0][0][0] = 0;
+            s->last_mv[0][0][1] = 0;
             return;
         }
     }
@@ -294,10 +293,10 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
     }
 
     if (IS_16X16(h->mtype)) {
-        mv_diff_x       = (motion_x >> 1) - h->current_mv_x;
-        mv_diff_y       = (motion_y >> 1) - h->current_mv_y;
-        h->current_mv_x = (motion_x >> 1);
-        h->current_mv_y = (motion_y >> 1);
+        mv_diff_x       = (motion_x >> 1) - s->last_mv[0][0][0];
+        mv_diff_y       = (motion_y >> 1) - s->last_mv[0][0][1];
+        s->last_mv[0][0][0] = (motion_x >> 1);
+        s->last_mv[0][0][1] = (motion_y >> 1);
         h261_encode_motion(h, mv_diff_x);
         h261_encode_motion(h, mv_diff_y);
     }
@@ -313,8 +312,8 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
         h261_encode_block(h, block[i], i);
 
     if (!IS_16X16(h->mtype)) {
-        h->current_mv_x = 0;
-        h->current_mv_y = 0;
+        s->last_mv[0][0][0] = 0;
+        s->last_mv[0][0][1] = 0;
     }
 }
 



More information about the ffmpeg-cvslog mailing list