Revert of -enable UBsan on AGC. (patchset #1 id:1 of https://codereview.webrtc.org/2063643003/ )

Reason for revert:
Breaks downstream code import.

Original issue's description:
> Reland of Re-enable UBsan on AGC.
>
> patchset #8 id:300001 of https://codereview.webrtc.org/2003623003/
>
> This reverts commit 2b9423f7a18145255deb93f2505a4fd1c3fa9ad7.
>
> BUG=webrtc:5530
> TBR=peah@webrtc.org, kjellander@webrtc.org
>
> Committed: https://crrev.com/b1963b403f8e9258c35a02d2622da254cbb90c51
> Cr-Commit-Position: refs/heads/master@{#13132}

TBR=henrik.lundin@webrtc.org,minyue@webrtc.org
BUG=webrtc:5530
NOTRY=true

Review-Url: https://codereview.webrtc.org/2078433003
Cr-Commit-Position: refs/heads/master@{#13169}
This commit is contained in:
pbos
2016-06-16 07:59:09 -07:00
committed by Commit bot
parent 30a3a751a6
commit 4867ca2689
4 changed files with 25 additions and 17 deletions

View File

@ -22,6 +22,12 @@ src:*/usr/*
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5513
fun:*FilterBanksTest*CalculateResidualEnergyTester*
#############################################################################
# The audio processing AGC submodule exhibits a few problems (overflows).
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5530
src:*/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
src:*/webrtc/modules/audio_processing/agc/legacy/digital_agc.c
#############################################################################
# Ignore errors in common_audio.
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5486

View File

@ -474,18 +474,18 @@ void WebRtcAgc_SaturationCtrl(LegacyAgc* stt,
void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) {
int16_t i;
int64_t tmp = 0;
int32_t tmp32 = 0;
int32_t midVal;
/* Is the input signal zero? */
for (i = 0; i < 10; i++) {
tmp += env[i];
tmp32 += env[i];
}
/* Each block is allowed to have a few non-zero
* samples.
*/
if (tmp < 500) {
if (tmp32 < 500) {
stt->msZero += 10;
} else {
stt->msZero = 0;

View File

@ -189,7 +189,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t* gainTable, // Q16
// Calculate ratio
// Shift |numFIX| as much as possible.
// Ensure we avoid wrap-around in |den| as well.
if (numFIX > (den >> 8) || -numFIX > (den >> 8)) // |den| is Q8.
if (numFIX > (den >> 8)) // |den| is Q8.
{
zeros = WebRtcSpl_NormW32(numFIX);
} else {
@ -198,11 +198,13 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t* gainTable, // Q16
numFIX *= 1 << zeros; // Q(14+zeros)
// Shift den so we end up in Qy1
tmp32no1 = WEBRTC_SPL_SHIFT_W32(den, zeros - 9); // Q(zeros - 1)
y32 = numFIX / tmp32no1; // in Q15
// This is to do rounding in Q14.
y32 = y32 >= 0 ? (y32 + 1) >> 1 : -((-y32 + 1) >> 1);
tmp32no1 = WEBRTC_SPL_SHIFT_W32(den, zeros - 8); // Q(zeros)
if (numFIX < 0) {
numFIX -= tmp32no1 / 2;
} else {
numFIX += tmp32no1 / 2;
}
y32 = numFIX / tmp32no1; // in Q14
if (limiterEnable && (i < limiterIdx)) {
tmp32 = WEBRTC_SPL_MUL_16_U16(i - 1, kLog10_2); // Q14
tmp32 -= limiterLvl * (1 << 14); // Q14

View File

@ -218,7 +218,7 @@ TEST(GainControlBitExactnessTest,
DISABLED_Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
#endif
const int kStreamAnalogLevelReference = 50;
const float kOutputReference[] = {-0.004028f, -0.001678f, 0.000946f};
const float kOutputReference[] = {-0.006317f, -0.002625f, 0.001495f};
RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
true, 0, 100, kStreamAnalogLevelReference,
kOutputReference);
@ -233,7 +233,7 @@ TEST(GainControlBitExactnessTest,
DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
#endif
const int kStreamAnalogLevelReference = 50;
const float kOutputReference[] = {-0.003967f, -0.002808f, -0.001770f};
const float kOutputReference[] = {-0.006256f, -0.004395f, -0.002777f};
RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
true, 0, 100, kStreamAnalogLevelReference,
kOutputReference);
@ -248,8 +248,8 @@ TEST(GainControlBitExactnessTest,
DISABLED_Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
#endif
const int kStreamAnalogLevelReference = 50;
const float kOutputReference[] = {-0.015411f, -0.008972f, -0.015839f,
-0.015411f, -0.008972f, -0.015839f};
const float kOutputReference[] = {-0.023956f, -0.013947f, -0.024597f,
-0.023956f, -0.013947f, -0.024597f};
RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
true, 0, 100, kStreamAnalogLevelReference,
kOutputReference);
@ -264,7 +264,7 @@ TEST(GainControlBitExactnessTest,
DISABLED_Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
#endif
const int kStreamAnalogLevelReference = 50;
const float kOutputReference[] = {-0.006134f, -0.005554f, -0.005005f};
const float kOutputReference[] = {-0.009644f, -0.008728f, -0.007904f};
RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
true, 0, 100, kStreamAnalogLevelReference,
kOutputReference);
@ -279,7 +279,7 @@ TEST(GainControlBitExactnessTest,
DISABLED_Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
#endif
const int kStreamAnalogLevelReference = 50;
const float kOutputReference[] = {-0.006134f, -0.005554f, -0.005005f};
const float kOutputReference[] = {-0.009644f, -0.008728f, -0.007904f};
RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
true, 0, 100, kStreamAnalogLevelReference,
kOutputReference);
@ -385,7 +385,7 @@ TEST(GainControlBitExactnessTest,
DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
#endif
const int kStreamAnalogLevelReference = 100;
const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001801f};
const float kOutputReference[] = {-0.006348f, -0.004456f, -0.002808f};
RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 100, 5,
true, 70, 80, kStreamAnalogLevelReference,
kOutputReference);
@ -400,7 +400,7 @@ TEST(GainControlBitExactnessTest,
DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
#endif
const int kStreamAnalogLevelReference = 100;
const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001801f};
const float kOutputReference[] = {-0.006592f, -0.004639f, -0.002930f};
RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100, 5,
false, 0, 100, kStreamAnalogLevelReference,
kOutputReference);