diff --git a/src/modules/audio_coding/NetEQ/main/source/accelerate.c b/src/modules/audio_coding/NetEQ/main/source/accelerate.c index edec9c6e9..285de4dc7 100644 --- a/src/modules/audio_coding/NetEQ/main/source/accelerate.c +++ b/src/modules/audio_coding/NetEQ/main/source/accelerate.c @@ -380,7 +380,7 @@ int WebRtcNetEQ_Accelerate(DSPInst_t *inst, w32_tmp = WEBRTC_SPL_MUL_16_16(w16_en1, w16_en2); /* Calculate square-root of energy product */ - w16_sqrtEn1En2 = (WebRtc_Word16) WebRtcSpl_Sqrt(w32_tmp); + w16_sqrtEn1En2 = (WebRtc_Word16) WebRtcSpl_SqrtFloor(w32_tmp); /* Calculate cc/sqrt(en1*en2) in Q14 */ w16_tmp = 14 - WEBRTC_SPL_RSHIFT_W16(w16_en1Scale+w16_en2Scale, 1); diff --git a/src/modules/audio_coding/NetEQ/main/source/bgn_update.c b/src/modules/audio_coding/NetEQ/main/source/bgn_update.c index 115168a0b..05956c2ba 100644 --- a/src/modules/audio_coding/NetEQ/main/source/bgn_update.c +++ b/src/modules/audio_coding/NetEQ/main/source/bgn_update.c @@ -188,7 +188,7 @@ void WebRtcNetEQ_BGNUpdate( w32_enBGN = WEBRTC_SPL_SHIFT_W32(w32_enBGN, w16_tmp2); /* Calculate scale and shift factor */ - BGN_Inst->w16_scale = (WebRtc_Word16) WebRtcSpl_Sqrt(w32_enBGN); + BGN_Inst->w16_scale = (WebRtc_Word16) WebRtcSpl_SqrtFloor(w32_enBGN); BGN_Inst->w16_scaleShift = 13 + ((6 + w16_tmp2) >> 1); /* RANDN table is in Q13, */ /* 6=log2(64) */ diff --git a/src/modules/audio_coding/NetEQ/main/source/expand.c b/src/modules/audio_coding/NetEQ/main/source/expand.c index 2520f6382..bfa8859a0 100644 --- a/src/modules/audio_coding/NetEQ/main/source/expand.c +++ b/src/modules/audio_coding/NetEQ/main/source/expand.c @@ -419,7 +419,7 @@ int WebRtcNetEQ_Expand(DSPInst_t *inst, w16_en1 = (WebRtc_Word16) WEBRTC_SPL_RSHIFT_W32(w32_en1, w16_en1Scale); w16_en2 = (WebRtc_Word16) WEBRTC_SPL_RSHIFT_W32(w32_en2, w16_en2Scale); w32_en1_mul_en2 = WEBRTC_SPL_MUL_16_16(w16_en1, w16_en2); - w16_sqrt_en1en2 = (WebRtc_Word16) WebRtcSpl_Sqrt(w32_en1_mul_en2); + w16_sqrt_en1en2 = (WebRtc_Word16) WebRtcSpl_SqrtFloor(w32_en1_mul_en2); /* Calculate cc/sqrt(en1*en2) in Q14 */ w16_ccShiftL = 14 - ((w16_en1Scale + w16_en2Scale) >> 1); @@ -463,7 +463,7 @@ int WebRtcNetEQ_Expand(DSPInst_t *inst, (WebRtc_Word16) (WEBRTC_SPL_RSHIFT_W32(w32_en2, w16_en2Scale))); /* calculate factor in Q13 (sqrt of en1/en2 in Q26) */ - w16_factor = (WebRtc_Word16) WebRtcSpl_Sqrt( + w16_factor = (WebRtc_Word16) WebRtcSpl_SqrtFloor( WEBRTC_SPL_LSHIFT_W32(w32_en1_mul_en2, 13)); /* Copy the two vectors and give them the same energy */ @@ -621,7 +621,7 @@ int WebRtcNetEQ_Expand(DSPInst_t *inst, w16_tmp += ((w16_tmp & 0x1) ^ 0x1); /* Make sure we do an odd number of shifts since we from earlier have 7 shifts from dividing with 128.*/ w32_tmp = WEBRTC_SPL_SHIFT_W32(w32_tmp, w16_tmp); - w32_tmp = WebRtcSpl_Sqrt(w32_tmp); + w32_tmp = WebRtcSpl_SqrtFloor(w32_tmp); ExpandState->w16_arGainScale = 13 + ((w16_tmp + 7 - w16_scale) >> 1); ExpandState->w16_arGain = (WebRtc_Word16) w32_tmp; diff --git a/src/modules/audio_coding/NetEQ/main/source/merge.c b/src/modules/audio_coding/NetEQ/main/source/merge.c index 28e31c4dc..16e91645f 100644 --- a/src/modules/audio_coding/NetEQ/main/source/merge.c +++ b/src/modules/audio_coding/NetEQ/main/source/merge.c @@ -253,7 +253,7 @@ int WebRtcNetEQ_Merge(DSPInst_t *inst, w16_tmp = WebRtcSpl_DivW32W16ResW16(w32_En_old_frame, (WebRtc_Word16) w32_En_new_frame); /* Calculate sqrt(w32_En_old_frame/w32_En_new_frame) in Q14 */ - w16_muted = (WebRtc_Word16) WebRtcSpl_Sqrt( + w16_muted = (WebRtc_Word16) WebRtcSpl_SqrtFloor( WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)w16_tmp,14)); } else diff --git a/src/modules/audio_coding/NetEQ/main/source/normal.c b/src/modules/audio_coding/NetEQ/main/source/normal.c index c86505234..b33940a49 100644 --- a/src/modules/audio_coding/NetEQ/main/source/normal.c +++ b/src/modules/audio_coding/NetEQ/main/source/normal.c @@ -164,7 +164,7 @@ int WebRtcNetEQ_Normal(DSPInst_t *inst, w32_tmp = WEBRTC_SPL_SHIFT_W32(inst->BGNInst.w32_energy, (w16_tmp+14)); w16_tmp = (WebRtc_Word16) WEBRTC_SPL_SHIFT_W32(w32_En_speech, w16_tmp); w16_tmp = (WebRtc_Word16) WebRtcSpl_DivW32W16(w32_tmp, w16_tmp); - w16_muted = (WebRtc_Word16) WebRtcSpl_Sqrt( + w16_muted = (WebRtc_Word16) WebRtcSpl_SqrtFloor( WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32) w16_tmp, 14)); /* w16_muted in Q14 (sqrt(Q28)) */ } diff --git a/src/modules/audio_coding/NetEQ/main/source/preemptive_expand.c b/src/modules/audio_coding/NetEQ/main/source/preemptive_expand.c index 7867b36dc..d4e375216 100644 --- a/src/modules/audio_coding/NetEQ/main/source/preemptive_expand.c +++ b/src/modules/audio_coding/NetEQ/main/source/preemptive_expand.c @@ -406,7 +406,7 @@ int WebRtcNetEQ_PreEmptiveExpand(DSPInst_t *inst, w32_tmp = WEBRTC_SPL_MUL_16_16(w16_en1, w16_en2); /* Calculate square-root of energy product */ - w16_sqrtEn1En2 = (WebRtc_Word16) WebRtcSpl_Sqrt(w32_tmp); + w16_sqrtEn1En2 = (WebRtc_Word16) WebRtcSpl_SqrtFloor(w32_tmp); /* Calculate cc/sqrt(en1*en2) in Q14 */ w16_tmp = 14 - ((w16_en1Scale + w16_en2Scale) >> 1); diff --git a/test/data/audio_coding/universal_ref.pcm b/test/data/audio_coding/universal_ref.pcm index da4a93033..411193aa3 100644 Binary files a/test/data/audio_coding/universal_ref.pcm and b/test/data/audio_coding/universal_ref.pcm differ