[FFmpeg-devel] [PATCH 04/21] swscale/input: add V30X input support

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


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

diff --git a/libswscale/input.c b/libswscale/input.c
index 7237333e56..35c1fb771e 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -764,6 +764,26 @@ static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, cons
     }
 }
 
+static void read_v30xle_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++)
+        AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
+}
+
+
+static void read_v30xle_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++) {
+        unsigned int uv = AV_RL32(src + i * 4);
+        AV_WN16(dstU + i * 2, (uv >>  2) & 0x3FFu);
+        AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
+    }
+}
+
 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)
 {
@@ -1501,6 +1521,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_V30XLE:
+        *chrToYV12 = read_v30xle_UV_c;
+        break;
     case AV_PIX_FMT_AYUV:
         *chrToYV12 = read_ayuv_UV_c;
         break;
@@ -1908,6 +1931,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_V30XLE:
+        *lumToYV12 = read_v30xle_Y_c;
+        break;
     case AV_PIX_FMT_AYUV:
     case AV_PIX_FMT_UYVA:
         *lumToYV12 = read_ayuv_Y_c;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 9caf392993..e2ad71a38d 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -271,6 +271,7 @@ static const FormatEntry format_entries[] = {
     [AV_PIX_FMT_AYUV]        = { 1, 0 },
     [AV_PIX_FMT_UYVA]        = { 1, 0 },
     [AV_PIX_FMT_VYU444]      = { 1, 0 },
+    [AV_PIX_FMT_V30XLE]      = { 1, 0 },
 };
 
 /**
-- 
2.46.2



More information about the ffmpeg-devel mailing list