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

Side by Side Diff: webrtc/modules/audio_processing/aecm/aecm_core_c.cc

Issue 3009123002: Move UBSan warnings from a blacklist to the source (Closed)
Patch Set: Address review comments Created 3 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #include "webrtc/modules/audio_processing/aecm/aecm_core.h" 11 #include "webrtc/modules/audio_processing/aecm/aecm_core.h"
12 12
13 #include <stddef.h> 13 #include <stddef.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 15
16 extern "C" { 16 extern "C" {
17 #include "webrtc/common_audio/ring_buffer.h" 17 #include "webrtc/common_audio/ring_buffer.h"
18 #include "webrtc/common_audio/signal_processing/include/real_fft.h" 18 #include "webrtc/common_audio/signal_processing/include/real_fft.h"
19 } 19 }
20 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" 20 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h"
21 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" 21 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
22 extern "C" { 22 extern "C" {
23 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" 23 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
24 } 24 }
25 25
26 #include "webrtc/rtc_base/checks.h" 26 #include "webrtc/rtc_base/checks.h"
27 #include "webrtc/rtc_base/sanitizer.h"
27 #include "webrtc/typedefs.h" 28 #include "webrtc/typedefs.h"
28 29
29 // Square root of Hanning window in Q14. 30 // Square root of Hanning window in Q14.
30 static const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = { 31 static const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = {
31 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172, 32 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172,
32 3562, 3951, 4337, 4720, 5101, 5478, 5853, 6224, 33 3562, 3951, 4337, 4720, 5101, 5478, 5853, 6224,
33 6591, 6954, 7313, 7668, 8019, 8364, 8705, 9040, 34 6591, 6954, 7313, 7668, 8019, 8364, 8705, 9040,
34 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514, 35 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514,
35 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553, 36 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553,
36 13773, 13985, 14189, 14384, 14571, 14749, 14918, 15079, 37 13773, 13985, 14189, 14384, 14571, 14749, 14918, 15079,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 freq_signal_abs[i] = (uint16_t)tmp32no1; 271 freq_signal_abs[i] = (uint16_t)tmp32no1;
271 #endif // AECM_WITH_ABS_APPROX 272 #endif // AECM_WITH_ABS_APPROX
272 } 273 }
273 (*freq_signal_sum_abs) += (uint32_t)freq_signal_abs[i]; 274 (*freq_signal_sum_abs) += (uint32_t)freq_signal_abs[i];
274 } 275 }
275 276
276 return time_signal_scaling; 277 return time_signal_scaling;
277 } 278 }
278 279
279 int WebRtcAecm_ProcessBlock(AecmCore* aecm, 280 int RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/8200
280 const int16_t* farend, 281 WebRtcAecm_ProcessBlock(AecmCore* aecm,
281 const int16_t* nearendNoisy, 282 const int16_t* farend,
282 const int16_t* nearendClean, 283 const int16_t* nearendNoisy,
283 int16_t* output) { 284 const int16_t* nearendClean,
285 int16_t* output) {
284 int i; 286 int i;
285 287
286 uint32_t xfaSum; 288 uint32_t xfaSum;
287 uint32_t dfaNoisySum; 289 uint32_t dfaNoisySum;
288 uint32_t dfaCleanSum; 290 uint32_t dfaCleanSum;
289 uint32_t echoEst32Gained; 291 uint32_t echoEst32Gained;
290 uint32_t tmpU32; 292 uint32_t tmpU32;
291 293
292 int32_t tmp32no1; 294 int32_t tmp32no1;
293 295
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 supGain = WebRtcAecm_CalcSuppressionGain(aecm); 448 supGain = WebRtcAecm_CalcSuppressionGain(aecm);
447 449
448 450
449 // Calculate Wiener filter hnl[] 451 // Calculate Wiener filter hnl[]
450 for (i = 0; i < PART_LEN1; i++) 452 for (i = 0; i < PART_LEN1; i++)
451 { 453 {
452 // Far end signal through channel estimate in Q8 454 // Far end signal through channel estimate in Q8
453 // How much can we shift right to preserve resolution 455 // How much can we shift right to preserve resolution
454 tmp32no1 = echoEst32[i] - aecm->echoFilt[i]; 456 tmp32no1 = echoEst32[i] - aecm->echoFilt[i];
455 aecm->echoFilt[i] += (tmp32no1 * 50) >> 8; 457 aecm->echoFilt[i] += (tmp32no1 * 50) >> 8;
458 // UBSan: 72293096 * 50 cannot be represented in type 'int'
456 459
457 zeros32 = WebRtcSpl_NormW32(aecm->echoFilt[i]) + 1; 460 zeros32 = WebRtcSpl_NormW32(aecm->echoFilt[i]) + 1;
458 zeros16 = WebRtcSpl_NormW16(supGain) + 1; 461 zeros16 = WebRtcSpl_NormW16(supGain) + 1;
459 if (zeros32 + zeros16 > 16) 462 if (zeros32 + zeros16 > 16)
460 { 463 {
461 // Multiplication is safe 464 // Multiplication is safe
462 // Result in 465 // Result in
463 // Q(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN+ 466 // Q(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN+
464 // aecm->xfaQDomainBuf[diff]) 467 // aecm->xfaQDomainBuf[diff])
465 echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i], 468 echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i],
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 13); 763 13);
761 } 764 }
762 uImag[PART_LEN] = 0; 765 uImag[PART_LEN] = 0;
763 766
764 for (i = 0; i < PART_LEN1; i++) 767 for (i = 0; i < PART_LEN1; i++)
765 { 768 {
766 out[i].real = WebRtcSpl_AddSatW16(out[i].real, uReal[i]); 769 out[i].real = WebRtcSpl_AddSatW16(out[i].real, uReal[i]);
767 out[i].imag = WebRtcSpl_AddSatW16(out[i].imag, uImag[i]); 770 out[i].imag = WebRtcSpl_AddSatW16(out[i].imag, uImag[i]);
768 } 771 }
769 } 772 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc ('k') | webrtc/rtc_base/ipaddress_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698