Browse code

Ensure that the deblock filter accesses the correct MVs for h264.

Originally committed as revision 22517 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2010/03/14 09:42:26
Showing 1 changed files
... ...
@@ -220,8 +220,11 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i
220 220
  * @param h     height in 8 pixel blocks
221 221
  */
222 222
 static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
223
-    int b_x, b_y;
223
+    int b_x, b_y, mvx_stride, mvy_stride;
224 224
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
225
+    set_mv_strides(s, &mvx_stride, &mvy_stride);
226
+    mvx_stride >>= is_luma;
227
+    mvy_stride *= mvx_stride;
225 228
 
226 229
     for(b_y=0; b_y<h; b_y++){
227 230
         for(b_x=0; b_x<w-1; b_x++){
... ...
@@ -233,8 +236,8 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
233 233
             int left_damage =  left_status&(DC_ERROR|AC_ERROR|MV_ERROR);
234 234
             int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR);
235 235
             int offset= b_x*8 + b_y*stride*8;
236
-            int16_t *left_mv=  s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ( b_x   <<(1-is_luma))];
237
-            int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))];
236
+            int16_t *left_mv=  s->current_picture.motion_val[0][mvy_stride*b_y + mvx_stride* b_x   ];
237
+            int16_t *right_mv= s->current_picture.motion_val[0][mvy_stride*b_y + mvx_stride*(b_x+1)];
238 238
 
239 239
             if(!(left_damage||right_damage)) continue; // both undamaged
240 240
 
... ...
@@ -280,8 +283,11 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
280 280
  * @param h     height in 8 pixel blocks
281 281
  */
282 282
 static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
283
-    int b_x, b_y;
283
+    int b_x, b_y, mvx_stride, mvy_stride;
284 284
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
285
+    set_mv_strides(s, &mvx_stride, &mvy_stride);
286
+    mvx_stride >>= is_luma;
287
+    mvy_stride *= mvx_stride;
285 288
 
286 289
     for(b_y=0; b_y<h-1; b_y++){
287 290
         for(b_x=0; b_x<w; b_x++){
... ...
@@ -293,8 +299,8 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
293 293
             int top_damage =      top_status&(DC_ERROR|AC_ERROR|MV_ERROR);
294 294
             int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR);
295 295
             int offset= b_x*8 + b_y*stride*8;
296
-            int16_t *top_mv=    s->current_picture.motion_val[0][s->b8_stride*( b_y   <<(1-is_luma)) + (b_x<<(1-is_luma))];
297
-            int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))];
296
+            int16_t *top_mv=    s->current_picture.motion_val[0][mvy_stride* b_y    + mvx_stride*b_x];
297
+            int16_t *bottom_mv= s->current_picture.motion_val[0][mvy_stride*(b_y+1) + mvx_stride*b_x];
298 298
 
299 299
             if(!(top_damage||bottom_damage)) continue; // both undamaged
300 300