[FFmpeg-devel] [PATCH 07/20] swscale/input: add VYU444 input support

James Almer jamrial at gmail.com
Mon Oct 7 15:29:42 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 3a93ac18e4..fe3e419edc 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)
 {
@@ -1336,6 +1354,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_UYVY422:
         c->chrToYV12 = uyvyToUV_c;
         break;
+    case AV_PIX_FMT_VYU444:
+        c->chrToYV12 = vyuToUV_c;
+        break;
     case AV_PIX_FMT_NV12:
     case AV_PIX_FMT_NV16:
     case AV_PIX_FMT_NV24:
@@ -1899,6 +1920,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_UYVY422:
         c->lumToYV12 = uyvyToY_c;
         break;
+    case AV_PIX_FMT_VYU444:
+        c->lumToYV12 = vyuToY_c;
+        break;
     case AV_PIX_FMT_BGR24:
         c->lumToYV12 = bgr24ToY_c;
         break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 2ddc8fa437..28861bde97 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