summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-23 12:15:28 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-23 12:15:28 +0200
commit7659740008f84b27022b30ac69939c772adc1461 (patch)
treeebb2dd4a3d0466615f2752039eb5dcb777d31bb9
parent5d4ae69a80ebbf1bba4bc9605b05222bcb4b9050 (diff)
Cope with noise being added to small JPEG2000 images.
-rw-r--r--test/overlap_video_test.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/test/overlap_video_test.cc b/test/overlap_video_test.cc
index 7268070d5..724f4e75b 100644
--- a/test/overlap_video_test.cc
+++ b/test/overlap_video_test.cc
@@ -83,28 +83,32 @@ BOOST_AUTO_TEST_CASE (overlap_video_test1)
BOOST_CHECK_EQUAL (asset->intrinsic_duration(), 72);
auto reader = asset->start_read ();
+ auto close = [](int a, int b, int d) {
+ BOOST_CHECK (std::abs(a - b) < d);
+ };
+
for (int i = 0; i < 24; ++i) {
auto frame = reader->get_frame (i);
auto image = dcp::decompress_j2k(*frame.get(), 0);
- BOOST_CHECK_EQUAL (image->data(0)[0], 2808);
- BOOST_CHECK_EQUAL (image->data(1)[0], 2176);
- BOOST_CHECK_EQUAL (image->data(2)[0], 865);
+ close (image->data(0)[0], 2808, 2);
+ close (image->data(1)[0], 2176, 2);
+ close (image->data(2)[0], 865, 2);
}
for (int i = 24; i < 48; ++i) {
auto frame = reader->get_frame (i);
auto image = dcp::decompress_j2k(*frame.get(), 0);
- BOOST_CHECK_EQUAL (image->data(0)[0], 2657);
- BOOST_CHECK_EQUAL (image->data(1)[0], 3470);
- BOOST_CHECK_EQUAL (image->data(2)[0], 1742);
+ close (image->data(0)[0], 2657, 2);
+ close (image->data(1)[0], 3470, 2);
+ close (image->data(2)[0], 1742, 2);
}
for (int i = 48; i < 72; ++i) {
auto frame = reader->get_frame (i);
auto image = dcp::decompress_j2k(*frame.get(), 0);
- BOOST_CHECK_EQUAL (image->data(0)[0], 2808);
- BOOST_CHECK_EQUAL (image->data(1)[0], 2176);
- BOOST_CHECK_EQUAL (image->data(2)[0], 865);
+ close (image->data(0)[0], 2808, 2);
+ close (image->data(1)[0], 2176, 2);
+ close (image->data(2)[0], 865, 2);
}
}