From 15cd0e2d8510c8375038cdfac7e8c7a42305fa72 Mon Sep 17 00:00:00 2001 From: Aura Munoz Date: Fri, 24 Nov 2023 15:24:37 +0100 Subject: [PATCH] fix(diff): Fix issue when computing perceptual diff - Fix perceptual test false positive by removing the initialization of `cr` to avoid losing the information when leaving block scope Signed-off-by: Aura Munoz --- src/idiff/idiff.cpp | 2 +- testsuite/diff/ref/out-fmt6.txt | 20 +++++++++++++++----- testsuite/diff/ref/out.txt | 20 +++++++++++++++----- testsuite/diff/run.py | 1 + 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/idiff/idiff.cpp b/src/idiff/idiff.cpp index 8b0346389e..1801a0925e 100644 --- a/src/idiff/idiff.cpp +++ b/src/idiff/idiff.cpp @@ -301,7 +301,7 @@ main(int argc, char* argv[]) int yee_failures = 0; if (perceptual && !img0.deep()) { - ImageBufAlgo::CompareResults cr; + cr = {}; yee_failures = ImageBufAlgo::compare_Yee(img0, img1, cr); } diff --git a/testsuite/diff/ref/out-fmt6.txt b/testsuite/diff/ref/out-fmt6.txt index 6a29967cf7..e488da6520 100644 --- a/testsuite/diff/ref/out-fmt6.txt +++ b/testsuite/diff/ref/out-fmt6.txt @@ -23,13 +23,23 @@ Computing perceptual diff of "img1.exr" vs "img1.exr" PASS Comparing "img1.exr" and "img2.exr" 64 x 64, 3 channels - Mean error = 0.0049235 - RMS error = 0.049616 - Peak SNR = 26.0876 - Max error = 0.5 @ (5, 17, G) values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1 - 121 pixels (2.95%) over 0.008 + Mean error = 0 + RMS error = 0 + Peak SNR = 0 + Max error = 1 @ (5, 17, R) values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1 + 0 pixels (0%) over 0.008 121 pixels (2.95%) over 0.004 121 pixels (2.9541%) failed the perceptual test FAILURE Comparing "img1.exr" and "img1.exr" PASS +Comparing "img1.exr" and "img2.exr" +64 x 64, 3 channels + Mean error = 0 + RMS error = 0 + Peak SNR = 0 + Max error = 1 @ (5, 17, R) values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1 + 0 pixels (0%) over 0.008 + 121 pixels (2.95%) over 1.0 + 121 pixels (2.9541%) failed the perceptual test +FAILURE diff --git a/testsuite/diff/ref/out.txt b/testsuite/diff/ref/out.txt index 97b19b165e..f5462e60c7 100644 --- a/testsuite/diff/ref/out.txt +++ b/testsuite/diff/ref/out.txt @@ -23,13 +23,23 @@ Computing perceptual diff of "img1.exr" vs "img1.exr" PASS Comparing "img1.exr" and "img2.exr" 64 x 64, 3 channels - Mean error = 0.0049235 - RMS error = 0.049616 - Peak SNR = 26.0876 - Max error = 0.5 @ (5, 17, G) values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1 - 121 pixels (2.95%) over 0.008 + Mean error = 0 + RMS error = 0 + Peak SNR = 0 + Max error = 1 @ (5, 17, R) values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1 + 0 pixels (0%) over 0.008 121 pixels (2.95%) over 0.004 121 pixels (2.9541%) failed the perceptual test FAILURE Comparing "img1.exr" and "img1.exr" PASS +Comparing "img1.exr" and "img2.exr" +64 x 64, 3 channels + Mean error = 0 + RMS error = 0 + Peak SNR = 0 + Max error = 1 @ (5, 17, R) values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1 + 0 pixels (0%) over 0.008 + 121 pixels (2.95%) over 1 + 121 pixels (2.9541%) failed the perceptual test +FAILURE diff --git a/testsuite/diff/run.py b/testsuite/diff/run.py index 0ba4a11193..967b2ce6e4 100644 --- a/testsuite/diff/run.py +++ b/testsuite/diff/run.py @@ -19,6 +19,7 @@ command += oiiotool("-pdiff img1.exr img1.exr") command += diff_command("img1.exr", "img2.exr", extraargs="-p") command += diff_command("img1.exr", "img1.exr", extraargs="-p") +command += diff_command("img1.exr", "img2.exr", extraargs="-p -fail 1") # Outputs to check against references