summaryrefslogtreecommitdiff
path: root/libswscale/rgb2rgb.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-01-12 20:28:47 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2012-01-12 16:43:17 -0800
commit0cc1a86dc34b020d857f946e47edf9e425274330 (patch)
tree9164db0fea530ad8f4ddde01f2ea6c41bb0683b3 /libswscale/rgb2rgb.c
parent06b0246da07e7c9d95476b35275a63cd6dbc300c (diff)
rgb2rgb: rgb12to15()
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r--libswscale/rgb2rgb.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 9fbb6cfd60..47b06f53fc 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;