[FFmpeg-devel] [PATCH] swscale/input: add support for UYYVYY411
James Almer
jamrial at gmail.com
Thu Mar 6 19:01:13 EET 2025
Signed-off-by: James Almer <jamrial at gmail.com>
---
Untested as i don't have a camera that outputs this, and no decoder or filter
seems to generate it either, but it seemed simple enough to write.
Anyone that can use the libdc1394 device and test would be welcome.
libswscale/input.c | 23 +++++++++++++++++++++++
libswscale/utils.c | 2 +-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/libswscale/input.c b/libswscale/input.c
index dfa8ed15ab..6d600385a1 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -904,6 +904,23 @@ static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, con
av_assert1(src1 == src2);
}
+static void uyyvyyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
+ int width, uint32_t *unused, void *opq)
+{
+ for (int i = 0; i < width; i++)
+ dst[i] = src[3 * (i >> 1) + 1 + (i & 1)];
+}
+
+static void uyyvyyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused, void *opq)
+{
+ for (int i = 0; i < width; i++) {
+ dstU[i] = src1[6 * i + 0];
+ dstV[i] = src1[6 * i + 3];
+ }
+ av_assert1(src1 == src2);
+}
+
static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
const uint8_t *src, int width)
{
@@ -1714,6 +1731,9 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
case AV_PIX_FMT_UYVY422:
*chrToYV12 = uyvyToUV_c;
break;
+ case AV_PIX_FMT_UYYVYY411:
+ *chrToYV12 = uyyvyyToUV_c;
+ break;
case AV_PIX_FMT_VYU444:
*chrToYV12 = vyuToUV_c;
break;
@@ -2351,6 +2371,9 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
case AV_PIX_FMT_UYVY422:
*lumToYV12 = uyvyToY_c;
break;
+ case AV_PIX_FMT_UYYVYY411:
+ *lumToYV12 = uyyvyyToY_c;
+ break;
case AV_PIX_FMT_VYU444:
*lumToYV12 = vyuToY_c;
break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 953bf015e4..389efd7c68 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -91,7 +91,7 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_YUVJ444P] = { 1, 1 },
[AV_PIX_FMT_YVYU422] = { 1, 1 },
[AV_PIX_FMT_UYVY422] = { 1, 1 },
- [AV_PIX_FMT_UYYVYY411] = { 0, 0 },
+ [AV_PIX_FMT_UYYVYY411] = { 1, 0 },
[AV_PIX_FMT_BGR8] = { 1, 1 },
[AV_PIX_FMT_BGR4] = { 0, 1 },
[AV_PIX_FMT_BGR4_BYTE] = { 1, 1 },
--
2.48.1
More information about the ffmpeg-devel
mailing list