summaryrefslogtreecommitdiff
path: root/libswscale/rgb2rgb.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2017-08-23 14:19:14 +0200
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2017-08-24 12:50:06 +0200
commitcb1a3eecac2d3395bf1e26289643082b4305f86a (patch)
treeed5ea71a62f92a25cbddc4ef0a7c76ed333715c1 /libswscale/rgb2rgb.c
parent351e28f9a799d9bbbb33dd10c964dca7219fa13b (diff)
downloadffmpeg-cb1a3eecac2d3395bf1e26289643082b4305f86a.tar.gz
lsws/rgb2rgb: Add unscaled 48bit to 64bit rgb conversion.
Based on b4befca2 and 6b7849e6 by Paul B Mahol. Fixes ticket #6608.
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r--libswscale/rgb2rgb.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index f7f8188af1..04b7908b5e 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -391,3 +391,41 @@ void rgb64to48_ ## need_bswap(const uint8_t *src, \
DEFINE_RGB64TO48(nobswap, 0)
DEFINE_RGB64TO48(bswap, 1)
+
+#define DEFINE_RGB48TOBGR64(need_bswap, swap) \
+void rgb48tobgr64_ ## 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 / 6; \
+ \
+ for (i = 0; i < num_pixels; i++) { \
+ d[4 * i ] = swap ? av_bswap16(s[3 * i + 2]) : s[3 * i + 2]; \
+ d[4 * i + 1] = swap ? av_bswap16(s[3 * i + 1]) : s[3 * i + 1]; \
+ d[4 * i + 2] = swap ? av_bswap16(s[3 * i ]) : s[3 * i ]; \
+ d[4 * i + 3] = 0xFFFF; \
+ } \
+}
+
+DEFINE_RGB48TOBGR64(nobswap, 0)
+DEFINE_RGB48TOBGR64(bswap, 1)
+
+#define DEFINE_RGB48TO64(need_bswap, swap) \
+void rgb48to64_ ## 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 / 6; \
+ \
+ for (i = 0; i < num_pixels; i++) { \
+ d[4 * i ] = swap ? av_bswap16(s[3 * i ]) : s[3 * i ]; \
+ d[4 * i + 1] = swap ? av_bswap16(s[3 * i + 1]) : s[3 * i + 1]; \
+ d[4 * i + 2] = swap ? av_bswap16(s[3 * i + 2]) : s[3 * i + 2]; \
+ d[4 * i + 3] = 0xFFFF; \
+ } \
+}
+
+DEFINE_RGB48TO64(nobswap, 0)
+DEFINE_RGB48TO64(bswap, 1)