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 <type> if result is assigned to <type> (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
This commit is contained in:
@@ -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];
|
||||
|
Reference in New Issue
Block a user