diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-19 04:19:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-19 12:49:27 +0200 |
commit | a4b55bbb6f8ba055bba1493f6872792503e47563 (patch) | |
tree | 0a1035d872c78a0abbd24dec5bdb8e5efcb29ac4 /libswscale | |
parent | 72f5a6d0672ab02f19865966af28f027b839a222 (diff) | |
download | ffmpeg-a4b55bbb6f8ba055bba1493f6872792503e47563.tar.gz |
swscale/input: fix 16bit gbrp input
Fixes Ticket2793
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/input.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libswscale/input.c b/libswscale/input.c index 35caa322ee..8016c307c6 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -754,12 +754,13 @@ static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_sr const uint16_t **src = (const uint16_t **)_src; uint16_t *dst = (uint16_t *)_dst; int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX]; + int shift = bpc < 16 ? bpc : 14; for (i = 0; i < width; i++) { int g = rdpx(src[0] + i); int b = rdpx(src[1] + i); int r = rdpx(src[2] + i); - dst[i] = ((ry*r + gy*g + by*b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + bpc - 14)); + dst[i] = ((ry*r + gy*g + by*b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + shift - 14)); } } @@ -773,13 +774,14 @@ static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV, uint16_t *dstV = (uint16_t *)_dstV; int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; + int shift = bpc < 16 ? bpc : 14; for (i = 0; i < width; i++) { int g = rdpx(src[0] + i); int b = rdpx(src[1] + i); int r = rdpx(src[2] + i); - dstU[i] = (ru*r + gu*g + bu*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + bpc - 14); - dstV[i] = (rv*r + gv*g + bv*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + bpc - 14); + dstU[i] = (ru*r + gu*g + bu*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + shift - 14); + dstV[i] = (rv*r + gv*g + bv*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + shift - 14); } } #undef rdpx |