diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-14 02:22:09 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-14 02:22:09 +0100 |
commit | e986a5d10d95b62cd85aaefc7d4da34699fbedeb (patch) | |
tree | 38dddca2b4582111bcf1bcb6be2d1c6193300f2d /libswscale/rgb2rgb.c | |
parent | 36397ea1c7e27ab850149cc61394c2baa26dd532 (diff) | |
parent | 68d6012c723bb520daac5336dcb046c0a5dd3826 (diff) | |
download | ffmpeg-e986a5d10d95b62cd85aaefc7d4da34699fbedeb.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
FATE: add tests for targa
ARM: fix Thumb-mode simple_idct_arm
ARM: 4-byte align start of all asm functions
rgb2rgb: rgb12to15()
swscale-test: fix stack overread.
swscale: fix invalid conversions and memory problems.
cabac: split cabac.h into declarations and function definitions
cabac: Mark ff_h264_mps_state array as static, it is only used within cabac.c.
cabac: Remove ff_h264_lps_state array.
Conflicts:
libswscale/rgb2rgb.h
libswscale/swscale_unscaled.c
tests/fate/image.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r-- | libswscale/rgb2rgb.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 31ebc20a68..96559202b9 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -183,6 +183,25 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size) } } +void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size) +{ + const uint16_t *end; + uint16_t *d = (uint16_t *)dst; + const uint16_t *s = (const uint16_t *)src; + uint16_t rgb, r, g, b; + end = s + src_size / 2; + while (s < end) { + rgb = *s++; + r = rgb & 0xF00; + g = rgb & 0x0F0; + b = rgb & 0x00F; + r = (r << 3) | ((r & 0x800) >> 1); + g = (g << 2) | ((g & 0x080) >> 2); + b = (b << 1) | ( b >> 3); + *d++ = r | g | b; + } +} + void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size) { const uint16_t *end; |