[FFmpeg-cvslog] swscale/input: add UYVA input support

James Almer git at videolan.org
Wed Oct 9 04:27:13 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Oct  6 19:43:24 2024 -0300| [ec7f5e314dbb4cd171600f1438d6e3a03c695971] | committer: James Almer

swscale/input: add UYVA input support

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec7f5e314dbb4cd171600f1438d6e3a03c695971
---

 libswscale/input.c | 15 +++++++++++++++
 libswscale/utils.c |  1 +
 2 files changed, 16 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index fd8077c455..462f0d71ea 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -736,6 +736,16 @@ static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unuse
         dst[i] = src[i * 4];
 }
 
+static void read_uyva_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];
+        dstV[i] = src[i * 4 + 2];
+    }
+}
+
 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)
 {
@@ -1476,6 +1486,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
     case AV_PIX_FMT_AYUV64LE:
         *chrToYV12 = read_ayuv64le_UV_c;
         break;
+    case AV_PIX_FMT_UYVA:
+        *chrToYV12 = read_uyva_UV_c;
+        break;
     case AV_PIX_FMT_XV36LE:
         *chrToYV12 = read_xv36le_UV_c;
         break;
@@ -1875,6 +1888,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
         *lumToYV12 = read_xv30le_Y_c;
         break;
     case AV_PIX_FMT_AYUV:
+    case AV_PIX_FMT_UYVA:
         *lumToYV12 = read_ayuv_Y_c;
         break;
     case AV_PIX_FMT_AYUV64LE:
@@ -2061,6 +2075,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
             *alpToYV12 = read_ya16be_alpha_c;
             break;
         case AV_PIX_FMT_VUYA:
+        case AV_PIX_FMT_UYVA:
             *alpToYV12 = read_vuya_A_c;
             break;
         case AV_PIX_FMT_AYUV:
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 403444b309..978a2e1f09 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -269,6 +269,7 @@ static const FormatEntry format_entries[] = {
     [AV_PIX_FMT_XV30LE]      = { 1, 1 },
     [AV_PIX_FMT_XV36LE]      = { 1, 1 },
     [AV_PIX_FMT_AYUV]        = { 1, 0 },
+    [AV_PIX_FMT_UYVA]        = { 1, 0 },
 };
 
 /**



More information about the ffmpeg-cvslog mailing list