Paul B Mahol wrote:
---
libswscale/rgb2rgb.c | 15 +++++++++++++++
libswscale/rgb2rgb.h | 1 +
libswscale/swscale_unscaled.c | 1 +
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 0f07e57..5458d26 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -282,6 +282,21 @@ 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 *dest = (uint16_t*)dst;
+ uint16_t *sour = (uint16_t*)src;
looks a bit ugly to me, we don't want the code to go "sour", do we?
+ int i;
+ int num_pixels = src_size>> 1;
+
+ for (i = 0; i< num_pixels; i++) {
give operators room to breathe and don't do double spaces:
"i < num_pixels"
+ unsigned br;
+ unsigned rgb = sour[i];
+ br = rgb& 0x0F0F;
same here, also you could do:
...
unsigned br = rgb & 0x0F0F;
+ dest[i] = (br>> 8) | (rgb& 0x00F0) | (br<< 8);
same here for spaces
+ }
+}
+
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 833a984..bfb85d7 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 5769548..a1b7199 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;
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel