diff options
author | bjornv@webrtc.org <bjornv@webrtc.org> | 2014-10-08 15:36:30 +0000 |
---|---|---|
committer | bjornv@webrtc.org <bjornv@webrtc.org> | 2014-10-08 15:36:30 +0000 |
commit | 20cc0ad0555ece11a955a326e199d548bcde3670 (patch) | |
tree | a4933ca84ecbd5ef31c7a2145d2e89b670c7d1f7 | |
parent | 19cf944f31abc93ad6330efe37c998626af8d17d (diff) | |
download | webrtc-20cc0ad0555ece11a955a326e199d548bcde3670.tar.gz |
audio_coding: Replaced macro WEBRTC_SPL_RSHIFT_W16 with >>
Replaced trivial shift macro with >>. The actual implementation of the macro is simply >>.
Affected codecs:
* ilbc
* isac/fix
BUG=3348,3353
TESTED=locally on linux and trybots
R=henrik.lundin@webrtc.org, kwiberg@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/23889004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7396 4adac7df-926f-26a2-2b94-8c16560cd09d
16 files changed, 47 insertions, 58 deletions
diff --git a/modules/audio_coding/codecs/ilbc/enhancer_interface.c b/modules/audio_coding/codecs/ilbc/enhancer_interface.c index 1e978eb2..0778c275 100644 --- a/modules/audio_coding/codecs/ilbc/enhancer_interface.c +++ b/modules/audio_coding/codecs/ilbc/enhancer_interface.c @@ -100,7 +100,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */ enh_buf+ENH_BUFL-inLen, /* Input samples */ (int16_t)(inLen+ENH_BUFL_FILTEROVERHEAD), downsampled, - (int16_t)WEBRTC_SPL_RSHIFT_W16(inLen, 1), + (int16_t)(inLen / 2), (int16_t*)WebRtcIlbcfix_kLpFiltCoefs, /* Coefficients in Q12 */ FILTERORDER_DS_PLUS1, /* Length of filter (order-1) */ FACTOR_DS, @@ -292,7 +292,7 @@ int WebRtcIlbcfix_EnhancerInterface( /* (o) Estimated lag in end of in[] */ /* Calculate increase parameter for window part (16 last samples) */ /* (1-2*SqrtEnChange)/16 in Q15 */ - inc=(2048-WEBRTC_SPL_RSHIFT_W16(SqrtEnChange, 3)); + inc = 2048 - (SqrtEnChange >> 3); win=0; tmpW16ptr=&plc_pred[plc_blockl-16]; diff --git a/modules/audio_coding/codecs/ilbc/get_cd_vec.c b/modules/audio_coding/codecs/ilbc/get_cd_vec.c index ca07b0ae..fb9b03d3 100644 --- a/modules/audio_coding/codecs/ilbc/get_cd_vec.c +++ b/modules/audio_coding/codecs/ilbc/get_cd_vec.c @@ -41,7 +41,7 @@ void WebRtcIlbcfix_GetCbVec( base_size=lMem-cbveclen+1; if (cbveclen==SUBL) { - base_size+=WEBRTC_SPL_RSHIFT_W16(cbveclen,1); + base_size += cbveclen / 2; } /* No filter -> First codebook section */ @@ -60,7 +60,7 @@ void WebRtcIlbcfix_GetCbVec( k=(int16_t)WEBRTC_SPL_MUL_16_16(2, (index-(lMem-cbveclen+1)))+cbveclen; - lag=WEBRTC_SPL_RSHIFT_W16(k, 1); + lag = k / 2; WebRtcIlbcfix_CreateAugmentedVec(lag, mem+lMem, cbvec); diff --git a/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c b/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c index 40737bbe..579fdcf7 100644 --- a/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c +++ b/modules/audio_coding/codecs/ilbc/lsf_to_lsp.c @@ -43,7 +43,7 @@ void WebRtcIlbcfix_Lsf2Lsp( Lower 8 bits give the difference, which needs to be approximated linearly */ - k = WEBRTC_SPL_RSHIFT_W16(freq, 8); + k = freq >> 8; diff = (freq&0x00ff); /* Guard against getting outside table */ diff --git a/modules/audio_coding/codecs/ilbc/poly_to_lsp.c b/modules/audio_coding/codecs/ilbc/poly_to_lsp.c index 3add966e..ce5de29a 100644 --- a/modules/audio_coding/codecs/ilbc/poly_to_lsp.c +++ b/modules/audio_coding/codecs/ilbc/poly_to_lsp.c @@ -91,7 +91,7 @@ void WebRtcIlbcfix_Poly2Lsp( /* Run 4 times to reduce the interval */ for (i = 0; i < 4; i++) { /* xmid =(xlow + xhigh)/2 */ - xmid = WEBRTC_SPL_RSHIFT_W16(xlow, 1) + WEBRTC_SPL_RSHIFT_W16(xhigh, 1); + xmid = (xlow >> 1) + (xhigh >> 1); ymid = WebRtcIlbcfix_Chebyshev(xmid, f[fi_select]); if (WEBRTC_SPL_MUL_16_16(ylow, ymid) <= 0) { diff --git a/modules/audio_coding/codecs/ilbc/refiner.c b/modules/audio_coding/codecs/ilbc/refiner.c index 50d30c9b..fed33948 100644 --- a/modules/audio_coding/codecs/ilbc/refiner.c +++ b/modules/audio_coding/codecs/ilbc/refiner.c @@ -53,7 +53,7 @@ void WebRtcIlbcfix_Refiner( /* defining array bounds */ - estSegPosRounded=WEBRTC_SPL_RSHIFT_W16((estSegPos - 2),2); + estSegPosRounded = (estSegPos - 2) >> 2; searchSegStartPos=estSegPosRounded-ENH_SLOP; @@ -103,7 +103,7 @@ void WebRtcIlbcfix_Refiner( bounds */ *updStartPos = (int16_t)WEBRTC_SPL_MUL_16_16(searchSegStartPos,4) + tloc + 4; - tloc2 = WEBRTC_SPL_RSHIFT_W16((tloc+3), 2); + tloc2 = (tloc + 3) >> 2; st=searchSegStartPos+tloc2-ENH_FL0; diff --git a/modules/audio_coding/codecs/ilbc/smooth_out_data.c b/modules/audio_coding/codecs/ilbc/smooth_out_data.c index df3a3b76..cf3b30ae 100644 --- a/modules/audio_coding/codecs/ilbc/smooth_out_data.c +++ b/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=(int16_t)WEBRTC_SPL_RSHIFT_W16((psseq[i]-odata[i]), 3); + err = (psseq[i] - odata[i]) >> 3; errs+=WEBRTC_SPL_MUL_16_16(err, err); /* errs in Q-6 */ } diff --git a/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c b/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c index 2cc020d4..b88bc1f2 100644 --- a/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c +++ b/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c @@ -188,7 +188,7 @@ int16_t WebRtcIsacfix_DecHistBisectMulti(int16_t *data, W_upper_MSB = WEBRTC_SPL_RSHIFT_W32(W_upper, 16); /* start halfway the cdf range */ - sizeTmp = WEBRTC_SPL_RSHIFT_W16(*cdfSize++, 1); + sizeTmp = *cdfSize++ / 2; cdfPtr = *cdf + (sizeTmp - 1); /* method of bisection */ @@ -196,7 +196,7 @@ int16_t WebRtcIsacfix_DecHistBisectMulti(int16_t *data, { W_tmp = WEBRTC_SPL_UMUL_32_16(W_upper_MSB, *cdfPtr); W_tmp += (W_upper_LSB * (*cdfPtr)) >> 16; - sizeTmp = WEBRTC_SPL_RSHIFT_W16(sizeTmp, 1); + sizeTmp /= 2; if (sizeTmp == 0) { break; } @@ -235,8 +235,7 @@ int16_t WebRtcIsacfix_DecHistBisectMulti(int16_t *data, (*streamPtr++ & 0x00FF); streamData->full = 1; } else { - streamval = WEBRTC_SPL_LSHIFT_W32(streamval, 8) | - WEBRTC_SPL_RSHIFT_W16(*streamPtr, 8); + streamval = (streamval << 8) | (*streamPtr >> 8); streamData->full = 0; } W_upper = WEBRTC_SPL_LSHIFT_W32(W_upper, 8); diff --git a/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c b/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c index 5133128b..27f582a2 100644 --- a/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c +++ b/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c @@ -264,8 +264,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7, } - res = WEBRTC_SPL_LSHIFT_W32((int32_t)1, - WEBRTC_SPL_RSHIFT_W16(WebRtcSpl_GetSizeInBits(envQ8[0]), 1)); + res = 1 << (WebRtcSpl_GetSizeInBits(envQ8[0]) >> 1); envCount = 0; /* code assumes lenData%4 == 0 */ diff --git a/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c b/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c index e69435f0..7012e8d6 100644 --- a/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c +++ b/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c @@ -904,12 +904,12 @@ uint16_t WebRtcIsacfix_GetMinBytes(RateModel *State, State->ExceedAgo = 0; } } else { - State->ExceedAgo += (int16_t)WEBRTC_SPL_RSHIFT_W16(FrameSamples, 4); /* ms */ + State->ExceedAgo += FrameSamples / SAMPLES_PER_MSEC; /* ms */ State->PrevExceed = 1; } } else { State->PrevExceed = 0; - State->ExceedAgo += (int16_t)WEBRTC_SPL_RSHIFT_W16(FrameSamples, 4); /* ms */ + State->ExceedAgo += FrameSamples / SAMPLES_PER_MSEC; /* ms */ } /* set burst flag if bottle neck not exceeded for long time */ @@ -925,7 +925,7 @@ uint16_t WebRtcIsacfix_GetMinBytes(RateModel *State, /* Update buffer delay */ TransmissionTime = (StreamSize * 8000) / BottleNeck; /* ms */ State->StillBuffered += TransmissionTime; - State->StillBuffered -= (int16_t)WEBRTC_SPL_RSHIFT_W16(FrameSamples, 4); //>>4 = SAMPLES_PER_MSEC /* ms */ + State->StillBuffered -= FrameSamples / SAMPLES_PER_MSEC; /* ms */ if (State->StillBuffered < 0) { State->StillBuffered = 0; } @@ -953,7 +953,7 @@ void WebRtcIsacfix_UpdateRateModel(RateModel *State, /* Update buffer delay */ State->StillBuffered += TransmissionTime; - State->StillBuffered -= (int16_t)WEBRTC_SPL_RSHIFT_W16(FrameSamples, 4); /* ms */ + State->StillBuffered -= FrameSamples >> 4; /* ms */ if (State->StillBuffered < 0) { State->StillBuffered = 0; } diff --git a/modules/audio_coding/codecs/isac/fix/source/decode_plc.c b/modules/audio_coding/codecs/isac/fix/source/decode_plc.c index fd301839..5d6bda57 100644 --- a/modules/audio_coding/codecs/isac/fix/source/decode_plc.c +++ b/modules/audio_coding/codecs/isac/fix/source/decode_plc.c @@ -110,9 +110,9 @@ static __inline int16_t exp2_Q10_T(int16_t x) { // Both in and out in Q10 int16_t tmp16_1, tmp16_2; tmp16_2=(int16_t)(0x0400|(x&0x03FF)); - tmp16_1=-(int16_t)WEBRTC_SPL_RSHIFT_W16(x,10); + tmp16_1 = -(x >> 10); if(tmp16_1>0) - return (int16_t) WEBRTC_SPL_RSHIFT_W16(tmp16_2, tmp16_1); + return tmp16_2 >> tmp16_1; else return (int16_t) WEBRTC_SPL_LSHIFT_W16(tmp16_2, -tmp16_1); @@ -305,8 +305,7 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16, - lag0 = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).lastPitchLag_Q7 + 64, 7 ) + 1; + lag0 = ((ISACdec_obj->plcstr_obj.lastPitchLag_Q7 + 64) >> 7) + 1; if( (ISACdec_obj->plcstr_obj).used != PLC_WAS_USED ) @@ -473,27 +472,23 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16, /* --- Low Pass */ (ISACdec_obj->plcstr_obj).seed = WEBRTC_SPL_RAND( (ISACdec_obj->plcstr_obj).seed ); - Vector_Word16_1[i] = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).seed, 10 ) - 16; + Vector_Word16_1[i] = (ISACdec_obj->plcstr_obj.seed >> 10) - 16; /* --- Highpass */ (ISACdec_obj->plcstr_obj).seed = WEBRTC_SPL_RAND( (ISACdec_obj->plcstr_obj).seed ); - Vector_Word16_2[i] = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).seed, 10 ) - 16; + Vector_Word16_2[i] = (ISACdec_obj->plcstr_obj.seed >> 10) - 16; } for( i = 1; i < NOISE_FILTER_LEN; i++ ) { (ISACdec_obj->plcstr_obj).seed = WEBRTC_SPL_RAND( (ISACdec_obj->plcstr_obj).seed ); - Vector_Word16_Extended_1[ i ] = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).seed, 10 ) - 16; + Vector_Word16_Extended_1[i] = (ISACdec_obj->plcstr_obj.seed >> 10) - 16; (ISACdec_obj->plcstr_obj).seed = WEBRTC_SPL_RAND( (ISACdec_obj->plcstr_obj).seed ); - Vector_Word16_Extended_2[ i ] = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).seed, 10 ) - 16; + Vector_Word16_Extended_2[i] = (ISACdec_obj->plcstr_obj.seed >> 10) - 16; } plc_filterma_Fast(Vector_Word16_1, Vector_Word16_Extended_1, &(ISACdec_obj->plcstr_obj).prevPitchInvIn[FRAMESAMPLES_HALF - @@ -638,8 +633,7 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16, (ISACdec_obj->plcstr_obj).seed = WEBRTC_SPL_RAND( (ISACdec_obj->plcstr_obj).seed ); - noise1 = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).seed, 10 ) - 16; + noise1 = (ISACdec_obj->plcstr_obj.seed >> 10) - 16; nLP = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT( (int16_t)((noise1)*(ISACdec_obj->plcstr_obj).std), @@ -648,8 +642,7 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16, /* --- Highpass */ (ISACdec_obj->plcstr_obj).seed = WEBRTC_SPL_RAND( (ISACdec_obj->plcstr_obj).seed ); - noise1 = WEBRTC_SPL_RSHIFT_W16( - (ISACdec_obj->plcstr_obj).seed, 11 ) - 8; + noise1 = (ISACdec_obj->plcstr_obj.seed >> 11) - 8; nHP = (int32_t)WEBRTC_SPL_MUL_16_32_RSFT15( (ISACdec_obj->plcstr_obj).decayCoeffNoise, diff --git a/modules/audio_coding/codecs/isac/fix/source/encode.c b/modules/audio_coding/codecs/isac/fix/source/encode.c index daf0d629..0998545a 100644 --- a/modules/audio_coding/codecs/isac/fix/source/encode.c +++ b/modules/audio_coding/codecs/isac/fix/source/encode.c @@ -456,7 +456,8 @@ int WebRtcIsacfix_EncodeImpl(int16_t *in, assert(stream_length >= 0); if (stream_length & 0x0001){ ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed ); - ISACenc_obj->bitstr_obj.stream[ WEBRTC_SPL_RSHIFT_W16(stream_length, 1) ] |= (uint16_t)(ISACenc_obj->bitstr_seed & 0xFF); + ISACenc_obj->bitstr_obj.stream[stream_length / 2] |= + (uint16_t)(ISACenc_obj->bitstr_seed & 0xFF); } else { ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed ); ISACenc_obj->bitstr_obj.stream[stream_length / 2] = diff --git a/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c b/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c index 27d1c1fc..c1b4abb7 100644 --- a/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c +++ b/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c @@ -142,7 +142,7 @@ static int32_t CalcExpN(int16_t x) { if (x>=0) { // ax=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(x, 23637-700, 14); //Q8 ax=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(x, 23637, 14); //Q8 - axINT = WEBRTC_SPL_RSHIFT_W16(ax, 8); //Q0 + axINT = ax >> 8; //Q0 axFRAC = ax&0x00FF; exp16 = WEBRTC_SPL_LSHIFT_W32(1, axINT); //Q0 axFRAC = axFRAC+256; //Q8 @@ -152,7 +152,7 @@ static int32_t CalcExpN(int16_t x) { // ax=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(x, 23637+700, 14); //Q8 ax=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(x, 23637, 14); //Q8 ax = -ax; - axINT = 1 + WEBRTC_SPL_RSHIFT_W16(ax, 8); //Q0 + axINT = 1 + (ax >> 8); //Q0 axFRAC = 0x00FF - (ax&0x00FF); exp16 = (int16_t) WEBRTC_SPL_RSHIFT_W32(32768, axINT); //Q15 axFRAC = axFRAC+256; //Q8 @@ -339,7 +339,7 @@ static void CalcRootInvArSpec(const int16_t *ARCoefQ12, in_sqrt = summQ16[0] + WEBRTC_SPL_LSHIFT_W32(diffQ16[0], shftVal); /* convert to magnitude spectrum, by doing square-roots (modified from SPLIB) */ - res = WEBRTC_SPL_LSHIFT_W32(1, WEBRTC_SPL_RSHIFT_W16(WebRtcSpl_GetSizeInBits(in_sqrt), 1)); + res = 1 << (WebRtcSpl_GetSizeInBits(in_sqrt) >> 1); for (k = 0; k < FRAMESAMPLES/8; k++) { diff --git a/modules/audio_coding/codecs/isac/fix/source/fft.c b/modules/audio_coding/codecs/isac/fix/source/fft.c index d9cf8f2b..a1876d09 100644 --- a/modules/audio_coding/codecs/isac/fix/source/fft.c +++ b/modules/audio_coding/codecs/isac/fix/source/fft.c @@ -176,10 +176,8 @@ int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[], int16_t ImxQx[], int16_ bjQx = ImxQx[k1] + ImxQx[k2]; RexQx[kk] = akQx + ajQx; ImxQx[kk] = bkQx + bjQx; - tmp116 = WEBRTC_SPL_RSHIFT_W16(ajQx, 1); - tmp216 = WEBRTC_SPL_RSHIFT_W16(bjQx, 1); - akQx = akQx - tmp116; - bkQx = bkQx - tmp216; + akQx -= ajQx >> 1; + bkQx -= bjQx >> 1; tmp116 = RexQx[k1] - RexQx[k2]; tmp216 = ImxQx[k1] - ImxQx[k2]; diff --git a/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.c b/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.c index deba0d5e..62608cfe 100644 --- a/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.c +++ b/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.c @@ -422,11 +422,11 @@ void WebRtcIsacfix_GetVars(const int16_t *input, const int16_t *pitchGains_Q12, tmp16=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(kExp2,pg3,13);/* Q13*Q10>>13 => Q10*/ if (tmp16<0) { tmp16_2 = (0x0400 | (tmp16 & 0x03FF)); - tmp16_1 = (WEBRTC_SPL_RSHIFT_W16((uint16_t)(tmp16 ^ 0xFFFF), 10)-3); /* Gives result in Q14 */ + tmp16_1 = ((uint16_t)(tmp16 ^ 0xFFFF) >> 10) - 3; /* Gives result in Q14 */ if (tmp16_1<0) expPg=(int16_t) -WEBRTC_SPL_LSHIFT_W16(tmp16_2, -tmp16_1); else - expPg=(int16_t) -WEBRTC_SPL_RSHIFT_W16(tmp16_2, tmp16_1); + expPg = -(tmp16_2 >> tmp16_1); } else expPg = (int16_t) -16384; /* 1 in Q14, since 2^0=1 */ @@ -436,11 +436,11 @@ void WebRtcIsacfix_GetVars(const int16_t *input, const int16_t *pitchGains_Q12, tmp16=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(kExp2,divVal,13);/* Q13*Q10>>13 => Q10*/ if (tmp16<0) { tmp16_2 = (0x0400 | (tmp16 & 0x03FF)); - tmp16_1 = (WEBRTC_SPL_RSHIFT_W16((uint16_t)(tmp16 ^ 0xFFFF), 10)-3); /* Gives result in Q14 */ + tmp16_1 = ((uint16_t)(tmp16 ^ 0xFFFF) >> 10) - 3; /* Gives result in Q14 */ if (tmp16_1<0) expPg=(int16_t) WEBRTC_SPL_LSHIFT_W16(tmp16_2, -tmp16_1); else - expPg=(int16_t) WEBRTC_SPL_RSHIFT_W16(tmp16_2, tmp16_1); + expPg = tmp16_2 >> tmp16_1; } else expPg = (int16_t) 16384; /* 1 in Q14, since 2^0=1 */ @@ -455,9 +455,9 @@ static __inline int16_t exp2_Q10_T(int16_t x) { // Both in and out in Q10 int16_t tmp16_1, tmp16_2; tmp16_2=(int16_t)(0x0400|(x&0x03FF)); - tmp16_1=-(int16_t)WEBRTC_SPL_RSHIFT_W16(x,10); + tmp16_1 = -(x >> 10); if(tmp16_1>0) - return (int16_t) WEBRTC_SPL_RSHIFT_W16(tmp16_2, tmp16_1); + return tmp16_2 >> tmp16_1; else return (int16_t) WEBRTC_SPL_LSHIFT_W16(tmp16_2, -tmp16_1); @@ -610,10 +610,10 @@ void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0, /* Calculate tmp = (1.0 + aa*aa); in Q12 */ tmp16 = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(aaQ14, aaQ14, 15); //Q14*Q14>>15 = Q13 - tmpQQlo = 4096 + WEBRTC_SPL_RSHIFT_W16(tmp16, 1); // Q12 + Q13>>1 = Q12 + tmpQQlo = 4096 + (tmp16 >> 1); // Q12 + Q13>>1 = Q12. /* Calculate tmp = (1.0+aa) * (1.0+aa); */ - tmp16 = 8192 + WEBRTC_SPL_RSHIFT_W16(aaQ14, 1); // 1+a in Q13 + tmp16 = 8192 + (aaQ14 >> 1); // 1+a in Q13. tmpQQhi = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(tmp16, tmp16, 14); //Q13*Q13>>14 = Q12 /* replace data in buffer by new look-ahead data */ @@ -878,8 +878,8 @@ void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0, //tmp32a=WEBRTC_SPL_MUL_16_16_RSFT(varscaleQ14, H_T_HQ19, 17); // Q14 - tmp32a=WEBRTC_SPL_RSHIFT_W32((int32_t) varscaleQ14,1); // H_T_HQ19=65536 (16-17=-1) ssh= WEBRTC_SPL_RSHIFT_W16(sh_lo, 1); // sqrt_nrg is in Qssh - ssh= WEBRTC_SPL_RSHIFT_W16(sh_lo, 1); // sqrt_nrg is in Qssh + tmp32a = varscaleQ14 >> 1; // H_T_HQ19=65536 (16-17=-1) + ssh = sh_lo >> 1; // sqrt_nrg is in Qssh. sh = ssh - 14; tmp32b = WEBRTC_SPL_SHIFT_W32(tmp32a, sh); // Q14->Qssh tmp32c = sqrt_nrg + tmp32b; // Qssh (denominator) diff --git a/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c b/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c index c38cbf62..3f384fea 100644 --- a/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c +++ b/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c @@ -45,9 +45,9 @@ static __inline int16_t Exp2Q10(int16_t x) { // Both in and out in Q10 int16_t tmp16_1, tmp16_2; tmp16_2=(int16_t)(0x0400|(x&0x03FF)); - tmp16_1=-(int16_t)WEBRTC_SPL_RSHIFT_W16(x,10); + tmp16_1 = -(x >> 10); if(tmp16_1>0) - return (int16_t) WEBRTC_SPL_RSHIFT_W16(tmp16_2, tmp16_1); + return tmp16_2 >> tmp16_1; else return (int16_t) WEBRTC_SPL_LSHIFT_W16(tmp16_2, -tmp16_1); @@ -88,7 +88,7 @@ static __inline void Intrp1DQ8(int32_t *x, int32_t *fx, int32_t *y, int32_t *fy) /* Part I: 0.5 * t * (t-1) * fx[0] */ tmp16_1=(int16_t)WEBRTC_SPL_MUL_16_16(t16,t16); /* Q8*Q8=Q16 */ - tmp16_1 = WEBRTC_SPL_RSHIFT_W16(tmp16_1,2); /* Q16>>2 = Q14 */ + tmp16_1 >>= 2; /* Q16>>2 = Q14 */ t16 = (int16_t)WEBRTC_SPL_MUL_16_16(t16, 64); /* Q8<<6 = Q14 */ tmp16 = tmp16_1-t16; *fy = WEBRTC_SPL_MUL_16_32_RSFT15(tmp16, fx[0]); /* (Q14 * Q8 >>15)/2 = Q8 */ diff --git a/modules/audio_coding/codecs/isac/fix/source/pitch_filter.c b/modules/audio_coding/codecs/isac/fix/source/pitch_filter.c index c3db01c6..6feb292a 100644 --- a/modules/audio_coding/codecs/isac/fix/source/pitch_filter.c +++ b/modules/audio_coding/codecs/isac/fix/source/pitch_filter.c @@ -207,8 +207,7 @@ void WebRtcIsacfix_PitchFilterGains(const int16_t* indatQ0, indW16 = (int16_t)CalcLrIntQ(curLagQ7, 7); tmpW16 = WEBRTC_SPL_LSHIFT_W16(indW16, 7); tmpW16 -= curLagQ7; - frcQQ = WEBRTC_SPL_RSHIFT_W16(tmpW16, 4); - frcQQ += 4; + frcQQ = (tmpW16 >> 4) + 4; if (frcQQ == PITCH_FRACS) { frcQQ = 0; |