From bb4fcfa395e3c8a985a7504aecbffb3d67368da3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 14 Mar 2010 00:42:26 +0000 Subject: [PATCH] Ensure that the deblock filter accesses the correct MVs for h264. Originally committed as revision 22517 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/error_resilience.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 4a3c6d5..135dc0a 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -220,8 +220,11 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i * @param h height in 8 pixel blocks */ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){ - int b_x, b_y; + int b_x, b_y, mvx_stride, mvy_stride; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; + set_mv_strides(s, &mvx_stride, &mvy_stride); + mvx_stride >>= is_luma; + mvy_stride *= mvx_stride; for(b_y=0; b_ycurrent_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ( b_x <<(1-is_luma))]; - int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))]; + int16_t *left_mv= s->current_picture.motion_val[0][mvy_stride*b_y + mvx_stride* b_x ]; + int16_t *right_mv= s->current_picture.motion_val[0][mvy_stride*b_y + mvx_stride*(b_x+1)]; if(!(left_damage||right_damage)) continue; // both undamaged @@ -280,8 +283,11 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st * @param h height in 8 pixel blocks */ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){ - int b_x, b_y; + int b_x, b_y, mvx_stride, mvy_stride; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; + set_mv_strides(s, &mvx_stride, &mvy_stride); + mvx_stride >>= is_luma; + mvy_stride *= mvx_stride; for(b_y=0; b_ycurrent_picture.motion_val[0][s->b8_stride*( b_y <<(1-is_luma)) + (b_x<<(1-is_luma))]; - int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))]; + int16_t *top_mv= s->current_picture.motion_val[0][mvy_stride* b_y + mvx_stride*b_x]; + int16_t *bottom_mv= s->current_picture.motion_val[0][mvy_stride*(b_y+1) + mvx_stride*b_x]; if(!(top_damage||bottom_damage)) continue; // both undamaged -- 2.7.4