diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-03-31 01:42:04 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-12-15 17:13:38 +0100 |
| commit | f810421b43ca7dd36a5a863d8b456c378bad4d0f (patch) | |
| tree | acb956f9f54d2b1e0324d62b3f10105ea8f65165 /src | |
| parent | efb0c24e00196766f6bc7e3c4eca697860cc92fa (diff) | |
Use new code_block_size for JPEG2000 code block notes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/verify.cc | 7 | ||||
| -rw-r--r-- | src/verify.h | 16 | ||||
| -rw-r--r-- | src/verify_j2k.cc | 10 |
3 files changed, 25 insertions, 8 deletions
diff --git a/src/verify.cc b/src/verify.cc index 42614dfd..88103d47 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -2160,9 +2160,9 @@ dcp::note_to_string(VerificationNote note, function<string (string)> process_str case VerificationNote::Code::INVALID_JPEG2000_TILE_SIZE: return process_string("The JPEG2000 tile size is not the same as the image size."); case VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH: - return compose("The JPEG2000 codestream uses a code block width of %1 instead of 32.", note.note().get()); + return compose("The JPEG2000 codestream uses a code block width of %1 instead of 32.", note.code_block_size().get()); case VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT: - return compose("The JPEG2000 codestream uses a code block height of %1 instead of 32.", note.note().get()); + return compose("The JPEG2000 codestream uses a code block height of %1 instead of 32.", note.code_block_size().get()); case VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K: return compose("%1 POC markers found in 2K JPEG2000 codestream instead of 0.", note.note().get()); case VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K: @@ -2286,7 +2286,8 @@ dcp::operator== (dcp::VerificationNote const& a, dcp::VerificationNote const& b) a.size_in_pixels() == b.size_in_pixels() && a.size_in_bytes() == b.size_in_bytes() && a.bit_depth() == b.bit_depth() && - a.marker_position() == b.marker_position(); + a.marker_position() == b.marker_position() && + a.code_block_size() == b.code_block_size(); } diff --git a/src/verify.h b/src/verify.h index d5ed8ec5..40a701d2 100644 --- a/src/verify.h +++ b/src/verify.h @@ -386,13 +386,13 @@ public: */ INVALID_JPEG2000_TILE_SIZE, /** JPEG2000 code block width is not 32 [Bv2.1_10.2.1] - * note contains the code block width + * code_block_size contains the code block width * id contains the asset ID * reel contains the reel index (starting from 0) */ INVALID_JPEG2000_CODE_BLOCK_WIDTH, /** JPEG2000 code block height is not 32 [Bv2.1_10.2.1] - * note contains the code block height + * code_block_size contains the code block height * id contains the asset ID * reel contains the reel index (starting from 0) */ @@ -623,7 +623,8 @@ private: SIZE_IN_PIXELS, SIZE_IN_BYTES, BIT_DEPTH, - MARKER_POSITION + MARKER_POSITION, + CODE_BLOCK_SIZE }; template <class T> @@ -888,6 +889,15 @@ public: return data<int64_t>(Data::MARKER_POSITION); } + VerificationNote& set_code_block_size(int code_block_size) { + _data[Data::CODE_BLOCK_SIZE] = code_block_size; + return *this; + } + + boost::optional<int> code_block_size() const { + return data<int>(Data::CODE_BLOCK_SIZE); + } + private: Type _type; Code _code; diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc index c895dadf..c88f3fbb 100644 --- a/src/verify_j2k.cc +++ b/src/verify_j2k.cc @@ -72,6 +72,8 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in /* See ITU-T T800 (visible on https://github.com/Ymagis/ClairMeta/issues/130) */ unsigned int const max_tile_part_size = std::floor(200e6 / (8 * frame_rate)); + using VN = dcp::VerificationNote; + try { auto ptr = j2k->data(); auto end = ptr + j2k->size(); @@ -247,11 +249,15 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in require_8(fourk ? 6 : 5, "invalid number of transform levels %1"); auto log_code_block_width = get_8(); if (log_code_block_width != 3) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH, fmt::to_string(4 * (2 << log_code_block_width)) }); + notes.push_back( + VN(VN::Type::BV21_ERROR, VN::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH).set_code_block_size(4 * (2 << log_code_block_width)) + ); } auto log_code_block_height = get_8(); if (log_code_block_height != 3) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT, fmt::to_string(4 * (2 << log_code_block_height)) }); + notes.push_back( + VN(VN::Type::BV21_ERROR, VN::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT).set_code_block_size(4 * (2 << log_code_block_height)) + ); } require_8(0, "invalid mode variations"); require_8(0, "invalid wavelet transform type %1"); // 9/7 irreversible |
