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

These are the fate tests for the associated PR - 
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21799 for OCIO (which has now been 
approved).
They are only enabled if the OpenColorIO library (and filter) are enabled.

This is a fairly minimal set of tests, to at least confirm that things are 
working, and it doesnt crash. For a more complete set of tests see: 
https://github.com/richardssam/ffmpeg-ocio-test


>From b3876be2d187ddc4fa3f1bfd4f1e215e5f1c1dfa Mon Sep 17 00:00:00 2001
From: Sam Richards <[email protected]>
Date: Wed, 30 Sep 2026 23:11:57 +0100
Subject: [PATCH] tests/fate: add ocio filter negotiation and alpha tests

The tests are gated on the ocio filter being enabled, in the same way
as the existing frei0r ones, so they are skipped for a build without
OpenColorIO.

They use synthetic frames and two small fixtures: an identity matrix
file, and a config whose only transform computes R' = R + 0.25 * A and
A' = 0.5 * A. The transforms are exact in floating point, so the results
do not depend on the OpenColorIO version. The output is converted to
rgba so the comparison does not hash native-endian float bytes.

Covered are the default pass-through of an integer format, consecutive
filters agreeing on a format, an alpha-mode converter on the input,
opaque alpha for an input without alpha, and a transform that uses the
input alpha to compute RGB and produces its own alpha.

Signed-off-by: Sam Richards <[email protected]>
---
 tests/fate/filter-video.mak                | 28 ++++++++++++++++++++++
 tests/ocio/alpha.ocio                      |  9 +++++++
 tests/ocio/identity.spimtx                 |  3 +++
 tests/ref/fate/filter-ocio-alpha-mode      |  6 +++++
 tests/ref/fate/filter-ocio-alpha-opaque    |  6 +++++
 tests/ref/fate/filter-ocio-alpha-transform |  6 +++++
 tests/ref/fate/filter-ocio-chained         |  6 +++++
 tests/ref/fate/filter-ocio-passthrough     |  6 +++++
 tests/ref/fate/filter-ocio-yuv             |  6 +++++
 9 files changed, 76 insertions(+)
 create mode 100644 tests/ocio/alpha.ocio
 create mode 100644 tests/ocio/identity.spimtx
 create mode 100644 tests/ref/fate/filter-ocio-alpha-mode
 create mode 100644 tests/ref/fate/filter-ocio-alpha-opaque
 create mode 100644 tests/ref/fate/filter-ocio-alpha-transform
 create mode 100644 tests/ref/fate/filter-ocio-chained
 create mode 100644 tests/ref/fate/filter-ocio-passthrough
 create mode 100644 tests/ref/fate/filter-ocio-yuv

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 82ab48dc68d..0fe8aa6cf96 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -879,6 +879,34 @@ fate-filter-frei0r-filter: CMD = framecrc -lavfi 
"testsrc2=r=1:d=5,frei0r=enable
 fate-filter-frei0r-filter-unaligned: CMD = framecrc -lavfi 
"testsrc2=s=328x240:r=1:d=5,frei0r=filter_name=distort0r"
 FATE_FFMPEG += $(FATE_FILTER_FREI0R-yes)
 
+# OCIO tests use an identity transform, or a matrix that is exact in
+# floating point, so that the results do not depend on the OpenColorIO
+# version. Output is converted to rgba to keep the comparison portable.
+OCIO_IDENTITY = ocio=filetransform=$(SRC_PATH)/tests/ocio/identity.spimtx
+OCIO_ALPHA    = 
ocio=config=$(SRC_PATH)/tests/ocio/alpha.ocio:input=linear:output=alpha_test
+
+FATE_FILTER_OCIO-$(call FILTERFRAMECRC, COLOR FORMAT OCIO) += 
fate-filter-ocio-passthrough
+fate-filter-ocio-passthrough: CMD = framecrc -lavfi 
"color=c=0x4080c0:s=4x4:d=1:r=1,format=rgb24,$(OCIO_IDENTITY)"
+
+FATE_FILTER_OCIO-$(call FILTERFRAMECRC, COLOR FORMAT OCIO) += 
fate-filter-ocio-alpha-opaque
+fate-filter-ocio-alpha-opaque: CMD = framecrc -lavfi 
"color=c=0x4080c0:s=4x4:d=1:r=1,format=rgb24,$(OCIO_IDENTITY):format=rgba"
+
+FATE_FILTER_OCIO-$(call FILTERFRAMECRC, COLOR FORMAT OCIO) += 
fate-filter-ocio-alpha-transform
+fate-filter-ocio-alpha-transform: CMD = framecrc -auto_conversion_filters 
-lavfi 
"color=c=0x4080c0:s=4x4:d=1:r=1,format=gbrpf32le,$(OCIO_ALPHA):format=rgba"
+
+FATE_FILTER_OCIO-$(call FILTERFRAMECRC, COLOR FORMAT OCIO) += 
fate-filter-ocio-chained
+fate-filter-ocio-chained: CMD = framecrc -lavfi 
"color=c=0x4080c0:s=4x4:d=1:r=1,format=rgb24,$(OCIO_IDENTITY),$(OCIO_IDENTITY),format=rgb24"
+
+# YUV input needs a scaler in front of the filter, which the graph inserts
+# while the filter has delayed publishing its output formats.
+FATE_FILTER_OCIO-$(call FILTERFRAMECRC, COLOR FORMAT OCIO) += 
fate-filter-ocio-yuv
+fate-filter-ocio-yuv: CMD = framecrc -auto_conversion_filters -lavfi 
"color=c=0x4080c0:s=4x4:d=1:r=1,format=yuv420p,$(OCIO_IDENTITY)"
+
+FATE_FILTER_OCIO-$(call FILTERFRAMECRC, COLOR FORMAT OCIO SETPARAMS) += 
fate-filter-ocio-alpha-mode
+fate-filter-ocio-alpha-mode: CMD = framecrc -auto_conversion_filters -lavfi 
"color=c=0x4080c0:s=4x4:d=1:r=1,format=rgba,setparams=alpha_mode=straight,$(OCIO_IDENTITY),format=alpha_modes=premultiplied"
+
+FATE_FFMPEG += $(FATE_FILTER_OCIO-yes)
+
 FATE_FILTER_FREI0R_SRC-$(call FILTERFRAMECRC, FREI0R_SRC) = 
