diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-10-14 17:42:41 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-16 20:44:12 +0200 |
commit | 37d6b2b4e6f858a984b6af19410dc60294c98e99 (patch) | |
tree | c1f9f53f8b5c361927c4b3afb847b42c0b574894 /libswscale | |
parent | 9ec9d463650749a0c5046479e2808b622a70220d (diff) | |
download | ffmpeg-37d6b2b4e6f858a984b6af19410dc60294c98e99.tar.gz |
swsscale/swscale_unscaled: add GBRAP16
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/swscale_unscaled.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 820073c81f..83086f7865 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -394,6 +394,7 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], int alpha, int swap, int bpp, int width) { int x, h, i; + int src_alpha = src[3] != NULL; int scale_high = 16 - bpp, scale_low = (bpp - 8) * 2; for (h = 0; h < srcSliceH; h++) { uint16_t *dest = (uint16_t *)(dst + dstStride * h); @@ -401,7 +402,7 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], switch(swap) { case 3: - if (alpha) { + if (alpha && !src_alpha) { for (x = 0; x < width; x++) { component = av_bswap16(src[0][x]); *dest++ = av_bswap16(component << scale_high | component >> scale_low); @@ -411,6 +412,17 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], *dest++ = av_bswap16(component << scale_high | component >> scale_low); *dest++ = 0xffff; } + } else if (alpha && src_alpha) { + for (x = 0; x < width; x++) { + component = av_bswap16(src[0][x]); + *dest++ = av_bswap16(component << scale_high | component >> scale_low); + component = av_bswap16(src[1][x]); + *dest++ = av_bswap16(component << scale_high | component >> scale_low); + component = av_bswap16(src[2][x]); + *dest++ = av_bswap16(component << scale_high | component >> scale_low); + component = av_bswap16(src[3][x]); + *dest++ = av_bswap16(component << scale_high | component >> scale_low); + } } else { for (x = 0; x < width; x++) { component = av_bswap16(src[0][x]); @@ -423,13 +435,20 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], } break; case 2: - if (alpha) { + if (alpha && !src_alpha) { for (x = 0; x < width; x++) { *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); *dest++ = 0xffff; } + } else if (alpha && src_alpha) { + for (x = 0; x < width; x++) { + *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); + *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); + *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); + *dest++ = av_bswap16(src[3][x] << scale_high | src[3][x] >> scale_low); + } } else { for (x = 0; x < width; x++) { *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); @@ -439,13 +458,20 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], } break; case 1: - if (alpha) { + if (alpha && !src_alpha) { for (x = 0; x < width; x++) { *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; *dest++ = 0xffff; } + } else if (alpha && src_alpha) { + for (x = 0; x < width; x++) { + *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; + *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; + *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; + *dest++ = av_bswap16(src[3][x]) << scale_high | av_bswap16(src[3][x]) >> scale_low; + } } else { for (x = 0; x < width; x++) { *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; @@ -455,13 +481,20 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], } break; default: - if (alpha) { + if (alpha && !src_alpha) { for (x = 0; x < width; x++) { *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; *dest++ = 0xffff; } + } else if (alpha && src_alpha) { + for (x = 0; x < width; x++) { + *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; + *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; + *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; + *dest++ = src[3][x] << scale_high | src[3][x] >> scale_low; + } } else { for (x = 0; x < width; x++) { *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; @@ -470,7 +503,7 @@ static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], } } } - for (i = 0; i < 3; i++) + for (i = 0; i < 3 + src_alpha; i++) src[i] += srcStride[i] >> 1; } } @@ -1225,7 +1258,8 @@ void ff_get_unscaled_swscale(SwsContext *c) srcFormat == AV_PIX_FMT_GBRP16LE || srcFormat == AV_PIX_FMT_GBRP16BE || srcFormat == AV_PIX_FMT_GBRP10LE || srcFormat == AV_PIX_FMT_GBRP10BE || srcFormat == AV_PIX_FMT_GBRP12LE || srcFormat == AV_PIX_FMT_GBRP12BE || - srcFormat == AV_PIX_FMT_GBRP14LE || srcFormat == AV_PIX_FMT_GBRP14BE) && + srcFormat == AV_PIX_FMT_GBRP14LE || srcFormat == AV_PIX_FMT_GBRP14BE || + srcFormat == AV_PIX_FMT_GBRAP16LE || srcFormat == AV_PIX_FMT_GBRAP16BE) && (dstFormat == AV_PIX_FMT_RGB48LE || dstFormat == AV_PIX_FMT_RGB48BE || dstFormat == AV_PIX_FMT_BGR48LE || dstFormat == AV_PIX_FMT_BGR48BE || dstFormat == AV_PIX_FMT_RGBA64LE || dstFormat == AV_PIX_FMT_RGBA64BE || |