Bug 1265408 - Avoid subnormals in IIRFilter; r=karlt

MozReview-Commit-ID: F4NUE8834tM

--HG--
extra : rebase_source : b2cdbe67760003adb0a4c12ba97e1fe461348af6
This commit is contained in:
Dan Minor 2016-05-30 05:36:11 -04:00
Родитель 63bac3a6eb
Коммит 9242944484
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -76,6 +76,7 @@ void Biquad::process(const float* sourceP, float* destP, size_t framesToProcess)
// Avoid introducing a stream of subnormals when input is silent and the
// tail approaches zero.
// TODO: Remove this code when Bug 1157635 is fixed.
if (x1 == 0.0 && x2 == 0.0 && (y1 != 0.0 || y2 != 0.0) &&
fabs(y1) < FLT_MIN && fabs(y2) < FLT_MIN) {
// Flush future values to zero (until there is new input).

Просмотреть файл

@ -98,7 +98,13 @@ void IIRFilter::process(const float* sourceP, float* destP, size_t framesToProce
m_bufferIndex = (m_bufferIndex + 1) & (kBufferLength - 1);
destP[n] = yn;
// Avoid introducing a stream of subnormals
// TODO: Remove this code when Bug 1157635 is fixed.
if (fabs(yn) >= FLT_MIN) {
destP[n] = yn;
} else {
destP[n] = 0.0;
}
}
}