[FFmpeg-devel] [PATCH 22/26] swscale/input: add V30X input support
James Almer
jamrial at gmail.com
Tue Oct 8 05:54:00 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..3d97c555a3 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++) {
+ uint32_t pixel = AV_RL32(src + i * 4);
+ AV_WN16(dstU + i * 2, (pixel >> 2) & 0x3FFu);
+ AV_WN16(dstV + i * 2, (pixel >> 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 2d3b2b9557..719619858f 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -271,6 +271,7 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_AYUV] = { 1, 1 },
[AV_PIX_FMT_UYVA] = { 1, 1 },
[AV_PIX_FMT_VYU444] = { 1, 1 },
+ [AV_PIX_FMT_V30XLE] = { 1, 0 },
};
/**
--
2.46.2
More information about the ffmpeg-devel
mailing list