aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-01-11 19:19:00 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2012-01-11 15:52:53 -0800
commitf7f3563214a4deb4bf664057a4cce0c4bf0bdb02 (patch)
tree4c0ba554107123e29aabbdb6298d8ba4ca219dac
parentb5fc571e4f730579f328ae9cf77435cb7fddc53d (diff)
downloadffmpeg-f7f3563214a4deb4bf664057a4cce0c4bf0bdb02.tar.gz
rgb2rgb: rgb12tobgr12()
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
-rw-r--r--libswscale/rgb2rgb.c13
-rw-r--r--libswscale/rgb2rgb.h1
-rw-r--r--libswscale/swscale_unscaled.c1
3 files changed, 15 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;
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index 833a984cec..bfb85d722f 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -62,6 +62,7 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size);
void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size);
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size);
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size);
void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size);
void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 57695483ea..a1b7199a23 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -400,6 +400,7 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
} else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
switch (srcId | (dstId << 16)) {
+ case 0x000C000C: conv = rgb12tobgr12; break;
case 0x000F000F: conv = rgb15tobgr15; break;
case 0x000F0010: conv = rgb16tobgr15; break;
case 0x000F0018: conv = rgb24tobgr15; break;