Reduce audio fragment alignment jitter by penalizing alignment
correction offsets that deviate too much from the target offset.
This is accomplished by multiplying the cross correlation search
window with a quadratic function.
Signed-off-by: Pavel Koshevoy <pavel@homestead.aragog.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
// normalize:
FFTSample drifti = (FFTSample)(drift + i);
- metric *= drifti;
+ metric *= drifti * (FFTSample)(i - i0) * (FFTSample)(i1 - i);
if (metric > best_metric) {
best_metric = metric;