# HG changeset patch # User michael # Date 1268527346 0 # Node ID b16c5c5705dfbdc4e39917b1508ee93da115ffa4 # Parent 7211254a444c3cbace6827a615c250e2b881ca0b Ensure that the deblock filter accesses the correct MVs for h264. diff -r 7211254a444c -r b16c5c5705df error_resilience.c --- a/error_resilience.c Sat Mar 13 21:12:45 2010 +0000 +++ b/error_resilience.c Sun Mar 14 00:42:26 2010 +0000 @@ -220,8 +220,11 @@ * @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 @@ * @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