From ea05edc9e0504bcbc5e0a9afd750a6c3ce0d3bd5 Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 7 Oct 2024 00:06:41 -0300 Subject: [PATCH] swscale/input: add VYU444 input support Signed-off-by: James Almer --- libswscale/input.c | 24 ++++++++++++++++++++++++ libswscale/utils.c | 1 + 2 files changed, 25 insertions(+) diff --git a/libswscale/input.c b/libswscale/input.c index 462f0d71ea..7237333e56 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 }, }; /**