diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-01-11 19:19:00 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-01-11 15:52:53 -0800 |
commit | f7f3563214a4deb4bf664057a4cce0c4bf0bdb02 (patch) | |
tree | 4c0ba554107123e29aabbdb6298d8ba4ca219dac /libswscale/rgb2rgb.c | |
parent | b5fc571e4f730579f328ae9cf77435cb7fddc53d (diff) | |
download | ffmpeg-f7f3563214a4deb4bf664057a4cce0c4bf0bdb02.tar.gz |
rgb2rgb: rgb12tobgr12()
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r-- | libswscale/rgb2rgb.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 0f07e57683..9fbb6cfd60 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -282,6 +282,19 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size) } } +void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size) +{ + uint16_t *d = (uint16_t*)dst; + uint16_t *s = (uint16_t*)src; + int i; + int num_pixels = src_size >> 1; + + for (i = 0; i < num_pixels; i++) { + unsigned rgb = s[i]; + d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF; + } +} + void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size) { int i; |