sync: masked waveform correlation, stretch sync, manual start time

- Waveform sync no longer treats uncached waveform regions as silence:
  the envelope extraction now reports a per-window validity mask and the
  correlation skips invalid windows on either side, improving accuracy
  for partially cached clips
- Add stretch/speed sync: AudioWaveformSync::EstimateStretchAndOffset
  searches a playback-rate range plus offset, and a new timeline
  context action 'Synchronize by Waveform (Adjust Speed)' applies the
  estimated rate as a clip speed change (with undo) when plain offset
  alignment is inconclusive
- Footage properties dialog gains a Source Start Time field so the
  value used by source-time sync can be viewed and edited manually
  instead of relying solely on auto-detected metadata; applied via an
  undo command, with Footage::ClearSourceStartTime() for removal
- Regression tests for masked correlation, stretch estimation, the
  envelope validity mask, and source-start-time set/clear
This commit is contained in:
2026-07-16 23:09:12 +08:00
parent 547c2480e0
commit caafac4203
13 changed files with 544 additions and 26 deletions
@@ -71,11 +71,15 @@ GetSelectedWaveformSyncClips(const QVector<Block *> &blocks);
* @brief Extract a peak envelope from the validated regions of a waveform cache.
*
* Windows that have not been cached yet are filled with zero so that every
* envelope stays aligned to the same absolute timeline.
* envelope stays aligned to the same absolute timeline; when @p valid_mask is
* provided it receives one flag per window marking whether the window was
* actually cached, allowing the correlation to skip uncached regions instead
* of treating them as silence.
*/
QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
int sample_rate,
size_t window_samples);
size_t window_samples,
QVector<bool> *valid_mask = nullptr);
} // namespace TimelineWaveformSync