diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-09-19 11:41:03 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-23 09:14:10 +0200 |
| commit | aac6fad8adad9020e6a82140085091fdef2873cf (patch) | |
| tree | a8512e8f4aa8be0b234b7c1d0f993e730e3a847b /test/test.cc | |
| parent | a757fe63424074e9d3dfe7847a17bfe2b5fd93de (diff) | |
Return quite close to original approach for "no colour conversion".
There's a few things going on here:
1. Improve the regression test for 3042. Previously we made a DCP from
the reporter's _original_ prores file (before they converted it to XYZ)
and compared the result to a reference J2K file of uncertain origin.
This seems wrong because:
a) We never got confirmation from the reporter that the fix worked for
them, so any arbitrary reference is dubious.
b) It doesn't seem to reflect their actual complaint, which was that
they got a different result when making a DCP from XYZ TIFFs compared
to their "XYZ" Prores.
The new test makes a DCP from their TIFFs and "XYZ" Prores and compares
the result.
2. Revert to the old approach to "no conversion" handling. In the good
old days we did everything -> RGB48LE except XYZ12LE -> XYZ12LE, and
that's what we do again here.
3. Change the YUV->RGB conversion from Rec.601 to Rec.709 for the
"no conversion" case. This fixes the 3042 regression test.
The supposed "XYZ" Prores is yuv444p12le according to ffprobe. So I
think what we have here is actually a file that was converted to XYZ
and then back to YUV by Resolve. I experimented with using the raw
YUV values and considering them as XYZ but this was clearly wrong.
I think 3 is probably what I should have done in the first place.
Diffstat (limited to 'test/test.cc')
| -rw-r--r-- | test/test.cc | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/test/test.cc b/test/test.cc index fb5f11902..633e2df6a 100644 --- a/test/test.cc +++ b/test/test.cc @@ -823,15 +823,20 @@ check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check, int au BOOST_REQUIRE_EQUAL (WEXITSTATUS(r), 0); } + +static +shared_ptr<dcp::OpenJPEGImage> +get_dcp_frame(boost::filesystem::path dcp_dir, int64_t index) { - dcp::DCP dcp (dcp_dir); - dcp.read (); + dcp::DCP dcp(dcp_dir); + dcp.read(); auto asset = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(dcp.cpls().front()->reels().front()->main_picture()->asset()); - BOOST_REQUIRE (asset); + BOOST_REQUIRE(asset); auto frame = asset->start_read()->get_frame(index); - dcp::MonoJ2KPictureFrame ref_frame(ref); + return frame->xyz_image(); +} + - auto image = frame->xyz_image (); void check_one_frame_against_j2c(boost::filesystem::path test, int64_t test_index, boost::filesystem::path ref, int tolerance) { @@ -858,6 +863,33 @@ check_one_frame_against_j2c(boost::filesystem::path test, int64_t test_index, bo } } + +void +check_one_frame_against_dcp(boost::filesystem::path test, int64_t test_index, boost::filesystem::path ref, int64_t ref_index, int tolerance) +{ + auto test_image = get_dcp_frame(test, test_index); + auto ref_image = get_dcp_frame(ref, ref_index); + + BOOST_REQUIRE_MESSAGE( + test_image->size() == ref_image->size(), + "Reference is " << ref_image->size().width << "x" << ref_image->size().height + << ", test image is " << test_image->size().width << "x" << test_image->size().height); + + int off = 0; + for (int y = 0; y < ref_image->size().height; ++y) { + for (int x = 0; x < ref_image->size().width; ++x) { + auto x_error = std::abs(ref_image->data(0)[off] - test_image->data(0)[off]); + BOOST_REQUIRE_MESSAGE(x_error <= tolerance, "x component at " << x << "," << y << " differs by " << x_error); + auto y_error = std::abs(ref_image->data(1)[off] - test_image->data(1)[off]); + BOOST_REQUIRE_MESSAGE(y_error <= tolerance, "y component at " << x << "," << y << " differs by " << y_error); + auto z_error = std::abs(ref_image->data(2)[off] - test_image->data(2)[off]); + BOOST_REQUIRE_MESSAGE(z_error <= tolerance, "z component at " << x << "," << y << " differs by " << z_error); + ++off; + } + } +} + + boost::filesystem::path dcp_file (shared_ptr<const Film> film, string prefix) { |