fate-filter-frei0r-source
 fate-filter-frei0r-source: CMD = framecrc -lavfi 
"frei0r_src=200x200:5:onecol0r:1/2/3" -frames:v 5
 FATE_FFMPEG += $(FATE_FILTER_FREI0R_SRC-yes)
diff --git a/tests/ocio/alpha.ocio b/tests/ocio/alpha.ocio
new file mode 100644
index 00000000000..b3438692997
--- /dev/null
+++ b/tests/ocio/alpha.ocio
@@ -0,0 +1,9 @@
+ocio_profile_version: 2
+roles: {default: linear}
+colorspaces:
+  - !<ColorSpace> {name: linear, bitdepth: 32f}
+  - !<ColorSpace>
+    name: alpha_test
+    bitdepth: 32f
+    from_reference: !<MatrixTransform>
+      matrix: [1, 0, 0, 0.25, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.5]
diff --git a/tests/ocio/identity.spimtx b/tests/ocio/identity.spimtx
new file mode 100644
index 00000000000..804f49700d1
--- /dev/null
+++ b/tests/ocio/identity.spimtx
@@ -0,0 +1,3 @@
+1 0 0 0
+0 1 0 0
+0 0 1 0
diff --git a/tests/ref/fate/filter-ocio-alpha-mode 
b/tests/ref/fate/filter-ocio-alpha-mode
new file mode 100644
index 00000000000..b21764679ec
--- /dev/null
+++ b/tests/ref/fate/filter-ocio-alpha-mode
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 4x4
+#sar 0: 1/1
+0,          0,          0,        1,       64, 0x912c27e0
diff --git a/tests/ref/fate/filter-ocio-alpha-opaque 
b/tests/ref/fate/filter-ocio-alpha-opaque
new file mode 100644
index 00000000000..e48a62717cf
--- /dev/null
+++ b/tests/ref/fate/filter-ocio-alpha-opaque
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 4x4
+#sar 0: 1/1
+0,          0,          0,        1,       64, 0xfe4c27f0
diff --git a/tests/ref/fate/filter-ocio-alpha-transform 
b/tests/ref/fate/filter-ocio-alpha-transform
new file mode 100644
index 00000000000..3e418ed0b46
--- /dev/null
+++ b/tests/ref/fate/filter-ocio-alpha-transform
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 4x4
+#sar 0: 1/1
+0,          0,          0,        1,       64, 0x8e1c23f0
diff --git a/tests/ref/fate/filter-ocio-chained 
b/tests/ref/fate/filter-ocio-chained
new file mode 100644
index 00000000000..18725ac5326
--- /dev/null
+++ b/tests/ref/fate/filter-ocio-chained
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 4x4
+#sar 0: 1/1
+0,          0,          0,        1,       48, 0x441e1800
diff --git a/tests/ref/fate/filter-ocio-passthrough 
b/tests/ref/fate/filter-ocio-passthrough
new file mode 100644
index 00000000000..18725ac5326
--- /dev/null
+++ b/tests/ref/fate/filter-ocio-passthrough
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 4x4
+#sar 0: 1/1
+0,          0,          0,        1,       48, 0x441e1800
diff --git a/tests/ref/fate/filter-ocio-yuv b/tests/ref/fate/filter-ocio-yuv
new file mode 100644
index 00000000000..8fa9abc16d5
--- /dev/null
+++ b/tests/ref/fate/filter-ocio-yuv
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 4x4
+#sar 0: 1/1
+0,          0,          0,        1,       48, 0x3f6617d0
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to