Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc
@ 2025-03-04 21:47 James Almer
  2025-03-08  1:28 ` Michael Niedermayer
  0 siblings, 1 reply; 3+ messages in thread
From: James Almer @ 2025-03-04 21:47 UTC (permalink / raw)
  To: ffmpeg-devel

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/drawutils.c    |  4 ++++
 libavfilter/vsrc_testsrc.c | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index b86f666f1f..299eb0fd93 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -89,6 +89,10 @@ int ff_fill_ayuv_map(uint8_t *ayuv_map, enum AVPixelFormat pix_fmt)
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
     if (desc->flags & AV_PIX_FMT_FLAG_RGB)
         return AVERROR(EINVAL);
+    if (desc->comp[0].plane == desc->comp[1].plane ||
+        desc->comp[0].plane == desc->comp[2].plane ||
+        desc->comp[1].plane == desc->comp[2].plane)
+        return AVERROR(EINVAL);
     return fill_map(desc, ayuv_map);
 }
 
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index c842cacceb..71188e624a 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1229,6 +1229,23 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
         AV_WN16(&dstp[1][i*2 + j*dst_linesizep[1]], u);
         AV_WN16(&dstp[2][i*2 + j*dst_linesizep[2]], v);
         break;
+    case AV_PIX_FMT_NV24:
+        dstp[0][i   + j*dst_linesizep[0] + 0] = y;
+        dstp[1][i*2 + j*dst_linesizep[1] + 0] = u;
+        dstp[1][i*2 + j*dst_linesizep[1] + 1] = v;
+        break;
+    case AV_PIX_FMT_NV42:
+        dstp[0][i   + j*dst_linesizep[0] + 0] = y;
+        dstp[1][i*2 + j*dst_linesizep[1] + 1] = u;
+        dstp[1][i*2 + j*dst_linesizep[1] + 0] = v;
+        break;
+    case AV_PIX_FMT_P410:
+    case AV_PIX_FMT_P412:
+    case AV_PIX_FMT_P416:
+        AV_WN16(&dstp[0][i*2 + j*dst_linesizep[0] + 0], y << (16 - desc->comp[0].depth));
+        AV_WN16(&dstp[1][i*4 + j*dst_linesizep[1] + 0], u << (16 - desc->comp[1].depth));
+        AV_WN16(&dstp[1][i*4 + j*dst_linesizep[1] + 2], v << (16 - desc->comp[1].depth));
+        break;
     }
 }
 
@@ -1272,6 +1289,8 @@ static const enum AVPixelFormat yuvtest_pix_fmts[] = {
     AV_PIX_FMT_AYUV, AV_PIX_FMT_UYVA, AV_PIX_FMT_AYUV64,
     AV_PIX_FMT_VUYA, AV_PIX_FMT_VUYX, AV_PIX_FMT_XV48,
     AV_PIX_FMT_XV30LE, AV_PIX_FMT_V30XLE, AV_PIX_FMT_XV36,
+    AV_PIX_FMT_NV24, AV_PIX_FMT_NV42,
+    AV_PIX_FMT_P410, AV_PIX_FMT_P412, AV_PIX_FMT_P416,
     AV_PIX_FMT_NONE
 };
 
-- 
2.48.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc
  2025-03-04 21:47 [FFmpeg-devel] [PATCH] avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc James Almer
@ 2025-03-08  1:28 ` Michael Niedermayer
  2025-03-08 22:30   ` James Almer
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer @ 2025-03-08  1:28 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1535 bytes --]

On Tue, Mar 04, 2025 at 06:47:28PM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavfilter/drawutils.c    |  4 ++++
>  libavfilter/vsrc_testsrc.c | 19 +++++++++++++++++++
>  2 files changed, 23 insertions(+)

This appears to fail here:

TEST    filter-yuvtestsrc-xv36
--- ./tests/ref/fate/filter-yuvtestsrc-xv36	2025-03-03 02:22:06.094332746 +0100
+++ tests/data/fate/filter-yuvtestsrc-xv36	2025-03-08 02:23:10.325029560 +0100
@@ -3,8 +3,8 @@
 #codec_id 0: rawvideo
 #dimensions 0: 320x240
 #sar 0: 1/1
-0,          0,          0,        1,   614400, 0xdadee6db
-0,          1,          1,        1,   614400, 0xdadee6db
-0,          2,          2,        1,   614400, 0xdadee6db
-0,          3,          3,        1,   614400, 0xdadee6db
-0,          4,          4,        1,   614400, 0xdadee6db
+0,          0,          0,        1,   614400, 0x071e35fc
+0,          1,          1,        1,   614400, 0x071e35fc
+0,          2,          2,        1,   614400, 0x071e35fc
+0,          3,          3,        1,   614400, 0x071e35fc
+0,          4,          4,        1,   614400, 0x071e35fc
Test filter-yuvtestsrc-xv36 failed. Look at tests/data/fate/filter-yuvtestsrc-xv36.err for details.
make: *** [tests/Makefile:311: fate-filter-yuvtestsrc-xv36] Error 1

(thats just ubuntu x86-64)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [FFmpeg-devel] [PATCH] avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc
  2025-03-08  1:28 ` Michael Niedermayer
