From a7add19cf4dfce4ebe7e4ed24da3e1c49d5ddcc1 Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Mon, 12 Jan 2015 21:12:29 +0000 Subject: [PATCH] audio_processing: Replaced macro WEBRTC_SPL_MUL_16_16 with * in high_pass_filter The macro is in C defined as #define WEBRTC_SPL_MUL_16_16(a, b) ((int32_t) (((int16_t)(a)) * ((int16_t)(b)))) (For definition on ARMv7 and MIPS, see common_audio/signal_processing/include/spl_inl_armv7.h and common_audio/signal_processing/include/spl_inl_mips.h) The replacement consists of - avoiding casts to int16_t if inputs already are int16_t - adding explicit cast to if result is assigned to (other than int or int32_t) BUG=3348,3353 TESTED=locally on Mac and trybots R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/37569004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8044 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../audio_processing/high_pass_filter_impl.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc index dc412e7e36..43c3754bdf 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.cc +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.cc @@ -59,20 +59,16 @@ int Filter(FilterState* hpf, int16_t* data, int length) { // y[i] = b[0] * x[i] + b[1] * x[i-1] + b[2] * x[i-2] // + -a[1] * y[i-1] + -a[2] * y[i-2]; - tmp_int32 = - WEBRTC_SPL_MUL_16_16(y[1], ba[3]); // -a[1] * y[i-1] (low part) - tmp_int32 += - WEBRTC_SPL_MUL_16_16(y[3], ba[4]); // -a[2] * y[i-2] (low part) + tmp_int32 = y[1] * ba[3]; // -a[1] * y[i-1] (low part) + tmp_int32 += y[3] * ba[4]; // -a[2] * y[i-2] (low part) tmp_int32 = (tmp_int32 >> 15); - tmp_int32 += - WEBRTC_SPL_MUL_16_16(y[0], ba[3]); // -a[1] * y[i-1] (high part) - tmp_int32 += - WEBRTC_SPL_MUL_16_16(y[2], ba[4]); // -a[2] * y[i-2] (high part) + tmp_int32 += y[0] * ba[3]; // -a[1] * y[i-1] (high part) + tmp_int32 += y[2] * ba[4]; // -a[2] * y[i-2] (high part) tmp_int32 = (tmp_int32 << 1); - tmp_int32 += WEBRTC_SPL_MUL_16_16(data[i], ba[0]); // b[0]*x[0] - tmp_int32 += WEBRTC_SPL_MUL_16_16(x[0], ba[1]); // b[1]*x[i-1] - tmp_int32 += WEBRTC_SPL_MUL_16_16(x[1], ba[2]); // b[2]*x[i-2] + tmp_int32 += data[i] * ba[0]; // b[0]*x[0] + tmp_int32 += x[0] * ba[1]; // b[1]*x[i-1] + tmp_int32 += x[1] * ba[2]; // b[2]*x[i-2] // Update state (input part) x[1] = x[0];