mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
b=865241 always leave 20 samples of headroom when extracting group delay, removing the discontinuity at delay = 20 r=ehsan
--HG-- extra : rebase_source : 30515ea2236b7503ff7e446d50930f91135bc7e0
This commit is contained in:
parent
7ec61fbe98
commit
f2b27a4c67
@ -165,6 +165,9 @@ double FFTBlock::ExtractAverageGroupDelay()
|
||||
|
||||
const double kSamplePhaseDelay = (2.0 * M_PI) / double(FFTSize());
|
||||
|
||||
// Remove DC offset
|
||||
dft[0].r = 0.0f;
|
||||
|
||||
// Calculate weighted average group delay
|
||||
for (int i = 1; i < halfSize; i++) {
|
||||
Complex c(dft[i].r, dft[i].i);
|
||||
@ -189,15 +192,13 @@ double FFTBlock::ExtractAverageGroupDelay()
|
||||
double aveSampleDelay = -ave / kSamplePhaseDelay;
|
||||
|
||||
// Leave 20 sample headroom (for leading edge of impulse)
|
||||
if (aveSampleDelay > 20.0)
|
||||
aveSampleDelay -= 20.0;
|
||||
aveSampleDelay -= 20.0;
|
||||
if (aveSampleDelay <= 0.0)
|
||||
return 0.0;
|
||||
|
||||
// Remove average group delay (minus 20 samples for headroom)
|
||||
AddConstantGroupDelay(-aveSampleDelay);
|
||||
|
||||
// Remove DC offset
|
||||
dft[0].r = 0.0f;
|
||||
|
||||
return aveSampleDelay;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user