зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265408 - Add buffersAreZero to IIRFilter; r=karlt
MozReview-Commit-ID: CM5x62GMXcj --HG-- extra : rebase_source : 05b1b7a1fac3bffaf6e143c046ccd46d047248d3
This commit is contained in:
Родитель
75164114ba
Коммит
63bac3a6eb
|
@ -129,4 +129,24 @@ void IIRFilter::getFrequencyResponse(int nFrequencies, const float* frequency, f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IIRFilter::buffersAreZero()
|
||||||
|
{
|
||||||
|
double* xBuffer = m_xBuffer.Elements();
|
||||||
|
double* yBuffer = m_yBuffer.Elements();
|
||||||
|
|
||||||
|
for (size_t k = 0; k < m_feedforward->Length(); ++k) {
|
||||||
|
if (xBuffer[(m_bufferIndex - k) & (kBufferLength - 1)] != 0.0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t k = 0; k < m_feedback->Length(); ++k) {
|
||||||
|
if (fabs(yBuffer[(m_bufferIndex - k) & (kBufferLength - 1)]) >= FLT_MIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace blink
|
} // namespace blink
|
||||||
|
|
|
@ -26,6 +26,8 @@ public:
|
||||||
float* magResponse,
|
float* magResponse,
|
||||||
float* phaseResponse);
|
float* phaseResponse);
|
||||||
|
|
||||||
|
bool buffersAreZero();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Filter memory
|
// Filter memory
|
||||||
//
|
//
|
||||||
|
|
Загрузка…
Ссылка в новой задаче