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

Side by Side Diff: webrtc/common_audio/signal_processing/vector_scaling_operations.c

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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 19 matching lines...) Expand all
30 if (right_shifts > 0) 30 if (right_shifts > 0)
31 { 31 {
32 for (i = length; i > 0; i--) 32 for (i = length; i > 0; i--)
33 { 33 {
34 (*res++) = ((*in++) >> right_shifts); 34 (*res++) = ((*in++) >> right_shifts);
35 } 35 }
36 } else 36 } else
37 { 37 {
38 for (i = length; i > 0; i--) 38 for (i = length; i > 0; i--)
39 { 39 {
40 (*res++) = ((*in++) << (-right_shifts)); 40 (*res++) = ((*in++) * (1 << (-right_shifts)));
41 } 41 }
42 } 42 }
43 } 43 }
44 44
45 void WebRtcSpl_VectorBitShiftW32(int32_t *out_vector, 45 void WebRtcSpl_VectorBitShiftW32(int32_t *out_vector,
46 size_t vector_length, 46 size_t vector_length,
47 const int32_t *in_vector, 47 const int32_t *in_vector,
48 int16_t right_shifts) 48 int16_t right_shifts)
49 { 49 {
50 size_t i; 50 size_t i;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 for (i = 0; i < length; i++) { 158 for (i = 0; i < length; i++) {
159 out_vector[i] = (int16_t)(( 159 out_vector[i] = (int16_t)((
160 in_vector1[i] * in_vector1_scale + in_vector2[i] * in_vector2_scale + 160 in_vector1[i] * in_vector1_scale + in_vector2[i] * in_vector2_scale +
161 round_value) >> right_shifts); 161 round_value) >> right_shifts);
162 } 162 }
163 163
164 return 0; 164 return 0;
165 } 165 }
OLDNEW
« no previous file with comments | « webrtc/common_audio/signal_processing/levinson_durbin.c ('k') | webrtc/modules/audio_coding/neteq/expand.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698