Per-shot match for beats with internal cuts; protect cache on --beat runs

Two issues fixed:

1. Beats with internal hard cuts (e.g. man-shot then back to woman) were
   being approximated by a single source clip because the multi-segment
   path only triggered for fade-bounded multi-island beats. Added
   _reference_shot_segments(), which returns the shot ranges by splitting
   each visible island at detected internal cuts. The multi-island gate in
   cmd_match and the per-island loop in _match_unmatched_visual_segments
   now use shots, so any beat with cuts > 0 produces one MatchSegment per
   shot. Each shot is matched independently against the source movie.

   Effect on Beat 10: 1 segment (3.32 s in scene 558) -> 3 segments
   covering shots 0-0.88 s, 0.88-2.64 s, 2.64-3.32 s in scenes 554, 559,
   556 respectively, with the previously missing "back to woman" cut now
   correctly placed in scene 556.

2. Targeted --beat N runs were silently dropping cache entries for other
   beats whose old scores no longer pass current quality gates
   (_normalize_cached_results runs at load time and removes them). The
   save path now re-loads the raw cache from disk and writes back every
   non-targeted beat verbatim, so a per-beat run can never regress
   another beat's stored match.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Melbar
2026-05-05 00:06:39 +02:00
parent 2a3840e528
commit cc27208d2a
3 changed files with 68 additions and 11 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long