Loading lib_com/ivas_sns_com_fx.c +12 −5 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ void sns_compute_scf_fx( Word32 *scf ) { Word16 i, n, k; Word32 x[FDNS_NPTS], xs[FDNS_NPTS], sum, mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; Word32 x[FDNS_NPTS], xs[FDNS_NPTS], mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; Word64 sum; Word32 L_tmp; const Word16 *pow_tilt; const UWord8 nBands = pPsychParams->nBands; Loading Loading @@ -139,8 +140,11 @@ void sns_compute_scf_fx( } /* Noise floor at -40dB */ sum = sum32_fx( xs, FDNS_NPTS ); mean = L_shr( sum, 6 ); sum = 0; for (Word16 ind = 0; ind < FDNS_NPTS; ind++) { sum += (Word64)xs[i]; } mean = (Word32)(sum >> 6); nf = Mpy_32_16_1( mean, 3 ); // 3 => powf( 10.0f, -4.0f ) in Q15 nf = L_max( nf, 0 ); // 0 => powf( 2.0f, -32.0f ) in Q15 Loading Loading @@ -198,8 +202,11 @@ void sns_compute_scf_fx( xl4[SNS_NPTS - 1] = L_tmp; /* Remove mean and scaling */ sum = sum32_fx( xl4, SNS_NPTS ); mean = L_shr( sum, 4 ); sum = 0; for (Word16 ind = 0; ind < SNS_NPTS; ind++) { sum += (Word64)xl4[i]; } mean = (Word32)(sum >> 4); FOR( i = 0; i < SNS_NPTS; i++ ) { Loading lib_dec/bass_psfilter.c +14 −3 Original line number Diff line number Diff line Loading @@ -589,7 +589,7 @@ int16_t res_bpf_adapt( Word16 res_bpf_adapt_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer Q12 */ ) { Word32 error_nrg; Loading @@ -601,6 +601,8 @@ Word16 res_bpf_adapt_fx( Word16 i_start; Word16 i_end; Word16 bw_inv; Word16 shift; Word64 W_tmp; IF( EQ_16( hStereoDft->res_cod_band_max, 6 ) ) { Loading @@ -617,11 +619,20 @@ Word16 res_bpf_adapt_fx( /* Measure energy of high frequency band in MDCT domain */ res_hb_nrg = L_deposit_l( 0 ); W_tmp = W_deposit32_l( 0 ); FOR( i = i_start; i < i_end; i++ ) { res_hb_nrg = Madd_32_32_r( res_hb_nrg, res_buf[i], res_buf[i] ); W_tmp = W_add_nosat( W_tmp, W_mult0_32_32( res_buf[i], res_buf[i] ) ); } res_hb_nrg = L_shl( (Word32) res_hb_nrg, Q7 ); // Q0 shift = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, shift ); res_hb_nrg = W_extract_h( W_tmp ); IF( GT_16( add( Q24, shift ), 32 ) ) { res_hb_nrg = L_shr( res_hb_nrg, sub( add( Q24, shift ), 32 ) ); // Q0 } res_hb_nrg = Mpy_32_16_1( res_hb_nrg, bw_inv ); res_hb_nrg = L_add( Mpy_32_16_1( res_hb_nrg, STEREO_DFT_BPF_ADAPT_ALPHA_FX ), Mpy_32_16_1( hStereoDft->res_hb_nrg_mem_fx, sub( MAX_16, STEREO_DFT_BPF_ADAPT_ALPHA_FX ) ) ); hStereoDft->res_hb_nrg_mem_fx = res_hb_nrg; Loading lib_dec/tonalMDCTconcealment.c +11 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #include "prot_fx2.h" #endif // IVAS_FLOAT_FIXED Loading Loading @@ -1214,9 +1215,18 @@ void TonalMdctConceal_whiten_noise_shape_ivas( Word32 whitenend_noise_shape_fx[L_FRAME16k]; Word32 scfs_int_fx[FDNS_NPTS], scfs_bg_fx[FDNS_NPTS]; Word16 q = 31; FOR( Word16 k = 0; k < L_FRAME16k; k++ ) { whitenend_noise_shape_fx[k] = (Word32) ( whitenend_noise_shape[k] * ONE_IN_Q7 ); if(abs((Word32)whitenend_noise_shape[k])!=0) q = s_min(q, norm_l( whitenend_noise_shape[k] )); } q -= find_guarded_bits_fx(L_frame) + 2; //q -= 1; FOR( Word16 k = 0; k < L_FRAME16k; k++ ) { whitenend_noise_shape_fx[k] = q>=0 ? ((Word32) ( whitenend_noise_shape[k] *(1<< q) )):((Word32) ( whitenend_noise_shape[k] / (1<< q) )); } sns_compute_scf_fx( whitenend_noise_shape_fx, psychParams, L_frame, scf_fx ); Loading Loading
lib_com/ivas_sns_com_fx.c +12 −5 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ void sns_compute_scf_fx( Word32 *scf ) { Word16 i, n, k; Word32 x[FDNS_NPTS], xs[FDNS_NPTS], sum, mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; Word32 x[FDNS_NPTS], xs[FDNS_NPTS], mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; Word64 sum; Word32 L_tmp; const Word16 *pow_tilt; const UWord8 nBands = pPsychParams->nBands; Loading Loading @@ -139,8 +140,11 @@ void sns_compute_scf_fx( } /* Noise floor at -40dB */ sum = sum32_fx( xs, FDNS_NPTS ); mean = L_shr( sum, 6 ); sum = 0; for (Word16 ind = 0; ind < FDNS_NPTS; ind++) { sum += (Word64)xs[i]; } mean = (Word32)(sum >> 6); nf = Mpy_32_16_1( mean, 3 ); // 3 => powf( 10.0f, -4.0f ) in Q15 nf = L_max( nf, 0 ); // 0 => powf( 2.0f, -32.0f ) in Q15 Loading Loading @@ -198,8 +202,11 @@ void sns_compute_scf_fx( xl4[SNS_NPTS - 1] = L_tmp; /* Remove mean and scaling */ sum = sum32_fx( xl4, SNS_NPTS ); mean = L_shr( sum, 4 ); sum = 0; for (Word16 ind = 0; ind < SNS_NPTS; ind++) { sum += (Word64)xl4[i]; } mean = (Word32)(sum >> 4); FOR( i = 0; i < SNS_NPTS; i++ ) { Loading
lib_dec/bass_psfilter.c +14 −3 Original line number Diff line number Diff line Loading @@ -589,7 +589,7 @@ int16_t res_bpf_adapt( Word16 res_bpf_adapt_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer Q12 */ ) { Word32 error_nrg; Loading @@ -601,6 +601,8 @@ Word16 res_bpf_adapt_fx( Word16 i_start; Word16 i_end; Word16 bw_inv; Word16 shift; Word64 W_tmp; IF( EQ_16( hStereoDft->res_cod_band_max, 6 ) ) { Loading @@ -617,11 +619,20 @@ Word16 res_bpf_adapt_fx( /* Measure energy of high frequency band in MDCT domain */ res_hb_nrg = L_deposit_l( 0 ); W_tmp = W_deposit32_l( 0 ); FOR( i = i_start; i < i_end; i++ ) { res_hb_nrg = Madd_32_32_r( res_hb_nrg, res_buf[i], res_buf[i] ); W_tmp = W_add_nosat( W_tmp, W_mult0_32_32( res_buf[i], res_buf[i] ) ); } res_hb_nrg = L_shl( (Word32) res_hb_nrg, Q7 ); // Q0 shift = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, shift ); res_hb_nrg = W_extract_h( W_tmp ); IF( GT_16( add( Q24, shift ), 32 ) ) { res_hb_nrg = L_shr( res_hb_nrg, sub( add( Q24, shift ), 32 ) ); // Q0 } res_hb_nrg = Mpy_32_16_1( res_hb_nrg, bw_inv ); res_hb_nrg = L_add( Mpy_32_16_1( res_hb_nrg, STEREO_DFT_BPF_ADAPT_ALPHA_FX ), Mpy_32_16_1( hStereoDft->res_hb_nrg_mem_fx, sub( MAX_16, STEREO_DFT_BPF_ADAPT_ALPHA_FX ) ) ); hStereoDft->res_hb_nrg_mem_fx = res_hb_nrg; Loading
lib_dec/tonalMDCTconcealment.c +11 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #include "prot_fx2.h" #endif // IVAS_FLOAT_FIXED Loading Loading @@ -1214,9 +1215,18 @@ void TonalMdctConceal_whiten_noise_shape_ivas( Word32 whitenend_noise_shape_fx[L_FRAME16k]; Word32 scfs_int_fx[FDNS_NPTS], scfs_bg_fx[FDNS_NPTS]; Word16 q = 31; FOR( Word16 k = 0; k < L_FRAME16k; k++ ) { whitenend_noise_shape_fx[k] = (Word32) ( whitenend_noise_shape[k] * ONE_IN_Q7 ); if(abs((Word32)whitenend_noise_shape[k])!=0) q = s_min(q, norm_l( whitenend_noise_shape[k] )); } q -= find_guarded_bits_fx(L_frame) + 2; //q -= 1; FOR( Word16 k = 0; k < L_FRAME16k; k++ ) { whitenend_noise_shape_fx[k] = q>=0 ? ((Word32) ( whitenend_noise_shape[k] *(1<< q) )):((Word32) ( whitenend_noise_shape[k] / (1<< q) )); } sns_compute_scf_fx( whitenend_noise_shape_fx, psychParams, L_frame, scf_fx ); Loading