diff --git a/webrtc/modules/audio_coding/codecs/ilbc/bw_expand.c b/webrtc/modules/audio_coding/codecs/ilbc/bw_expand.c index 4c29bb19d..b02abab3f 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/bw_expand.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/bw_expand.c @@ -37,6 +37,6 @@ void WebRtcIlbcfix_BwExpand( /* out[i] = coef[i] * in[i] with rounding. in[] and out[] are in Q12 and coef[] is in Q15 */ - out[i] = (int16_t)((WEBRTC_SPL_MUL_16_16(coef[i], in[i])+16384)>>15); + out[i] = (int16_t)((coef[i] * in[i] + 16384) >> 15); } } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c index 04a59e1d2..9d11b83ac 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c @@ -56,9 +56,9 @@ void WebRtcIlbcfix_CbConstruct( gainPtr = &gain[0]; for (j=0;j> 14); } 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 4c7332a20..87a510da6 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 @@ -45,8 +45,7 @@ void WebRtcIlbcfix_CbMemEnergyCalc( /* Calculate next energy by a +/- operation on the edge samples */ - tmp = WEBRTC_SPL_MUL_16_16(*ppi, *ppi); - tmp -= WEBRTC_SPL_MUL_16_16(*ppo, *ppo); + tmp = (*ppi) * (*ppi) - (*ppo) * (*ppo); energy += tmp >> scale; energy = WEBRTC_SPL_MAX(energy, 0); diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_search.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_search.c index 8a89c87ff..b4d2b37ec 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/cb_search.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_search.c @@ -113,7 +113,7 @@ void WebRtcIlbcfix_CbSearch( if ((temp1>0)&&(temp2>0)) { temp1 = WEBRTC_SPL_MAX(temp1, temp2); - scale = WebRtcSpl_GetSizeInBits(WEBRTC_SPL_MUL_16_16(temp1, temp1)); + scale = WebRtcSpl_GetSizeInBits((uint32_t)(temp1 * temp1)); } else { /* temp1 or temp2 is negative (maximum was -32768) */ scale = 30; @@ -361,8 +361,7 @@ void WebRtcIlbcfix_CbSearch( tmp = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(gains[1],gains[1], 14); - targetEner = WEBRTC_SPL_MUL_16_16( - WEBRTC_SPL_SHIFT_W32(targetEner, -bits), tmp); + targetEner = (int16_t)WEBRTC_SPL_SHIFT_W32(targetEner, -bits) * tmp; tmpW32 = ((int32_t)(gains[1]-1))<<1; @@ -381,7 +380,7 @@ void WebRtcIlbcfix_CbSearch( gainTbl[i] < 2*gain[0] */ - t32 = WEBRTC_SPL_MUL_16_16(temp1, (*gainPtr)); + t32 = temp1 * *gainPtr; t32 = t32 - targetEner; if (t32 < 0) { if ((*WebRtcIlbcfix_kGainSq5_ptr) < tmpW32) { 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 a51142248..559d99817 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c @@ -70,7 +70,7 @@ void WebRtcIlbcfix_CbSearchCore( cDotSqW16 = (int16_t)(((int32_t)(tmp16)*(tmp16))>>16); /* Calculate the criteria (cDot*cDot/energy) */ - *critPtr=WEBRTC_SPL_MUL_16_16(cDotSqW16, (*inverseEnergyPtr)); + *critPtr = cDotSqW16 * *inverseEnergyPtr; /* Extract the maximum shift value under the constraint that the criteria is not zero */ diff --git a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c index 6174c9ddd..50d91e46c 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c @@ -50,8 +50,7 @@ int16_t WebRtcIlbcfix_Chebyshev( 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) + - WEBRTC_SPL_MUL_16_16_RSFT(b1_low, x, 15)), 2); + tmp1W32 = WEBRTC_SPL_LSHIFT_W32(b1_high * x + ((b1_low * x) >> 15), 2); tmp1W32 -= b2; tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[i], 14); @@ -65,7 +64,7 @@ int16_t WebRtcIlbcfix_Chebyshev( 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) + + tmp1W32 = WEBRTC_SPL_LSHIFT_W32(b1_high * x, 1) + WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16_RSFT(b1_low, x, 15), 1); tmp1W32 -= b2; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c b/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c index 53a4e9a51..2306be11a 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/do_plc.c @@ -107,12 +107,11 @@ void WebRtcIlbcfix_DoThePlc( WEBRTC_SPL_SHIFT_W32(cross_comp, -shift1), 15); shift2 = WebRtcSpl_GetSizeInBits(ener)-15; - measure = WEBRTC_SPL_MUL_16_16(WEBRTC_SPL_SHIFT_W32(ener, -shift2), - crossSquare); + measure = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, -shift2) * crossSquare; shift3 = WebRtcSpl_GetSizeInBits(ener_comp)-15; - maxMeasure = WEBRTC_SPL_MUL_16_16(WEBRTC_SPL_SHIFT_W32(ener_comp, -shift3), - crossSquareMax); + maxMeasure = (int16_t)WEBRTC_SPL_SHIFT_W32(ener_comp, -shift3) * + crossSquareMax; /* Calculate shift value, so that the two measures can be put in the same Q domain */ @@ -164,7 +163,7 @@ void WebRtcIlbcfix_DoThePlc( tmp1 = (int16_t)WEBRTC_SPL_SHIFT_W32(cross, (totscale>>1)); tmp2 = (int16_t)WEBRTC_SPL_SHIFT_W32(cross, totscale-(totscale>>1)); - nom = WEBRTC_SPL_MUL_16_16(tmp1, tmp2); + nom = tmp1 * tmp2; max_perSquare = (int16_t)WebRtcSpl_DivW32W16(nom, denom); } else { @@ -230,7 +229,7 @@ void WebRtcIlbcfix_DoThePlc( for (i=0; iblockl; i++) { /* noise component - 52 < randlagFIX < 117 */ - iLBCdec_inst->seed = (int16_t)(WEBRTC_SPL_MUL_16_16(iLBCdec_inst->seed, 31821)+(int32_t)13849); + iLBCdec_inst->seed = (int16_t)(iLBCdec_inst->seed * 31821 + 13849); randlag = 53 + (int16_t)(iLBCdec_inst->seed & 63); pick = i - randlag; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/encode.c b/webrtc/modules/audio_coding/codecs/ilbc/encode.c index 6f7c04ef3..1d46eff43 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/encode.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/encode.c @@ -154,7 +154,7 @@ void WebRtcIlbcfix_EncodeImpl( index = (iLBCbits_inst->startIdx-1)*SUBL; max=WebRtcSpl_MaxAbsValueW16(&residual[index], 2*SUBL); - scale=WebRtcSpl_GetSizeInBits(WEBRTC_SPL_MUL_16_16(max,max)); + scale = WebRtcSpl_GetSizeInBits((uint32_t)(max * max)); /* Scale to maximum 25 bits so that the MAC won't cause overflow */ scale = scale - 25; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/enh_upsample.c b/webrtc/modules/audio_coding/codecs/ilbc/enh_upsample.c index 91f3970ea..929c630c6 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/enh_upsample.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/enh_upsample.c @@ -39,26 +39,26 @@ void WebRtcIlbcfix_EnhUpsample( /* i = 2 */ pp=WebRtcIlbcfix_kEnhPolyPhaser[j]+1; ps=seq1+2; - (*pu11) = WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); + *pu11 = (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; pu11+=ENH_UPS0; /* i = 3 */ pp=WebRtcIlbcfix_kEnhPolyPhaser[j]+1; ps=seq1+3; - (*pu11) = WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); + *pu11 = (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; pu11+=ENH_UPS0; /* i = 4 */ pp=WebRtcIlbcfix_kEnhPolyPhaser[j]+1; ps=seq1+4; - (*pu11) = WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); - (*pu11) += WEBRTC_SPL_MUL_16_16(*ps--,*pp++); + *pu11 = (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; + *pu11 += (*ps--) * *pp++; pu1++; } @@ -79,7 +79,7 @@ void WebRtcIlbcfix_EnhUpsample( pp = polyp[j]+i; ps = seq1+dim1-1; for(k=0;k totsh[i]) { sh = WEBRTC_SPL_MIN(31, totsh[ind]-totsh[i]); - if ( WEBRTC_SPL_MUL_16_16(corr16[ind], en16[i]) < + if (corr16[ind] * en16[i] < WEBRTC_SPL_MUL_16_16_RSFT(corr16[i], en16[ind], sh)) { ind = i; } } else { sh = WEBRTC_SPL_MIN(31, totsh[i]-totsh[ind]); if (WEBRTC_SPL_MUL_16_16_RSFT(corr16[ind], en16[i], sh) < - WEBRTC_SPL_MUL_16_16(corr16[i], en16[ind])) { + corr16[i] * en16[ind]) { ind = i; } } @@ -176,21 +176,20 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */ lag = lagmax[ind] + 10; /* Store the estimated lag in the non-downsampled domain */ - enh_period[ENH_NBLOCKS_TOT-new_blocks+iblock] = - (int16_t)WEBRTC_SPL_MUL_16_16(lag, 8); + enh_period[ENH_NBLOCKS_TOT - new_blocks + iblock] = (int16_t)(lag * 8); /* Store the estimated lag for backward PLC */ if (iLBCdec_inst->prev_enh_pl==1) { if (!iblock) { - tlag = WEBRTC_SPL_MUL_16_16(lag, 2); + tlag = lag * 2; } } else { if (iblock==1) { - tlag = WEBRTC_SPL_MUL_16_16(lag, 2); + tlag = lag * 2; } } - lag = WEBRTC_SPL_MUL_16_16(lag, 2); + lag *= 2; } if ((iLBCdec_inst->prev_enh_pl==1)||(iLBCdec_inst->prev_enh_pl==2)) { @@ -370,10 +369,10 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */ /* Perform enhancement block by block */ for (iblock = 0; iblockblockl); - scale=WebRtcSpl_GetSizeInBits(WEBRTC_SPL_MUL_16_16(max,max)); + scale = WebRtcSpl_GetSizeInBits((uint32_t)(max * max)); /* Scale to maximum 24 bits so that it won't overflow for 76 samples */ scale = scale-24; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/gain_dequant.c b/webrtc/modules/audio_coding/codecs/ilbc/gain_dequant.c index 8570c8bed..07e09bb88 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/gain_dequant.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/gain_dequant.c @@ -41,5 +41,5 @@ int16_t WebRtcIlbcfix_GainDequant( /* select the quantization table and return the decoded value */ gain = WebRtcIlbcfix_kGain[stage]; - return((int16_t)((WEBRTC_SPL_MUL_16_16(scale, gain[index])+8192)>>14)); + return (int16_t)((scale * gain[index] + 8192) >> 14); } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c b/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c index f7a8083df..983c6db3c 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c @@ -30,7 +30,7 @@ int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */ int16_t *index /* (o) quantization index */ ) { - int16_t scale, returnVal, cblen; + int16_t scale, cblen; int32_t gainW32, measure1, measure2; const int16_t *cbPtr, *cb; int loc, noMoves, noChecks, i; @@ -62,7 +62,7 @@ int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */ for (i=noChecks;i>0;i--) { noMoves>>=1; - measure1=WEBRTC_SPL_MUL_16_16(scale, (*cbPtr)); + measure1 = scale * *cbPtr; /* Move up if gain is larger, otherwise move down in table */ measure1 = measure1 - gainW32; @@ -78,16 +78,16 @@ int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */ /* Check which value is the closest one: loc-1, loc or loc+1 */ - measure1=WEBRTC_SPL_MUL_16_16(scale, (*cbPtr)); + measure1 = scale * *cbPtr; if (gainW32>measure1) { /* Check against value above loc */ - measure2=WEBRTC_SPL_MUL_16_16(scale, (*(cbPtr+1))); + measure2 = scale * cbPtr[1]; if ((measure2-gainW32)<(gainW32-measure1)) { loc+=1; } } else { /* Check against value below loc */ - measure2=WEBRTC_SPL_MUL_16_16(scale, (*(cbPtr-1))); + measure2 = scale * cbPtr[-1]; if ((gainW32-measure2)<=(measure1-gainW32)) { loc-=1; } @@ -98,9 +98,6 @@ int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */ loc=WEBRTC_SPL_MIN(loc, (cblen-1)); *index=loc; - /* Calculate the quantized gain value (in Q14) */ - returnVal=(int16_t)((WEBRTC_SPL_MUL_16_16(scale, cb[loc])+8192)>>14); - - /* return the quantized value */ - return(returnVal); + /* Calculate and return the quantized gain value (in Q14) */ + return (int16_t)((scale * cb[loc] + 8192) >> 14); } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c b/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c index fb9b03d3f..cf05ce331 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c @@ -58,7 +58,7 @@ void WebRtcIlbcfix_GetCbVec( /* Calculate lag */ - k=(int16_t)WEBRTC_SPL_MUL_16_16(2, (index-(lMem-cbveclen+1)))+cbveclen; + k = (int16_t)(2 * (index - (lMem - cbveclen + 1))) + cbveclen; lag = k / 2; 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 2b0fe2bba..64079a327 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c @@ -67,7 +67,7 @@ void WebRtcIlbcfix_GetLspPoly( 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) + + tmpW32 = WEBRTC_SPL_LSHIFT_W32(high * *lspPtr, 2) + WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16_RSFT(low, (*lspPtr), 15), 2); (*fPtr) += fPtr[-2]; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/get_sync_seq.c b/webrtc/modules/audio_coding/codecs/ilbc/get_sync_seq.c index 695631a26..480ed7c6c 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/get_sync_seq.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/get_sync_seq.c @@ -46,11 +46,12 @@ void WebRtcIlbcfix_GetSyncSeq( /* present (find predicted lag from this position) */ - WebRtcIlbcfix_NearestNeighbor(lagBlock+hl,plocs, - (int16_t)WEBRTC_SPL_MUL_16_16(2, (centerStartPos+centerEndPos)), + WebRtcIlbcfix_NearestNeighbor(lagBlock + hl, + plocs, + (int16_t)(2 * (centerStartPos + centerEndPos)), periodl); - blockStartPos[hl]=(int16_t)WEBRTC_SPL_MUL_16_16(4, centerStartPos); + blockStartPos[hl] = (int16_t)(4 * centerStartPos); /* past (find predicted position and perform a refined search to find the best sequence) */ @@ -58,11 +59,14 @@ void WebRtcIlbcfix_GetSyncSeq( for(q=hl-1;q>=0;q--) { blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]]; - WebRtcIlbcfix_NearestNeighbor(lagBlock+q, plocs, - (int16_t)(blockStartPos[q] + (int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)-period[lagBlock[q+1]]), - periodl); + WebRtcIlbcfix_NearestNeighbor( + lagBlock + q, + plocs, + (int16_t)(blockStartPos[q] + 4 * ENH_BLOCKL_HALF - + period[lagBlock[q + 1]]), + periodl); - if((blockStartPos[q]-(int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_OVERHANG))>=0) { + if (blockStartPos[q] - 4 * ENH_OVERHANG >= 0) { /* Find the best possible sequence in the 4 times upsampled domain around blockStartPos+q */ @@ -82,17 +86,17 @@ void WebRtcIlbcfix_GetSyncSeq( plocs2[i]=(plocs[i]-period[i]); } - for(q=hl+1;q<=WEBRTC_SPL_MUL_16_16(2, hl);q++) { + for (q = hl + 1; q <= (int16_t)(2 * hl); q++) { - WebRtcIlbcfix_NearestNeighbor(lagBlock+q,plocs2, - (int16_t)(blockStartPos[q-1]+ - (int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)),periodl); + WebRtcIlbcfix_NearestNeighbor( + lagBlock + q, + plocs2, + (int16_t)(blockStartPos[q - 1] + 4 * ENH_BLOCKL_HALF), + periodl); blockStartPos[q]=blockStartPos[q-1]+period[lagBlock[q]]; - if( (blockStartPos[q]+(int16_t)WEBRTC_SPL_MUL_16_16(4, (ENH_BLOCKL+ENH_OVERHANG))) - < - (int16_t)WEBRTC_SPL_MUL_16_16(4, idatal)) { + if (blockStartPos[q] + 4 * (ENH_BLOCKL + ENH_OVERHANG) < 4 * idatal) { /* Find the best possible sequence in the 4 times upsampled domain around blockStartPos+q */ diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c index 40c35eb31..a36ea3944 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c @@ -43,16 +43,16 @@ void WebRtcIlbcfix_HpInput( + (-a[1])*y[i-1] + (-a[2])*y[i-2]; */ - tmpW32 = WEBRTC_SPL_MUL_16_16(y[1], ba[3]); /* (-a[1])*y[i-1] (low part) */ - tmpW32 += WEBRTC_SPL_MUL_16_16(y[3], ba[4]); /* (-a[2])*y[i-2] (low part) */ + tmpW32 = y[1] * ba[3]; /* (-a[1])*y[i-1] (low part) */ + tmpW32 += y[3] * ba[4]; /* (-a[2])*y[i-2] (low part) */ tmpW32 = (tmpW32>>15); - tmpW32 += WEBRTC_SPL_MUL_16_16(y[0], ba[3]); /* (-a[1])*y[i-1] (high part) */ - tmpW32 += WEBRTC_SPL_MUL_16_16(y[2], ba[4]); /* (-a[2])*y[i-2] (high part) */ + tmpW32 += y[0] * ba[3]; /* (-a[1])*y[i-1] (high part) */ + tmpW32 += y[2] * ba[4]; /* (-a[2])*y[i-2] (high part) */ tmpW32 = (tmpW32<<1); - tmpW32 += WEBRTC_SPL_MUL_16_16(signal[i], ba[0]); /* b[0]*x[0] */ - tmpW32 += WEBRTC_SPL_MUL_16_16(x[0], ba[1]); /* b[1]*x[i-1] */ - tmpW32 += WEBRTC_SPL_MUL_16_16(x[1], ba[2]); /* b[2]*x[i-2] */ + tmpW32 += signal[i] * ba[0]; /* b[0]*x[0] */ + tmpW32 += x[0] * ba[1]; /* b[1]*x[i-1] */ + tmpW32 += x[1] * ba[2]; /* b[2]*x[i-2] */ /* Update state (input part) */ x[1] = x[0]; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c index e1de8292d..970ae1179 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c @@ -43,16 +43,16 @@ void WebRtcIlbcfix_HpOutput( + (-a[1])*y[i-1] + (-a[2])*y[i-2]; */ - tmpW32 = WEBRTC_SPL_MUL_16_16(y[1], ba[3]); /* (-a[1])*y[i-1] (low part) */ - tmpW32 += WEBRTC_SPL_MUL_16_16(y[3], ba[4]); /* (-a[2])*y[i-2] (low part) */ + tmpW32 = y[1] * ba[3]; /* (-a[1])*y[i-1] (low part) */ + tmpW32 += y[3] * ba[4]; /* (-a[2])*y[i-2] (low part) */ tmpW32 = (tmpW32>>15); - tmpW32 += WEBRTC_SPL_MUL_16_16(y[0], ba[3]); /* (-a[1])*y[i-1] (high part) */ - tmpW32 += WEBRTC_SPL_MUL_16_16(y[2], ba[4]); /* (-a[2])*y[i-2] (high part) */ + tmpW32 += y[0] * ba[3]; /* (-a[1])*y[i-1] (high part) */ + tmpW32 += y[2] * ba[4]; /* (-a[2])*y[i-2] (high part) */ tmpW32 = (tmpW32<<1); - tmpW32 += WEBRTC_SPL_MUL_16_16(signal[i], ba[0]); /* b[0]*x[0] */ - tmpW32 += WEBRTC_SPL_MUL_16_16(x[0], ba[1]); /* b[1]*x[i-1] */ - tmpW32 += WEBRTC_SPL_MUL_16_16(x[1], ba[2]); /* b[2]*x[i-2] */ + tmpW32 += signal[i] * ba[0]; /* b[0]*x[0] */ + tmpW32 += x[0] * ba[1]; /* b[1]*x[i-1] */ + tmpW32 += x[1] * ba[2]; /* b[2]*x[i-2] */ /* Update state (input part) */ x[1] = x[0]; 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 078a0fc04..250329300 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c @@ -53,7 +53,7 @@ void WebRtcIlbcfix_Lsf2Lsp( } /* Calculate linear approximation */ - tmpW32 = WEBRTC_SPL_MUL_16_16(WebRtcIlbcfix_kCosDerivative[k], diff); + tmpW32 = WebRtcIlbcfix_kCosDerivative[k] * diff; lsp[i] = WebRtcIlbcfix_kCos[k] + (int16_t)(tmpW32 >> 12); } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/my_corr.c b/webrtc/modules/audio_coding/codecs/ilbc/my_corr.c index c6cd83432..048745a3a 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/my_corr.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/my_corr.c @@ -37,7 +37,7 @@ void WebRtcIlbcfix_MyCorr( max=WebRtcSpl_MaxAbsValueW16(seq1, dim1); scale=WebRtcSpl_GetSizeInBits(max); - scale = (int16_t)(WEBRTC_SPL_MUL_16_16(2,scale)-26); + scale = (int16_t)(2 * scale - 26); if (scale<0) { scale=0; } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c b/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c index 8d1272f4b..632990885 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/nearest_neighbor.c @@ -38,7 +38,7 @@ void WebRtcIlbcfix_NearestNeighbor( /* Calculate square distance */ for(i=0;i> 1) + (xhigh >> 1); ymid = WebRtcIlbcfix_Chebyshev(xmid, f[fi_select]); - if (WEBRTC_SPL_MUL_16_16(ylow, ymid) <= 0) { + if (ylow * ymid <= 0) { yhigh = ymid; xhigh = xmid; } else { diff --git a/webrtc/modules/audio_coding/codecs/ilbc/refiner.c b/webrtc/modules/audio_coding/codecs/ilbc/refiner.c index e96ae2697..ca99b3a91 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/refiner.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/refiner.c @@ -101,7 +101,7 @@ void WebRtcIlbcfix_Refiner( /* make vector can be upsampled without ever running outside bounds */ - *updStartPos = (int16_t)WEBRTC_SPL_MUL_16_16(searchSegStartPos,4) + tloc + 4; + *updStartPos = (int16_t)(searchSegStartPos * 4) + tloc + 4; tloc2 = (tloc + 3) >> 2; @@ -127,7 +127,7 @@ void WebRtcIlbcfix_Refiner( } } /* Calculate which of the 4 fractions to use */ - fraction=(int16_t)WEBRTC_SPL_MUL_16_16(tloc2,ENH_UPS0)-tloc; + fraction = (int16_t)(tloc2 * ENH_UPS0) - tloc; /* compute the segment (this is actually a convolution) */ diff --git a/webrtc/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.c b/webrtc/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.c index ef5488322..9fa0d61de 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.c @@ -36,11 +36,11 @@ void WebRtcIlbcfix_SimpleLsfDeQ( cb_pos = 0; for (i = 0; i < LSF_NSPLIT; i++) { for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) { - lsfdeq[pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + - WEBRTC_SPL_MUL_16_16(index[i], WebRtcIlbcfix_kLsfDimCb[i]) + j]; + lsfdeq[pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + j + index[i] * + WebRtcIlbcfix_kLsfDimCb[i]]; } pos += WebRtcIlbcfix_kLsfDimCb[i]; - cb_pos += WEBRTC_SPL_MUL_16_16(WebRtcIlbcfix_kLsfSizeCb[i], WebRtcIlbcfix_kLsfDimCb[i]); + cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i]; } if (lpc_n>1) { @@ -49,11 +49,11 @@ void WebRtcIlbcfix_SimpleLsfDeQ( cb_pos = 0; for (i = 0; i < LSF_NSPLIT; i++) { for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) { - lsfdeq[LPC_FILTERORDER + pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + - WEBRTC_SPL_MUL_16_16(index[LSF_NSPLIT + i], WebRtcIlbcfix_kLsfDimCb[i]) + j]; + lsfdeq[LPC_FILTERORDER + pos + j] = WebRtcIlbcfix_kLsfCb[ + cb_pos + index[LSF_NSPLIT + i] * WebRtcIlbcfix_kLsfDimCb[i] + j]; } pos += WebRtcIlbcfix_kLsfDimCb[i]; - cb_pos += WEBRTC_SPL_MUL_16_16(WebRtcIlbcfix_kLsfSizeCb[i], WebRtcIlbcfix_kLsfDimCb[i]); + cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i]; } } return; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/smooth.c b/webrtc/modules/audio_coding/codecs/ilbc/smooth.c index 3d59c521d..57bd4aeda 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/smooth.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/smooth.c @@ -51,7 +51,7 @@ void WebRtcIlbcfix_Smooth( maxtot=WEBRTC_SPL_MAX(max1, max2); scale=WebRtcSpl_GetSizeInBits(maxtot); - scale = (int16_t)WEBRTC_SPL_MUL_16_16(2,scale)-26; + scale = (int16_t)(2 * scale) - 26; scale=WEBRTC_SPL_MAX(0, scale); w00=WebRtcSpl_DotProductWithScale(current,current,ENH_BLOCKL,scale); @@ -122,17 +122,14 @@ void WebRtcIlbcfix_Smooth( scale = scale1; } - w11w00 = WEBRTC_SPL_MUL_16_16( - (int16_t)WEBRTC_SPL_SHIFT_W32(w11, -scale), - (int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale)); + w11w00 = (int16_t)WEBRTC_SPL_SHIFT_W32(w11, -scale) * + (int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale); - w10w10 = WEBRTC_SPL_MUL_16_16( - (int16_t)WEBRTC_SPL_SHIFT_W32(w10, -scale), - (int16_t)WEBRTC_SPL_SHIFT_W32(w10, -scale)); + w10w10 = (int16_t)WEBRTC_SPL_SHIFT_W32(w10, -scale) * + (int16_t)WEBRTC_SPL_SHIFT_W32(w10, -scale); - w00w00 = WEBRTC_SPL_MUL_16_16( - (int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale), - (int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale)); + w00w00 = (int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale) * + (int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale); /* Calculate (w11*w00-w10*w10)/(w00*w00) in Q16 */ if (w00w00>65536) { 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 622af7bb7..9c41e0422 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/smooth_out_data.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/smooth_out_data.c @@ -37,7 +37,7 @@ int32_t WebRtcIlbcfix_Smooth_odata( errs=0; for(i=0;i<80;i++) { err = (psseq[i] - odata[i]) >> 3; - errs+=WEBRTC_SPL_MUL_16_16(err, err); /* errs in Q-6 */ + errs += err * err; /* errs in Q-6 */ } return errs; diff --git a/webrtc/modules/audio_coding/codecs/ilbc/state_construct.c b/webrtc/modules/audio_coding/codecs/ilbc/state_construct.c index 492ad59b7..80b3e1b73 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/state_construct.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/state_construct.c @@ -60,7 +60,8 @@ void WebRtcIlbcfix_StateConstruct( for(k=0; k> 22); + *tmp1 = (int16_t)((maxVal * WebRtcIlbcfix_kStateSq3[*tmp2] + 2097152) >> + 22); tmp1++; tmp2--; } @@ -68,7 +69,8 @@ void WebRtcIlbcfix_StateConstruct( for(k=0; k> 19); + *tmp1 = (int16_t)((maxVal * WebRtcIlbcfix_kStateSq3[*tmp2] + 262144) >> + 19); tmp1++; tmp2--; } @@ -76,7 +78,8 @@ void WebRtcIlbcfix_StateConstruct( for(k=0; k> 17); + *tmp1 = (int16_t)((maxVal * WebRtcIlbcfix_kStateSq3[*tmp2] + 65536) >> + 17); tmp1++; tmp2--; } diff --git a/webrtc/modules/audio_coding/codecs/ilbc/vq3.c b/webrtc/modules/audio_coding/codecs/ilbc/vq3.c index a6c6cdb81..ee3b26e03 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/vq3.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/vq3.c @@ -41,10 +41,10 @@ void WebRtcIlbcfix_Vq3( /* Find the codebook with the lowest square distance */ for (j = 0; j < n_cb; j++) { tmp = X[0] - CB[pos]; - dist = WEBRTC_SPL_MUL_16_16(tmp, tmp); + dist = tmp * tmp; for (i = 1; i < 3; i++) { tmp = X[i] - CB[pos + i]; - dist += WEBRTC_SPL_MUL_16_16(tmp, tmp); + dist += tmp * tmp; } if (dist < mindist) { diff --git a/webrtc/modules/audio_coding/codecs/ilbc/vq4.c b/webrtc/modules/audio_coding/codecs/ilbc/vq4.c index 7776dfb6d..bc2095213 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/vq4.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/vq4.c @@ -41,10 +41,10 @@ void WebRtcIlbcfix_Vq4( /* Find the codebook with the lowest square distance */ for (j = 0; j < n_cb; j++) { tmp = X[0] - CB[pos]; - dist = WEBRTC_SPL_MUL_16_16(tmp, tmp); + dist = tmp * tmp; for (i = 1; i < 4; i++) { tmp = X[i] - CB[pos + i]; - dist += WEBRTC_SPL_MUL_16_16(tmp, tmp); + dist += tmp * tmp; } if (dist < mindist) { diff --git a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c index ef5357e48..78524192b 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c +++ b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c @@ -53,7 +53,7 @@ void WebRtcIlbcfix_Window32W32( 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); + temp = (x_hi * y_hi) << 1; temp = (temp + (WEBRTC_SPL_MUL_16_16_RSFT(x_hi, y_low, 14))); z[i] = (temp + (WEBRTC_SPL_MUL_16_16_RSFT(x_low, y_hi, 14)));