Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: webrtc/common_audio/signal_processing/filter_ar.c

Issue 2387333005: Fix "left shift of negative value" bug (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/signal_processing/filter_ar.c
diff --git a/webrtc/common_audio/signal_processing/filter_ar.c b/webrtc/common_audio/signal_processing/filter_ar.c
index dfbc4c2f7a0ad2effe892002c910a63eefcaade4..d389ee47e544053378adf2dddb2890d40b4a49e0 100644
--- a/webrtc/common_audio/signal_processing/filter_ar.c
+++ b/webrtc/common_audio/signal_processing/filter_ar.c
@@ -45,7 +45,7 @@ size_t WebRtcSpl_FilterAR(const int16_t* a,
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 @@ size_t WebRtcSpl_FilterAR(const int16_t* a,
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698