aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2024-10-23 13:19:13 -0300
committerJames Almer <jamrial@gmail.com>2024-10-26 00:04:50 -0300
commita67ba3c13276cc082e650ad6df49b56268454668 (patch)
treefdc0eab97797636a3658aa60928ccfba86ad3b08 /libswscale
parent2f13f74791a207b2a6ca3e76a8e5de8c9fc7865f (diff)
downloadffmpeg-a67ba3c13276cc082e650ad6df49b56268454668.tar.gz
swscale/output: add XV48 output support
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/output.c37
-rw-r--r--libswscale/utils.c4
-rw-r--r--libswscale/version.h2
3 files changed, 27 insertions, 16 deletions
diff --git a/libswscale/output.c b/libswscale/output.c
index 0df14e99d6..b37568a10a 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2577,7 +2577,8 @@ yuv2ayuv64_X_c(SwsInternal *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, int is_be)
+ const int16_t **_alpSrc, uint8_t *dest, int dstW, int y,
+ int A_offset, int Y_offset, int U_offset, int V_offset, int is_be)
{
const int32_t **lumSrc = (const int32_t **) _lumSrc,
**chrUSrc = (const int32_t **) _chrUSrc,
@@ -2612,20 +2613,19 @@ yuv2ayuv64_X_c(SwsInternal *c, const int16_t *lumFilter,
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);
+ if (hasAlpha)
+ A = 0x8000 + av_clip_int16(A >> 15);
- output_pixels(dest + 8 * i, hasAlpha ? A : 65535);
- output_pixels(dest + 8 * i + 2, Y);
- output_pixels(dest + 8 * i + 4, U);
- output_pixels(dest + 8 * i + 6, V);
+ output_pixels(dest + 8 * i + A_offset, hasAlpha ? A : 65535);
+ output_pixels(dest + 8 * i + Y_offset, Y);
+ output_pixels(dest + 8 * i + U_offset, U);
+ output_pixels(dest + 8 * i + V_offset, V);
}
}
-#undef output_pixels
-
-#define YUV2AYUV64(BE_LE, is_be) \
+#define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
static void \
-yuv2ayuv64 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
+yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *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, \
@@ -2633,11 +2633,16 @@ yuv2ayuv64 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
{ \
yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
- alpSrc, dest, dstW, y, is_be); \
+ alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
}
-YUV2AYUV64(le, 0)
-YUV2AYUV64(be, 1)
+YUV2AYUV64(ayuv64, le, 0, 2, 4, 6, 0)
+YUV2AYUV64(ayuv64, be, 0, 2, 4, 6, 1)
+
+YUV2AYUV64(xv48, le, 6, 2, 0, 4, 0)
+YUV2AYUV64(xv48, be, 6, 2, 0, 4, 1)
+
+#undef output_pixels
static av_always_inline void
yuv2v30_X_c_template(SwsInternal *c, const int16_t *lumFilter,
@@ -3692,6 +3697,12 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
case AV_PIX_FMT_XV36BE:
*yuv2packedX = yuv2xv36be_X_c;
break;
+ case AV_PIX_FMT_XV48LE:
+ *yuv2packedX = yuv2xv48le_X_c;
+ break;
+ case AV_PIX_FMT_XV48BE:
+ *yuv2packedX = yuv2xv48be_X_c;
+ break;
case AV_PIX_FMT_Y210LE:
*yuv2packedX = yuv2y210le_X_c;
break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 004cdf749f..c49121de59 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -277,8 +277,8 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_XV30LE] = { 1, 1 },
[AV_PIX_FMT_XV36LE] = { 1, 1 },
[AV_PIX_FMT_XV36BE] = { 1, 1 },
- [AV_PIX_FMT_XV48LE] = { 1, 0 },
- [AV_PIX_FMT_XV48BE] = { 1, 0 },
+ [AV_PIX_FMT_XV48LE] = { 1, 1 },
+ [AV_PIX_FMT_XV48BE] = { 1, 1 },
[AV_PIX_FMT_AYUV] = { 1, 1 },
[AV_PIX_FMT_UYVA] = { 1, 1 },
[AV_PIX_FMT_VYU444] = { 1, 1 },
diff --git a/libswscale/version.h b/libswscale/version.h
index 109bb5cfd9..41c4181e22 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBSWSCALE_VERSION_MINOR 9
-#define LIBSWSCALE_VERSION_MICRO 100
+#define LIBSWSCALE_VERSION_MICRO 101
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \