diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-12-16 12:23:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-12-20 01:52:16 +0100 |
| commit | ff869661d7632bc40aec17d1d42e31f18bd0c40b (patch) | |
| tree | 9a921beb0fe0f07765abd16247712f89728e9c1d /src/verify_j2k.cc | |
| parent | f8b7b44ac1ea1e6744026beec57465707b04f07f (diff) | |
Derive verification note type from the code...v1.10.45
...rather than having to specify it each time.
Diffstat (limited to 'src/verify_j2k.cc')
| -rw-r--r-- | src/verify_j2k.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc index cba00e87..dcea6f60 100644 --- a/src/verify_j2k.cc +++ b/src/verify_j2k.cc @@ -172,16 +172,16 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in 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) }); + notes.push_back({ 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) }); + notes.push_back({ 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(); auto const tile_height = get_32(); if (tile_width != image_width || tile_height != image_height) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_SIZE }); + notes.push_back ({ VerificationNote::Code::INVALID_JPEG2000_TILE_SIZE }); } require_32 (0, "invalid tile anchor x coordinate %1"); require_32 (0, "invalid tile anchor y coordinate %1"); @@ -217,13 +217,13 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in auto const tile_part_index = get_8(); auto tile_parts = get_8(); if (!fourk && tile_parts != 3) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_2K, fmt::to_string(tile_parts) }); + notes.push_back({ VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_2K, fmt::to_string(tile_parts) }); } if (fourk && tile_parts != 6) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_4K, fmt::to_string(tile_parts) }); + notes.push_back({ VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_4K, fmt::to_string(tile_parts) }); } if (tile_part_length > max_tile_part_size) { - VerificationNote note{VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PART_SIZE}; + VerificationNote note{VerificationNote::Code::INVALID_JPEG2000_TILE_PART_SIZE}; note.set_frame(frame_index); note.set_frame_rate(frame_rate); note.set_component(tile_part_index); @@ -247,11 +247,11 @@ 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({ VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH, fmt::to_string(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({ VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT, fmt::to_string(4 * (2 << log_code_block_height)) }); } require_8(0, "invalid mode variations"); require_8(0, "invalid wavelet transform type %1"); // 9/7 irreversible @@ -270,10 +270,10 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in auto quantization_style = get_8(); int guard_bits = (quantization_style >> 5) & 7; if (fourk && guard_bits != 2) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K, fmt::to_string(guard_bits) }); + notes.push_back({ VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K, fmt::to_string(guard_bits) }); } if (!fourk && guard_bits != 1) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K, fmt::to_string(guard_bits) }); + notes.push_back({ VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K, fmt::to_string(guard_bits) }); } ptr += L_qcd - 3; } else if (*marker_name == "COC") { @@ -313,13 +313,13 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in auto require_8_poc = [&](uint16_t value, string note) { if (get_8() != value) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, String::compose(note, value) }); + notes.push_back ({ VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, String::compose(note, value) }); } }; auto require_16_poc = [&](uint16_t value, string note) { if (get_16() != value) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, String::compose(note, value) }); + notes.push_back ({ VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, String::compose(note, value) }); } }; @@ -352,21 +352,21 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in throw InvalidCodestream("more than one QCD marker found"); } if (num_POC_in_main != 0 && !fourk) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K, fmt::to_string(num_POC_in_main) }); + notes.push_back({ VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K, fmt::to_string(num_POC_in_main) }); } if (num_POC_in_main != 1 && fourk) { - notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K, fmt::to_string(num_POC_in_main) }); + notes.push_back({ VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K, fmt::to_string(num_POC_in_main) }); } if (num_POC_after_main != 0) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_POC_MARKER_LOCATION }); + notes.push_back ({ VerificationNote::Code::INVALID_JPEG2000_POC_MARKER_LOCATION }); } if (!tlm) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_JPEG2000_TLM_MARKER }); + notes.push_back ({ VerificationNote::Code::MISSING_JPEG2000_TLM_MARKER }); } } catch (InvalidCodestream const& e) { - VerificationNote note({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string(e.what())}); + VerificationNote note({VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string(e.what())}); note.set_frame(start_index + frame_index); note.set_frame_rate(frame_rate); notes.push_back(note); |
