summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-27 01:27:53 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-06 23:05:15 +0100
commit73780cdb80eb3ac1f0f9d96fe6032f8a2317b01b (patch)
tree171b53d146b9eb5a0e98e90b5dbdbff6cf3a7a50 /test
parenteac3cac07eb97a6bcf6accd1575af76cd6f59112 (diff)
WIP: analyse J2K files.j2k-check
Diffstat (limited to 'test')
-rw-r--r--test/test.cc15
-rw-r--r--test/test.h1
-rw-r--r--test/verify_test.cc38
3 files changed, 54 insertions, 0 deletions
diff --git a/test/test.cc b/test/test.cc
index 7ee42cf8..1f12bee4 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -515,4 +515,19 @@ black_picture_asset (boost::filesystem::path dir, int frames)
}
+boost::filesystem::path
+find_file (boost::filesystem::path dir, string filename_part)
+{
+ boost::optional<boost::filesystem::path> found;
+ for (auto i: boost::filesystem::directory_iterator(dir)) {
+ if (i.path().filename().string().find(filename_part) != string::npos) {
+ BOOST_REQUIRE (!found);
+ found = i;
+ }
+ }
+ BOOST_REQUIRE (found);
+ return *found;
+}
+
+
BOOST_GLOBAL_FIXTURE (TestConfig);
diff --git a/test/test.h b/test/test.h
index 155c7898..57be5d11 100644
--- a/test/test.h
+++ b/test/test.h
@@ -54,6 +54,7 @@ extern std::shared_ptr<dcp::DCP> make_simple_with_interop_ccaps (boost::filesyst
extern std::shared_ptr<dcp::DCP> make_simple_with_smpte_ccaps (boost::filesystem::path path);
extern std::shared_ptr<dcp::OpenJPEGImage> black_image (dcp::Size size = dcp::Size(1998, 1080));
extern std::shared_ptr<dcp::ReelAsset> black_picture_asset (boost::filesystem::path dir, int frames = 24);
+extern boost::filesystem::path find_file (boost::filesystem::path dir, std::string filename_part);
/** Creating an object of this class will make asdcplib's random number generation
* (more) predictable.
diff --git a/test/verify_test.cc b/test/verify_test.cc
index f5a012a6..e3efb57f 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -53,6 +53,7 @@
#include "test.h"
#include "util.h"
#include "verify.h"
+#include "verify_j2k.h"
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string.hpp>
#include <cstdio>
@@ -2728,3 +2729,40 @@ BOOST_AUTO_TEST_CASE (verify_partially_encrypted)
check_verify_result ({dir}, {{dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::PARTIALLY_ENCRYPTED}});
}
+
+BOOST_AUTO_TEST_CASE (verify_jpeg2000_codestream_2k)
+{
+ vector<dcp::VerificationNote> notes;
+ dcp::MonoPictureAsset picture (find_file(private_test / "data" / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV", "j2c.mxf"));
+ auto reader = picture.start_read ();
+ auto frame = reader->get_frame (0);
+ verify_j2k (frame, notes);
+ dump_notes (notes);
+}
+
+
+BOOST_AUTO_TEST_CASE (verify_jpeg2000_codestream_4k)
+{
+ vector<dcp::VerificationNote> notes;
+ dcp::MonoPictureAsset picture (find_file(private_test / "data" / "sul", "TLR"));
+ auto reader = picture.start_read ();
+ auto frame = reader->get_frame (0);
+ verify_j2k (frame, notes);
+ dump_notes (notes);
+}
+
+
+BOOST_AUTO_TEST_CASE (verify_jpeg2000_codestream_libdcp)
+{
+ boost::filesystem::path dir = "build/test/verify_jpeg2000_codestream_libdcp";
+ prepare_directory (dir);
+ auto dcp = make_simple (dir);
+ dcp->write_xml (dcp::Standard::SMPTE);
+ vector<dcp::VerificationNote> notes;
+ dcp::MonoPictureAsset picture (find_file(dir, "video"));
+ auto reader = picture.start_read ();
+ auto frame = reader->get_frame (0);
+ verify_j2k (frame, notes);
+ dump_notes (notes);
+}
+