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
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
index 808451f..04a59e1 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
@@ -60,7 +60,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c
index f883287..50ad0ad 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c
@@ -54,7 +54,7 @@
/* 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 @@
/* 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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c
index 29f499f..e5fb81c 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c
@@ -60,7 +60,7 @@
/* 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++;
}
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c
index a2bc9b8..4c7332a 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c
@@ -47,7 +47,7 @@
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 @@
*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);
}
}
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c
index c2299d5..a511422 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c
@@ -66,7 +66,7 @@
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) */
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_update_best_index.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_update_best_index.c
index 88ea199..9e32437 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_update_best_index.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_update_best_index.c
@@ -51,8 +51,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c
index b49dd79..6174c9d 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c
@@ -46,8 +46,8 @@
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 @@
}
/* 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 @@
} 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);
}
}
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c b/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c
index c0f5368..4d233e3 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c
@@ -262,11 +262,11 @@
/* 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 */
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
index d44380f..2b0fe2b 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
@@ -64,8 +64,8 @@
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);
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c
index 48bd7c4..40c35eb 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c
@@ -65,7 +65,7 @@
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];
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
index 432fdee..e1de829 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
@@ -65,7 +65,7 @@
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];
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c b/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c
index b6ea201..d0869a5 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c
@@ -39,9 +39,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c b/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c
index 579fdcf..078a0fc 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c
@@ -54,7 +54,7 @@
/* 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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_poly.c b/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_poly.c
index acc5ac8..c3a34ca 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_poly.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_poly.c
@@ -71,10 +71,10 @@
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--;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/poly_to_lsp.c b/webrtc/modules/audio_coding/codecs/ilbc/poly_to_lsp.c
index e194e8f..74bb1b7 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/poly_to_lsp.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/poly_to_lsp.c
@@ -56,8 +56,10 @@
(*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++;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/refiner.c b/webrtc/modules/audio_coding/codecs/ilbc/refiner.c
index fed3394..e96ae26 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/refiner.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/refiner.c
@@ -81,7 +81,7 @@
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++) {
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/smooth.c b/webrtc/modules/audio_coding/codecs/ilbc/smooth.c
index c975098..3d59c52 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/smooth.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/smooth.c
@@ -101,7 +101,7 @@
} 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 @@
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 @@
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 @@
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 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/smooth_out_data.c b/webrtc/modules/audio_coding/codecs/ilbc/smooth_out_data.c
index cf3b30a..622af7b 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/smooth_out_data.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/smooth_out_data.c
@@ -31,8 +31,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/sort_sq.c b/webrtc/modules/audio_coding/codecs/ilbc/sort_sq.c
index dcfd8bd..c51bf6d 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/sort_sq.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/sort_sq.c
@@ -40,7 +40,7 @@
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 {
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c
index 9ff1be3..ef5357e 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c
@@ -42,15 +42,15 @@
*/
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);
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/xcorr_coef.c b/webrtc/modules/audio_coding/codecs/ilbc/xcorr_coef.c
index eb7f828..38af71f 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/xcorr_coef.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/xcorr_coef.c
@@ -131,9 +131,7 @@
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;
}