[FFmpeg-cvslog] swscale: factor shift out of DITHER_COPY().
Michael Niedermayer
git at videolan.org
Tue May 10 00:44:19 CEST 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon May 9 22:02:44 2011 +0200| [9c49ca0f19a99375dfa4fbe7cce4732667cf9ba0] | committer: Michael Niedermayer
swscale: factor shift out of DITHER_COPY().
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c49ca0f19a99375dfa4fbe7cce4732667cf9ba0
---
libswscale/swscale.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 1f476ad..d7920bf 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -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;\
}
More information about the ffmpeg-cvslog
mailing list