diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-01-10 17:29:16 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-01-10 18:00:38 +0000 |
commit | 4ad40d6d9f489aed3e4b283c640e81585686e4a1 (patch) | |
tree | c797923978d1eb8a4e65f556d6d7c7a4b4928b44 /libswscale/rgb2rgb.c | |
parent | 277030627d847d1478fe0d64fe7fdeb8fb7d837a (diff) | |
download | ffmpeg-4ad40d6d9f489aed3e4b283c640e81585686e4a1.tar.gz |
rgb2rgb: rgb12tobgr12()
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 5b84f89ec5..c6c1ebaaa5 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) +{ + int i; + int num_pixels = src_size >> 1; + + for (i = 0; i < num_pixels; i++) { + unsigned br; + unsigned rgb = ((const uint16_t *)src)[i]; + br = rgb & 0x0F0F; + ((uint16_t *)dst)[i] = (br >> 8) | (rgb & 0x00F0) | (br << 8); + } +} + void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size) { int i; |