Switch to new sqrt in NetEQ
Switched to WebRtcSpl_SqrtFloor instead of WebRtcSpl_Sqrt in NetEQ. The output is not bit-exact, but subjective listening tests show no audible difference. Analysis shows that almost all of the difference is in changed delay. The reference file for NetEQ's unit test was updated. Review URL: http://webrtc-codereview.appspot.com/139019 git-svn-id: http://webrtc.googlecode.com/svn/trunk@583 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f0a8464b74
commit
9f710d08e1
@ -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);
|
||||
|
@ -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) */
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)) */
|
||||
}
|
||||
|
@ -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);
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user