OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 for (n = 0; n < FRAMESAMPLES/8; n++) | 186 for (n = 0; n < FRAMESAMPLES/8; n++) |
187 sum += (WebRtcIsacfix_kCos[k][n] * summ[n] + 256) >> 9; | 187 sum += (WebRtcIsacfix_kCos[k][n] * summ[n] + 256) >> 9; |
188 CorrQ7[k+1] = sum; | 188 CorrQ7[k+1] = sum; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 // Some arithmetic operations that are allowed to overflow. (It's still | 192 // Some arithmetic operations that are allowed to overflow. (It's still |
193 // undefined behavior, so not a good idea; this just makes UBSan ignore the | 193 // undefined behavior, so not a good idea; this just makes UBSan ignore the |
194 // violations, so that our old code can continue to do what it's always been | 194 // violations, so that our old code can continue to do what it's always been |
195 // doing.) | 195 // doing.) |
196 static inline int32_t OverflowingMulS16S32ToS32(int16_t a, int32_t b) | 196 static inline int32_t RTC_NO_SANITIZE("signed-integer-overflow") |
197 RTC_NO_SANITIZE("signed-integer-overflow") { | 197 OverflowingMulS16S32ToS32(int16_t a, int32_t b) { |
198 return a * b; | 198 return a * b; |
199 } | 199 } |
200 static inline int32_t OverflowingAddS32S32ToS32(int32_t a, int32_t b) | 200 static inline int32_t RTC_NO_SANITIZE("signed-integer-overflow") |
201 RTC_NO_SANITIZE("signed-integer-overflow") { | 201 OverflowingAddS32S32ToS32(int32_t a, int32_t b) { |
202 return a + b; | 202 return a + b; |
203 } | 203 } |
204 static inline int32_t OverflowingSubS32S32ToS32(int32_t a, int32_t b) | 204 static inline int32_t RTC_NO_SANITIZE("signed-integer-overflow") |
205 RTC_NO_SANITIZE("signed-integer-overflow") { | 205 OverflowingSubS32S32ToS32(int32_t a, int32_t b) { |
206 return a - b; | 206 return a - b; |
207 } | 207 } |
208 | 208 |
209 /* compute inverse AR power spectrum */ | 209 /* compute inverse AR power spectrum */ |
210 static void CalcInvArSpec(const int16_t *ARCoefQ12, | 210 static void CalcInvArSpec(const int16_t *ARCoefQ12, |
211 const int32_t gainQ10, | 211 const int32_t gainQ10, |
212 int32_t *CurveQ16) | 212 int32_t *CurveQ16) |
213 { | 213 { |
214 int32_t CorrQ11[AR_ORDER+1]; | 214 int32_t CorrQ11[AR_ORDER+1]; |
215 int32_t sum, tmpGain; | 215 int32_t sum, tmpGain; |
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 | 2047 |
2048 index_gQQ[k] = pos2QQ + WebRtcIsacfix_kQuantMinGain[k]; //ATTN: ok? | 2048 index_gQQ[k] = pos2QQ + WebRtcIsacfix_kQuantMinGain[k]; //ATTN: ok? |
2049 if (index_gQQ[k] < 0) { | 2049 if (index_gQQ[k] < 0) { |
2050 index_gQQ[k] = 0; | 2050 index_gQQ[k] = 0; |
2051 } | 2051 } |
2052 else if (index_gQQ[k] > WebRtcIsacfix_kMaxIndGain[k]) { | 2052 else if (index_gQQ[k] > WebRtcIsacfix_kMaxIndGain[k]) { |
2053 index_gQQ[k] = WebRtcIsacfix_kMaxIndGain[k]; | 2053 index_gQQ[k] = WebRtcIsacfix_kMaxIndGain[k]; |
2054 } | 2054 } |
2055 } | 2055 } |
2056 } | 2056 } |
OLD | NEW |