diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-06-06 16:31:13 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-06-09 11:55:52 +0000 |
commit | 1d69dcb8871db06a0a84f09a9d902f93f6f5a1ce (patch) | |
tree | bbee1f60907b952826a67b769a67e84f96a0d69e /libswscale/rgb2rgb.c | |
parent | e400b95b3205d5b861346f525cf6f423d93d2f04 (diff) | |
download | ffmpeg-1d69dcb8871db06a0a84f09a9d902f93f6f5a1ce.tar.gz |
swscale: unscaled rgb48 <-> bgr48
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r-- | libswscale/rgb2rgb.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index ba7d6de7b6..afc8d1f3a1 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -26,6 +26,7 @@ #include <inttypes.h> #include "libavutil/bswap.h" +#include "libavutil/intreadwrite.h" #include "config.h" #include "rgb2rgb.h" #include "swscale.h" @@ -333,3 +334,21 @@ DEFINE_SHUFFLE_BYTES(0, 3, 2, 1) DEFINE_SHUFFLE_BYTES(1, 2, 3, 0) DEFINE_SHUFFLE_BYTES(3, 0, 1, 2) DEFINE_SHUFFLE_BYTES(3, 2, 1, 0) + +#define DEFINE_RGB48TOBGR48(ie, oe) \ +void rgb48tobgr48_ ## ie ## oe(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 >> 1; \ + \ + for (i = 0; i < num_pixels; i += 3) { \ + AV_W ## oe ## 16(&d[i ], AV_R ## ie ## 16(&s[i + 2])); \ + AV_W ## oe ## 16(&d[i + 1], AV_R ## ie ## 16(&s[i + 1])); \ + AV_W ## oe ## 16(&d[i + 2], AV_R ## ie ## 16(&s[i ])); \ + } \ +} + +DEFINE_RGB48TOBGR48(L, L) +DEFINE_RGB48TOBGR48(L, B) |