audio_coding/codecs/ilbc: Replaced macro WEBRTC_SPL_RSHIFT_W32 with >>
Removed usage of trivial macro. BUG=3348,3353 TESTED=locally on linux and trybots R=henrik.lundin@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/29789004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7480 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
913f7b8d5e
commit
78ea06dd34
@ -60,7 +60,7 @@ void WebRtcIlbcfix_CbConstruct(
|
||||
a32 += WEBRTC_SPL_MUL_16_16(*gainPtr++, cbvec1[j]);
|
||||
a32 += WEBRTC_SPL_MUL_16_16(*gainPtr, cbvec2[j]);
|
||||
gainPtr -= 2;
|
||||
decvector[j] = (int16_t) WEBRTC_SPL_RSHIFT_W32(a32 + 8192, 14);
|
||||
decvector[j] = (int16_t)((a32 + 8192) >> 14);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -54,7 +54,7 @@ void WebRtcIlbcfix_CbMemEnergy(
|
||||
/* Normalize the energy and store the number of shifts */
|
||||
energyShifts[0] = (int16_t)WebRtcSpl_NormW32(energy);
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, energyShifts[0]);
|
||||
energyW16[0] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
|
||||
energyW16[0] = (int16_t)(tmp32 >> 16);
|
||||
|
||||
/* Compute the energy of the rest of the cb memory
|
||||
* by step wise adding and subtracting the next
|
||||
@ -70,7 +70,7 @@ void WebRtcIlbcfix_CbMemEnergy(
|
||||
/* Normalize the energy and store the number of shifts */
|
||||
energyShifts[base_size] = (int16_t)WebRtcSpl_NormW32(energy);
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, energyShifts[base_size]);
|
||||
energyW16[base_size] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
|
||||
energyW16[base_size] = (int16_t)(tmp32 >> 16);
|
||||
|
||||
ppi = filteredCB + lMem - 1 - lTarget;
|
||||
ppo = filteredCB + lMem - 1;
|
||||
|
@ -60,7 +60,7 @@ void WebRtcIlbcfix_CbMemEnergyAugmentation(
|
||||
/* Normalize the energy and store the number of shifts */
|
||||
(*enShPtr) = (int16_t)WebRtcSpl_NormW32(energy);
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, (*enShPtr));
|
||||
(*enPtr) = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
|
||||
*enPtr = (int16_t)(tmp32 >> 16);
|
||||
enShPtr++;
|
||||
enPtr++;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void WebRtcIlbcfix_CbMemEnergyCalc(
|
||||
operation on the edge samples */
|
||||
tmp = WEBRTC_SPL_MUL_16_16(*ppi, *ppi);
|
||||
tmp -= WEBRTC_SPL_MUL_16_16(*ppo, *ppo);
|
||||
energy += WEBRTC_SPL_RSHIFT_W32(tmp, scale);
|
||||
energy += tmp >> scale;
|
||||
energy = WEBRTC_SPL_MAX(energy, 0);
|
||||
|
||||
ppi--;
|
||||
@ -60,6 +60,6 @@ void WebRtcIlbcfix_CbMemEnergyCalc(
|
||||
*eSh_ptr++ = shft;
|
||||
|
||||
tmp = WEBRTC_SPL_LSHIFT_W32(energy, shft);
|
||||
*eW16_ptr++ = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp, 16);
|
||||
*eW16_ptr++ = (int16_t)(tmp >> 16);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void WebRtcIlbcfix_CbSearchCore(
|
||||
for (i=0;i<range;i++) {
|
||||
/* Calculate cDot*cDot and put the result in a int16_t */
|
||||
tmp32 = WEBRTC_SPL_LSHIFT_W32(*cDotPtr,sh);
|
||||
tmp16 = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32,16);
|
||||
tmp16 = (int16_t)(tmp32 >> 16);
|
||||
cDotSqW16 = (int16_t)(((int32_t)(tmp16)*(tmp16))>>16);
|
||||
|
||||
/* Calculate the criteria (cDot*cDot/energy) */
|
||||
|
@ -51,8 +51,7 @@ void WebRtcIlbcfix_CbUpdateBestIndex(
|
||||
calculate the gain and store this index as the new best one
|
||||
*/
|
||||
|
||||
if (WEBRTC_SPL_RSHIFT_W32(CritNew, shNew)>
|
||||
WEBRTC_SPL_RSHIFT_W32((*CritMax),shOld)) {
|
||||
if ((CritNew >> shNew) > (*CritMax >> shOld)) {
|
||||
|
||||
tmp16 = (int16_t)WebRtcSpl_NormW32(cDotNew);
|
||||
tmp16 = 16 - tmp16;
|
||||
|
@ -46,8 +46,8 @@ int16_t WebRtcIlbcfix_Chebyshev(
|
||||
tmp2W32 = tmp1W32;
|
||||
|
||||
/* Split b1 (in tmp1W32) into a high and low part */
|
||||
b1_high = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 16);
|
||||
b1_low = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32-WEBRTC_SPL_LSHIFT_W32(((int32_t)b1_high),16), 1);
|
||||
b1_high = (int16_t)(tmp1W32 >> 16);
|
||||
b1_low = (int16_t)((tmp1W32 - ((int32_t)b1_high << 16)) >> 1);
|
||||
|
||||
/* Calculate 2*x*b1-b2+f[i] */
|
||||
tmp1W32 = WEBRTC_SPL_LSHIFT_W32( (WEBRTC_SPL_MUL_16_16(b1_high, x) +
|
||||
@ -61,8 +61,8 @@ int16_t WebRtcIlbcfix_Chebyshev(
|
||||
}
|
||||
|
||||
/* Split b1 (in tmp1W32) into a high and low part */
|
||||
b1_high = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 16);
|
||||
b1_low = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32-WEBRTC_SPL_LSHIFT_W32(((int32_t)b1_high),16), 1);
|
||||
b1_high = (int16_t)(tmp1W32 >> 16);
|
||||
b1_low = (int16_t)((tmp1W32 - ((int32_t)b1_high << 16)) >> 1);
|
||||
|
||||
/* tmp1W32 = x*b1 - b2 + f[i]/2 */
|
||||
tmp1W32 = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(b1_high, x), 1) +
|
||||
@ -77,6 +77,6 @@ int16_t WebRtcIlbcfix_Chebyshev(
|
||||
} else if (tmp1W32<((int32_t)-33554432)) {
|
||||
return(WEBRTC_SPL_WORD16_MIN);
|
||||
} else {
|
||||
return((int16_t)WEBRTC_SPL_RSHIFT_W32(tmp1W32, 10));
|
||||
return (int16_t)(tmp1W32 >> 10);
|
||||
}
|
||||
}
|
||||
|
@ -262,11 +262,11 @@ void WebRtcIlbcfix_DoThePlc(
|
||||
|
||||
/* mix noise and pitch repeatition */
|
||||
|
||||
PLCresidual[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(tot_gain,
|
||||
(int16_t)WEBRTC_SPL_RSHIFT_W32( (WEBRTC_SPL_MUL_16_16(pitchfact, PLCresidual[i]) +
|
||||
WEBRTC_SPL_MUL_16_16((32767-pitchfact), randvec[i]) + 16384),
|
||||
15),
|
||||
15);
|
||||
PLCresidual[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(
|
||||
tot_gain,
|
||||
(pitchfact * PLCresidual[i] + (32767 - pitchfact) * randvec[i] +
|
||||
16384) >> 15,
|
||||
15);
|
||||
|
||||
/* Shifting down the result one step extra to ensure that no overflow
|
||||
will occur */
|
||||
|
@ -64,8 +64,8 @@ void WebRtcIlbcfix_GetLspPoly(
|
||||
for(j=i; j>1; j--)
|
||||
{
|
||||
/* Compute f[j] = f[j] + tmp*f[j-1] + f[j-2]; */
|
||||
high = (int16_t)WEBRTC_SPL_RSHIFT_W32(fPtr[-1], 16);
|
||||
low = (int16_t)WEBRTC_SPL_RSHIFT_W32(fPtr[-1]-WEBRTC_SPL_LSHIFT_W32(((int32_t)high),16), 1);
|
||||
high = (int16_t)(fPtr[-1] >> 16);
|
||||
low = (int16_t)((fPtr[-1] - ((int32_t)high << 16)) >> 1);
|
||||
|
||||
tmpW32 = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(high, (*lspPtr)), 2) +
|
||||
WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16_RSFT(low, (*lspPtr), 15), 2);
|
||||
|
@ -65,7 +65,7 @@ void WebRtcIlbcfix_HpInput(
|
||||
tmpW32b = WEBRTC_SPL_SAT((int32_t)268435455, tmpW32b, (int32_t)-268435456);
|
||||
|
||||
/* Convert back to Q0 and multiply with 0.5 */
|
||||
signal[i] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmpW32b, 13);
|
||||
signal[i] = (int16_t)(tmpW32b >> 13);
|
||||
|
||||
/* Update state (filtered part) */
|
||||
y[2] = y[0];
|
||||
|
@ -65,7 +65,7 @@ void WebRtcIlbcfix_HpOutput(
|
||||
tmpW32b = WEBRTC_SPL_SAT((int32_t)67108863, tmpW32b, (int32_t)-67108864);
|
||||
|
||||
/* Convert back to Q0 and multiply with 2 */
|
||||
signal[i] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmpW32b, 11);
|
||||
signal[i] = (int16_t)(tmpW32b >> 11);
|
||||
|
||||
/* Update state (filtered part) */
|
||||
y[2] = y[0];
|
||||
|
@ -39,9 +39,7 @@ void WebRtcIlbcfix_Interpolate(
|
||||
|
||||
invcoef = 16384 - coef; /* 16384 = 1.0 (Q14)*/
|
||||
for (i = 0; i < length; i++) {
|
||||
out[i] = (int16_t) WEBRTC_SPL_RSHIFT_W32(
|
||||
(WEBRTC_SPL_MUL_16_16(coef, in1[i]) + WEBRTC_SPL_MUL_16_16(invcoef, in2[i]))+8192,
|
||||
14);
|
||||
out[i] = (int16_t)((coef * in1[i] + invcoef * in2[i] + 8192) >> 14);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -54,7 +54,7 @@ void WebRtcIlbcfix_Lsf2Lsp(
|
||||
|
||||
/* Calculate linear approximation */
|
||||
tmpW32 = WEBRTC_SPL_MUL_16_16(WebRtcIlbcfix_kCosDerivative[k], diff);
|
||||
lsp[i] = WebRtcIlbcfix_kCos[k]+(int16_t)(WEBRTC_SPL_RSHIFT_W32(tmpW32, 12));
|
||||
lsp[i] = WebRtcIlbcfix_kCos[k] + (int16_t)(tmpW32 >> 12);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -71,10 +71,10 @@ void WebRtcIlbcfix_Lsf2Poly(
|
||||
for (i=5; i>0; i--)
|
||||
{
|
||||
tmpW32 = (*f1ptr) + (*f2ptr);
|
||||
(*a1ptr) = (int16_t)WEBRTC_SPL_RSHIFT_W32((tmpW32+4096),13);
|
||||
*a1ptr = (int16_t)((tmpW32 + 4096) >> 13);
|
||||
|
||||
tmpW32 = (*f1ptr) - (*f2ptr);
|
||||
(*a2ptr) = (int16_t)WEBRTC_SPL_RSHIFT_W32((tmpW32+4096),13);
|
||||
*a2ptr = (int16_t)((tmpW32 + 4096) >> 13);
|
||||
|
||||
a1ptr++;
|
||||
a2ptr--;
|
||||
|
@ -56,8 +56,10 @@ void WebRtcIlbcfix_Poly2Lsp(
|
||||
(*f1ptr) = 1024; /* 1.0 in Q10 */
|
||||
(*f2ptr) = 1024; /* 1.0 in Q10 */
|
||||
for (i = 0; i < 5; i++) {
|
||||
(*(f1ptr+1)) = (int16_t)(WEBRTC_SPL_RSHIFT_W32(((int32_t)(*a_i_ptr)+(*a_10mi_ptr)), 2) - (*f1ptr));
|
||||
(*(f2ptr+1)) = (int16_t)(WEBRTC_SPL_RSHIFT_W32(((int32_t)(*a_i_ptr)-(*a_10mi_ptr)), 2) + (*f2ptr));
|
||||
*(f1ptr + 1) =
|
||||
(int16_t)((((int32_t)(*a_i_ptr) + *a_10mi_ptr) >> 2) - *f1ptr);
|
||||
*(f2ptr + 1) =
|
||||
(int16_t)((((int32_t)(*a_i_ptr) - *a_10mi_ptr) >> 2) + *f2ptr);
|
||||
a_i_ptr++;
|
||||
a_10mi_ptr--;
|
||||
f1ptr++;
|
||||
|
@ -81,7 +81,7 @@ void WebRtcIlbcfix_Refiner(
|
||||
|
||||
if (scalefact>0) {
|
||||
for (i=0;i<corrdim;i++) {
|
||||
corrVec[i]=(int16_t)WEBRTC_SPL_RSHIFT_W32(corrVecTemp[i], scalefact);
|
||||
corrVec[i] = (int16_t)(corrVecTemp[i] >> scalefact);
|
||||
}
|
||||
} else {
|
||||
for (i=0;i<corrdim;i++) {
|
||||
|
@ -101,7 +101,7 @@ void WebRtcIlbcfix_Smooth(
|
||||
} else {
|
||||
/* crit = 0.05 * w00 (Result in Q-6) */
|
||||
crit = WEBRTC_SPL_SHIFT_W32(
|
||||
WEBRTC_SPL_MUL(ENH_A0, WEBRTC_SPL_RSHIFT_W32(w00prim, 14)),
|
||||
WEBRTC_SPL_MUL(ENH_A0, w00prim >> 14),
|
||||
-(6-scale+scale1));
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ void WebRtcIlbcfix_Smooth(
|
||||
endiff = (w11w00-w10w10);
|
||||
endiff = WEBRTC_SPL_MAX(0, endiff);
|
||||
/* denom is in Q16 */
|
||||
denom = WebRtcSpl_DivW32W16(endiff, (int16_t)WEBRTC_SPL_RSHIFT_W32(w00w00, 16));
|
||||
denom = WebRtcSpl_DivW32W16(endiff, (int16_t)(w00w00 >> 16));
|
||||
} else {
|
||||
denom = 65536;
|
||||
}
|
||||
@ -151,10 +151,10 @@ void WebRtcIlbcfix_Smooth(
|
||||
|
||||
if (scale>0) {
|
||||
/* denomW16 is in Q(16+scale) */
|
||||
denomW16=(int16_t)WEBRTC_SPL_RSHIFT_W32(denom, scale);
|
||||
denomW16 = (int16_t)(denom >> scale);
|
||||
|
||||
/* num in Q(34-scale) */
|
||||
num=WEBRTC_SPL_RSHIFT_W32(ENH_A0_MINUS_A0A0DIV4, scale);
|
||||
num = ENH_A0_MINUS_A0A0DIV4 >> scale;
|
||||
} else {
|
||||
/* denomW16 is in Q16 */
|
||||
denomW16=(int16_t)denom;
|
||||
@ -174,8 +174,8 @@ void WebRtcIlbcfix_Smooth(
|
||||
scale = bitsw00-scale2-15;
|
||||
|
||||
if (scale>0) {
|
||||
w10prim=WEBRTC_SPL_RSHIFT_W32(w10prim, scale);
|
||||
w00prim=WEBRTC_SPL_RSHIFT_W32(w00prim, scale);
|
||||
w10prim >>= scale;
|
||||
w00prim >>= scale;
|
||||
}
|
||||
|
||||
if ((w00prim>0)&&(w10prim>0)) {
|
||||
@ -187,7 +187,7 @@ void WebRtcIlbcfix_Smooth(
|
||||
B_W32 = (int32_t)1073741824 - (int32_t)ENH_A0DIV2 -
|
||||
WEBRTC_SPL_MUL(A, w11_div_w00);
|
||||
}
|
||||
B = (int16_t)WEBRTC_SPL_RSHIFT_W32(B_W32, 16); /* B in Q14 */
|
||||
B = (int16_t)(B_W32 >> 16); /* B in Q14. */
|
||||
} else {
|
||||
/* No smoothing */
|
||||
A = 0;
|
||||
|
@ -31,8 +31,7 @@ int32_t WebRtcIlbcfix_Smooth_odata(
|
||||
int32_t errs;
|
||||
|
||||
for(i=0;i<80;i++) {
|
||||
odata[i]= (int16_t)WEBRTC_SPL_RSHIFT_W32(
|
||||
(WEBRTC_SPL_MUL_16_16(C, surround[i])+1024), 11);
|
||||
odata[i]= (int16_t)((C * surround[i] + 1024) >> 11);
|
||||
}
|
||||
|
||||
errs=0;
|
||||
|
@ -40,7 +40,7 @@ void WebRtcIlbcfix_SortSq(
|
||||
i++;
|
||||
}
|
||||
|
||||
if (x > WEBRTC_SPL_RSHIFT_W32(( (int32_t)cb[i] + cb[i - 1] + 1),1)) {
|
||||
if (x > (((int32_t)cb[i] + cb[i - 1] + 1) >> 1)) {
|
||||
*index = i;
|
||||
*xq = cb[i];
|
||||
} else {
|
||||
|
@ -42,15 +42,15 @@ void WebRtcIlbcfix_Window32W32(
|
||||
*/
|
||||
for (i = 0; i < N; i++) {
|
||||
/* Extract higher bytes */
|
||||
x_hi = (int16_t) WEBRTC_SPL_RSHIFT_W32(x[i], 16);
|
||||
y_hi = (int16_t) WEBRTC_SPL_RSHIFT_W32(y[i], 16);
|
||||
x_hi = (int16_t)(x[i] >> 16);
|
||||
y_hi = (int16_t)(y[i] >> 16);
|
||||
|
||||
/* Extract lower bytes, defined as (w32 - hi<<16)>>1 */
|
||||
temp = WEBRTC_SPL_LSHIFT_W32((int32_t)x_hi, 16);
|
||||
x_low = (int16_t) WEBRTC_SPL_RSHIFT_W32((x[i] - temp), 1);
|
||||
x_low = (int16_t)((x[i] - temp) >> 1);
|
||||
|
||||
temp = WEBRTC_SPL_LSHIFT_W32((int32_t)y_hi, 16);
|
||||
y_low = (int16_t) WEBRTC_SPL_RSHIFT_W32((y[i] - temp), 1);
|
||||
y_low = (int16_t)((y[i] - temp) >> 1);
|
||||
|
||||
/* Calculate z by a 32 bit multiplication using both low and high from x and y */
|
||||
temp = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(x_hi, y_hi), 1);
|
||||
|
@ -131,9 +131,7 @@ int WebRtcIlbcfix_XcorrCoef(
|
||||
pos+=step;
|
||||
|
||||
/* Do a +/- to get the next energy */
|
||||
Energy += step*(WEBRTC_SPL_RSHIFT_W32(
|
||||
((int32_t)(*rp_end)*(*rp_end)) - ((int32_t)(*rp_beg)*(*rp_beg)),
|
||||
shifts));
|
||||
Energy += step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts);
|
||||
rp_beg+=step;
|
||||
rp_end+=step;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user