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:
@@ -95,6 +95,36 @@ TEST(TimelineWaveformSync, ExtractEnvelopeUsesOnlyValidatedRanges)
|
||||
EXPECT_DOUBLE_EQ(envelope.at(59), 0.0);
|
||||
}
|
||||
|
||||
TEST(TimelineWaveformSync, ExtractEnvelopeReportsValidityMask)
|
||||
{
|
||||
constexpr int kSampleRate = 48000;
|
||||
constexpr size_t kWindowSamples = kSampleRate / 20; // 50 ms windows
|
||||
|
||||
AudioWaveformCache cache;
|
||||
WritePartialWaveform(&cache, kSampleRate);
|
||||
|
||||
WaveformSyncClip clip;
|
||||
clip.waveform = &cache;
|
||||
clip.media_range = TimeRange(0, 3);
|
||||
clip.sample_rate = kSampleRate;
|
||||
|
||||
QVector<bool> valid_mask;
|
||||
const QVector<double> envelope =
|
||||
TimelineWaveformSync::ExtractWaveformCacheEnvelope(
|
||||
clip, kSampleRate, kWindowSamples, &valid_mask);
|
||||
|
||||
// One flag per envelope window
|
||||
ASSERT_EQ(valid_mask.size(), envelope.size());
|
||||
|
||||
// Windows outside the validated second are flagged invalid, windows
|
||||
// inside it are flagged valid
|
||||
EXPECT_FALSE(valid_mask.at(0));
|
||||
EXPECT_FALSE(valid_mask.at(59));
|
||||
for (int i = 20; i < 40; ++i) {
|
||||
EXPECT_TRUE(valid_mask.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(TimelineWaveformSync, PartialCacheIsConsideredReady)
|
||||
{
|
||||
constexpr int kSampleRate = 48000;
|
||||
|
||||
Reference in New Issue
Block a user