mirror of https://git.ffmpeg.org/ffmpeg.git
swscale: factor shift out of DITHER_COPY().
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
300e497b5f
commit
9c49ca0f19
|
@ -1859,19 +1859,20 @@ static int packedCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[
|
|||
|
||||
#define DITHER_COPY(dst, dstStride, src, srcStride)\
|
||||
for (i = 0; i < height; i++) {\
|
||||
int shift= src_depth-dst_depth;\
|
||||
uint8_t *dither= dithers[src_depth-9][i&7];\
|
||||
for (j = 0; j < length-7; j+=8){\
|
||||
dst[j+0] = (src[j+0] + dither[0])>>(src_depth-dst_depth);\
|
||||
dst[j+1] = (src[j+1] + dither[1])>>(src_depth-dst_depth);\
|
||||
dst[j+2] = (src[j+2] + dither[2])>>(src_depth-dst_depth);\
|
||||
dst[j+3] = (src[j+3] + dither[3])>>(src_depth-dst_depth);\
|
||||
dst[j+4] = (src[j+4] + dither[4])>>(src_depth-dst_depth);\
|
||||
dst[j+5] = (src[j+5] + dither[5])>>(src_depth-dst_depth);\
|
||||
dst[j+6] = (src[j+6] + dither[6])>>(src_depth-dst_depth);\
|
||||
dst[j+7] = (src[j+7] + dither[7])>>(src_depth-dst_depth);\
|
||||
dst[j+0] = (src[j+0] + dither[0])>>shift;\
|
||||
dst[j+1] = (src[j+1] + dither[1])>>shift;\
|
||||
dst[j+2] = (src[j+2] + dither[2])>>shift;\
|
||||
dst[j+3] = (src[j+3] + dither[3])>>shift;\
|
||||
dst[j+4] = (src[j+4] + dither[4])>>shift;\
|
||||
dst[j+5] = (src[j+5] + dither[5])>>shift;\
|
||||
dst[j+6] = (src[j+6] + dither[6])>>shift;\
|
||||
dst[j+7] = (src[j+7] + dither[7])>>shift;\
|
||||
}\
|
||||
for (; j < length; j++)\
|
||||
dst[j] = (src[j] + dither[j&7])>>(src_depth-dst_depth);\
|
||||
dst[j] = (src[j] + dither[j&7])>>shift;\
|
||||
dst += dstStride;\
|
||||
src += srcStride;\
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue