---
 libswscale/rgb2rgb.c          |   12 ++++++++++++
 libswscale/rgb2rgb.h          |    1 +
 libswscale/swscale_unscaled.c |    1 +
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 9fbb6cf..802ed96 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -183,6 +183,18 @@ 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;
+    end = s + src_size/2;
+    while (s < end) {
+        *d++ = ((*s & 0xF00) << 3) | ((*s & 0xF0) << 2) | ((*s & 0xF) << 1);
+        s++;
+    }
+}
+
 void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
 {
     const uint16_t *end;
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index bfb85d7..42f468f 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -63,6 +63,7 @@ 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    rgb12to15(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 a1b7199..bc74df2 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -384,6 +384,7 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t 
*src[], int srcStride[],
     if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||
         (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
         switch (srcId | (dstId << 16)) {
+        case 0x000F000C: conv = rgb12to15; break;
         case 0x000F0010: conv = rgb16to15; break;
         case 0x000F0018: conv = rgb24to15; break;
         case 0x000F0020: conv = rgb32to15; break;
-- 
1.7.7

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to