aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-07-18 01:34:20 +0000
committerPaul B Mahol <onemda@gmail.com>2012-07-19 00:16:17 +0000
commitb4befca23e8c4fc2cd173e23d2a7c52f18cbc347 (patch)
treeec831eb56dbab50ba0574df9cdbf313c1ceba7a6
parent9d8eac6899eac64ad595bfae1e5bb0ccd61d97a4 (diff)
downloadffmpeg-b4befca23e8c4fc2cd173e23d2a7c52f18cbc347.tar.gz
swscale: unscaled rgba64->bgr48
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libswscale/colorspace-test.c2
-rw-r--r--libswscale/rgb2rgb.c18
-rw-r--r--libswscale/rgb2rgb.h2
-rw-r--r--libswscale/swscale_unscaled.c16
4 files changed, 38 insertions, 0 deletions
diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
index c88f3829b9..8614b2700c 100644
--- a/libswscale/colorspace-test.c
+++ b/libswscale/colorspace-test.c
@@ -86,6 +86,8 @@ int main(int argc, char **argv)
FUNC(4, 4, shuffle_bytes_2103), /* rgb32tobgr32 */
FUNC(6, 6, rgb48tobgr48_nobswap),
FUNC(6, 6, rgb48tobgr48_bswap),
+ FUNC(8, 6, rgb64tobgr48_nobswap),
+ FUNC(8, 6, rgb64tobgr48_bswap),
FUNC(0, 0, NULL)
};
int width;
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 58c5a750a0..86e3113e42 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -351,3 +351,21 @@ void rgb48tobgr48_ ## need_bswap(const uint8_t *src, \
DEFINE_RGB48TOBGR48(nobswap, 0)
DEFINE_RGB48TOBGR48(bswap, 1)
+
+#define DEFINE_RGB64TOBGR48(need_bswap, swap) \
+void rgb64tobgr48_ ## need_bswap(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 >> 3; \
+ \
+ for (i = 0; i < num_pixels; i++) { \
+ d[3 * i ] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \
+ 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 ]) : s[4 * i ]; \
+ } \
+}
+
+DEFINE_RGB64TOBGR48(nobswap, 0)
+DEFINE_RGB64TOBGR48(bswap, 1)
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index dd368af435..d4fd56a336 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -52,6 +52,8 @@ extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb64tobgr48_bswap(const uint8_t *src, uint8_t *dst, int src_size);
void rgb48tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
void rgb48tobgr48_bswap(const uint8_t *src, uint8_t *dst, int src_size);
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 323417cc8b..a78a1d8f30 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -521,6 +521,13 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
|| (x) == PIX_FMT_ABGR \
)
+#define isRGBA64(x) ( \
+ (x) == PIX_FMT_RGBA64LE \
+ || (x) == PIX_FMT_RGBA64BE \
+ || (x) == PIX_FMT_BGRA64LE \
+ || (x) == PIX_FMT_BGRA64BE \
+ )
+
#define isRGB48(x) ( \
(x) == PIX_FMT_RGB48LE \
|| (x) == PIX_FMT_RGB48BE \
@@ -566,6 +573,15 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
|| CONV_IS(BGR48LE, RGB48BE)
|| CONV_IS(RGB48BE, BGR48LE)
|| CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_bswap;
+ } else if (isRGBA64(srcFormat) && isRGB48(dstFormat)) {
+ if (CONV_IS(RGBA64LE, BGR48LE)
+ || CONV_IS(BGRA64LE, RGB48LE)
+ || CONV_IS(RGBA64BE, BGR48BE)
+ || CONV_IS(BGRA64BE, RGB48BE)) conv = rgb64tobgr48_nobswap;
+ else if (CONV_IS(RGBA64LE, BGR48BE)
+ || CONV_IS(BGRA64LE, RGB48BE)
+ || CONV_IS(RGBA64BE, BGR48LE)
+ || CONV_IS(BGRA64BE, RGB48LE)) conv = rgb64tobgr48_bswap;
} else
/* BGR -> BGR */
if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||