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

## Summary

Add three FATE regression tests for XPSNR correctness,
covering high-bit-depth reference-plane stride handling and
activity calculation at narrow frame boundaries.

## Dependency

**Depends on FFmpeg PR #25246:**
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25246

This test-only contribution must not be merged before the
production fixes. The tests intentionally fail against the
original implementation.

## Regression coverage

| Test | Scenario | Expected result |
|---|---|---|
| `fate-filter-xpsnr-stride-10bit` | Identical 10-bit frames, 300x202 | 
Infinite Y/U/V XPSNR |
| `fate-filter-xpsnr-stride-12bit` | Identical 12-bit frames, 300x202 | 
Infinite Y/U/V XPSNR |
| `fate-filter-xpsnr-highds-edge` | 2048x1154 frame with narrow right-edge 
difference | Correct activity-weighted XPSNR |

The high-bit-depth tests detect incorrect reference-plane
stride handling.

The edge test detects the ignored return value from `highds()`
in the activity calculation.

## Validation

- All three FATE tests pass with the corrected implementation.
- All three tests fail against the original implementation.
- The `highds()` defect was independently reproduced with
  the reference-stride correction preserved.
- Invalid FFmpeg filter graphs correctly return a test failure.
- Shell syntax and Git whitespace checks pass.
- FATE dependency registration was verified.

## Scope

The contribution modifies only:

- `tests/fate-run.sh`
- `tests/fate/filter-video.mak`
- Three XPSNR FATE reference files

No production source changes are included.



>From 845cbd1a898bd4b3ee61fef92a0cf7ce066e7003 Mon Sep 17 00:00:00 2001
From: Rajesh Gopinath Kumar <[email protected]>
Date: Tue, 20 Oct 2026 07:40:13 -0500
Subject: [PATCH] fate: add XPSNR high-bit-depth stride and highds regression
 tests

Add regression coverage for incorrect reference-plane stride handling in 10-bit 
and 12-bit XPSNR calculations.

Cover the ignored highds() activity return value using a narrow right-edge 
difference.

Verify XPSNR frame metadata with reference comparisons and propagate FFmpeg 
execution failures.

Tests depend on the production fixes in FFmpeg PR #25246.
---
 tests/fate-run.sh                        | 14 ++++++++++++++
 tests/fate/filter-video.mak              | 14 ++++++++++++++
 tests/ref/fate/filter-xpsnr-highds-edge  |  4 ++++
 tests/ref/fate/filter-xpsnr-stride-10bit |  4 ++++
 tests/ref/fate/filter-xpsnr-stride-12bit |  4 ++++
 5 files changed, 40 insertions(+)
 create mode 100644 tests/ref/fate/filter-xpsnr-highds-edge
 create mode 100644 tests/ref/fate/filter-xpsnr-stride-10bit
 create mode 100644 tests/ref/fate/filter-xpsnr-stride-12bit

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 0fde5485497..e05866e9314 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -534,6 +534,20 @@ lavf_video(){
     do_avconv_crc $file -auto_conversion_filters $DEC_OPTS -i 
$target_path/$file $1
 }
 
