From 975a1a81b28dc632d7c4bee99d5eccf09b9603d8 Mon Sep 17 00:00:00 2001 From: Jerome Borsboom Date: Wed, 20 Jun 2018 13:11:07 +0200 Subject: avcodec/vc1: fix overlap filter for frame interlaced pictures The overlap filter is not correct for vertical edges in frame interlaced I and P pictures. When filtering macroblocks with different FIELDTX values, we have to match the lines at both sides of the vertical border. In addition, we have to use the correct rounding values, depending on the line we are filtering. Signed-off-by: Jerome Borsboom --- libavcodec/vc1dsp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libavcodec/vc1dsp.c') diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index 9239a4a1f5..778b811f1a 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -107,12 +107,13 @@ static void vc1_v_s_overlap_c(int16_t *top, int16_t *bottom) } } -static void vc1_h_s_overlap_c(int16_t *left, int16_t *right) +static void vc1_h_s_overlap_c(int16_t *left, int16_t *right, int left_stride, int right_stride, int flags) { int i; int a, b, c, d; int d1, d2; - int rnd1 = 4, rnd2 = 3; + int rnd1 = flags & 2 ? 3 : 4; + int rnd2 = 7 - rnd1; for (i = 0; i < 8; i++) { a = left[6]; b = left[7]; @@ -126,10 +127,12 @@ static void vc1_h_s_overlap_c(int16_t *left, int16_t *right) right[0] = ((c << 3) + d2 + rnd1) >> 3; right[1] = ((d << 3) + d1 + rnd2) >> 3; - right += 8; - left += 8; - rnd2 = 7 - rnd2; - rnd1 = 7 - rnd1; + right += right_stride; + left += left_stride; + if (flags & 1) { + rnd2 = 7 - rnd2; + rnd1 = 7 - rnd1; + } } } -- cgit v1.2.3