From 4bd886fb75bb6856ac28711bb515b4eb8582422c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 16 Aug 2026 00:18:30 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(bench):=20the=20cutloop=20ti?= =?UTF-8?q?meline=20is=20the=20keeps=20alone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The freeze metric's harness, corrected on its first live runs: the holes are the odd clips of the cut list and the tail past the last keep is the last one, deleted from the far end down so no delete moves an index still to be named (repeatedly deleting index 1 alternated hole, keep, hole, keep); V1 names each hole and the group takes the A1 half of the take with it; the end of the last keep is cut so the run plays the keeps and not the rest of the film; and a shape guard refuses a timeline that is not the keeps it asked for. The spans before and after the deletes go to the log as provenance. --- crates/engine/examples/bench.rs | 42 ++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/crates/engine/examples/bench.rs b/crates/engine/examples/bench.rs index ecc879c..979c908 100644 --- a/crates/engine/examples/bench.rs +++ b/crates/engine/examples/bench.rs @@ -584,25 +584,51 @@ fn cutloop_bench(path: &Path, regions: u32, keep_s: f64, cut_s: f64) { return; } } - // The holes are the odd clips: index 1, `regions` times over, as every - // delete closes the list up onto the next one. - for i in 0..regions { - if !session.delete_clip(Lane::V1, 1) { + // ...and the end of the last keep, so the timeline that plays out is the + // keeps alone and not the rest of the film (a cut past the end of the + // file is no cut, and the shape check below says so if it mattered). + session.cut_at(f64::from(regions) * stride + keep_s); + eprintln!( + "cutloop: spans before the deletes: {:?}", + session.clip_spans() + ); + // The holes are the odd clips and the tail is the last: deleted from the + // far end down, so no delete moves the index of a clip still to be + // deleted. V1 names each hole and the group takes the A1 half of the + // take with it; the shape check below guards the lot. + for idx in (1..=2 * regions as usize + 1).rev().step_by(2) { + if !session.delete_clip(Lane::V1, idx) { row( path, "cutloop_displayed", "count", &[], - &format!("FAIL(hole {i} of {regions} would not delete)"), + &format!("FAIL(clip {idx} of the cut timeline would not delete)"), ); return; } } + eprintln!( + "cutloop: spans after the deletes: {:?}", + session.clip_spans() + ); + let spans = session.clip_spans(); let timeline = session.timeline_duration(); + let expect = (f64::from(regions) + 1.0) * keep_s; + if (timeline - expect).abs() > keep_s { + row( + path, + "cutloop_displayed", + "count", + &[], + &format!("FAIL(timeline {timeline:.2}s, expected ~{expect:.2}s of kept clips)"), + ); + return; + } eprintln!( - "cutloop: {regions} regions of {cut_s}s cut, {} clips of {keep_s}s left, \ - {timeline:.1}s of timeline at {fps:.3} fps", - regions + 1 + "cutloop: {regions} regions of {cut_s}s cut, {} clips left on the \ + video lane, {timeline:.1}s of timeline at {fps:.3} fps", + spans.len() ); session.seek(0.0);