+xpsnr_regression_metadata(){
+    graph=$1
+    fuzz=${2:-0.0001}
+    tmpfile="${outdir}/${test}.xpsnr-metadata"
+    cleanfiles="$cleanfiles $tmpfile"
+
+    ffmpeg -auto_conversion_filters $FLAGS $ENC_OPTS \
+        -lavfi "$graph" -frames:v 1 -f null /dev/null \
+        > "$tmpfile" || return 1
+
+    awk -v ref="${ref}" -v fuzz="${fuzz}" \
+        -f "${base}/refcmp-metadata.awk" "$tmpfile"
+}
+
 refcmp_metadata(){
     refcmp=$1
     pixfmt=$2
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 4a065ec0320..34ae27a4cc6 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -975,6 +975,20 @@ fate-filter-refcmp-ssim-yuv: CMD = refcmp_metadata ssim 
yuv422p 0.015
 FATE_FILTER_REFCMP_METADATA-$(call ALLYES, XPSNR_FILTER SCALE_FILTER) += 
fate-filter-refcmp-xpsnr-rgb
 fate-filter-refcmp-xpsnr-rgb: CMD = refcmp_metadata xpsnr rgb24 0.002
 
+# XPSNR regression coverage.
+FATE_FILTER_XPSNR-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SPLIT_FILTER 
XPSNR_FILTER METADATA_FILTER WRAPPED_AVFRAME_ENCODER NULL_MUXER PIPE_PROTOCOL) 
+= \
+    fate-filter-xpsnr-stride-10bit \
+    fate-filter-xpsnr-stride-12bit
+
+FATE_FILTER_XPSNR-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SPLIT_FILTER 
XPSNR_FILTER METADATA_FILTER DRAWBOX_FILTER WRAPPED_AVFRAME_ENCODER NULL_MUXER 
PIPE_PROTOCOL) += \
+    fate-filter-xpsnr-highds-edge
+
+fate-filter-xpsnr-stride-10bit: CMD = xpsnr_regression_metadata 
"testsrc2=size=300x202:rate=1:duration=1,format=yuv420p10le,split[a][b];[a][b]xpsnr,metadata=print:file=-"
+fate-filter-xpsnr-stride-12bit: CMD = xpsnr_regression_metadata 
"testsrc2=size=300x202:rate=1:duration=1,format=yuv420p12le,split[a][b];[a][b]xpsnr,metadata=print:file=-"
+fate-filter-xpsnr-highds-edge: CMD = xpsnr_regression_metadata 
"testsrc2=size=2048x1154:rate=1:duration=1,format=yuv420p,split[a][b];[b]drawbox=x=2040:y=0:w=8:h=1154:color=white:t=fill[c];[a][c]xpsnr,metadata=print:file=-"
 0.0001
+
+FATE_FILTER-yes += $(FATE_FILTER_XPSNR-yes)
+
 FATE_FILTER_REFCMP_METADATA-$(CONFIG_XPSNR_FILTER) += 
fate-filter-refcmp-xpsnr-yuv
 fate-filter-refcmp-xpsnr-yuv: CMD = refcmp_metadata xpsnr yuv422p 0.0015
 
diff --git a/tests/ref/fate/filter-xpsnr-highds-edge 
b/tests/ref/fate/filter-xpsnr-highds-edge
new file mode 100644
index 00000000000..fd77f60578e
--- /dev/null
+++ b/tests/ref/fate/filter-xpsnr-highds-edge
@@ -0,0 +1,4 @@
+frame:0    pts:0       pts_time:0
+lavfi.xpsnr.xpsnr.y=43.088905
+lavfi.xpsnr.xpsnr.u=48.019009
+lavfi.xpsnr.xpsnr.v=38.626488
diff --git a/tests/ref/fate/filter-xpsnr-stride-10bit 
b/tests/ref/fate/filter-xpsnr-stride-10bit
new file mode 100644
index 00000000000..9ce07e6f6ac
--- /dev/null
+++ b/tests/ref/fate/filter-xpsnr-stride-10bit
@@ -0,0 +1,4 @@
+frame:0    pts:0       pts_time:0
+lavfi.xpsnr.xpsnr.y=inf
+lavfi.xpsnr.xpsnr.u=inf
+lavfi.xpsnr.xpsnr.v=inf
diff --git a/tests/ref/fate/filter-xpsnr-stride-12bit 
b/tests/ref/fate/filter-xpsnr-stride-12bit
new file mode 100644
index 00000000000..9ce07e6f6ac
--- /dev/null
+++ b/tests/ref/fate/filter-xpsnr-stride-12bit
@@ -0,0 +1,4 @@
+frame:0    pts:0       pts_time:0
+lavfi.xpsnr.xpsnr.y=inf
+lavfi.xpsnr.xpsnr.u=inf
+lavfi.xpsnr.xpsnr.v=inf
-- 
2.54.0

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

Reply via email to