audio_processing: Replaced macro WEBRTC_SPL_LSHIFT_W16 with <<
A trivial macro that serves no purpose. Affected components are: * audio_processing/nsx * audio_processing/agc * audio_processing/aecm * common_audio/LpcToReflCoef BUG=3348,3353 TESTED=locally on linux R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/22539004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7321 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
7c15510f38
commit
d71118194f
@ -26,7 +26,7 @@ void WebRtcSpl_LpcToReflCoef(int16_t* a16, int use_order, int16_t* k16)
|
||||
int32_t tmp_inv_denom32;
|
||||
int16_t tmp_inv_denom16;
|
||||
|
||||
k16[use_order - 1] = WEBRTC_SPL_LSHIFT_W16(a16[use_order], 3); //Q12<<3 => Q15
|
||||
k16[use_order - 1] = a16[use_order] << 3; // Q12<<3 => Q15
|
||||
for (m = use_order - 1; m > 0; m--)
|
||||
{
|
||||
// (1 - k^2) in Q30
|
||||
|
@ -746,7 +746,7 @@ void WebRtcAecm_CalcEnergies(AecmCore_t * aecm,
|
||||
int16_t decrease_max_shifts = 11;
|
||||
int16_t increase_min_shifts = 11;
|
||||
int16_t decrease_min_shifts = 3;
|
||||
int16_t kLogLowValue = WEBRTC_SPL_LSHIFT_W16(PART_LEN_SHIFT, 7);
|
||||
static const int16_t kLogLowValue = PART_LEN_SHIFT << 7;
|
||||
|
||||
// Get log of near end energy and store in buffer
|
||||
|
||||
@ -761,8 +761,8 @@ void WebRtcAecm_CalcEnergies(AecmCore_t * aecm,
|
||||
zeros = WebRtcSpl_NormU32(nearEner);
|
||||
frac = ExtractFractionPart(nearEner, zeros);
|
||||
// log2 in Q8
|
||||
tmp16 += WEBRTC_SPL_LSHIFT_W16((31 - zeros), 8) + frac;
|
||||
tmp16 -= WEBRTC_SPL_LSHIFT_W16(aecm->dfaNoisyQDomain, 8);
|
||||
tmp16 += ((31 - zeros) << 8) + frac;
|
||||
tmp16 -= aecm->dfaNoisyQDomain << 8;
|
||||
}
|
||||
aecm->nearLogEnergy[0] = tmp16;
|
||||
// END: Get log of near end energy
|
||||
@ -782,8 +782,8 @@ void WebRtcAecm_CalcEnergies(AecmCore_t * aecm,
|
||||
zeros = WebRtcSpl_NormU32(tmpFar);
|
||||
frac = ExtractFractionPart(tmpFar, zeros);
|
||||
// log2 in Q8
|
||||
tmp16 += WEBRTC_SPL_LSHIFT_W16((31 - zeros), 8) + frac;
|
||||
tmp16 -= WEBRTC_SPL_LSHIFT_W16(far_q, 8);
|
||||
tmp16 += ((31 - zeros) << 8) + frac;
|
||||
tmp16 -= far_q << 8;
|
||||
}
|
||||
aecm->farLogEnergy = tmp16;
|
||||
|
||||
@ -794,8 +794,8 @@ void WebRtcAecm_CalcEnergies(AecmCore_t * aecm,
|
||||
zeros = WebRtcSpl_NormU32(tmpAdapt);
|
||||
frac = ExtractFractionPart(tmpAdapt, zeros);
|
||||
//log2 in Q8
|
||||
tmp16 += WEBRTC_SPL_LSHIFT_W16((31 - zeros), 8) + frac;
|
||||
tmp16 -= WEBRTC_SPL_LSHIFT_W16(RESOLUTION_CHANNEL16 + far_q, 8);
|
||||
tmp16 += ((31 - zeros) << 8) + frac;
|
||||
tmp16 -= (RESOLUTION_CHANNEL16 + far_q) << 8;
|
||||
}
|
||||
aecm->echoAdaptLogEnergy[0] = tmp16;
|
||||
|
||||
@ -806,8 +806,8 @@ void WebRtcAecm_CalcEnergies(AecmCore_t * aecm,
|
||||
zeros = WebRtcSpl_NormU32(tmpStored);
|
||||
frac = ExtractFractionPart(tmpStored, zeros);
|
||||
//log2 in Q8
|
||||
tmp16 += WEBRTC_SPL_LSHIFT_W16((31 - zeros), 8) + frac;
|
||||
tmp16 -= WEBRTC_SPL_LSHIFT_W16(RESOLUTION_CHANNEL16 + far_q, 8);
|
||||
tmp16 += ((31 - zeros) << 8) + frac;
|
||||
tmp16 -= (RESOLUTION_CHANNEL16 + far_q) << 8;
|
||||
}
|
||||
aecm->echoStoredLogEnergy[0] = tmp16;
|
||||
|
||||
|
@ -235,14 +235,14 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
fracPart = (uint16_t)(tmp32 & 0x00003FFF); // in Q14
|
||||
if (WEBRTC_SPL_RSHIFT_W32(fracPart, 13))
|
||||
{
|
||||
tmp16 = WEBRTC_SPL_LSHIFT_W16(2, 14) - constLinApprox;
|
||||
tmp16 = (2 << 14) - constLinApprox;
|
||||
tmp32no2 = WEBRTC_SPL_LSHIFT_W32(1, 14) - fracPart;
|
||||
tmp32no2 *= tmp16;
|
||||
tmp32no2 = WEBRTC_SPL_RSHIFT_W32(tmp32no2, 13);
|
||||
tmp32no2 = WEBRTC_SPL_LSHIFT_W32(1, 14) - tmp32no2;
|
||||
} else
|
||||
{
|
||||
tmp16 = constLinApprox - WEBRTC_SPL_LSHIFT_W16(1, 14);
|
||||
tmp16 = constLinApprox - (1 << 14);
|
||||
tmp32no2 = fracPart * tmp16;
|
||||
tmp32no2 = WEBRTC_SPL_RSHIFT_W32(tmp32no2, 13);
|
||||
}
|
||||
@ -480,7 +480,7 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt, const int16_t *in_near,
|
||||
}
|
||||
|
||||
// Gate processing (lower gain during absence of speech)
|
||||
zeros = WEBRTC_SPL_LSHIFT_W16(zeros, 9) - WEBRTC_SPL_RSHIFT_W16(frac, 3);
|
||||
zeros = (zeros << 9) - (frac >> 3);
|
||||
// find number of leading zeros
|
||||
zeros_fast = WebRtcSpl_NormU32((uint32_t)stt->capacitorFast);
|
||||
if (stt->capacitorFast == 0)
|
||||
@ -488,7 +488,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);
|
||||
zeros_fast = WEBRTC_SPL_LSHIFT_W16(zeros_fast, 9);
|
||||
zeros_fast <<= 9;
|
||||
zeros_fast -= (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 22);
|
||||
|
||||
gate = 1000 + zeros_fast - zeros - stt->vadNearend.stdShortTerm;
|
||||
@ -645,14 +645,14 @@ void WebRtcAgc_InitVad(AgcVad_t *state)
|
||||
state->HPstate = 0; // state of high pass filter
|
||||
state->logRatio = 0; // log( P(active) / P(inactive) )
|
||||
// average input level (Q10)
|
||||
state->meanLongTerm = WEBRTC_SPL_LSHIFT_W16(15, 10);
|
||||
state->meanLongTerm = 15 << 10;
|
||||
|
||||
// variance of input level (Q8)
|
||||
state->varianceLongTerm = WEBRTC_SPL_LSHIFT_W32(500, 8);
|
||||
|
||||
state->stdLongTerm = 0; // standard deviation of input level in dB
|
||||
// short-term average input level (Q10)
|
||||
state->meanShortTerm = WEBRTC_SPL_LSHIFT_W16(15, 10);
|
||||
state->meanShortTerm = 15 << 10;
|
||||
|
||||
// short-term variance of input level (Q8)
|
||||
state->varianceShortTerm = WEBRTC_SPL_LSHIFT_W32(500, 8);
|
||||
@ -739,7 +739,7 @@ int16_t WebRtcAgc_ProcessVad(AgcVad_t *state, // (i) VAD state
|
||||
}
|
||||
|
||||
// energy level (range {-32..30}) (Q10)
|
||||
dB = WEBRTC_SPL_LSHIFT_W16(15 - zeros, 11);
|
||||
dB = (15 - zeros) << 11;
|
||||
|
||||
// Update statistics
|
||||
|
||||
@ -780,7 +780,7 @@ int16_t WebRtcAgc_ProcessVad(AgcVad_t *state, // (i) VAD state
|
||||
state->stdLongTerm = (int16_t)WebRtcSpl_Sqrt(tmp32);
|
||||
|
||||
// update voice activity measure (Q10)
|
||||
tmp16 = WEBRTC_SPL_LSHIFT_W16(3, 12);
|
||||
tmp16 = 3 << 12;
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16(tmp16, (dB - state->meanLongTerm));
|
||||
tmp32 = WebRtcSpl_DivW32W16(tmp32, state->stdLongTerm);
|
||||
tmpU16 = (13 << 12);
|
||||
|
@ -545,8 +545,9 @@ static void NormalizeRealBufferC(NsxInst_t* inst,
|
||||
const int16_t* in,
|
||||
int16_t* out) {
|
||||
int i = 0;
|
||||
assert(inst->normData >= 0);
|
||||
for (i = 0; i < inst->anaLen; ++i) {
|
||||
out[i] = WEBRTC_SPL_LSHIFT_W16(in[i], inst->normData); // Q(normData)
|
||||
out[i] = in[i] << inst->normData; // Q(normData)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -690,7 +690,7 @@ void WebRtcNsx_CreateComplexBufferNeon(NsxInst_t* inst,
|
||||
// Loop unrolled once, so ptr_in is incremented by 8 twice,
|
||||
// and ptr_out is incremented by 8 four times.
|
||||
__asm__ __volatile__(
|
||||
// out[j] = WEBRTC_SPL_LSHIFT_W16(in[i], inst->normData); // Q(normData)
|
||||
// out[j] = in[i] << inst->normData; // Q(normData)
|
||||
"vld1.16 {d22, d23}, [%[ptr_in]]!\n\t"
|
||||
"vshl.s16 q11, q10\n\t"
|
||||
"vmov d24, d23\n\t"
|
||||
@ -700,7 +700,7 @@ void WebRtcNsx_CreateComplexBufferNeon(NsxInst_t* inst,
|
||||
"vst2.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
"vst2.16 {d24, d25}, [%[ptr_out]]!\n\t"
|
||||
|
||||
// out[j] = WEBRTC_SPL_LSHIFT_W16(in[i], inst->normData); // Q(normData)
|
||||
// out[j] = in[i] << inst->normData; // Q(normData)
|
||||
"vld1.16 {d22, d23}, [%[ptr_in]]!\n\t"
|
||||
"vshl.s16 q11, q10\n\t"
|
||||
"vmov d24, d23\n\t"
|
||||
|
Loading…
x
Reference in New Issue
Block a user