summaryrefslogtreecommitdiff
path: root/libswscale/rgb2rgb.c
diff options
context:
space:
mode:
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r--libswscale/rgb2rgb.c13
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;