Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ #ifndef BASOP_NOGLOB_DEV_USE_GLOBALS #define BASOP_NOGLOB_DECLARE_LOCAL #endif #define FIX_732_MS_PERIODOG_FLOOR /* Eri: Issue-732: Dynamic range of msPeriodog leads to minimum value 1e-5 being truncated to zero. This uses the smallest non-zero value instead. */ #define FIX_867_CLDFB_NRG_SCALE Loading lib_dec/dec_tcx_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -2886,7 +2886,7 @@ void IMDCT_ivas_fx( { Word16 q_old_out = q_win; move16(); edct_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); edct_ivas_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); Word16 res_m, res_e; res_e = 0; move16(); Loading lib_dec/fd_cng_dec_fx.c +33 −2 Original line number Diff line number Diff line Loading @@ -1501,14 +1501,19 @@ void perform_noise_estimation_dec_ivas_fx( Word16 enr_e, enr_ratio, alpha; Word32 *msPeriodog; Word32 *msNoiseEst; #ifdef FIX_732_MS_PERIODOG_FLOOR Word32 msPeriodog_floor; #endif Word32 *reIter; Word32 rescale_fac = 0; Word64 W_tmp; Word16 tmp_s, tmp_q, min_q = 31; Word16 q_shift; Word32 max_l; Word16 norm_shift; #ifdef FIX_732_MS_PERIODOG_FLOOR Word16 norm_shift, check = 0; move16(); #endif /* pointer initialization */ periodog = hFdCngDec->hFdCngCom->periodog; /*Q31 - hFdCngDec->hFdCngCom->periodog_exp*/ fftBuffer = hFdCngDec->hFdCngCom->fftBuffer; /*Q31 - hFdCngDec->hFdCngCom->fftBuffer_exp*/ Loading Loading @@ -1706,12 +1711,38 @@ void perform_noise_estimation_dec_ivas_fx( msPeriodog[p] = L_add( msPeriodog[p], L_tmp ); /*Q31 - hFdCngDec->msPeriodog_exp*/ move32(); #ifdef FIX_732_MS_PERIODOG_FLOOR msPeriodog_floor = L_max( 1, L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ); /*Q31 - hFdCngDec->msPeriodog_exp*/ IF( LT_32( msPeriodog[p], msPeriodog_floor ) ) #else IF( LT_32( msPeriodog[p], L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ) ) #endif { #ifdef FIX_732_MS_PERIODOG_FLOOR msPeriodog[p] = msPeriodog_floor; move32(); #else msPeriodog[p] = L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ); /*Q31 - hFdCngDec->msPeriodog_exp*/ move32(); #endif } } #ifdef FIX_732_MS_PERIODOG_FLOOR FOR( p = 0; p < npart; p++ ) { IF( GT_32( msPeriodog[p], 1 ) ) { check = 1; move16(); BREAK; } } IF( check == 0 ) { hFdCngDec->msPeriodog_exp = 14; /* msPeriodog buffer will have minimum value as 1e-5f */ move16(); } #endif } /* calculate total energy (short-term and long-term) */ Loading lib_dec/ivas_stereo_dft_dec_fx.c +5 −5 Original line number Diff line number Diff line Loading @@ -2608,7 +2608,7 @@ void stereo_dft_dec_fx( q_cna_level = hFdCngDec->smoothed_psd_exp; move16(); l_tmp = Sqrt32( cna_level, &q_cna_level ); scale_fact = Mpy_32_32( l_tmp, scale_fact0 ); /* q_cna_level */ scale_fact = Mpy_32_32( l_tmp, scale_fact0 ); /* Q = (31-q_cna_level) + Q15 - 31 */ /* scale_fact0 will be in Q15 by the time the above operation is performed so the q of scale_fact represented now by q_cna_level has to be updated Loading @@ -2628,12 +2628,12 @@ void stereo_dft_dec_fx( l_tmp = L_add( Madd_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */ l_tmp = L_shr( l_tmp, sub( q_cna_level, hStereoDft->q_dft ) ); /* q_dft */ #endif /* OPT_STEREO_32KBPS_V1 */ DFT_L[2 * i] = L_add( DFT_L[2 * i], l_tmp ); /* q_dft */ DFT_L[2 * i] = L_add_sat( DFT_L[2 * i], l_tmp ); /* q_dft */ move32(); #ifdef OPT_STEREO_32KBPS_V1 l_tmp = Msub_32_16( Msub_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */ l_tmp = L_shr( l_tmp, shift ); /* q_dft */ DFT_R[2 * i] = L_add( DFT_R[2 * i], l_tmp ); /* q_dft */ DFT_R[2 * i] = L_add_sat( DFT_R[2 * i], l_tmp ); /* q_dft */ #else /* OPT_STEREO_32KBPS_V1 */ l_tmp = L_sub( Msub_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */ l_tmp = L_shr( l_tmp, sub( q_cna_level, hStereoDft->q_dft ) ); /* q_dft */ Loading @@ -2646,11 +2646,11 @@ void stereo_dft_dec_fx( #ifdef OPT_STEREO_32KBPS_V1 l_tmp = Madd_32_16( Madd_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */ l_tmp = L_shr( l_tmp, shift ); /* q_dft */ DFT_L[2 * i + 1] = L_add( DFT_L[2 * i + 1], l_tmp ); /* q_dft */ DFT_L[2 * i + 1] = L_add_sat( DFT_L[2 * i + 1], l_tmp ); /* q_dft */ move32(); l_tmp = Msub_32_16( Msub_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */ l_tmp = L_shr( l_tmp, shift ); /* q_dft */ DFT_R[2 * i + 1] = L_add( DFT_R[2 * i + 1], l_tmp ); /* q_dft */ DFT_R[2 * i + 1] = L_add_sat( DFT_R[2 * i + 1], l_tmp ); /* q_dft */ move32(); #else /* OPT_STEREO_32KBPS_V1 */ l_tmp = L_add( Madd_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */ Loading lib_enc/tcx_utils_enc_fx.c +19 −11 Original line number Diff line number Diff line Loading @@ -1392,25 +1392,33 @@ void tcx_scalar_quantization_ivas_fx( s = sub( add( x_e, gain_e ), 15 ); } /* substract 0x8000 to affect the mac_r in the following loop so it acts like extract_h. the 0x4000 will be multiplied by 2 by the mac_r to get to 0x8000 and disable the round. */ offset = sub( offset, 0x4000 ); FOR( ; i >= 0; i-- ) { offs32 = Mpy_32_16_1( L_abs( x[i] ), gain ); /* multiply */ offs32 = Mpy_32_16_1( x[i], gain ); /* multiply */ offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ tmp16 = mac_r_sat( offs32, offset, 1 ); /* add offset and truncate */ IF( x[i] < 0 ) IF( x[i] > 0 ) { tmp16 = negate( tmp16 ); /* restore sign */ offs32 = L_add_sat( offs32, L_shl( offset, 1 ) ); tmp16 = extract_h( offs32 ); IF( GT_32( L_deposit_h( tmp16 ), offs32 ) ) { tmp16 = sub( tmp16, 1 ); } } ELSE { offs32 = L_add_sat( offs32, L_shl( negate( offset ), 1 ) ); tmp16 = extract_h( offs32 ); IF( LT_32( L_deposit_h( tmp16 ), offs32 ) ) { tmp16 = add( tmp16, 1 ); } } xq[i] = tmp16; move16(); } IF( alfe_flag == 0 ) { AdaptLowFreqEmph_fx( x, x_e, xq, gain, gain_e, Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ #ifndef BASOP_NOGLOB_DEV_USE_GLOBALS #define BASOP_NOGLOB_DECLARE_LOCAL #endif #define FIX_732_MS_PERIODOG_FLOOR /* Eri: Issue-732: Dynamic range of msPeriodog leads to minimum value 1e-5 being truncated to zero. This uses the smallest non-zero value instead. */ #define FIX_867_CLDFB_NRG_SCALE Loading
lib_dec/dec_tcx_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -2886,7 +2886,7 @@ void IMDCT_ivas_fx( { Word16 q_old_out = q_win; move16(); edct_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); edct_ivas_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); Word16 res_m, res_e; res_e = 0; move16(); Loading
lib_dec/fd_cng_dec_fx.c +33 −2 Original line number Diff line number Diff line Loading @@ -1501,14 +1501,19 @@ void perform_noise_estimation_dec_ivas_fx( Word16 enr_e, enr_ratio, alpha; Word32 *msPeriodog; Word32 *msNoiseEst; #ifdef FIX_732_MS_PERIODOG_FLOOR Word32 msPeriodog_floor; #endif Word32 *reIter; Word32 rescale_fac = 0; Word64 W_tmp; Word16 tmp_s, tmp_q, min_q = 31; Word16 q_shift; Word32 max_l; Word16 norm_shift; #ifdef FIX_732_MS_PERIODOG_FLOOR Word16 norm_shift, check = 0; move16(); #endif /* pointer initialization */ periodog = hFdCngDec->hFdCngCom->periodog; /*Q31 - hFdCngDec->hFdCngCom->periodog_exp*/ fftBuffer = hFdCngDec->hFdCngCom->fftBuffer; /*Q31 - hFdCngDec->hFdCngCom->fftBuffer_exp*/ Loading Loading @@ -1706,12 +1711,38 @@ void perform_noise_estimation_dec_ivas_fx( msPeriodog[p] = L_add( msPeriodog[p], L_tmp ); /*Q31 - hFdCngDec->msPeriodog_exp*/ move32(); #ifdef FIX_732_MS_PERIODOG_FLOOR msPeriodog_floor = L_max( 1, L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ); /*Q31 - hFdCngDec->msPeriodog_exp*/ IF( LT_32( msPeriodog[p], msPeriodog_floor ) ) #else IF( LT_32( msPeriodog[p], L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ) ) #endif { #ifdef FIX_732_MS_PERIODOG_FLOOR msPeriodog[p] = msPeriodog_floor; move32(); #else msPeriodog[p] = L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ); /*Q31 - hFdCngDec->msPeriodog_exp*/ move32(); #endif } } #ifdef FIX_732_MS_PERIODOG_FLOOR FOR( p = 0; p < npart; p++ ) { IF( GT_32( msPeriodog[p], 1 ) ) { check = 1; move16(); BREAK; } } IF( check == 0 ) { hFdCngDec->msPeriodog_exp = 14; /* msPeriodog buffer will have minimum value as 1e-5f */ move16(); } #endif } /* calculate total energy (short-term and long-term) */ Loading
lib_dec/ivas_stereo_dft_dec_fx.c +5 −5 Original line number Diff line number Diff line Loading @@ -2608,7 +2608,7 @@ void stereo_dft_dec_fx( q_cna_level = hFdCngDec->smoothed_psd_exp; move16(); l_tmp = Sqrt32( cna_level, &q_cna_level ); scale_fact = Mpy_32_32( l_tmp, scale_fact0 ); /* q_cna_level */ scale_fact = Mpy_32_32( l_tmp, scale_fact0 ); /* Q = (31-q_cna_level) + Q15 - 31 */ /* scale_fact0 will be in Q15 by the time the above operation is performed so the q of scale_fact represented now by q_cna_level has to be updated Loading @@ -2628,12 +2628,12 @@ void stereo_dft_dec_fx( l_tmp = L_add( Madd_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */ l_tmp = L_shr( l_tmp, sub( q_cna_level, hStereoDft->q_dft ) ); /* q_dft */ #endif /* OPT_STEREO_32KBPS_V1 */ DFT_L[2 * i] = L_add( DFT_L[2 * i], l_tmp ); /* q_dft */ DFT_L[2 * i] = L_add_sat( DFT_L[2 * i], l_tmp ); /* q_dft */ move32(); #ifdef OPT_STEREO_32KBPS_V1 l_tmp = Msub_32_16( Msub_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */ l_tmp = L_shr( l_tmp, shift ); /* q_dft */ DFT_R[2 * i] = L_add( DFT_R[2 * i], l_tmp ); /* q_dft */ DFT_R[2 * i] = L_add_sat( DFT_R[2 * i], l_tmp ); /* q_dft */ #else /* OPT_STEREO_32KBPS_V1 */ l_tmp = L_sub( Msub_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */ l_tmp = L_shr( l_tmp, sub( q_cna_level, hStereoDft->q_dft ) ); /* q_dft */ Loading @@ -2646,11 +2646,11 @@ void stereo_dft_dec_fx( #ifdef OPT_STEREO_32KBPS_V1 l_tmp = Madd_32_16( Madd_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */ l_tmp = L_shr( l_tmp, shift ); /* q_dft */ DFT_L[2 * i + 1] = L_add( DFT_L[2 * i + 1], l_tmp ); /* q_dft */ DFT_L[2 * i + 1] = L_add_sat( DFT_L[2 * i + 1], l_tmp ); /* q_dft */ move32(); l_tmp = Msub_32_16( Msub_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */ l_tmp = L_shr( l_tmp, shift ); /* q_dft */ DFT_R[2 * i + 1] = L_add( DFT_R[2 * i + 1], l_tmp ); /* q_dft */ DFT_R[2 * i + 1] = L_add_sat( DFT_R[2 * i + 1], l_tmp ); /* q_dft */ move32(); #else /* OPT_STEREO_32KBPS_V1 */ l_tmp = L_add( Madd_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */ Loading
lib_enc/tcx_utils_enc_fx.c +19 −11 Original line number Diff line number Diff line Loading @@ -1392,25 +1392,33 @@ void tcx_scalar_quantization_ivas_fx( s = sub( add( x_e, gain_e ), 15 ); } /* substract 0x8000 to affect the mac_r in the following loop so it acts like extract_h. the 0x4000 will be multiplied by 2 by the mac_r to get to 0x8000 and disable the round. */ offset = sub( offset, 0x4000 ); FOR( ; i >= 0; i-- ) { offs32 = Mpy_32_16_1( L_abs( x[i] ), gain ); /* multiply */ offs32 = Mpy_32_16_1( x[i], gain ); /* multiply */ offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ tmp16 = mac_r_sat( offs32, offset, 1 ); /* add offset and truncate */ IF( x[i] < 0 ) IF( x[i] > 0 ) { tmp16 = negate( tmp16 ); /* restore sign */ offs32 = L_add_sat( offs32, L_shl( offset, 1 ) ); tmp16 = extract_h( offs32 ); IF( GT_32( L_deposit_h( tmp16 ), offs32 ) ) { tmp16 = sub( tmp16, 1 ); } } ELSE { offs32 = L_add_sat( offs32, L_shl( negate( offset ), 1 ) ); tmp16 = extract_h( offs32 ); IF( LT_32( L_deposit_h( tmp16 ), offs32 ) ) { tmp16 = add( tmp16, 1 ); } } xq[i] = tmp16; move16(); } IF( alfe_flag == 0 ) { AdaptLowFreqEmph_fx( x, x_e, xq, gain, gain_e, Loading