[FFmpeg-devel] [PATCH 2/2] swscale: unscaled rgba64->rgb48
Paul B Mahol
onemda at gmail.com
Wed Jul 18 03:54:23 CEST 2012
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libswscale/rgb2rgb.c | 18 ++++++++++++++++++
libswscale/rgb2rgb.h | 2 ++
libswscale/swscale_unscaled.c | 8 ++++++++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index a1eab0a..f43f925 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -369,3 +369,21 @@ void rgb64tobgr48_ ## swap(const uint8_t *src, \
DEFINE_RGB64TOBGR48(0)
DEFINE_RGB64TOBGR48(1)
+
+#define DEFINE_RGB64TO48(swap) \
+void rgb64to48_ ## swap(const uint8_t *src, \
+ uint8_t *dst, int src_size) \
+{ \
+ uint16_t *d = (uint16_t *)dst; \
+ uint16_t *s = (uint16_t *)src; \
+ int i, num_pixels = src_size >> 2; \
+ \
+ for (i = 0; i < num_pixels; i++) { \
+ d[3 * i ] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
+ d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
+ d[3 * i + 2] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \
+ } \
+}
+
+DEFINE_RGB64TO48(0)
+DEFINE_RGB64TO48(1)
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index 4ce2f85..b6f1463 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -56,6 +56,8 @@ void rgb64tobgr48_0(const uint8_t *src, uint8_t *dst, int src_size);
void rgb64tobgr48_1(const uint8_t *src, uint8_t *dst, int src_size);
void rgb48tobgr48_0(const uint8_t *src, uint8_t *dst, int src_size);
void rgb48tobgr48_1(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb64to48_0(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb64to48_1(const uint8_t *src, uint8_t *dst, int src_size);
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size);
void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size);
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index bfec7b4..b133e3d 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -582,6 +582,14 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
|| CONV_IS(BGRA64LE, RGB48BE)
|| CONV_IS(RGBA64BE, BGR48LE)
|| CONV_IS(BGRA64BE, RGB48LE)) conv = rgb64tobgr48_1;
+ else if (CONV_IS(RGBA64LE, RGB48LE)
+ || CONV_IS(BGRA64LE, BGR48LE)
+ || CONV_IS(RGBA64BE, RGB48BE)
+ || CONV_IS(BGRA64BE, BGR48BE)) conv = rgb64to48_0;
+ else if (CONV_IS(RGBA64LE, RGB48BE)
+ || CONV_IS(BGRA64LE, BGR48BE)
+ || CONV_IS(RGBA64BE, RGB48LE)
+ || CONV_IS(BGRA64BE, BGR48LE)) conv = rgb64to48_1;
} else
/* BGR -> BGR */
if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||
--
1.7.7
More information about the ffmpeg-devel
mailing list