[FFmpeg-cvslog] avcodec/svq1enc: fix undefined pointer operation

Michael Niedermayer git at videolan.org
Tue Mar 25 03:45:51 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Mar 25 03:34:00 2014 +0100| [a81ee2651fafd4412d0f8df159a3a11f6365ba70] | committer: Michael Niedermayer

avcodec/svq1enc: fix undefined pointer operation

Fixes Ticket3152

This also removes the dependance on ff_init_block_index/ff_update_block_index()

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

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

 libavcodec/svq1enc.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index a4cb279..9e32040 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -258,6 +258,15 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref,
     return best_score;
 }
 
+static void init_block_index(MpegEncContext *s){
+    s->block_index[0]= s->b8_stride*(s->mb_y*2    )     + s->mb_x*2;
+    s->block_index[1]= s->b8_stride*(s->mb_y*2    ) + 1 + s->mb_x*2;
+    s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1)     + s->mb_x*2;
+    s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) + 1 + s->mb_x*2;
+    s->block_index[4]= s->mb_stride*(s->mb_y + 1)                + s->b8_stride*s->mb_height*2 + s->mb_x;
+    s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x;
+}
+
 static int svq1_encode_plane(SVQ1Context *s, int plane,
                              unsigned char *src_plane,
                              unsigned char *ref_plane,
@@ -353,8 +362,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane,
 
             for (x = 0; x < block_width; x++) {
                 s->m.mb_x = x;
-                ff_init_block_index(&s->m);
-                ff_update_block_index(&s->m);
+                init_block_index(&s->m);
 
                 ff_estimate_p_frame_motion(&s->m, x, y);
             }
@@ -394,8 +402,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane,
             }
 
             s->m.mb_x = x;
-            ff_init_block_index(&s->m);
-            ff_update_block_index(&s->m);
+            init_block_index(&s->m);
 
             if (f->pict_type == AV_PICTURE_TYPE_I ||
                 (s->m.mb_type[x + y * s->m.mb_stride] &



More information about the ffmpeg-cvslog mailing list