diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-07-03 16:13:11 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-07-24 03:45:48 +0000 |
commit | 3cb8eee6f7bff275081e640b7529f90c52fb3224 (patch) | |
tree | 61df870889c6a11b2dcfed2f8e368919b7f2d33c /libswscale | |
parent | 052f64ecb2f1381e721920dd4f64fd8470c246b5 (diff) | |
download | ffmpeg-streaming-3cb8eee6f7bff275081e640b7529f90c52fb3224.zip ffmpeg-streaming-3cb8eee6f7bff275081e640b7529f90c52fb3224.tar.gz |
swscale: ayuv64le output support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/output.c | 48 | ||||
-rw-r--r-- | libswscale/utils.c | 2 |
2 files changed, 49 insertions, 1 deletions
diff --git a/libswscale/output.c b/libswscale/output.c index 1db0a51..ca60bf2 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2008,6 +2008,51 @@ yuv2ya8_X_c(SwsContext *c, const int16_t *lumFilter, } } +static void +yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter, + const int32_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int32_t **chrUSrc, + const int32_t **chrVSrc, int chrFilterSize, + const int32_t **alpSrc, uint8_t *dest, int dstW, int y) +{ + int hasAlpha = !!alpSrc; + int i; + + for (i = 0; i < dstW; i++) { + int Y = 1 << 14, U = 1 << 14; + int V = 1 << 14, A = 1 << 14; + int j; + + Y -= 0x40000000; + U -= 0x40000000; + V -= 0x40000000; + A -= 0x40000000; + + for (j = 0; j < lumFilterSize; j++) + Y += lumSrc[j][i] * (unsigned)lumFilter[j]; + + for (j = 0; j < chrFilterSize; j++) + U += chrUSrc[j][i] * (unsigned)chrFilter[j]; + + for (j = 0; j < chrFilterSize; j++) + V += chrVSrc[j][i] * (unsigned)chrFilter[j]; + + if (hasAlpha) + for (j = 0; j < lumFilterSize; j++) + A += alpSrc[j][i] * (unsigned)lumFilter[j]; + + Y = 0x8000 + av_clip_int16(Y >> 15); + U = 0x8000 + av_clip_int16(U >> 15); + V = 0x8000 + av_clip_int16(V >> 15); + A = 0x8000 + av_clip_int16(A >> 15); + + AV_WL16(dest + 8 * i, hasAlpha ? A : 65535); + AV_WL16(dest + 8 * i + 2, Y); + AV_WL16(dest + 8 * i + 4, U); + AV_WL16(dest + 8 * i + 6, V); + } +} + av_cold void ff_sws_init_output_funcs(SwsContext *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, @@ -2457,5 +2502,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, *yuv2packed2 = yuv2ya8_2_c; *yuv2packedX = yuv2ya8_X_c; break; + case AV_PIX_FMT_AYUV64LE: + *yuv2packedX = yuv2ayuv64le_X_c; + break; } } diff --git a/libswscale/utils.c b/libswscale/utils.c index 7dfd43b..565c904 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -225,7 +225,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 }, [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, [AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 }, - [AV_PIX_FMT_AYUV64LE] = { 1, 0}, + [AV_PIX_FMT_AYUV64LE] = { 1, 1}, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) |