diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-03-25 22:22:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-03-25 22:22:12 +0100 |
| commit | f3f92c6924c145a4995e3e7c71e237a4f6464c8f (patch) | |
| tree | fe043d4271b008ef4921b3067bc44ea131ead4ca /src/verify_j2k.cc | |
| parent | 0a87232762148a3cb97e3650fb219b3b07a05d1d (diff) | |
Check J2K Rsiz (capabilities) word.
Diffstat (limited to 'src/verify_j2k.cc')
| -rw-r--r-- | src/verify_j2k.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc index f1bed1ed..474bf2f5 100644 --- a/src/verify_j2k.cc +++ b/src/verify_j2k.cc @@ -42,6 +42,7 @@ #include "raw_convert.h" #include "verify.h" #include "verify_j2k.h" +#include <openjpeg.h> #include <fmt/format.h> #include <memory> #include <vector> @@ -165,10 +166,16 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in throw InvalidCodestream("unexpected SIZ size " + fmt::to_string(L_siz)); } - get_16(); // CA: codestream capabilities + // Codestream capabilities (CA, or Rsiz) + auto const rsiz = get_16(); auto const image_width = get_32(); auto const image_height = get_32(); auto const fourk = image_width > 2048; + if (!fourk && rsiz != OPJ_PROFILE_CINEMA_2K) { + notes.push_back({ VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_JPEG2000_RSIZ_FOR_2K, fmt::to_string(rsiz) }); + } else if (fourk && rsiz != OPJ_PROFILE_CINEMA_4K) { + notes.push_back({ VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_JPEG2000_RSIZ_FOR_4K, fmt::to_string(rsiz) }); + } require_32 (0, "invalid top-left image x coordinate %1"); require_32 (0, "invalid top-left image y coordinate %1"); auto const tile_width = get_32(); |
