audio_processing: Replaced trivial macro WEBRTC_SPL_LSHIFT_W32 with <<
Affected components: * AECM * AGC * HPF * NSx BUG=3348,3353 TESTED=locally on linux and trybots R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/27629004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7329 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
8cad9432d5
commit
750423c722
@ -303,8 +303,7 @@ void WebRtcAecm_InitEchoPathCore(AecmCore_t* aecm, const int16_t* echo_path)
|
||||
memcpy(aecm->channelAdapt16, echo_path, sizeof(int16_t) * PART_LEN1);
|
||||
for (i = 0; i < PART_LEN1; i++)
|
||||
{
|
||||
aecm->channelAdapt32[i] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)(aecm->channelAdapt16[i]), 16);
|
||||
aecm->channelAdapt32[i] = (int32_t)aecm->channelAdapt16[i] << 16;
|
||||
}
|
||||
|
||||
// Reset channel storing variables
|
||||
@ -370,16 +369,12 @@ static void ResetAdaptiveChannelC(AecmCore_t* aecm)
|
||||
// Restore the W32 channel
|
||||
for (i = 0; i < PART_LEN; i += 4)
|
||||
{
|
||||
aecm->channelAdapt32[i] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)aecm->channelStored[i], 16);
|
||||
aecm->channelAdapt32[i + 1] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)aecm->channelStored[i + 1], 16);
|
||||
aecm->channelAdapt32[i + 2] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)aecm->channelStored[i + 2], 16);
|
||||
aecm->channelAdapt32[i + 3] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)aecm->channelStored[i + 3], 16);
|
||||
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
|
||||
aecm->channelAdapt32[i + 1] = (int32_t)aecm->channelStored[i + 1] << 16;
|
||||
aecm->channelAdapt32[i + 2] = (int32_t)aecm->channelStored[i + 2] << 16;
|
||||
aecm->channelAdapt32[i + 3] = (int32_t)aecm->channelStored[i + 3] << 16;
|
||||
}
|
||||
aecm->channelAdapt32[i] = WEBRTC_SPL_LSHIFT_W32((int32_t)aecm->channelStored[i], 16);
|
||||
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
|
||||
}
|
||||
|
||||
// Initialize function pointers for ARM Neon platform.
|
||||
|
||||
@ -687,7 +687,7 @@ static void ComfortNoise(AecmCore_t* aecm,
|
||||
{
|
||||
// Shift to the noise domain.
|
||||
tmp32 = (int32_t)dfa[i];
|
||||
outLShift32 = WEBRTC_SPL_LSHIFT_W32(tmp32, shiftFromNearToNoise);
|
||||
outLShift32 = tmp32 << shiftFromNearToNoise;
|
||||
|
||||
if (outLShift32 < aecm->noiseEst[i])
|
||||
{
|
||||
@ -750,7 +750,7 @@ static void ComfortNoise(AecmCore_t* aecm,
|
||||
if (tmp32 > 32767)
|
||||
{
|
||||
tmp32 = 32767;
|
||||
aecm->noiseEst[i] = WEBRTC_SPL_LSHIFT_W32(tmp32, shiftFromNearToNoise);
|
||||
aecm->noiseEst[i] = tmp32 << shiftFromNearToNoise;
|
||||
}
|
||||
noiseRShift16[i] = (int16_t)tmp32;
|
||||
|
||||
|
||||
@ -606,8 +606,7 @@ void WebRtcAecm_ResetAdaptiveChannel_mips(AecmCore_t* aecm) {
|
||||
);
|
||||
}
|
||||
|
||||
aecm->channelAdapt32[i] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)aecm->channelStored[i], 16);
|
||||
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
|
||||
}
|
||||
#endif // #if defined(MIPS_DSP_R1_LE)
|
||||
|
||||
@ -1471,11 +1470,11 @@ static void ComfortNoise(AecmCore_t* aecm,
|
||||
|
||||
if (tmp32 > 32767) {
|
||||
tmp32 = 32767;
|
||||
aecm->noiseEst[i] = WEBRTC_SPL_LSHIFT_W32(tmp32, shiftFromNearToNoise);
|
||||
aecm->noiseEst[i] = tmp32 << shiftFromNearToNoise;
|
||||
}
|
||||
if (tmp321 > 32767) {
|
||||
tmp321 = 32767;
|
||||
aecm->noiseEst[i+1] = WEBRTC_SPL_LSHIFT_W32(tmp321, shiftFromNearToNoise);
|
||||
aecm->noiseEst[i+1] = tmp321 << shiftFromNearToNoise;
|
||||
}
|
||||
|
||||
__asm __volatile (
|
||||
|
||||
@ -330,8 +330,7 @@ void WebRtcAecm_ResetAdaptiveChannelNeon(AecmCore_t* aecm) {
|
||||
|
||||
for (i = 0; i < PART_LEN - 7; i += 8) {
|
||||
// aecm->channelAdapt16[i] = aecm->channelStored[i];
|
||||
// aecm->channelAdapt32[i] = WEBRTC_SPL_LSHIFT_W32((int32_t)
|
||||
// aecm->channelStored[i], 16);
|
||||
// aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
|
||||
__asm __volatile("vld1.16 {d24, d25}, [%0, :128]" : :
|
||||
"r"(&aecm->channelStored[i]) : "q12");
|
||||
__asm __volatile("vst1.16 {d24, d25}, [%0, :128]" : :
|
||||
@ -342,6 +341,5 @@ void WebRtcAecm_ResetAdaptiveChannelNeon(AecmCore_t* aecm) {
|
||||
"r"(&aecm->channelAdapt32[i]): "q10", "q11");
|
||||
}
|
||||
aecm->channelAdapt16[i] = aecm->channelStored[i];
|
||||
aecm->channelAdapt32[i] = WEBRTC_SPL_LSHIFT_W32(
|
||||
(int32_t)aecm->channelStored[i], 16);
|
||||
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ int WebRtcAgc_VirtualMic(void *agcInst, int16_t *in_near, int16_t *in_near_H,
|
||||
stt->lowLevelSignal = 0;
|
||||
}
|
||||
|
||||
micLevelTmp = WEBRTC_SPL_LSHIFT_W32(micLevelIn, stt->scale);
|
||||
micLevelTmp = micLevelIn << stt->scale;
|
||||
/* Set desired level */
|
||||
gainIdx = stt->micVol;
|
||||
if (stt->micVol > stt->maxAnalog)
|
||||
@ -769,7 +769,7 @@ int32_t WebRtcAgc_ProcessAnalog(void *state, int32_t inMicLevel,
|
||||
Agc_t *stt;
|
||||
|
||||
stt = (Agc_t *)state;
|
||||
inMicLevelTmp = WEBRTC_SPL_LSHIFT_W32(inMicLevel, stt->scale);
|
||||
inMicLevelTmp = inMicLevel << stt->scale;
|
||||
|
||||
if (inMicLevelTmp > stt->maxAnalog)
|
||||
{
|
||||
@ -1089,7 +1089,7 @@ int32_t WebRtcAgc_ProcessAnalog(void *state, int32_t inMicLevel,
|
||||
stt->msTooLow = 0;
|
||||
|
||||
/* Normalize the volume level */
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(inMicLevelTmp - stt->minLevel, 14);
|
||||
tmp32 = (inMicLevelTmp - stt->minLevel) << 14;
|
||||
if (stt->maxInit != stt->minLevel)
|
||||
{
|
||||
volNormFIX = tmp32 / (stt->maxInit - stt->minLevel);
|
||||
@ -1150,7 +1150,7 @@ int32_t WebRtcAgc_ProcessAnalog(void *state, int32_t inMicLevel,
|
||||
stt->msTooLow = 0;
|
||||
|
||||
/* Normalize the volume level */
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(inMicLevelTmp - stt->minLevel, 14);
|
||||
tmp32 = (inMicLevelTmp - stt->minLevel) << 14;
|
||||
if (stt->maxInit != stt->minLevel)
|
||||
{
|
||||
volNormFIX = tmp32 / (stt->maxInit - stt->minLevel);
|
||||
@ -1612,8 +1612,8 @@ int WebRtcAgc_Init(void *agcInst, int32_t minLevel, int32_t maxLevel,
|
||||
// TODO(bjornv): Investigate if we really need to scale up a small range now when we have
|
||||
// a guard against zero-increments. For now, we do not support scale up (scale = 0).
|
||||
stt->scale = 0;
|
||||
maxLevel = WEBRTC_SPL_LSHIFT_W32(maxLevel, stt->scale);
|
||||
minLevel = WEBRTC_SPL_LSHIFT_W32(minLevel, stt->scale);
|
||||
maxLevel <<= stt->scale;
|
||||
minLevel <<= stt->scale;
|
||||
|
||||
/* Make minLevel and maxLevel static in AdaptiveDigital */
|
||||
if (stt->agcMode == kAgcModeAdaptiveDigital)
|
||||
|
||||
@ -116,9 +116,8 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
// limiterLvlX = analogTarget - limiterOffset
|
||||
// limiterLvl = targetLevelDbfs + limiterOffset/compRatio
|
||||
limiterLvlX = analogTarget - limiterOffset;
|
||||
limiterIdx = 2
|
||||
+ WebRtcSpl_DivW32W16ResW16(WEBRTC_SPL_LSHIFT_W32((int32_t)limiterLvlX, 13),
|
||||
(kLog10_2 / 2));
|
||||
limiterIdx =
|
||||
2 + WebRtcSpl_DivW32W16ResW16((int32_t)limiterLvlX << 13, kLog10_2 / 2);
|
||||
tmp16no1 = WebRtcSpl_DivW32W16ResW16(limiterOffset + (kCompRatio >> 1), kCompRatio);
|
||||
limiterLvl = targetLevelDbfs + tmp16no1;
|
||||
|
||||
@ -144,7 +143,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
inLevel = WebRtcSpl_DivW32W16(tmp32, kCompRatio); // Q14
|
||||
|
||||
// Calculate diffGain-inLevel, to map using the genFuncTable
|
||||
inLevel = WEBRTC_SPL_LSHIFT_W32((int32_t)diffGain, 14) - inLevel; // Q14
|
||||
inLevel = ((int32_t)diffGain << 14) - inLevel; // Q14
|
||||
|
||||
// Make calculations on abs(inLevel) and compensate for the sign afterwards.
|
||||
absInLevel = (uint32_t)WEBRTC_SPL_ABS_W32(inLevel); // Q14
|
||||
@ -186,7 +185,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
logApprox = WEBRTC_SPL_RSHIFT_U32(tmpU32no1 - tmpU32no2, 8 - zerosScale); //Q14
|
||||
}
|
||||
}
|
||||
numFIX = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_U16(maxGain, constMaxGain), 6); // Q14
|
||||
numFIX = (maxGain * constMaxGain) << 6; // Q14
|
||||
numFIX -= (int32_t)logApprox * diffGain; // Q14
|
||||
|
||||
// Calculate ratio
|
||||
@ -199,7 +198,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
{
|
||||
zeros = WebRtcSpl_NormW32(den) + 8;
|
||||
}
|
||||
numFIX = WEBRTC_SPL_LSHIFT_W32(numFIX, zeros); // Q(14+zeros)
|
||||
numFIX <<= zeros; // Q(14+zeros)
|
||||
|
||||
// Shift den so we end up in Qy1
|
||||
tmp32no1 = WEBRTC_SPL_SHIFT_W32(den, zeros - 8); // Q(zeros)
|
||||
@ -214,7 +213,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
if (limiterEnable && (i < limiterIdx))
|
||||
{
|
||||
tmp32 = WEBRTC_SPL_MUL_16_U16(i - 1, kLog10_2); // Q14
|
||||
tmp32 -= WEBRTC_SPL_LSHIFT_W32(limiterLvl, 14); // Q14
|
||||
tmp32 -= limiterLvl << 14; // Q14
|
||||
y32 = WebRtcSpl_DivW32W16(tmp32 + 10, 20);
|
||||
}
|
||||
if (y32 > 39000)
|
||||
@ -226,7 +225,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
tmp32 = WEBRTC_SPL_MUL(y32, kLog10) + 8192; // in Q28
|
||||
tmp32 = WEBRTC_SPL_RSHIFT_W32(tmp32, 14); // in Q14
|
||||
}
|
||||
tmp32 += WEBRTC_SPL_LSHIFT_W32(16, 14); // in Q14 (Make sure final output is in Q16)
|
||||
tmp32 += 16 << 14; // in Q14 (Make sure final output is in Q16)
|
||||
|
||||
// Calculate power
|
||||
if (tmp32 > 0)
|
||||
@ -236,10 +235,10 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
if (WEBRTC_SPL_RSHIFT_W32(fracPart, 13))
|
||||
{
|
||||
tmp16 = (2 << 14) - constLinApprox;
|
||||
tmp32no2 = WEBRTC_SPL_LSHIFT_W32(1, 14) - fracPart;
|
||||
tmp32no2 = (1 << 14) - fracPart;
|
||||
tmp32no2 *= tmp16;
|
||||
tmp32no2 = WEBRTC_SPL_RSHIFT_W32(tmp32no2, 13);
|
||||
tmp32no2 = WEBRTC_SPL_LSHIFT_W32(1, 14) - tmp32no2;
|
||||
tmp32no2 = (1 << 14) - tmp32no2;
|
||||
} else
|
||||
{
|
||||
tmp16 = constLinApprox - (1 << 14);
|
||||
@ -247,8 +246,8 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
tmp32no2 = WEBRTC_SPL_RSHIFT_W32(tmp32no2, 13);
|
||||
}
|
||||
fracPart = (uint16_t)tmp32no2;
|
||||
gainTable[i] = WEBRTC_SPL_LSHIFT_W32(1, intPart)
|
||||
+ WEBRTC_SPL_SHIFT_W32(fracPart, intPart - 14);
|
||||
gainTable[i] =
|
||||
(1 << intPart) + WEBRTC_SPL_SHIFT_W32(fracPart, intPart - 14);
|
||||
} else
|
||||
{
|
||||
gainTable[i] = 0;
|
||||
@ -462,7 +461,7 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt, const int16_t *in_near,
|
||||
{
|
||||
zeros = 31;
|
||||
}
|
||||
tmp32 = (WEBRTC_SPL_LSHIFT_W32(cur_level, zeros) & 0x7FFFFFFF);
|
||||
tmp32 = (cur_level << zeros) & 0x7FFFFFFF;
|
||||
frac = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 19); // Q12
|
||||
tmp32 = WEBRTC_SPL_MUL((stt->gainTable[zeros-1] - stt->gainTable[zeros]), frac);
|
||||
gains[k + 1] = stt->gainTable[zeros] + WEBRTC_SPL_RSHIFT_W32(tmp32, 12);
|
||||
@ -487,7 +486,7 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt, const int16_t *in_near,
|
||||
{
|
||||
zeros_fast = 31;
|
||||
}
|
||||
tmp32 = (WEBRTC_SPL_LSHIFT_W32(stt->capacitorFast, zeros_fast) & 0x7FFFFFFF);
|
||||
tmp32 = (stt->capacitorFast << zeros_fast) & 0x7FFFFFFF;
|
||||
zeros_fast <<= 9;
|
||||
zeros_fast -= (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 22);
|
||||
|
||||
@ -570,8 +569,8 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt, const int16_t *in_near,
|
||||
|
||||
// Apply gain
|
||||
// handle first sub frame separately
|
||||
delta = WEBRTC_SPL_LSHIFT_W32(gains[1] - gains[0], (4 - L2));
|
||||
gain32 = WEBRTC_SPL_LSHIFT_W32(gains[0], 4);
|
||||
delta = (gains[1] - gains[0]) << (4 - L2);
|
||||
gain32 = gains[0] << 4;
|
||||
// iterate over samples
|
||||
for (n = 0; n < L; n++)
|
||||
{
|
||||
@ -615,8 +614,8 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt, const int16_t *in_near,
|
||||
// iterate over subframes
|
||||
for (k = 1; k < 10; k++)
|
||||
{
|
||||
delta = WEBRTC_SPL_LSHIFT_W32(gains[k+1] - gains[k], (4 - L2));
|
||||
gain32 = WEBRTC_SPL_LSHIFT_W32(gains[k], 4);
|
||||
delta = (gains[k+1] - gains[k]) << (4 - L2);
|
||||
gain32 = gains[k] << 4;
|
||||
// iterate over samples
|
||||
for (n = 0; n < L; n++)
|
||||
{
|
||||
@ -648,14 +647,14 @@ void WebRtcAgc_InitVad(AgcVad_t *state)
|
||||
state->meanLongTerm = 15 << 10;
|
||||
|
||||
// variance of input level (Q8)
|
||||
state->varianceLongTerm = WEBRTC_SPL_LSHIFT_W32(500, 8);
|
||||
state->varianceLongTerm = 500 << 8;
|
||||
|
||||
state->stdLongTerm = 0; // standard deviation of input level in dB
|
||||
// short-term average input level (Q10)
|
||||
state->meanShortTerm = 15 << 10;
|
||||
|
||||
// short-term variance of input level (Q8)
|
||||
state->varianceShortTerm = WEBRTC_SPL_LSHIFT_W32(500, 8);
|
||||
state->varianceShortTerm = 500 << 8;
|
||||
|
||||
state->stdShortTerm = 0; // short-term standard deviation of input level in dB
|
||||
state->counter = 3; // counts updates
|
||||
@ -760,7 +759,7 @@ int16_t WebRtcAgc_ProcessVad(AgcVad_t *state, // (i) VAD state
|
||||
|
||||
// update short-term estimate of standard deviation in energy level (Q10)
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16(state->meanShortTerm, state->meanShortTerm);
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(state->varianceShortTerm, 12) - tmp32;
|
||||
tmp32 = (state->varianceShortTerm << 12) - tmp32;
|
||||
state->stdShortTerm = (int16_t)WebRtcSpl_Sqrt(tmp32);
|
||||
|
||||
// update long-term estimate of mean energy level (Q10)
|
||||
@ -776,7 +775,7 @@ int16_t WebRtcAgc_ProcessVad(AgcVad_t *state, // (i) VAD state
|
||||
|
||||
// update long-term estimate of standard deviation in energy level (Q10)
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16(state->meanLongTerm, state->meanLongTerm);
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(state->varianceLongTerm, 12) - tmp32;
|
||||
tmp32 = (state->varianceLongTerm << 12) - tmp32;
|
||||
state->stdLongTerm = (int16_t)WebRtcSpl_Sqrt(tmp32);
|
||||
|
||||
// update voice activity measure (Q10)
|
||||
|
||||
@ -82,8 +82,8 @@ int Filter(FilterState* hpf, int16_t* data, int length) {
|
||||
y[2] = y[0];
|
||||
y[3] = y[1];
|
||||
y[0] = static_cast<int16_t>(tmp_int32 >> 13);
|
||||
y[1] = static_cast<int16_t>((tmp_int32 -
|
||||
WEBRTC_SPL_LSHIFT_W32(static_cast<int32_t>(y[0]), 13)) << 2);
|
||||
y[1] = static_cast<int16_t>(
|
||||
(tmp_int32 - (static_cast<int32_t>(y[0]) << 13)) << 2);
|
||||
|
||||
// Rounding in Q12, i.e. add 2^11
|
||||
tmp_int32 += 2048;
|
||||
|
||||
@ -325,7 +325,7 @@ static void UpdateNoiseEstimate(NsxInst_t* inst, int offset) {
|
||||
if (tmp16 < 0) {
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1, -tmp16);
|
||||
} else {
|
||||
tmp32no1 = WEBRTC_SPL_LSHIFT_W32(tmp32no1, tmp16);
|
||||
tmp32no1 <<= tmp16;
|
||||
}
|
||||
inst->noiseEstQuantile[i] = WebRtcSpl_SatW32ToW16(tmp32no1);
|
||||
}
|
||||
@ -604,7 +604,7 @@ void WebRtcNsx_CalcParametricNoiseEstimate(NsxInst_t* inst,
|
||||
|
||||
// Calculate output: 2^tmp32no1
|
||||
// Output in Q(minNorm-stages)
|
||||
tmp32no1 += WEBRTC_SPL_LSHIFT_W32((int32_t)(inst->minNorm - inst->stages), 11);
|
||||
tmp32no1 += (inst->minNorm - inst->stages) << 11;
|
||||
if (tmp32no1 > 0) {
|
||||
int_part = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32no1, 11);
|
||||
frac_part = (int16_t)(tmp32no1 & 0x000007ff); // Q11
|
||||
@ -1071,7 +1071,7 @@ void WebRtcNsx_ComputeSpectralFlatness(NsxInst_t* inst, uint16_t* magn) {
|
||||
logCurSpectralFlatness = (int32_t)avgSpectralFlatnessNum;
|
||||
logCurSpectralFlatness += ((int32_t)(inst->stages - 1) << (inst->stages + 7)); // Q(8+stages-1)
|
||||
logCurSpectralFlatness -= (tmp32 << (inst->stages - 1));
|
||||
logCurSpectralFlatness = WEBRTC_SPL_LSHIFT_W32(logCurSpectralFlatness, 10 - inst->stages); // Q17
|
||||
logCurSpectralFlatness <<= (10 - inst->stages); // Q17
|
||||
tmp32 = (int32_t)(0x00020000 | (WEBRTC_SPL_ABS_W32(logCurSpectralFlatness)
|
||||
& 0x0001FFFF)); //Q17
|
||||
intPart = -(int16_t)WEBRTC_SPL_RSHIFT_W32(logCurSpectralFlatness, 17);
|
||||
@ -1079,7 +1079,7 @@ void WebRtcNsx_ComputeSpectralFlatness(NsxInst_t* inst, uint16_t* magn) {
|
||||
if (intPart > 0) {
|
||||
currentSpectralFlatness = WEBRTC_SPL_RSHIFT_W32(tmp32, intPart);
|
||||
} else {
|
||||
currentSpectralFlatness = WEBRTC_SPL_LSHIFT_W32(tmp32, -intPart);
|
||||
currentSpectralFlatness = tmp32 << -intPart;
|
||||
}
|
||||
|
||||
//time average update of spectral flatness feature
|
||||
@ -1387,7 +1387,7 @@ void WebRtcNsx_DataAnalysis(NsxInst_t* inst, short* speechFrame, uint16_t* magnU
|
||||
tmp_1_w32 = (int32_t)matrix_determinant;
|
||||
tmp_1_w32 += WEBRTC_SPL_MUL_16_16_RSFT(kSumLogIndex[65], sum_log_i, 9);
|
||||
tmp_1_w32 -= WEBRTC_SPL_MUL_16_16_RSFT(kSumLogIndex[65], kSumLogIndex[65], 10);
|
||||
tmp_1_w32 -= WEBRTC_SPL_LSHIFT_W32((int32_t)sum_log_i_square, 4);
|
||||
tmp_1_w32 -= (int32_t)sum_log_i_square << 4;
|
||||
tmp_1_w32 -= WEBRTC_SPL_MUL_16_16_RSFT((int16_t)
|
||||
(inst->magnLen - kStartBand), kSumSquareLogIndex[65], 2);
|
||||
matrix_determinant = (int16_t)tmp_1_w32;
|
||||
@ -1400,7 +1400,7 @@ void WebRtcNsx_DataAnalysis(NsxInst_t* inst, short* speechFrame, uint16_t* magnU
|
||||
if (zeros < 0) {
|
||||
zeros = 0;
|
||||
}
|
||||
tmp_1_w32 = WEBRTC_SPL_LSHIFT_W32(sum_log_magn, 1); // Q9
|
||||
tmp_1_w32 = sum_log_magn << 1; // Q9
|
||||
sum_log_magn_u16 = (uint16_t)WEBRTC_SPL_RSHIFT_W32(tmp_1_w32, zeros);//Q(9-zeros)
|
||||
|
||||
// Calculate and update pinkNoiseNumerator. Result in Q11.
|
||||
@ -1417,7 +1417,7 @@ void WebRtcNsx_DataAnalysis(NsxInst_t* inst, short* speechFrame, uint16_t* magnU
|
||||
tmp_2_w32 -= (int32_t)WEBRTC_SPL_UMUL_32_16(tmpU32no1, tmp_u16); // Q(11-zeros)
|
||||
matrix_determinant = WEBRTC_SPL_RSHIFT_W16(matrix_determinant, zeros); // Q(-zeros)
|
||||
tmp_2_w32 = WebRtcSpl_DivW32W16(tmp_2_w32, matrix_determinant); // Q11
|
||||
tmp_2_w32 += WEBRTC_SPL_LSHIFT_W32((int32_t)net_norm, 11); // Q11
|
||||
tmp_2_w32 += (int32_t)net_norm << 11; // Q11
|
||||
if (tmp_2_w32 < 0) {
|
||||
tmp_2_w32 = 0;
|
||||
}
|
||||
@ -1944,8 +1944,8 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram
|
||||
tmp32no1 *= ONE_MINUS_GAMMA_PAUSE_Q8; // Q(8+prevQMagn+nShifts)
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1 + 128, 8); // Q(qMagn)
|
||||
} else {
|
||||
tmp32no1 = WEBRTC_SPL_LSHIFT_W32((int32_t)magnU16[i], nShifts)
|
||||
- inst->avgMagnPause[i]; // Q(qMagn+nShifts)
|
||||
// In Q(qMagn+nShifts)
|
||||
tmp32no1 = ((int32_t)magnU16[i] << nShifts) - inst->avgMagnPause[i];
|
||||
tmp32no1 *= ONE_MINUS_GAMMA_PAUSE_Q8; // Q(8+prevQMagn+nShifts)
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1 + (128 << nShifts), 8 + nShifts); // Q(qMagn)
|
||||
}
|
||||
|
||||
@ -234,8 +234,8 @@ void WebRtcNsx_SpeechNoiseProb(NsxInst_t* inst,
|
||||
// Quadratic approximation of 2^frac
|
||||
tmp32no2 = WEBRTC_SPL_RSHIFT_W32(frac * frac * 44, 19); // Q12
|
||||
tmp32no2 += WEBRTC_SPL_MUL_16_16_RSFT(frac, 84, 7); // Q12
|
||||
invLrtFX = WEBRTC_SPL_LSHIFT_W32(1, 8 + intPart)
|
||||
+ WEBRTC_SPL_SHIFT_W32(tmp32no2, intPart - 4); // Q8
|
||||
invLrtFX = (1 << (8 + intPart)) +
|
||||
WEBRTC_SPL_SHIFT_W32(tmp32no2, intPart - 4); // Q8
|
||||
|
||||
normTmp = WebRtcSpl_NormW32(invLrtFX);
|
||||
normTmp2 = WebRtcSpl_NormW16((16384 - inst->priorNonSpeechProb));
|
||||
@ -253,8 +253,7 @@ void WebRtcNsx_SpeechNoiseProb(NsxInst_t* inst,
|
||||
invLrtFX = WEBRTC_SPL_RSHIFT_W32(tmp32no1, 8); // Q14
|
||||
}
|
||||
|
||||
tmp32no1 = WEBRTC_SPL_LSHIFT_W32((int32_t)inst->priorNonSpeechProb,
|
||||
8); // Q22
|
||||
tmp32no1 = (int32_t)inst->priorNonSpeechProb << 8; // Q22
|
||||
|
||||
nonSpeechProbFinal[i] = tmp32no1 /
|
||||
(inst->priorNonSpeechProb + invLrtFX); // Q8
|
||||
|
||||
@ -102,7 +102,7 @@ static void UpdateNoiseEstimateNeon(NsxInst_t* inst, int offset) {
|
||||
// if (tmp16 < 0) {
|
||||
// tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1, -tmp16);
|
||||
// } else {
|
||||
// tmp32no1 = WEBRTC_SPL_LSHIFT_W32(tmp32no1, tmp16);
|
||||
// tmp32no1 <<= tmp16;
|
||||
// }
|
||||
v32x4B = vshlq_s32(v32x4A, v32x4B);
|
||||
|
||||
@ -127,7 +127,7 @@ static void UpdateNoiseEstimateNeon(NsxInst_t* inst, int offset) {
|
||||
if (tmp16 < 0) {
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1, -tmp16);
|
||||
} else {
|
||||
tmp32no1 = WEBRTC_SPL_LSHIFT_W32(tmp32no1, tmp16);
|
||||
tmp32no1 <<= tmp16;
|
||||
}
|
||||
*ptr_noiseEstQuantile = WebRtcSpl_SatW32ToW16(tmp32no1);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user