diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-19 04:19:23 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-07-19 14:59:58 +0200 |
commit | d83ab33715cbf25ed552306a436d39531b07c55b (patch) | |
tree | b87c523c92a4232ec02a9ff258000bfafd517655 | |
parent | 06190d75d09a2c2ac7d080c0633eef3fd2d51dca (diff) | |
download | ffmpeg-d83ab33715cbf25ed552306a436d39531b07c55b.tar.gz |
swscale/input: fix 16bit gbrp input
Fixes Ticket2793
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a4b55bbb6f8ba055bba1493f6872792503e47563)
Conflicts:
libswscale/input.c
-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 2def2de6c8..acf56b3404 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -724,12 +724,13 @@ static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_sr int i; const uint16_t **src = (const uint16_t **)_src; uint16_t *dst = (uint16_t *)_dst; + 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)); } } @@ -791,13 +792,14 @@ static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint16_t **src = (const uint16_t **)_src; uint16_t *dstU = (uint16_t *)_dstU; uint16_t *dstV = (uint16_t *)_dstV; + 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 |