aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-07-18 00:09:37 +0000
committerPaul B Mahol <onemda@gmail.com>2012-07-18 23:47:40 +0000
commit9d8eac6899eac64ad595bfae1e5bb0ccd61d97a4 (patch)
tree07365f70427497452a053f7e69b695010bf7eb83 /libswscale
parent204c4e953d895e15ab0908d715fd46181bf32add (diff)
downloadffmpeg-9d8eac6899eac64ad595bfae1e5bb0ccd61d97a4.tar.gz
swscale: simplify unscaled rgb48<->bgr48
Using av_bswap16 should be enough.
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/colorspace-test.c4
-rw-r--r--libswscale/rgb2rgb.c17
-rw-r--r--libswscale/rgb2rgb.h4
-rw-r--r--libswscale/swscale_unscaled.c4
4 files changed, 14 insertions, 15 deletions
diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
index 440b5d369a..c88f3829b9 100644
--- a/libswscale/colorspace-test.c
+++ b/libswscale/colorspace-test.c
@@ -84,8 +84,8 @@ int main(int argc, char **argv)
FUNC(4, 2, rgb32tobgr16),
FUNC(4, 3, rgb32tobgr24),
FUNC(4, 4, shuffle_bytes_2103), /* rgb32tobgr32 */
- FUNC(6, 6, rgb48tobgr48_LL),
- FUNC(6, 6, rgb48tobgr48_LB),
+ FUNC(6, 6, rgb48tobgr48_nobswap),
+ FUNC(6, 6, rgb48tobgr48_bswap),
FUNC(0, 0, NULL)
};
int width;
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index afc8d1f3a1..58c5a750a0 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -26,7 +26,6 @@
#include <inttypes.h>
#include "libavutil/bswap.h"
-#include "libavutil/intreadwrite.h"
#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
@@ -335,20 +334,20 @@ 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) \
+#define DEFINE_RGB48TOBGR48(need_bswap, swap) \
+void rgb48tobgr48_ ## 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 >> 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 ])); \
+ d[i ] = swap ? av_bswap16(s[i + 2]) : s[i + 2]; \
+ d[i + 1] = swap ? av_bswap16(s[i + 1]) : s[i + 1]; \
+ d[i + 2] = swap ? av_bswap16(s[i ]) : s[i ]; \
} \
}
-DEFINE_RGB48TOBGR48(L, L)
-DEFINE_RGB48TOBGR48(L, B)
+DEFINE_RGB48TOBGR48(nobswap, 0)
+DEFINE_RGB48TOBGR48(bswap, 1)
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index 6e3be2a573..dd368af435 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -52,8 +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 rgb48tobgr48_LL(const uint8_t *src, uint8_t *dst, int src_size);
-void rgb48tobgr48_LB(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);
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 74767ae534..323417cc8b 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -561,11 +561,11 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
if (CONV_IS(RGB48LE, BGR48LE)
|| CONV_IS(BGR48LE, RGB48LE)
|| CONV_IS(RGB48BE, BGR48BE)
- || CONV_IS(BGR48BE, RGB48BE)) conv = rgb48tobgr48_LL;
+ || CONV_IS(BGR48BE, RGB48BE)) conv = rgb48tobgr48_nobswap;
else if (CONV_IS(RGB48LE, BGR48BE)
|| CONV_IS(BGR48LE, RGB48BE)
|| CONV_IS(RGB48BE, BGR48LE)
- || CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_LB;
+ || CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_bswap;
} else
/* BGR -> BGR */
if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||