diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c index 808451f3c4..04a59e1d27 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 @@ 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; 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 f883287d80..50ad0ad385 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 @@ 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; 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 29f499f248..e5fb81c547 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 @@ 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++; } 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 a2bc9b881c..4c7332a20e 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 @@ 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); } } 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 c2299d538a..a51142248b 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 @@ void WebRtcIlbcfix_CbSearchCore( for (i=0;i> 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 88ea19970f..9e32437ff0 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 @@ 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; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c index b49dd79944..6174c9ddd3 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c @@ -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); } } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c b/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c index c0f5368442..4d233e395e 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 @@ 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 */ 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 d44380f26d..2b0fe2bba0 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 @@ 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); diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c index 48bd7c4e38..40c35eb314 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 @@ 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]; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c index 432fdee281..e1de8292d8 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 @@ 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]; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c b/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c index b6ea201fd6..d0869a5dc2 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/interpolate.c @@ -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; 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 579fdcf7eb..078a0fc049 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 @@ 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; 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 acc5ac83ed..c3a34cab00 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 @@ 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--; 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 e194e8fd03..74bb1b7d4b 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 @@ 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++; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/refiner.c b/webrtc/modules/audio_coding/codecs/ilbc/refiner.c index fed3394812..e96ae2697c 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/refiner.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/refiner.c @@ -81,7 +81,7 @@ void WebRtcIlbcfix_Refiner( if (scalefact>0) { for (i=0;i> scalefact); } } else { for (i=0;i> 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; 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 cf3b30ae1a..622af7bb7b 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 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; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/sort_sq.c b/webrtc/modules/audio_coding/codecs/ilbc/sort_sq.c index dcfd8bdf27..c51bf6dc63 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 @@ 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 { diff --git a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c index 9ff1be397b..ef5357e486 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 @@ 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); diff --git a/webrtc/modules/audio_coding/codecs/ilbc/xcorr_coef.c b/webrtc/modules/audio_coding/codecs/ilbc/xcorr_coef.c index eb7f828f2a..38af71f883 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 @@ 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; }