From e9c0bbba808f88640203105410cef0d476e8670e Mon Sep 17 00:00:00 2001 From: Jaume Puig Date: Fri, 23 Oct 2026 11:26:18 +0200 Subject: [PATCH 1/2] Add a warning when some reels have Atmos and some do not. SMPTE ST 429-19 section 6.2 says that each reel of a composition with immersive audio should contain it, and some processors fall back to the normal sound when a reel is missing it. Claude-Session: https://claude.ai/code/session_011HCUWvPpbN7e6hcwuWBJjs --- src/verify.cc | 16 ++++++ src/verify.h | 4 ++ test/verify_test.cc | 115 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) diff --git a/src/verify.cc b/src/verify.cc index 1ead5c05..44b39737 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1646,6 +1646,10 @@ verify_cpl(Context& context, shared_ptr cpl) size_t fewest_closed_captions = SIZE_MAX; /* most number of closed caption assets seen in a reel */ size_t most_closed_captions = 0; + /* set to true if any reel has an Atmos asset */ + auto have_atmos = false; + /* set to true if any reel has no Atmos asset */ + auto have_no_atmos = false; map markers_seen; auto const main_picture_active_area = cpl->main_picture_active_area(); @@ -1690,6 +1694,11 @@ verify_cpl(Context& context, shared_ptr cpl) &fewest_closed_captions, &markers_seen ); + if (reel->atmos()) { + have_atmos = true; + } else { + have_no_atmos = true; + } frame += reel->duration(); ++reel_index; } @@ -1716,6 +1725,10 @@ verify_cpl(Context& context, shared_ptr cpl) context.add_note(VerificationNote::Code::MISMATCHED_CLOSED_CAPTION_ASSET_COUNTS); } + if (have_atmos && have_no_atmos) { + context.add_note(VerificationNote::Code::MISSING_ATMOS_FROM_SOME_REELS); + } + if (cpl->content_kind() == ContentKind::FEATURE) { if (markers_seen.find(Marker::FFEC) == markers_seen.end()) { context.add_note(VerificationNote::Code::MISSING_FFEC_IN_FEATURE); @@ -2216,6 +2229,8 @@ dcp::note_to_string(VerificationNote note, function process_str return compose("The CPL %1 has no tag", note.cpl_id().get()); case VerificationNote::Code::INVALID_PKL_NAMESPACE: return compose("The namespace %1 in PKL %2 is invalid", *note.xml_namespace(), note.file()->filename()); + case VerificationNote::Code::MISSING_ATMOS_FROM_SOME_REELS: + return process_string("At least one reel contains an Atmos asset, but some reel(s) do not."); } return ""; @@ -2349,6 +2364,7 @@ dcp::VerificationNote::type() const case Code::THREED_ASSET_MARKED_AS_TWOD: case Code::INVALID_SUBTITLE_DURATION_BV21: case Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES: + case Code::MISSING_ATMOS_FROM_SOME_REELS: return Type::WARNING; }; diff --git a/src/verify.h b/src/verify.h index 0f65b0cb..a8414fd8 100644 --- a/src/verify.h +++ b/src/verify.h @@ -597,6 +597,10 @@ class VerificationNote * file contains the PKL filename */ INVALID_PKL_NAMESPACE, + /** If one reel has an Atmos asset, all should have one (SMPTE ST 429-19 section 6.2) + * cpl_id contains the CPL ID + */ + MISSING_ATMOS_FROM_SOME_REELS, }; VerificationNote(Code code) diff --git a/test/verify_test.cc b/test/verify_test.cc index 88e6681b..04daaea8 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -32,6 +32,8 @@ */ +#include "atmos_asset.h" +#include "atmos_asset_writer.h" #include "combine.h" #include "compose.hpp" #include "cpl.h" @@ -44,6 +46,7 @@ #include "openjpeg_image.h" #include "raw_convert.h" #include "reel.h" +#include "reel_atmos_asset.h" #include "reel_interop_text_asset.h" #include "reel_markers_asset.h" #include "reel_mono_picture_asset.h" @@ -3669,6 +3672,118 @@ BOOST_AUTO_TEST_CASE (verify_missing_main_subtitle_from_some_reels) } +/** Make an Atmos asset of the given length; the content of the frames is not important here */ +static +shared_ptr +simple_atmos(path dir, string suffix, int frames) +{ + auto asset = make_shared(dcp::Fraction(24, 1), 0, 10, 118, 1); + auto writer = asset->start_write(dir / ("atmos" + suffix + ".mxf")); + std::vector frame(256, 0); + for (int i = 0; i < frames; ++i) { + writer->write(frame.data(), frame.size()); + } + writer->finalize(); + return asset; +} + + +static +shared_ptr +verify_atmos_should_be_in_all_reels_check(path dir, bool add_to_reel1, bool add_to_reel2) +{ + prepare_directory(dir); + auto dcp = make_shared(dir); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); + + auto constexpr reel_length = 192; + + auto reel1 = make_shared( + make_shared(simple_picture(dir, "1", reel_length), 0), + make_shared(simple_sound(dir, "1", dcp::MXFMetadata(), "en-US", reel_length), 0) + ); + + if (add_to_reel1) { + reel1->add(make_shared(simple_atmos(dir, "1", reel_length), 0)); + } + + auto markers1 = make_shared(dcp::Fraction(24, 1), reel_length); + markers1->set(dcp::Marker::FFOC, dcp::Time(1, 24, 24)); + reel1->add(markers1); + + cpl->add(reel1); + + auto reel2 = make_shared( + make_shared(simple_picture(dir, "2", reel_length), 0), + make_shared(simple_sound(dir, "2", dcp::MXFMetadata(), "en-US", reel_length), 0) + ); + + if (add_to_reel2) { + reel2->add(make_shared(simple_atmos(dir, "2", reel_length), 0)); + } + + auto markers2 = make_shared(dcp::Fraction(24, 1), reel_length); + markers2->set(dcp::Marker::LFOC, dcp::Time(reel_length - 1, 24, 24)); + reel2->add(markers2); + + cpl->add(reel2); + + dcp->add(cpl); + dcp->set_annotation_text("A Test DCP"); + dcp->write_xml(); + + return cpl; +} + + +/** SMPTE ST 429-19 says that each reel of a DCP with immersive audio should have it */ +BOOST_AUTO_TEST_CASE(verify_missing_atmos_from_some_reels) +{ + using VN = dcp::VerificationNote; + using VC = VN::Code; + + auto ok_notes = [](path dir, shared_ptr cpl) -> vector { + std::vector const picture_ids = { + cpl->reels()[0]->main_picture()->asset()->id(), + cpl->reels()[1]->main_picture()->asset()->id() + }; + return vector{ + note(VC::NONE_ENCRYPTED, cpl), + VN(VC::VALID_CPL_ANNOTATION_TEXT).set_cpl_id(cpl->id()).set_annotation_text("A Test DCP"), + note(VC::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpl), + note(VC::VALID_CONTENT_KIND, cpl).set_content_kind("trailer"), + note(VC::VALID_CONTENT_VERSION_LABEL_TEXT, cpl).set_content_version(cpl->content_version()->label_text), + note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "video1.mxf"), cpl).set_reel_index(0).set_asset_id(picture_ids[0]), + note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(dir / "video2.mxf"), cpl).set_reel_index(1).set_asset_id(picture_ids[1]), + note(VC::MATCHING_CPL_HASHES, cpl), + note(VC::CORRECT_PICTURE_HASH, canonical(dir / "video1.mxf"), cpl).set_reel_index(0).set_asset_id(picture_ids[0]), + note(VC::CORRECT_PICTURE_HASH, canonical(dir / "video2.mxf"), cpl).set_reel_index(1).set_asset_id(picture_ids[1]), + VN(VC::MISSING_CPL_METADATA, cpl->file().get()).set_cpl_id(cpl->id()) + }; + }; + + { + path dir("build/test/verify_missing_atmos_from_some_reels"); + auto cpl = verify_atmos_should_be_in_all_reels_check(dir, true, false); + auto notes = ok_notes(dir, cpl); + notes.push_back(VN(VC::MISSING_ATMOS_FROM_SOME_REELS).set_cpl_id(cpl->id())); + check_verify_result({dir}, {}, notes); + } + + { + path dir("build/test/verify_atmos_in_all_reels"); + auto cpl = verify_atmos_should_be_in_all_reels_check(dir, true, true); + check_verify_result({dir}, {}, ok_notes(dir, cpl)); + } + + { + path dir("build/test/verify_atmos_in_no_reels"); + auto cpl = verify_atmos_should_be_in_all_reels_check(dir, false, false); + check_verify_result({dir}, {}, ok_notes(dir, cpl)); + } +} + + static shared_ptr verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, int caps_in_reel2) From 91dc70f64d68d7f2c5a6886c169d1076d0d0f780 Mon Sep 17 00:00:00 2001 From: Jaume Puig Date: Fri, 23 Oct 2026 14:36:36 +0200 Subject: [PATCH 2/2] Cite the edition of ST 429-19 that has the reel rule in section 6.2. The 2023 edition renumbers it to section 6.3. Claude-Session: https://claude.ai/code/session_011HCUWvPpbN7e6hcwuWBJjs --- src/verify.h | 2 +- test/verify_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/verify.h b/src/verify.h index a8414fd8..f089efc3 100644 --- a/src/verify.h +++ b/src/verify.h @@ -597,7 +597,7 @@ class VerificationNote * file contains the PKL filename */ INVALID_PKL_NAMESPACE, - /** If one reel has an Atmos asset, all should have one (SMPTE ST 429-19 section 6.2) + /** If one reel has an Atmos asset, all should have one (SMPTE ST 429-19:2019 section 6.2) * cpl_id contains the CPL ID */ MISSING_ATMOS_FROM_SOME_REELS, diff --git a/test/verify_test.cc b/test/verify_test.cc index 04daaea8..34680109 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -3736,7 +3736,7 @@ verify_atmos_should_be_in_all_reels_check(path dir, bool add_to_reel1, bool add_ } -/** SMPTE ST 429-19 says that each reel of a DCP with immersive audio should have it */ +/** SMPTE ST 429-19:2019 section 6.2 says that each reel of a DCP with immersive audio should have it */ BOOST_AUTO_TEST_CASE(verify_missing_atmos_from_some_reels) { using VN = dcp::VerificationNote;