diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2006-11-26 04:57:31 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2006-11-26 04:57:31 +0000 |
commit | 61f5b14a8e2b4f64acb6296ac64c2309e13d3ae9 (patch) | |
tree | b923832e6250f7ca90a503a210efdcfd6586910d /libavcodec | |
parent | 5081f3aad5a734df9090a6156336443b6bd2e67a (diff) | |
download | ffmpeg-streaming-61f5b14a8e2b4f64acb6296ac64c2309e13d3ae9.zip ffmpeg-streaming-61f5b14a8e2b4f64acb6296ac64c2309e13d3ae9.tar.gz |
Correct rounding values in overlap filtering
Originally committed as revision 7171 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dsputil.h | 4 | ||||
-rw-r--r-- | libavcodec/vc1.c | 56 | ||||
-rw-r--r-- | libavcodec/vc1dsp.c | 8 |
3 files changed, 36 insertions, 32 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 9d246a2..1097b87 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -397,8 +397,8 @@ typedef struct DSPContext { void (*vc1_inv_trans_8x4)(DCTELEM *b, int n); void (*vc1_inv_trans_4x8)(DCTELEM *b, int n); void (*vc1_inv_trans_4x4)(DCTELEM *b, int n); - void (*vc1_v_overlap)(uint8_t* src, int stride, int rnd); - void (*vc1_h_overlap)(uint8_t* src, int stride, int rnd); + void (*vc1_v_overlap)(uint8_t* src, int stride); + void (*vc1_h_overlap)(uint8_t* src, int stride); /* put 8x8 block with bicubic interpolation and quarterpel precision * last argument is actually round value instead of height */ diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index d303a8d..db1a5fa 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -3397,9 +3397,9 @@ static int vc1_decode_p_mb(VC1Context *v) s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->pq >= 9 && v->overlap) { if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? (i&1) : (s->mb_x&1)); + s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? ((i&1)>>1) : (s->mb_y&1)); + s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block); @@ -3500,9 +3500,9 @@ static int vc1_decode_p_mb(VC1Context *v) s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? (i&1) : (s->mb_x&1)); + s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? ((i&1)>>1) : (s->mb_y&1)); + s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(is_coded[i]) { status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block); @@ -3769,25 +3769,25 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_put_block(v, s->block); if(v->pq >= 9 && v->overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize, 0); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize, 0); + s->dsp.vc1_h_overlap(s->dest[0], s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize, s->mb_x&1); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize, s->mb_x&1); + s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize, 1); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize, 1); + s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize, 0); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize, 0); + s->dsp.vc1_v_overlap(s->dest[0], s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize, s->mb_y&1); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize, s->mb_y&1); + s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize, 1); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize, 1); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } if(get_bits_count(&s->gb) > v->bits) { @@ -3898,25 +3898,25 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) vc1_put_block(v, s->block); if(overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize, 0); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize, 0); + s->dsp.vc1_h_overlap(s->dest[0], s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize, s->mb_x&1); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize, s->mb_x&1); + s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize, 1); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize, 1); + s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize, 0); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize, 0); + s->dsp.vc1_v_overlap(s->dest[0], s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize, s->mb_y&1); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize, s->mb_y&1); + s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize, 1); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize, 1); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } if(get_bits_count(&s->gb) > v->bits) { diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index 518a690..9139ffb 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -31,11 +31,12 @@ /** Apply overlap transform to horizontal edge */ -static void vc1_v_overlap_c(uint8_t* src, int stride, int rnd) +static void vc1_v_overlap_c(uint8_t* src, int stride) { int i; int a, b, c, d; int d1, d2; + int rnd = 1; for(i = 0; i < 8; i++) { a = src[-2*stride]; b = src[-stride]; @@ -49,16 +50,18 @@ static void vc1_v_overlap_c(uint8_t* src, int stride, int rnd) src[0] = c + d2; src[stride] = d + d1; src++; + rnd = !rnd; } } /** Apply overlap transform to vertical edge */ -static void vc1_h_overlap_c(uint8_t* src, int stride, int rnd) +static void vc1_h_overlap_c(uint8_t* src, int stride) { int i; int a, b, c, d; int d1, d2; + int rnd = 1; for(i = 0; i < 8; i++) { a = src[-2]; b = src[-1]; @@ -72,6 +75,7 @@ static void vc1_h_overlap_c(uint8_t* src, int stride, int rnd) src[0] = c + d2; src[1] = d + d1; src += stride; + rnd = !rnd; } } |