summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrun/tests2
-rw-r--r--src/lib/dcp_video.cc3
-rw-r--r--test/3042_regression_test.cc39
-rw-r--r--test/j2k_encoder_test.cc2
-rw-r--r--test/test.cc8
-rw-r--r--test/test.h2
-rw-r--r--test/wscript1
7 files changed, 49 insertions, 8 deletions
diff --git a/run/tests b/run/tests
index 520d5dbaf..c32565d73 100755
--- a/run/tests
+++ b/run/tests
@@ -3,7 +3,7 @@
# e.g. --run_tests=foo
set -e
-PRIVATE_GIT="083f563af5a4b21a91aa4ea9e2749aa4f0e1bcb2"
+PRIVATE_GIT="9c5ab14355ba4abb93d855ca1796bf80c4e1b153"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $DIR/environment
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc
index a7a360cb3..525a755b8 100644
--- a/src/lib/dcp_video.cc
+++ b/src/lib/dcp_video.cc
@@ -101,8 +101,8 @@ DCPVideo::convert_to_xyz(shared_ptr<const PlayerVideo> frame)
{
shared_ptr<dcp::OpenJPEGImage> xyz;
- auto image = frame->image(bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
if (frame->colour_conversion()) {
+ auto image = frame->image([](AVPixelFormat) { return AV_PIX_FMT_RGB48LE; }, VideoRange::FULL, false);
xyz = dcp::rgb_to_xyz(
image->data()[0],
image->size(),
@@ -110,6 +110,7 @@ DCPVideo::convert_to_xyz(shared_ptr<const PlayerVideo> frame)
frame->colour_conversion().get()
);
} else {
+ auto image = frame->image([](AVPixelFormat) { return AV_PIX_FMT_XYZ12LE; }, VideoRange::FULL, false);
xyz = make_shared<dcp::OpenJPEGImage>(image->data()[0], image->size(), image->stride()[0]);
}
diff --git a/test/3042_regression_test.cc b/test/3042_regression_test.cc
new file mode 100644
index 000000000..000fb6001
--- /dev/null
+++ b/test/3042_regression_test.cc
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2025 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "lib/content_factory.h"
+#include "lib/film.h"
+#include "lib/video_content.h"
+#include "test.h"
+#include <boost/test/unit_test.hpp>
+
+
+BOOST_AUTO_TEST_CASE(encode_xyz_from_prores_test)
+{
+ auto content = content_factory(TestPaths::private_data() / "dcp-o-matic_test_20250521_p3d65.mov")[0];
+ auto film = new_test_film("encode_xyz_from_prores_test", { content });
+ content->video->unset_colour_conversion();
+
+ make_and_verify_dcp(film);
+
+ check_one_frame(film->dir(film->dcp_name()), 0, TestPaths::private_data() / "dcp-o-matic_test_20250521_p3d65_frame0.j2c", 18);
+}
+
diff --git a/test/j2k_encoder_test.cc b/test/j2k_encoder_test.cc
index 358ccf435..1726419c1 100644
--- a/test/j2k_encoder_test.cc
+++ b/test/j2k_encoder_test.cc
@@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(j2k_encoder_deadlock_test)
Eyes::BOTH,
Part::WHOLE,
optional<ColourConversion>(),
- VideoRange::VIDEO,
+ VideoRange::FULL,
weak_ptr<Content>(),
optional<dcpomatic::ContentTime>(),
false
diff --git a/test/test.cc b/test/test.cc
index f518cdccc..c55025650 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -827,7 +827,7 @@ check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check, int au
}
void
-check_one_frame (boost::filesystem::path dcp_dir, int64_t index, boost::filesystem::path ref)
+check_one_frame(boost::filesystem::path dcp_dir, int64_t index, boost::filesystem::path ref, int tolerance)
{
dcp::DCP dcp (dcp_dir);
dcp.read ();
@@ -845,11 +845,11 @@ check_one_frame (boost::filesystem::path dcp_dir, int64_t index, boost::filesyst
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] - image->data(0)[off]);
- BOOST_REQUIRE_MESSAGE(x_error == 0, "x component at " << x << "," << y << " differs by " << x_error);
+ 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] - image->data(1)[off]);
- BOOST_REQUIRE_MESSAGE(y_error == 0, "y component at " << x << "," << y << " differs by " << y_error);
+ 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] - image->data(2)[off]);
- BOOST_REQUIRE_MESSAGE(z_error == 0, "z component at " << x << "," << y << " differs by " << z_error);
+ BOOST_REQUIRE_MESSAGE(z_error <= tolerance, "z component at " << x << "," << y << " differs by " << z_error);
++off;
}
}
diff --git a/test/test.h b/test/test.h
index bb92b5385..e26a0a690 100644
--- a/test/test.h
+++ b/test/test.h
@@ -72,7 +72,7 @@ extern void check_image(boost::filesystem::path ref, boost::filesystem::path che
extern boost::filesystem::path test_film_dir (std::string);
extern void write_image (std::shared_ptr<const Image> image, boost::filesystem::path file);
boost::filesystem::path dcp_file (std::shared_ptr<const Film> film, std::string prefix);
-void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref);
+void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref, int tolerance = 0);
extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
extern void make_random_file (boost::filesystem::path path, size_t size);
extern void verify_dcp(boost::filesystem::path dir, std::vector<dcp::VerificationNote::Code> ignore);
diff --git a/test/wscript b/test/wscript
index b568872a3..d9529d0b8 100644
--- a/test/wscript
+++ b/test/wscript
@@ -46,6 +46,7 @@ def build(bld):
obj.source = """
2536_regression_test.cc
2986_regression_test.cc
+ 3042_regression_test.cc
4k_test.cc
analytics_test.cc
atmos_test.cc