diff options
Diffstat (limited to 'webrtc/common_audio/signal_processing/filter_ar_fast_q12.c')
-rw-r--r-- | webrtc/common_audio/signal_processing/filter_ar_fast_q12.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c b/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c index 70001a0..8b8bdb1 100644 --- a/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c +++ b/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c @@ -7,9 +7,11 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ -#include <assert.h> -#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" +#include "stddef.h" + +#include "rtc_base/checks.h" +#include "common_audio/signal_processing/include/signal_processing_library.h" // TODO(bjornv): Change the return type to report errors. @@ -21,15 +23,18 @@ void WebRtcSpl_FilterARFastQ12(const int16_t* data_in, size_t i = 0; size_t j = 0; - assert(data_length > 0); - assert(coefficients_length > 1); + RTC_DCHECK_GT(data_length, 0); + RTC_DCHECK_GT(coefficients_length, 1); for (i = 0; i < data_length; i++) { - int32_t output = 0; - int32_t sum = 0; + int64_t output = 0; + int64_t sum = 0; for (j = coefficients_length - 1; j > 0; j--) { - sum += coefficients[j] * data_out[i - j]; + // Negative overflow is permitted here, because this is + // auto-regressive filters, and the state for each batch run is + // stored in the "negative" positions of the output vector. + sum += coefficients[j] * data_out[(ptrdiff_t) i - (ptrdiff_t) j]; } output = coefficients[0] * data_in[i]; |