Fix "left shift of negative value" bug
The values in question are supposed to be able to be negative.
BUG=chromium:653448
Review-Url: https://codereview.webrtc.org/2387333005
Cr-Commit-Position: refs/heads/master@{#14573}
diff --git a/webrtc/common_audio/signal_processing/filter_ar.c b/webrtc/common_audio/signal_processing/filter_ar.c
index dfbc4c2..d389ee4 100644
--- a/webrtc/common_audio/signal_processing/filter_ar.c
+++ b/webrtc/common_audio/signal_processing/filter_ar.c
@@ -45,7 +45,7 @@
int16_t* state_ptr = &state[state_length - 1];
int16_t* state_low_ptr = &state_low[state_length - 1];
- o = (int32_t)(*x_ptr++) << 12;
+ o = (int32_t)(*x_ptr++) * (1 << 12);
oLOW = (int32_t)0;
stop = (i < a_length) ? i + 1 : a_length;
@@ -62,8 +62,8 @@
o += (oLOW >> 12);
*filteredFINAL_ptr = (int16_t)((o + (int32_t)2048) >> 12);
- *filteredFINAL_LOW_ptr++ = (int16_t)(o - ((int32_t)(*filteredFINAL_ptr++)
- << 12));
+ *filteredFINAL_LOW_ptr++ =
+ (int16_t)(o - ((int32_t)(*filteredFINAL_ptr++) * (1 << 12)));
}
// Save the filter state