aboutsummaryrefslogtreecommitdiff
path: root/webrtc
diff options
context:
space:
mode:
authorbjornv@webrtc.org <bjornv@webrtc.org>2014-09-29 10:56:27 +0000
committerbjornv@webrtc.org <bjornv@webrtc.org>2014-09-29 10:56:27 +0000
commitd71118194faf15f091071ca38727d191a50678d0 (patch)
tree1ffd73330267392d5cb7f228782d397f96a1c131 /webrtc
parent7c15510f389b00fea03e8512cf1a09d0a344b8e9 (diff)
downloadwebrtc-d71118194faf15f091071ca38727d191a50678d0.tar.gz
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
Diffstat (limited to 'webrtc')
-rw-r--r--webrtc/common_audio/signal_processing/lpc_to_refl_coef.c2
-rw-r--r--webrtc/modules/audio_processing/aecm/aecm_core.c18
-rw-r--r--webrtc/modules/audio_processing/agc/digital_agc.c16
-rw-r--r--webrtc/modules/audio_processing/ns/nsx_core.c3
-rw-r--r--webrtc/modules/audio_processing/ns/nsx_core_neon.c4
5 files changed, 22 insertions, 21 deletions
diff --git a/webrtc/common_audio/signal_processing/lpc_to_refl_coef.c b/webrtc/common_audio/signal_processing/lpc_to_refl_coef.c
index d191590e4d..b1a34d48fd 100644
--- a/webrtc/common_audio/signal_processing/lpc_to_refl_coef.c
+++ b/webrtc/common_audio/signal_processing/lpc_to_refl_coef.c
@@ -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
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c
index 340eacfca0..3a92ab7981 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.c
@@ -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;
diff --git a/webrtc/modules/audio_processing/agc/digital_agc.c b/webrtc/modules/audio_processing/agc/digital_agc.c
index da087ca3c1..922eafb1ed 100644
--- a/webrtc/modules/audio_processing/agc/digital_agc.c
+++ b/webrtc/modules/audio_processing/agc/digital_agc.c
@@ -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);
diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c
index 930c2c2e77..56db109244 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core.c
@@ -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)
}
}
diff --git a/webrtc/modules/audio_processing/ns/nsx_core_neon.c b/webrtc/modules/audio_processing/ns/nsx_core_neon.c
index 4dbad9e6cf..6041785503 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core_neon.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core_neon.c
@@ -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"