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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.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) 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
11 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" 11 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h"
12 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal .h" 12 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal .h"
13 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_tables.h " 13 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_tables.h "
14 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/settings.h" 14 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/settings.h"
15 #include "webrtc/rtc_base/sanitizer.h"
15 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" 16 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
16 #include "webrtc/test/gtest.h" 17 #include "webrtc/test/gtest.h"
17 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
18 19
19 class FilterBanksTest : public testing::Test { 20 class FilterBanksTest : public testing::Test {
20 protected: 21 protected:
21 // Pass a function pointer to the Tester function. 22 // Pass a function pointer to the Tester function.
22 void CalculateResidualEnergyTester(AllpassFilter2FixDec16 23 void RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/5513
23 AllpassFilter2FixDec16Function) { 24 CalculateResidualEnergyTester(AllpassFilter2FixDec16
25 AllpassFilter2FixDec16Function) {
24 const int kSamples = QLOOKAHEAD; 26 const int kSamples = QLOOKAHEAD;
25 const int kState = 2; 27 const int kState = 2;
26 int16_t data_ch1[kSamples] = {0}; 28 int16_t data_ch1[kSamples] = {0};
27 int16_t data_ch2[kSamples] = {0}; 29 int16_t data_ch2[kSamples] = {0};
28 int32_t state_ch1[kState] = {0}; 30 int32_t state_ch1[kState] = {0};
29 int32_t state_ch2[kState] = {0}; 31 int32_t state_ch2[kState] = {0};
30 const int32_t out_state_ch1[kState] = {-809122714, 1645972152}; 32 const int32_t out_state_ch1[kState] = {-809122714, 1645972152};
31 const int32_t out_state_ch2[kState] = {428019288, 1057309936}; 33 const int32_t out_state_ch2[kState] = {428019288, 1057309936};
32 const int32_t out_data_ch1[kSamples] = {0, 0, 347, 10618, 16718, -7089, 34 const int32_t out_data_ch1[kSamples] = {0, 0, 347, 10618, 16718, -7089,
33 32767, 16913, 27042, 8377, -22973, -28372, -27603, -14804, 398, -25332, 35 32767, 16913, 27042, 8377, -22973, -28372, -27603, -14804, 398, -25332,
34 -11200, 18044, 25223, -6839, 1116, -23984, 32717, 7364}; 36 -11200, 18044, 25223, -6839, 1116, -23984, 32717, 7364};
35 const int32_t out_data_ch2[kSamples] = {0, 0, 3010, 22351, 21106, 16969, 37 const int32_t out_data_ch2[kSamples] = {0, 0, 3010, 22351, 21106, 16969,
36 -2095, -664, 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339, 38 -2095, -664, 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
37 -17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504}; 39 -17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504};
38 int sign = 1; 40 int sign = 1;
39 41
40 for (int i = 0; i < kSamples; i++) { 42 for (int i = 0; i < kSamples; i++) {
41 sign *= -1; 43 sign *= -1;
42 data_ch1[i] = sign * WEBRTC_SPL_WORD32_MAX / (i * i + 1); 44 data_ch1[i] = sign * WEBRTC_SPL_WORD32_MAX / (i * i + 1);
43 data_ch2[i] = sign * WEBRTC_SPL_WORD32_MIN / (i * i + 1); 45 data_ch2[i] = sign * WEBRTC_SPL_WORD32_MIN / (i * i + 1);
46 // UBSan: -1 * -2147483648 cannot be represented in type 'int'
44 }; 47 };
45 48
46 AllpassFilter2FixDec16Function(data_ch1, 49 AllpassFilter2FixDec16Function(data_ch1,
47 data_ch2, 50 data_ch2,
48 WebRtcIsacfix_kUpperApFactorsQ15, 51 WebRtcIsacfix_kUpperApFactorsQ15,
49 WebRtcIsacfix_kLowerApFactorsQ15, 52 WebRtcIsacfix_kLowerApFactorsQ15,
50 kSamples, 53 kSamples,
51 state_ch1, 54 state_ch1,
52 state_ch2); 55 state_ch2);
53 56
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 in[i] = WEBRTC_SPL_WORD32_MAX / (i + 1); 97 in[i] = WEBRTC_SPL_WORD32_MAX / (i + 1);
95 } 98 }
96 99
97 WebRtcIsacfix_HighpassFilterFixDec32(in, kSamples, 100 WebRtcIsacfix_HighpassFilterFixDec32(in, kSamples,
98 WebRtcIsacfix_kHPStCoeffOut1Q30, state); 101 WebRtcIsacfix_kHPStCoeffOut1Q30, state);
99 102
100 for (int i = 0; i < kSamples; i++) { 103 for (int i = 0; i < kSamples; i++) {
101 EXPECT_EQ(out[i], in[i]); 104 EXPECT_EQ(out[i], in[i]);
102 } 105 }
103 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698