aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/output.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-08-19 16:53:37 -0700
committerPhilip Langdale <philipl@overt.org>2022-08-25 19:03:49 -0700
commit45726aa1177ee7d9d17435f879c96ab3537d8ad3 (patch)
treee76b5e34bdb1f288378e445027059b519c11367f /libswscale/output.c
parentcc5a5c986047d38b53c0f12a227b04487624e7cb (diff)
downloadffmpeg-45726aa1177ee7d9d17435f879c96ab3537d8ad3.tar.gz
libswscale: add support for VUYX format
As we already have support for VUYA, I figured I should do the small amount of work to support VUYX as well. That means a little refactoring to share code.
Diffstat (limited to 'libswscale/output.c')
-rw-r--r--libswscale/output.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/libswscale/output.c b/libswscale/output.c
index 74f992ae80..40a4476c6d 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2585,13 +2585,14 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter,
}
static void
-yuv2vuya_X_c(SwsContext *c, const int16_t *lumFilter,
+yuv2vuyX_X_c(SwsContext *c, const int16_t *lumFilter,
const int16_t **lumSrc, int lumFilterSize,
const int16_t *chrFilter, const int16_t **chrUSrc,
const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+ const int16_t **alpSrc, uint8_t *dest, int dstW, int y,
+ int destHasAlpha)
{
- int hasAlpha = !!alpSrc;
+ int hasAlpha = destHasAlpha && (!!alpSrc);
int i;
for (i = 0; i < dstW; i++) {
@@ -2634,10 +2635,33 @@ yuv2vuya_X_c(SwsContext *c, const int16_t *lumFilter,
dest[4 * i ] = V;
dest[4 * i + 1] = U;
dest[4 * i + 2] = Y;
- dest[4 * i + 3] = A;
+ if (destHasAlpha)
+ dest[4 * i + 3] = A;
}
}
+static void
+yuv2vuya_X_c(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+{
+ yuv2vuyX_X_c(c, lumFilter, lumSrc, lumFilterSize, chrFilter,
+ chrUSrc, chrVSrc, chrFilterSize, alpSrc, dest, dstW, y, 1);
+}
+
+static void
+yuv2vuyx_X_c(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+{
+ yuv2vuyX_X_c(c, lumFilter, lumSrc, lumFilterSize, chrFilter,
+ chrUSrc, chrVSrc, chrFilterSize, alpSrc, dest, dstW, y, 0);
+}
+
av_cold void ff_sws_init_output_funcs(SwsContext *c,
yuv2planar1_fn *yuv2plane1,
yuv2planarX_fn *yuv2planeX,
@@ -3143,5 +3167,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
case AV_PIX_FMT_VUYA:
*yuv2packedX = yuv2vuya_X_c;
break;
+ case AV_PIX_FMT_VUYX:
+ *yuv2packedX = yuv2vuyx_X_c;
+ break;
}
}