aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/rgb2rgb.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-07-18 01:49:52 +0000
committerPaul B Mahol <onemda@gmail.com>2012-07-19 00:17:16 +0000
commit6b7849e6da54d57d04c4816b1a0717c1527afc19 (patch)
tree063be76de3f4d327d626cb5bd08874367a873dc8 /libswscale/rgb2rgb.c
parentb4befca23e8c4fc2cd173e23d2a7c52f18cbc347 (diff)
downloadffmpeg-6b7849e6da54d57d04c4816b1a0717c1527afc19.tar.gz
swscale: unscaled rgba64->rgb48
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r--libswscale/rgb2rgb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 86e3113e42..70aaee47d8 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -369,3 +369,21 @@ void rgb64tobgr48_ ## need_bswap(const uint8_t *src, \
DEFINE_RGB64TOBGR48(nobswap, 0)
DEFINE_RGB64TOBGR48(bswap, 1)
+
+#define DEFINE_RGB64TO48(need_bswap, swap) \
+void rgb64to48_ ## 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 ]) : 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(nobswap, 0)
+DEFINE_RGB64TO48(bswap, 1)