[FFmpeg-devel] [PATCH v2 07/20] swscale/input: add VYU444 input support
James Almer
jamrial at gmail.com
Tue Oct 8 00:43:27 EEST 2024
Signed-off-by: James Almer <jamrial at gmail.com>
---
libswscale/input.c | 24 ++++++++++++++++++++++++
libswscale/utils.c | 1 +
2 files changed, 25 insertions(+)
diff --git a/libswscale/input.c b/libswscale/input.c
index 15b0957fce..721f3a9645 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -746,6 +746,24 @@ static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0,
}
}
+static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
+ uint32_t *unused2, void *opq)
+{
+ int i;
+ for (i = 0; i < width; i++)
+ dst[i] = src[i * 3 + 1];
+}
+
+static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
+ const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ dstU[i] = src[i * 3 + 2];
+ dstV[i] = src[i * 3];
+ }
+}
+
static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
{
@@ -1342,6 +1360,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
case AV_PIX_FMT_UYVY422:
*chrToYV12 = uyvyToUV_c;
break;
+ case AV_PIX_FMT_VYU444:
+ *chrToYV12 = vyuToUV_c;
+ break;
case AV_PIX_FMT_NV12:
case AV_PIX_FMT_NV16:
case AV_PIX_FMT_NV24:
@@ -1905,6 +1926,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
case AV_PIX_FMT_UYVY422:
*lumToYV12 = uyvyToY_c;
break;
+ case AV_PIX_FMT_VYU444:
+ *lumToYV12 = vyuToY_c;
+ break;
case AV_PIX_FMT_BGR24:
*lumToYV12 = bgr24ToY_c;
break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 978a2e1f09..9caf392993 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -270,6 +270,7 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_XV36LE] = { 1, 1 },
[AV_PIX_FMT_AYUV] = { 1, 0 },
[AV_PIX_FMT_UYVA] = { 1, 0 },
+ [AV_PIX_FMT_VYU444] = { 1, 0 },
};
/**
--
2.46.2
More information about the ffmpeg-devel
mailing list