From cf566417081f97f33f1006f1af3f571df4ae80bc Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 16 Apr 2013 12:23:14 +0200 Subject: [PATCH] mkvmerge: sort cue entries --- src/merge/cues.cpp | 13 +++++++------ tests/results.txt | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/merge/cues.cpp b/src/merge/cues.cpp index b517ecfd9..caf66bffd 100644 --- a/src/merge/cues.cpp +++ b/src/merge/cues.cpp @@ -15,6 +15,7 @@ #include "common/debugging.h" #include "common/ebml.h" +#include "common/fs_sys_helpers.h" #include "common/hacks.h" #include "common/math.h" #include "merge/cluster_helper.h" @@ -76,7 +77,9 @@ cues_c::write(mm_io_c &out, if (!m_points.size() || !g_cue_writing_requested) return; - // sort(); + // auto start = get_current_time_millis(); + sort(); + // auto end_sort = get_current_time_millis(); // Need to write the (empty) cues element so that its position will // be set for indexing in g_kax_sh_main. Necessary because there's @@ -121,6 +124,9 @@ cues_c::write(mm_io_c &out, m_points.clear(); m_codec_state_position_map.clear(); m_num_cue_points_postprocessed = 0; + + // auto end_all = get_current_time_millis(); + // mxinfo(boost::format("dur sort %1% write %2% total %3%\n") % (end_sort - start) % (end_all - end_sort) % (end_all - start)); } void @@ -133,11 +139,6 @@ cues_c::sort() { if (a.track_num < b.track_num) return true; - if (a.track_num > b.track_num) - return false; - - if (a.cluster_position < b.cluster_position) - return true; return false; }); diff --git a/tests/results.txt b/tests/results.txt index e17bbcfb6..f3fd3bf31 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -27,7 +27,7 @@ T_026sync_pcm:685121e0c33a48a69c57ad481990b9bb-ffcfaccc447ab521bd97456aea52812f: T_027default_track:753697fb82497fbfe6b6c83642659f5b:passed:20040825-234348:0.613537442 T_028compression:c6e205fd245ead3b2bf9639d89eb8072:passed:20040825-234348:0.078682653 T_029link:all ok:passed:20040825-235039:0.925578898 -T_032cues:9293e2c07a751975ebdd0a6c28b16d42:passed:20040825-235040:0.182090352 +T_032cues:0d931122011e25a5c14d541d28ce23cb:passed:20040825-235040:0.182090352 T_033timecode_scale:65f8beb3cd7967461c241a022cb8971c-b81d18a1b6abea58bf6dff80830ccbba:passed:20040825-235040:0.312093398 T_034ac3misdetected_as_mp2:e00456052afcf360e535f9ee6930155b:passed:20040920-100447:0.099427838 T_035X_vfw_video:5bcb3426b2635ae5c89a5e5fe46aa416:passed:20040920-185358:0.177301623 @@ -94,7 +94,7 @@ T_244iconv_missing_character:87ada016ba183506a3ef8c9c198e5bbe:passed:20081004-21 T_245srt_timecode_formats:db711245f3231dece61fb4fd1cf869f7-db711245f3231dece61fb4fd1cf869f7:passed:20081202-141604:0.255023139 T_246theora_pixel_aspect_ratio:2ba0c9f0c1f9fecf3facfda6ada6a772:passed:20081205-174857:0.061985381 T_247attachment_selection:b32c725c988ca94ceda98862ef7df60d-9df530055faf72516492ffae09c48c69-f12e1fd51070592c524268846c7d89b6-104b6490840528815487544f8b6bbd75+bb1a0ce26f393b20541b593147e6c02b:passed:20090228-191612:0.113510024 -T_248mpeg2:c8c53d0cda2e3d411b5fbfd4f55258b5-9ebea3f3ca9bfc7dd946d88a3a9880fc:passed:20090531-132819:8.128150931 +T_248mpeg2:c8c53d0cda2e3d411b5fbfd4f55258b5-746f7913f5268c6f70dec695bf6faf49:passed:20090531-132819:8.128150931 T_249mpeg2_no_codecprivate:5c7cd1448703e8a9f9833e3f0e403db9:passed:20090531-132821:1.45695982 T_250tag_selection:9c4305408e0e554c1b7cfd1d76eda262-babfe57e09701b9e4a2ea5d030cdb697-cffb288a439fefcf4a97255726c50b90-427042640dbd4fa5fbf6a58f2f7f5141-79aaa97a5d6b24106f1cde250003f71c-79aaa97a5d6b24106f1cde250003f71c-0ca4f5905985fc16daf2556695b450c5:passed:20090531-205640:1.287172749 T_251vc1_truehd_eac3_from_evo:737dd53b2e1bf3987d35a0cdc88b4c4d:passed:20090606-220945:1.173449174 @@ -171,7 +171,7 @@ T_322propedit_track_headers:785209f2dc35ad6177bea2ca6e43198f-9896cdb0b3116d8c171 T_323propedit_segment_info:785209f2dc35ad6177bea2ca6e43198f-2df9da2d502a7d5ad914966c27393844-c65579659de3fb44c74aed6965b5ce2e:passed:20111203-152845:0.425794709 T_324propedit_chapters:785209f2dc35ad6177bea2ca6e43198f-a9255d40de93e2731aaead0a746e582f-a6d99a5e779aa1c65ba4d03597754d37-ae788bbd0580dd01d10672a46e3be84d-2a53e52d0e3b13d37f5e9f411a9e74eb-b6aafbfe2bc4902f3187031a71730f8d-ee5f4977886284f0d97519895fbab9d8-48614f8c72edb5d3e23115e1998f5997-11d7efba28fe0cd85b03919dd87324e9-d41d8cd98f00b204e9800998ecf8427e:passed:20111203-154502:0.736303091 T_325propedit_tags:785209f2dc35ad6177bea2ca6e43198f-26ad4ab0491d76d9fb6f57b4a4b35400-e58a5937ac6e0dc71d6c8264c53535be-52322241c33de4f7b56ede7a4764f72f-e58a5937ac6e0dc71d6c8264c53535be-52322241c33de4f7b56ede7a4764f72f-e26ce3a9725c74e16b5be99a5a917ae2-591a65deb231cb0150a4da224d5f3415-8aa2fda41ba5c0cfe6fec3d46611896c-438f0a8ce757e03b77c084bd593cb196-8aa2fda41ba5c0cfe6fec3d46611896c-438f0a8ce757e03b77c084bd593cb196-1e335b1d4a8ed48cbaa4efcffecdba28-5a8f05d63ffe9d53046abf40ec30e42a-54597c44d0938662d716edd21e4d6c68-d41d8cd98f00b204e9800998ecf8427e:passed:20111203-160727:1.314514241 -T_326mpeg_ps_mpeg_audio_layer4:d407f772b3e6f0ca303f021888bfd8bd:passed:20111207-224511:1.505513342 +T_326mpeg_ps_mpeg_audio_layer4:6c77b47883f05561162f204ef0769c89:passed:20111207-224511:1.505513342 T_327vp8_frame_type:d7fccc3488a0210aec835cca10d216eb:passed:20111207-233304:0.089263543 T_328dts_detected_as_ac3:c8703f578e0bcbbfdc155cb5603141bc:passed:20111229-192324:0.090561076 T_329X_timecodes_v2:dadc36ce79c1c4b281f8f1f865746598-049cdc2d9226fac8c61d193d803bfc1f-3720aac3f16b66ec3308ffa7bf913c6e-6469e2522a4b48b7b20bae93f5d9086d-1ff091abfcb0938d6ac7fd0495e899b3-049cdc2d9226fac8c61d193d803bfc1f-d172a9340cbf2802690479e396879d1e-bf76c5886cc7c18cc7e6ee796c3406b4-b3f9d126c31505c22f292a1d2bdffba2-4bd97467fac0ac0b561d68b8b15a79dd:passed:20120105-202451:1.376047868 @@ -186,7 +186,7 @@ T_337vc1_es_sequence_header_not_at_start:bf6ac6f8b3e8114b2c890e5b56dc29cb:passed T_338h264_width_height_pixl_format_non_420:fe22e2b6f46d871a486bc024c12b3a2c-ok:passed:20120222-153143:1.938343358 T_339eac3_dependent_frames:91fadd41d83959d89b473b3311a7bc88:passed:20120226-133623:0.201626612 T_340m2ts_interlaced_h264_timecode_every_second_frame:7529de3e9350326a2b1b9c0329c0ca19:passed:20120304-163131:25.31191697 -T_341vob_interlaced_h264:82defc8cef89ecb261ad78e2af5f825c:passed:20120304-163313:5.303087276 +T_341vob_interlaced_h264:7219d932c74ab66f68df48c5a714a173:passed:20120304-163313:5.303087276 T_342m2ts_interlaced_h264_from_arte:a69b18f93bb2cbd05363718216d6b0b1:passed:20120304-165917:4.5443942 T_343m2ts_interlaced_h264_match_of_the_day:36e84933954a5e4a666b6bdf28457b8b:passed:20120304-171453:3.858753744 T_344microdvd_recognition:ok:passed:20120304-175209:0.114439546 @@ -212,7 +212,7 @@ T_363srt_colon_decimal_separator:b6238ce10811e42597b9317cd19e8d68:passed:2012052 T_364qtmp4_track_with_empty_chunkmap_table:2f0702572c330de93fbbccb688fa56a3:passed:20120605-223925:0.168392001 T_365qtmp4_constant_sample_size:181985c63652382ceeb5ca4c34ab3a90-7c1c5d4e5b1c1806b9b38a573d66b865:passed:20120605-230823:0.675175697 T_366srt_with_space_in_timecode_arrow:e60688199251ed6d1707a2568bdd923c:passed:20120801-132204:0.121731174 -T_367vob_80ms_delay_by_b_frames:1436db01851530a35a1663f01e7cb6fd-0ae290ba0a60c2981c37fc118cc5c3c0:passed:20120801-182507:0.106468603 +T_367vob_80ms_delay_by_b_frames:ca816e9717bfe04b13ac95cf805a396d-68176ff42f353eca1b256489ba1aa35e:passed:20120801-182507:0.106468603 T_368alac:bcea307b10ac57962ddaa23edf21f36d-889ecedd1dd661d84a644b61d9e6db72-bf27f11ef2cc46c8490fe6ecfbc9d47c-af4091373a11b7846c3180eced2d1f3b:passed:20120805-160128:0.596006157 T_369mpeg_ts_timecode_overflow:44d575ca60a1b03bc3158e3b6df1025e:passed:20120807-120810:5.138361997 T_370propedit_attachments:fe7081a60f52b80a5db51465df7dc608-fe7081a60f52b80a5db51465df7dc608-8794280ea166dcf3e5621ba2ba3529f9-fe7081a60f52b80a5db51465df7dc608-8794280ea166dcf3e5621ba2ba3529f9-fe7081a60f52b80a5db51465df7dc608-8794280ea166dcf3e5621ba2ba3529f9-fe7081a60f52b80a5db51465df7dc608-e7fbe93de534eb1ac0141460f183dcbb-fe7081a60f52b80a5db51465df7dc608-e57493ef18bb460098c52427f9c8e33d-fe7081a60f52b80a5db51465df7dc608-56f7636b429c5898c424168483047966-fe7081a60f52b80a5db51465df7dc608-7dda363254ac10c41363140da90f9d43-fe7081a60f52b80a5db51465df7dc608-7ab3e6b9ee0fbd7d2d77bbca60d38cb3-fe7081a60f52b80a5db51465df7dc608-8b41ecf4fb28fb10e927ef0cfe5eba31-fe7081a60f52b80a5db51465df7dc608-409c266d0a4e3fe4c157bb30f12f4ac2-fe7081a60f52b80a5db51465df7dc608-409c266d0a4e3fe4c157bb30f12f4ac2-fe7081a60f52b80a5db51465df7dc608-34d178b3bb21da9336acb9dc4b310f42-fe7081a60f52b80a5db51465df7dc608-d79a39e0091bebe1c84e0b8331c1a5f3-fe7081a60f52b80a5db51465df7dc608-061f3629eaa5f8ecbad695134d9971d7-fe7081a60f52b80a5db51465df7dc608-061f3629eaa5f8ecbad695134d9971d7-fe7081a60f52b80a5db51465df7dc608-92483b6576eea95770986cd54d95f890-fe7081a60f52b80a5db51465df7dc608-5f23352d0793d55005ce41fa4a12e4b2-fe7081a60f52b80a5db51465df7dc608-94f12821ced5f6254cdd10032348854c:passed:20120902-110003:0.73777194