The cutloop timeline is the keeps alone
Browse files at this commit4bd886fb75bb6856ac28711bb515b4eb8582422cParent: 27b5f78- fix
- the cutloop timeline is the keeps alone
1 changed file +34 -8
crates/engine/examples/bench.rsmodified+34 -8
| @@ -584,25 +584,51 @@ fn cutloop_bench(path: &Path, regions: u32, keep_s: f64, cut_s: f64) { | |||
| 584 | return; | 584 | return; |
| 585 | } | 585 | } |
| 586 | } | 586 | } |
| 587 | - // The holes are the odd clips: index 1, `regions` times over, as every | 587 | + // ...and the end of the last keep, so the timeline that plays out is the |
| 588 | - // delete closes the list up onto the next one. | 588 | + // keeps alone and not the rest of the film (a cut past the end of the |
| 589 | - for i in 0..regions { | 589 | + // file is no cut, and the shape check below says so if it mattered). |
| 590 | - if !session.delete_clip(Lane::V1, 1) { | 590 | + session.cut_at(f64::from(regions) * stride + keep_s); |
| 591 | + eprintln!( | ||
| 592 | + "cutloop: spans before the deletes: {:?}", | ||
| 593 | + session.clip_spans() | ||
| 594 | + ); | ||
| 595 | + // The holes are the odd clips and the tail is the last: deleted from the | ||
| 596 | + // far end down, so no delete moves the index of a clip still to be | ||
| 597 | + // deleted. V1 names each hole and the group takes the A1 half of the | ||
| 598 | + // take with it; the shape check below guards the lot. | ||
| 599 | + for idx in (1..=2 * regions as usize + 1).rev().step_by(2) { | ||
| 600 | + if !session.delete_clip(Lane::V1, idx) { | ||
| 591 | row( | 601 | row( |
| 592 | path, | 602 | path, |
| 593 | "cutloop_displayed", | 603 | "cutloop_displayed", |
| 594 | "count", | 604 | "count", |
| 595 | &[], | 605 | &[], |
| 596 | - &format!("FAIL(hole {i} of {regions} would not delete)"), | 606 | + &format!("FAIL(clip {idx} of the cut timeline would not delete)"), |
| 597 | ); | 607 | ); |
| 598 | return; | 608 | return; |
| 599 | } | 609 | } |
| 600 | } | 610 | } |
| 611 | + eprintln!( | ||
| 612 | + "cutloop: spans after the deletes: {:?}", | ||
| 613 | + session.clip_spans() | ||
| 614 | + ); | ||
| 615 | + let spans = session.clip_spans(); | ||
| 601 | let timeline = session.timeline_duration(); | 616 | let timeline = session.timeline_duration(); |
| 617 | + let expect = (f64::from(regions) + 1.0) * keep_s; | ||
| 618 | + if (timeline - expect).abs() > keep_s { | ||
| 619 | + row( | ||
| 620 | + path, | ||
| 621 | + "cutloop_displayed", | ||
| 622 | + "count", | ||
| 623 | + &[], | ||
| 624 | + &format!("FAIL(timeline {timeline:.2}s, expected ~{expect:.2}s of kept clips)"), | ||
| 625 | + ); | ||
| 626 | + return; | ||
| 627 | + } | ||
| 602 | eprintln!( | 628 | eprintln!( |
| 603 | - "cutloop: {regions} regions of {cut_s}s cut, {} clips of {keep_s}s left, \ | 629 | + "cutloop: {regions} regions of {cut_s}s cut, {} clips left on the \ |
| 604 | - {timeline:.1}s of timeline at {fps:.3} fps", | 630 | + video lane, {timeline:.1}s of timeline at {fps:.3} fps", |
| 605 | - regions + 1 | 631 | + spans.len() |
| 606 | ); | 632 | ); |
| 607 | 633 | ||
| 608 | session.seek(0.0); | 634 | session.seek(0.0); |