[FFmpeg-devel] [PATCH 01/21] swscale/input: add AYUV input support

James Almer jamrial at gmail.com
Wed Oct 9 01:50:06 EEST 2024


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libswscale/input.c | 35 +++++++++++++++++++++++++++++++++++
 libswscale/utils.c |  1 +
 2 files changed, 36 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 2a7a6c91dd..fd8077c455 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -710,6 +710,32 @@ static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unuse
         dst[i] = src[i * 4 + 3];
 }
 
+static void read_ayuv_UV_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 * 4 + 2];
+        dstV[i] = src[i * 4 + 3];
+    }
+}
+
+static void read_ayuv_Y_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 * 4 + 1];
+}
+
+static void read_ayuv_A_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 * 4];
+}
+
 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)
 {
@@ -1444,6 +1470,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
     case AV_PIX_FMT_XV30LE:
         *chrToYV12 = read_xv30le_UV_c;
         break;
+    case AV_PIX_FMT_AYUV:
+        *chrToYV12 = read_ayuv_UV_c;
+        break;
     case AV_PIX_FMT_AYUV64LE:
         *chrToYV12 = read_ayuv64le_UV_c;
         break;
@@ -1845,6 +1874,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
     case AV_PIX_FMT_XV30LE:
         *lumToYV12 = read_xv30le_Y_c;
         break;
+    case AV_PIX_FMT_AYUV:
+        *lumToYV12 = read_ayuv_Y_c;
+        break;
     case AV_PIX_FMT_AYUV64LE:
         *lumToYV12 = read_ayuv64le_Y_c;
         break;
@@ -2031,6 +2063,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
         case AV_PIX_FMT_VUYA:
             *alpToYV12 = read_vuya_A_c;
             break;
+        case AV_PIX_FMT_AYUV:
+            *alpToYV12 = read_ayuv_A_c;
+            break;
         case AV_PIX_FMT_AYUV64LE:
             *alpToYV12 = read_ayuv64le_A_c;
             break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 642e34c46c..403444b309 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -268,6 +268,7 @@ static const FormatEntry format_entries[] = {
     [AV_PIX_FMT_RGBAF16LE]   = { 1, 0 },
     [AV_PIX_FMT_XV30LE]      = { 1, 1 },
     [AV_PIX_FMT_XV36LE]      = { 1, 1 },
+    [AV_PIX_FMT_AYUV]        = { 1, 0 },
 };
 
 /**
-- 
2.46.2



More information about the ffmpeg-devel mailing list