Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-04-02 23:38:46 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 20:55:09 +0300
commit3a53f3795084afef052ca46beb51b83ffc89b988 (patch)
tree062d1beb7eca2d61def4c291b8ca7b7a1c9ab53d /libswscale
parent63c6e55edf231c2ad4915bad43f862da8be9e0e7 (diff)
swscale/yuv2rgb: Fix vertical dither offset with slices
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit be3c29e3795cb2499e3b96335286d6a8423c0bcf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/yuv2rgb.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 1fe5abed9c..9b86c4c181 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -138,10 +138,11 @@ const int *sws_getCoefficients(int colorspace)
srcStride[2] *= 2; \
} \
for (y = 0; y < srcSliceH; y += 2) { \
+ int yd = y + srcSliceY; \
dst_type *dst_1 = \
- (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]); \
+ (dst_type *)(dst[0] + (yd) * dstStride[0]); \
dst_type *dst_2 = \
- (dst_type *)(dst[0] + (y + srcSliceY + 1) * dstStride[0]); \
+ (dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \
dst_type av_unused *r, *g, *b; \
const uint8_t *py_1 = src[0] + y * srcStride[0]; \
const uint8_t *py_2 = py_1 + srcStride[0]; \
@@ -490,8 +491,8 @@ CLOSEYUV2RGBFUNC(8)
// r, g, b, dst_1, dst_2
YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
- const uint8_t *d32 = ff_dither_8x8_32[y & 7];
- const uint8_t *d64 = ff_dither_8x8_73[y & 7];
+ const uint8_t *d32 = ff_dither_8x8_32[yd & 7];
+ const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
#define PUTRGB8(dst, src, i, o) \
Y = src[2 * i]; \
@@ -520,8 +521,8 @@ YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
PUTRGB8(dst_1, py_1, 3, 6);
ENDYUV2RGBLINE(8, 0)
- const uint8_t *d32 = ff_dither_8x8_32[y & 7];
- const uint8_t *d64 = ff_dither_8x8_73[y & 7];
+ const uint8_t *d32 = ff_dither_8x8_32[yd & 7];
+ const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
LOADCHROMA(0);
PUTRGB8(dst_1, py_1, 0, 0);
PUTRGB8(dst_2, py_2, 0, 0 + 8);
@@ -531,8 +532,8 @@ ENDYUV2RGBLINE(8, 0)
PUTRGB8(dst_1, py_1, 1, 2);
ENDYUV2RGBLINE(8, 1)
- const uint8_t *d32 = ff_dither_8x8_32[y & 7];
- const uint8_t *d64 = ff_dither_8x8_73[y & 7];
+ const uint8_t *d32 = ff_dither_8x8_32[yd & 7];
+ const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
LOADCHROMA(0);
PUTRGB8(dst_1, py_1, 0, 0);
PUTRGB8(dst_2, py_2, 0, 0 + 8);
@@ -541,8 +542,8 @@ ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
- const uint8_t * d64 = ff_dither_8x8_73[y & 7];
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t * d64 = ff_dither_8x8_73[yd & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
int acc;
#define PUTRGB4D(dst, src, i, o) \
@@ -573,8 +574,8 @@ YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
PUTRGB4D(dst_1, py_1, 3, 6);
ENDYUV2RGBLINE(4, 0)
- const uint8_t * d64 = ff_dither_8x8_73[y & 7];
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t * d64 = ff_dither_8x8_73[yd & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
int acc;
LOADCHROMA(0);
PUTRGB4D(dst_1, py_1, 0, 0);
@@ -585,8 +586,8 @@ ENDYUV2RGBLINE(4, 0)
PUTRGB4D(dst_1, py_1, 1, 2);
ENDYUV2RGBLINE(4, 1)
- const uint8_t * d64 = ff_dither_8x8_73[y & 7];
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t * d64 = ff_dither_8x8_73[yd & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
int acc;
LOADCHROMA(0);
PUTRGB4D(dst_1, py_1, 0, 0);
@@ -594,8 +595,8 @@ ENDYUV2RGBLINE(4, 1)
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
- const uint8_t *d64 = ff_dither_8x8_73[y & 7];
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
#define PUTRGB4DB(dst, src, i, o) \
Y = src[2 * i]; \
@@ -623,8 +624,8 @@ YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
PUTRGB4DB(dst_2, py_2, 3, 6 + 8);
PUTRGB4DB(dst_1, py_1, 3, 6);
ENDYUV2RGBLINE(8, 0)
- const uint8_t *d64 = ff_dither_8x8_73[y & 7];
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
LOADCHROMA(0);
PUTRGB4DB(dst_1, py_1, 0, 0);
PUTRGB4DB(dst_2, py_2, 0, 0 + 8);
@@ -633,15 +634,15 @@ ENDYUV2RGBLINE(8, 0)
PUTRGB4DB(dst_2, py_2, 1, 2 + 8);
PUTRGB4DB(dst_1, py_1, 1, 2);
ENDYUV2RGBLINE(8, 1)
- const uint8_t *d64 = ff_dither_8x8_73[y & 7];
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t *d64 = ff_dither_8x8_73[yd & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
LOADCHROMA(0);
PUTRGB4DB(dst_1, py_1, 0, 0);
PUTRGB4DB(dst_2, py_2, 0, 0 + 8);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
- const uint8_t *d128 = ff_dither_8x8_220[y & 7];
+ const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
char out_1 = 0, out_2 = 0;
g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM];