]> git.sesse.net Git - ffmpeg/commitdiff
libavfilter: improve atempo audio quality
authorPavel Koshevoy <pkoshevoy@gmail.com>
Sun, 17 Jun 2012 22:45:26 +0000 (16:45 -0600)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 19 Jun 2012 15:29:27 +0000 (17:29 +0200)
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>
libavfilter/af_atempo.c

index 1ccc3f56291fff876208cca3dbc7aac93e3c07a5..92390cf2176f75b66bc0aef19068633008c222f2 100644 (file)
@@ -654,7 +654,7 @@ static int yae_align(AudioFragment *frag,
 
         // normalize:
         FFTSample drifti = (FFTSample)(drift + i);
-        metric *= drifti;
+        metric *= drifti * (FFTSample)(i - i0) * (FFTSample)(i1 - i);
 
         if (metric > best_metric) {
             best_metric = metric;