From a346aadfae424d261cc375b99fb6f158d7f1cbc1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 21 Oct 2018 22:29:43 +0200 Subject: [PATCH] AV1 parser: include OBU common data in `av1C` Part of the fix of #2410. --- NEWS.md | 4 ++++ src/common/av1.cpp | 16 +++++++--------- tests/results.txt | 6 +++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/NEWS.md b/NEWS.md index 886ad6684..ad09e96fe 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,10 @@ * mkvmerge: AV1 parser: fixed an error in the sequence header parser if neither the `reduced_still_picture_header` nor the `frame_id_numbers_present_flag` is set. Part of the fix for #2410. +* mkvmerge: AV1 parser: when creating the `av1C` structure for the Codec + Private element the sequence header OBU wasn't copied completely: its common + data (type field & OBU size among others) was missing. Part of the fix for + #2410. # Version 28.0.0 "Voice In My Head" 2018-10-20 diff --git a/src/common/av1.cpp b/src/common/av1.cpp index 6c7969aff..f2ca9cf8c 100644 --- a/src/common/av1.cpp +++ b/src/common/av1.cpp @@ -416,18 +416,19 @@ parser_c::parse_obu() { return false; } - at_scope_exit_c copy_current_and_seek_to_next_obu([this, start_bit_position, next_obu_bit_position, &keep_obu]() { + auto obu = memory_c::borrow(p->buffer.get_buffer() + (start_bit_position / 8), (next_obu_bit_position - start_bit_position) / 8); + mtx::bits::reader_c sub_r{obu->get_buffer(), obu->get_size()}; + sub_r.set_bit_position(r.get_bit_position() - start_bit_position); + + at_scope_exit_c copy_current_and_seek_to_next_obu([this, start_bit_position, next_obu_bit_position, &obu, &keep_obu]() { p->r.set_bit_position(next_obu_bit_position); if (!keep_obu) return; - auto start = p->buffer.get_buffer() + (start_bit_position / 8); - auto size = (next_obu_bit_position - start_bit_position) / 8; - if (p->current_frame.mem) - p->current_frame.mem->add(start, size); + p->current_frame.mem->add(*obu); else - p->current_frame.mem = memory_c::clone(start, size); + p->current_frame.mem = obu->clone(); if (p->obu_type == OBU_SEQUENCE_HEADER) p->current_frame_contains_sequence_header = true; @@ -458,9 +459,6 @@ parser_c::parse_obu() { return true; } - auto obu = memory_c::borrow(p->buffer.get_buffer() + (r.get_bit_position() / 8), static_cast(*obu_size)); - mtx::bits::reader_c sub_r{obu->get_buffer(), obu->get_size()}; - if (p->obu_type == OBU_SEQUENCE_HEADER) { parse_sequence_header_obu(sub_r); p->sequence_header_obu = obu->clone(); diff --git a/tests/results.txt b/tests/results.txt index c02ddc207..e6e4fa467 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -483,7 +483,7 @@ T_634dialog_normalization_gain_removal:9a438e39ffa72c89a1e9ed940ecf6a0a-5c7588e4 T_635propedit_update_doc_type_version:181040794c0287a418f558e46d598b7d-1+1-4+1:passed:20180310-135142:0.138196579 T_636flac_with_id3_tags:c8b37897660d88038c4e6f401fe6c94c:passed:20180310-182917:0.204964643 T_637mp4_8_channels_in_track_headers_but_7_in_codec_specific_config:true:passed:20180322-222201:0.012853536 -T_638av1_ivf_webm:d429eca5062c7441d855fee9361c2499-c1050864ce2c49a80ef39bee50da870b-96396dd41a44c98f3fa1d586082a83b5-533a689b8739705a879e7a4f53aeea7d-d12b160c887cb4061535dc0467bf9c1b-3a85cfc4bf6606def216fc821542e72b:passed:20180401-164905:0.057717643 +T_638av1_ivf_webm:dc1b96c3c48ecda7b7da0b41a555af3f-c1050864ce2c49a80ef39bee50da870b-a5add2983081e735d6177c7c7f810e9d-f63ddb67079fdf2b9120e1f257c506c2-d12b160c887cb4061535dc0467bf9c1b-508dc51869e291813e77512a252d1e3b:passed:20180401-164905:0.057717643 T_639vobsub_missing_duration_in_matroska:1da346761ddede951b1f2f5f11cd3f69:passed:20180401-193013:0.014669303 T_640no_date:20fbba5a79a436caa36582e7675c1038:passed:20180427-231324:0.011724657 T_641keep_display_unit:f3c2b4b8f52f2d29025052a6be092451-3+16x9-2392d8546623ab6265c1cdbc1cab4739-0+123x456:passed:20180609-123022:0.062045824 @@ -503,6 +503,6 @@ T_654text_subtitles_without_duration:ada9aaa1ae07ff6b20fb0618304d0820:passed:201 T_655mpeg_ts_teletext_subs_long_gap_until_end_of_display:6027ec285e5c03ec7fa84afea1d57f56:passed:20181005-212927:0.513727609 T_656mpeg_ts_bad_utf8_in_service_names2:544606778297772ea61146bdbd8f1186:passed:20181006-122753:0.020246407 T_657av1_from_mp4:08895840fd959294a31f7cbba8b2d9dd:passed:20181007-220646:0.040201275 -T_658X_av1:20347e54bac4d1b0fe82d1f2f6c17c4d+2bdc874816ea1e781a533c2fc64fbe70:passed:20181007-225807:0.019174721 -T_659av1_timing_info_in_bitstream:a2b134d6d35b3011926d95b90667b606-55cc6918680c4e1eaf59ca6ccd3f93dd:passed:20181007-235434:0.016544501 +T_658X_av1:20347e54bac4d1b0fe82d1f2f6c17c4d+8a967d44a1de7c00bf8be24156802f4f:passed:20181007-225807:0.019174721 +T_659av1_timing_info_in_bitstream:b0b31fd8f8f569f7dcb7f29a3960050d-15361e7c74dfdbd59ffe96009b44a63f:passed:20181007-235434:0.016544501 T_660propedit_replace_one_byte_with_ebmlvoid_all_surrounding_elements_coded_size_length_8:a16d7aa5d00d120d20c4c3c718e1b00b:passed:20181020-160502:0.0