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] Small fixes for the extended color primaries and transfer functions (PR #20863)
@ 2025-11-08 12:47 Lynne via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Lynne via ffmpeg-devel @ 2025-11-08 12:47 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Lynne

PR #20863 opened by Lynne
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20863
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20863.patch

This just lets them actually be used in swscale and vf_colorspace.


>From 7e9039e3e472567e8fb3df3ee89861f9915ee5a5 Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Fri, 7 Nov 2025 13:53:48 +0100
Subject: [PATCH 1/2] swscale: allow extended primaries

---
 libswscale/format.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libswscale/format.c b/libswscale/format.c
index 6aec0132be..2ae6d50523 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -546,7 +546,8 @@ int sws_test_colorspace(enum AVColorSpace csp, int output)
 
 int sws_test_primaries(enum AVColorPrimaries prim, int output)
 {
-    return prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB &&
+    return ((prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB) ||
+            (prim >= AVCOL_PRI_EXT_BASE && prim < AVCOL_PRI_EXT_NB)) &&
            prim != AVCOL_PRI_RESERVED;
 }
 
-- 
2.49.1


>From be498dfabc17bfdaca36982275e0bf166cd51abc Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Fri, 7 Nov 2025 13:24:43 +0100
Subject: [PATCH 2/2] vf_colorspace: allow for extended primaries and
 colorspace

---
 libavfilter/vf_colorspace.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 52e84abbe1..78164e1f34 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -950,7 +950,7 @@ static const AVOption colorspace_options[] = {
 
     { "primaries",  "Output color primaries",
       OFFSET(user_prm),   AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
-      AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, .unit = "prm" },
+      AVCOL_PRI_RESERVED0, AVCOL_PRI_EXT_NB - 1, FLAGS, .unit = "prm" },
     ENUM("bt709",        AVCOL_PRI_BT709,      "prm"),
     ENUM("bt470m",       AVCOL_PRI_BT470M,     "prm"),
     ENUM("bt470bg",      AVCOL_PRI_BT470BG,    "prm"),
@@ -963,10 +963,11 @@ static const AVOption colorspace_options[] = {
     ENUM("bt2020",       AVCOL_PRI_BT2020,     "prm"),
     ENUM("jedec-p22",    AVCOL_PRI_JEDEC_P22,  "prm"),
     ENUM("ebu3213",      AVCOL_PRI_EBU3213,    "prm"),
+    ENUM("vgamut",       AVCOL_PRI_V_GAMUT,    "prm"),
 
     { "trc",        "Output transfer characteristics",
       OFFSET(user_trc),   AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
-      AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, .unit = "trc" },
+      AVCOL_TRC_RESERVED0, AVCOL_TRC_EXT_NB - 1, FLAGS, .unit = "trc" },
     ENUM("bt709",        AVCOL_TRC_BT709,        "trc"),
     ENUM("bt470m",       AVCOL_TRC_GAMMA22,      "trc"),
     ENUM("gamma22",      AVCOL_TRC_GAMMA22,      "trc"),
@@ -981,6 +982,7 @@ static const AVOption colorspace_options[] = {
     ENUM("iec61966-2-4", AVCOL_TRC_IEC61966_2_4, "trc"),
     ENUM("bt2020-10",    AVCOL_TRC_BT2020_10,    "trc"),
     ENUM("bt2020-12",    AVCOL_TRC_BT2020_12,    "trc"),
+    ENUM("vlog",         AVCOL_TRC_V_LOG,        "trc"),
 
     { "format",   "Output pixel format",
       OFFSET(user_format), AV_OPT_TYPE_INT,  { .i64 = AV_PIX_FMT_NONE },
@@ -1030,10 +1032,10 @@ static const AVOption colorspace_options[] = {
       AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, .unit = "rng" },
     { "iprimaries", "Input color primaries",
       OFFSET(user_iprm),  AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
-      AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, .unit = "prm" },
+      AVCOL_PRI_RESERVED0, AVCOL_PRI_EXT_NB - 1, FLAGS, .unit = "prm" },
     { "itrc",       "Input transfer characteristics",
       OFFSET(user_itrc),  AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
-      AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, .unit = "trc" },
+      AVCOL_TRC_RESERVED0, AVCOL_TRC_EXT_NB - 1, FLAGS, .unit = "trc" },
 
     { NULL }
 };
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-08 12:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-08 12:47 [FFmpeg-devel] [PATCH] Small fixes for the extended color primaries and transfer functions (PR #20863) Lynne via ffmpeg-devel

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