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

Unified Diff: webrtc/modules/audio_coding/neteq/expand.cc

Issue 2500953003: Avoid left-shifting negative values in a number of places (Closed)
Patch Set: Created 4 years, 1 month 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 | « webrtc/common_audio/signal_processing/vector_scaling_operations.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/expand.cc
diff --git a/webrtc/modules/audio_coding/neteq/expand.cc b/webrtc/modules/audio_coding/neteq/expand.cc
index 963f4bdb6c05428f7e94c97d77896538fecbb48a..ffe4370e4e61e8766c50ce8efcf22c96bd9723bf 100644
--- a/webrtc/modules/audio_coding/neteq/expand.cc
+++ b/webrtc/modules/audio_coding/neteq/expand.cc
@@ -712,7 +712,7 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
x2 = (x1 * x1) >> 14; // Shift 14 to keep result in Q14.
x3 = (x1 * x2) >> 14;
static const int kCoefficients[4] = { -5179, 19931, -16422, 5776 };
- int32_t temp_sum = kCoefficients[0] << 14;
+ int32_t temp_sum = kCoefficients[0] * 16384;
temp_sum += kCoefficients[1] * x1;
temp_sum += kCoefficients[2] * x2;
temp_sum += kCoefficients[3] * x3;
@@ -751,7 +751,7 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
// Calculate (1 - slope) / distortion_lag.
// Shift |slope| by 7 to Q20 before the division. The result is in Q20.
parameters.mute_slope = WebRtcSpl_DivW32W16(
- (8192 - slope) << 7, static_cast<int16_t>(distortion_lag));
+ (8192 - slope) * 128, static_cast<int16_t>(distortion_lag));
if (parameters.voice_mix_factor <= 13107) {
// Make sure the mute factor decreases from 1.0 to 0.9 in no more than
// 6.25 ms.
« no previous file with comments | « webrtc/common_audio/signal_processing/vector_scaling_operations.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698