@ 2025-03-08 22:30   ` James Almer
  0 siblings, 0 replies; 3+ messages in thread
From: James Almer @ 2025-03-08 22:30 UTC (permalink / raw)
  To: ffmpeg-devel

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/drawutils.c               |  2 ++
 libavfilter/vsrc_testsrc.c            | 19 +++++++++++++++++++
 tests/fate/filter-video.mak           |  6 ++++++
 tests/ref/fate/filter-yuvtestsrc-nv24 | 10 ++++++++++
 tests/ref/fate/filter-yuvtestsrc-p410 | 10 ++++++++++
 5 files changed, 47 insertions(+)
 create mode 100644 tests/ref/fate/filter-yuvtestsrc-nv24
 create mode 100644 tests/ref/fate/filter-yuvtestsrc-p410

diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index b86f666f1f..c3d4bb0a25 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -39,6 +39,8 @@ static int fill_map(const AVPixFmtDescriptor *desc, uint8_t *map)
         return AVERROR(EINVAL);
     av_assert0(desc->nb_components == 3 + !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA));
     if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) {
+        if (desc->nb_components != av_pix_fmt_count_planes(av_pix_fmt_desc_get_id(desc)))
+            return AVERROR(EINVAL);
         map[RED]   = desc->comp[0].plane;
         map[GREEN] = desc->comp[1].plane;
         map[BLUE]  = desc->comp[2].plane;
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index c842cacceb..71188e624a 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1229,6 +1229,23 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
         AV_WN16(&dstp[1][i*2 + j*dst_linesizep[1]], u);
         AV_WN16(&dstp[2][i*2 + j*dst_linesizep[2]], v);
         break;
+    case AV_PIX_FMT_NV24:
+        dstp[0][i   + j*dst_linesizep[0] + 0] = y;
+        dstp[1][i*2 + j*dst_linesizep[1] + 0] = u;
+        dstp[1][i*2 + j*dst_linesizep[1] + 1] = v;
+        break;
+    case AV_PIX_FMT_NV42:
+        dstp[0][i   + j*dst_linesizep[0] + 0] = y;
+        dstp[1][i*2 + j*dst_linesizep[1] + 1] = u;
+        dstp[1][i*2 + j*dst_linesizep[1] + 0] = v;
+        break;
+    case AV_PIX_FMT_P410:
+    case AV_PIX_FMT_P412:
+    case AV_PIX_FMT_P416:
+        AV_WN16(&dstp[0][i*2 + j*dst_linesizep[0] + 0], y << (16 - desc->comp[0].depth));
+        AV_WN16(&dstp[1][i*4 + j*dst_linesizep[1] + 0], u << (16 - desc->comp[1].depth));
+        AV_WN16(&dstp[1][i*4 + j*dst_linesizep[1] + 2], v << (16 - desc->comp[1].depth));
+        break;
     }
 }
 
@@ -1272,6 +1289,8 @@ static const enum AVPixelFormat yuvtest_pix_fmts[] = {
     AV_PIX_FMT_AYUV, AV_PIX_FMT_UYVA, AV_PIX_FMT_AYUV64,
     AV_PIX_FMT_VUYA, AV_PIX_FMT_VUYX, AV_PIX_FMT_XV48,
     AV_PIX_FMT_XV30LE, AV_PIX_FMT_V30XLE, AV_PIX_FMT_XV36,
+    AV_PIX_FMT_NV24, AV_PIX_FMT_NV42,
+    AV_PIX_FMT_P410, AV_PIX_FMT_P412, AV_PIX_FMT_P416,
     AV_PIX_FMT_NONE
 };
 
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index cdd34b72ea..5d64d1e7f4 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -124,6 +124,12 @@ fate-filter-yuvtestsrc-yuv444p: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-yuv444p12
 fate-filter-yuvtestsrc-yuv444p12: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=yuv444p12,scale -pix_fmt yuv444p12le
 
+FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-nv24
+fate-filter-yuvtestsrc-nv24: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=nv24,scale -pix_fmt nv24
+
+FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-p410
+fate-filter-yuvtestsrc-p410: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=p410,scale -pix_fmt p410le
+
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-ayuv
 fate-filter-yuvtestsrc-ayuv: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt ayuv
 
diff --git a/tests/ref/fate/filter-yuvtestsrc-nv24 b/tests/ref/fate/filter-yuvtestsrc-nv24
new file mode 100644
index 0000000000..1f4affd0cf
--- /dev/null
+++ b/tests/ref/fate/filter-yuvtestsrc-nv24
@@ -0,0 +1,10 @@
+#tb 0: 1/5
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,          0,          0,        1,   230400, 0x62632a4f
+0,          1,          1,        1,   230400, 0x62632a4f
+0,          2,          2,        1,   230400, 0x62632a4f
+0,          3,          3,        1,   230400, 0x62632a4f
+0,          4,          4,        1,   230400, 0x62632a4f
diff --git a/tests/ref/fate/filter-yuvtestsrc-p410 b/tests/ref/fate/filter-yuvtestsrc-p410
new file mode 100644
index 0000000000..68199b4a15
--- /dev/null
+++ b/tests/ref/fate/filter-yuvtestsrc-p410
@@ -0,0 +1,10 @@
+#tb 0: 1/5
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,          0,          0,        1,   460800, 0x2f2d2f95
+0,          1,          1,        1,   460800, 0x2f2d2f95
+0,          2,          2,        1,   460800, 0x2f2d2f95
+0,          3,          3,        1,   460800, 0x2f2d2f95
+0,          4,          4,        1,   460800, 0x2f2d2f95
-- 
2.48.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-08 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04 21:47 [FFmpeg-devel] [PATCH] avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc James Almer
2025-03-08  1:28 ` Michael Niedermayer
2025-03-08 22:30   ` James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git