summaryrefslogtreecommitdiff
path: root/libswscale/swscale_unscaled.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2011-12-16 23:04:30 +0100
committerJanne Grunau <janne-libav@jannau.net>2011-12-17 19:52:19 +0100
commitb4dc68803bd7fa73c2e37f55ae73b5fdb293c68d (patch)
treeb7f1a8505ac2b294f4cb2ec7a735ba489cb13b87 /libswscale/swscale_unscaled.c
parentbe1bafc303a77fa9ca5a99e36a65d5765012d3f4 (diff)
downloadffmpeg-b4dc68803bd7fa73c2e37f55ae73b5fdb293c68d.tar.gz
swscale: add endian conversion for RGB555 and RGB444 pixel formats
Add a macro to shorten the if condition.
Diffstat (limited to 'libswscale/swscale_unscaled.c')
-rw-r--r--libswscale/swscale_unscaled.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index b42854ad9f..3dc2929a5a 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -688,6 +688,12 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[
return srcSliceH;
}
+
+#define IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt) \
+ ((src_fmt == pix_fmt ## BE && dst_fmt == pix_fmt ## LE) || \
+ (src_fmt == pix_fmt ## LE && dst_fmt == pix_fmt ## BE))
+
+
void ff_get_unscaled_swscale(SwsContext *c)
{
const enum PixelFormat srcFormat = c->srcFormat;
@@ -737,16 +743,15 @@ void ff_get_unscaled_swscale(SwsContext *c)
c->swScale= rgbToRgbWrapper;
/* bswap 16 bits per pixel/component packed formats */
- if ((srcFormat == PIX_FMT_RGB48LE && dstFormat == PIX_FMT_RGB48BE) ||
- (srcFormat == PIX_FMT_RGB48BE && dstFormat == PIX_FMT_RGB48LE) ||
- (srcFormat == PIX_FMT_BGR48LE && dstFormat == PIX_FMT_BGR48BE) ||
- (srcFormat == PIX_FMT_BGR48BE && dstFormat == PIX_FMT_BGR48LE) ||
- (srcFormat == PIX_FMT_GRAY16LE && dstFormat == PIX_FMT_GRAY16BE) ||
- (srcFormat == PIX_FMT_GRAY16BE && dstFormat == PIX_FMT_GRAY16LE) ||
- (srcFormat == PIX_FMT_RGB565LE && dstFormat == PIX_FMT_RGB565BE) ||
- (srcFormat == PIX_FMT_RGB565BE && dstFormat == PIX_FMT_RGB565LE) ||
- (srcFormat == PIX_FMT_BGR565BE && dstFormat == PIX_FMT_BGR565LE) ||
- (srcFormat == PIX_FMT_BGR565LE && dstFormat == PIX_FMT_BGR565BE))
+ if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR444) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR48) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR555) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR565) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_GRAY16) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB444) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB48) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB555) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB565))
c->swScale = packed_16bpc_bswap;
if ((usePal(srcFormat) && (