Loading lib_com/ivas_prot_fx.h +8 −2 Original line number Diff line number Diff line Loading @@ -1576,8 +1576,11 @@ void decoder_tcx_imdct_fx( void ivas_sba_dirac_stereo_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel */ const Word16 output_frame /* i : output frame length per channel */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , const Word16 mcmasa /* i : McMASA flag */ #endif ); ivas_error ivas_osba_render_sf_fx( Loading Loading @@ -4273,8 +4276,11 @@ void ivas_ism_coh_estim_dtx_enc_fx( void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const Word16 sce_id_dtx, /* i : SCE DTX ID */ const Word16 nchan_transport, /* i : number of transport channels */ const Word16 nchan_transport /* i : number of transport channels */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , Word16 *Q_cngNoiseLevel #endif ); ivas_error stereo_dft_enc_create_fx( Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */ #define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */ #define FIX_1904_HARM_GSC_ENC /* VA: #1904 Harmonization of EVS and IVAS GSC code */ #define REMOVE_UNUSED_CODE_IVAS_DEC /* VA: remove unused code in ivas_jbm_dec_tc_fx() */() /* #################### End BE switches ################################## */ Loading lib_dec/ivas_ism_dtx_dec_fx.c +28 −4 Original line number Diff line number Diff line Loading @@ -152,16 +152,40 @@ void ivas_ism_dtx_dec_fx( * for DTX frames where the energy of the sent noise estimate of the dominant object * is near silence, limit the other objects CNG energies to the same level *-------------------------------------------------------------------*/ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const Word16 sce_id_dtx, /* i : SCE DTX ID */ const Word16 nchan_transport, /* i : number of transport channels */ const Word16 nchan_transport /* i : number of transport channels */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , Word16 *Q_cngNoiseLevel /* i : stores Q factor of hFdCngCom->cngNoiseLevel for various channels*/ #endif ) { Word32 fac_fx, cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx; Word16 ch, cng_noise_level_len, Q_cng_noise_nrg_dominant, exp; HANDLE_FD_CNG_COM hFdCngCom; #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Word16 Q_cngNoiseLevel[MAX_SCE]; FOR( ch = 0; ch < nchan_transport; ch++ ) { IF( hSCE[ch] != NULL ) { Word16 shift = getScaleFactor32( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN ); if ( LT_16( sub( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) { shift = sub( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 ); } scale_sig32( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31-(cngNoiseLevelExp -shift) ) hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ); Q_cngNoiseLevel[ch] = sub( 31, hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ); move16(); move16(); } } #endif hFdCngCom = hSCE[sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); Loading lib_dec/ivas_jbm_dec_fx.c +316 −220 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_dec/ivas_sba_dirac_stereo_dec_fx.c +293 −6 Original line number Diff line number Diff line Loading @@ -1231,8 +1231,11 @@ void ivas_sba_dirac_stereo_smooth_parameters_fx( void ivas_sba_dirac_stereo_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel Q0*/ const Word16 output_frame /* i : output frame length per channel Q0*/ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , const Word16 mcmasa /* i : McMASA flag Q0*/ #endif ) { Word16 dtx_flag, fd_cng_flag; Loading @@ -1250,27 +1253,199 @@ void ivas_sba_dirac_stereo_dec_fx( SCE_DEC_HANDLE hSCE; CPE_DEC_HANDLE hCPE; STEREO_DFT_DEC_DATA_HANDLE hStereoDft; #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Word16 mcmasa; mcmasa = 0; move16(); if ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { mcmasa = 1; move16(); } #endif #ifdef REMOVE_UNUSED_CODE_IVAS_DEC hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; hStereoDft = hCPE->hStereoDft; /*----------------------------------------------------------------* * Adjust scaling of buffers *----------------------------------------------------------------*/ Decoder_State *st; Word16 i, ii, s; s = 0; move16(); FOR( i = 0; i < CPE_CHANNELS; i++ ) { #ifdef REMOVE_UNUSED_CODE_IVAS_DEC s = s_min( s, L_norm_arr( output[i], output_frame ) - Q11 ) /* Guard bits */; // L_frame should be used instead of L_FRAME48k */ #else s = s_min( s, L_norm_arr( output[i], L_FRAME48k ) - 11 ) /* Guard bits */; // L_frame should be used instead of L_FRAME48k */ #endif } FOR( i = 0; i < CPE_CHANNELS; i++ ) { #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Scale_sig32( output[i], output_frame, s ); // Q(11+s) #else Scale_sig32( output[i], L_FRAME48k, s ); // Q(11+s) #endif } hStereoDft->q_dft = add( Q11, s ); move16(); IF( EQ_16( hStereoDft->first_frame, 1 ) ) { hStereoDft->q_smoothed_nrg = Q6; // hStereoDft->q_dft; move16(); hStereoDft->q_ap_delay_mem_fx = hStereoDft->q_dft; move16(); } q = hStereoDft->q_dft; move16(); scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hStereoDft->q_dft, Q11 ) ); // q_dft FOR( i = 0; i < CPE_CHANNELS; ++i ) { scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hStereoDft->q_dft, Q11 ) ); // q_dft scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } IF( hCPE->hCoreCoder[0] != NULL ) { Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, output_frame, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q #else Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q #endif hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q; move16(); } IF( hStereoDft != NULL ) { IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; test(); test(); test(); test(); test(); IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) || ( EQ_16( st->bfi, 1 ) && EQ_16( st->core, ACELP_CORE ) && EQ_16( st->con_tcx, 1 ) ) ) { test(); test(); test(); test(); test(); test(); test(); test(); IF( ( ( ( st->last_core != ACELP_CORE ) || ( EQ_16( st->prev_bfi, 1 ) && ( st->last_core == ACELP_CORE ) && EQ_16( st->last_con_tcx, 1 ) ) ) && NE_16( st->last_core, AMR_WB_CORE ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_16( st->cng_type, FD_CNG ) ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } ELSE IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) /* ACELP -> TCX/HQ */ { IF( !st->tcxonly ) { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } } } ELSE /* ACELP core */ { test(); test(); IF( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) || EQ_16( st->last_core, HQ_CORE ) ) /* TCX/HQ -> ACELP */ { test(); test(); test(); test(); IF( ( LE_16( st->last_L_frame, L_FRAME16k ) && LE_16( st->L_frame, L_FRAME16k ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) ) { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft } } } } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC IF( NE_32( st_ivas->ivas_format, SBA_FORMAT ) ) { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } #endif scale_sig32( hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( hStereoDft->q_dft, hStereoDft->q_ap_fade_mem_fx ) ); // q_dft hStereoDft->q_ap_fade_mem_fx = hStereoDft->q_dft; move16(); } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC test(); if ( st_ivas->hSpar != NULL && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; move16(); } #endif IF( hSCE != NULL ) { Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mult_32_16( hCPE->hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_hb_synth_fx ) ); // q_dft hSCE->q_save_hb_synth_fx = hStereoDft->q_dft; move16(); Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mult_32_16( hCPE->hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_synth_fx ) ); // q_dft hSCE->q_save_synth_fx = hStereoDft->q_dft; move16(); } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[ii] = hStereoDft->q_dft; move16(); } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx } /*----------------------------------------------------------------* * Processing *----------------------------------------------------------------*/ #endif #ifdef REMOVE_UNUSED_CODE_IVAS_DEC FOR( i = 0; i < CPE_CHANNELS; i++ ) #else FOR( Word16 i = 0; i < CPE_CHANNELS; i++ ) #endif { set32_fx( DFT[i], 0, STEREO_DFT_BUF_MAX ); } #ifndef REMOVE_UNUSED_CODE_IVAS_DEC hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; hStereoDft = hCPE->hStereoDft; q = hCPE->hStereoDft->q_dft; #endif q = hStereoDft->q_dft; move16(); q_dft[0] = hCPE->hStereoDft->q_dft; q_dft[0] = hStereoDft->q_dft; move16(); q_dft[1] = hCPE->hStereoDft->q_dft; q_dft[1] = hStereoDft->q_dft; move16(); Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ IF( hSCE != NULL ) { Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ hSCE->q_prev_hb_synth_fx = hCPE->hStereoDft->q_dft; hSCE->q_prev_hb_synth_fx = hStereoDft->q_dft; move16(); } Loading Loading @@ -1407,5 +1582,117 @@ void ivas_sba_dirac_stereo_dec_fx( move16(); } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC /*----------------------------------------------------------------* * Adjust scaling of buffers *----------------------------------------------------------------*/ FOR( i = 0; i < CPE_CHANNELS; i++ ) { #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Scale_sig32( output[i], output_frame, negate( s ) ); #else Scale_sig32( output[i], L_FRAME48k, negate( s ) ); #endif } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( hCPE->prev_synth_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 } scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) { scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } IF( hCPE->hCoreCoder[0] != NULL ) { Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB - q ); // Q_old_wtda_LB #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, output_frame, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); // Q_old_wtda_LB #else Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); // Q_old_wtda_LB #endif } IF( hCPE->hStereoDft != NULL ) { IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; test(); test(); test(); test(); test(); IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) || ( EQ_16( st->bfi, 1 ) && st->core == ACELP_CORE && EQ_16( st->con_tcx, 1 ) ) ) { test(); test(); test(); test(); test(); test(); test(); test(); IF( ( ( st->last_core != ACELP_CORE || ( EQ_16( st->prev_bfi, 1 ) && st->last_core == ACELP_CORE && EQ_16( st->last_con_tcx, 1 ) ) ) && NE_16( st->last_core, AMR_WB_CORE ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_16( st->cng_type, FD_CNG ) ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } ELSE IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) /* ACELP -> TCX/HQ */ { IF( !st->tcxonly ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } } } ELSE /* ACELP core */ { test(); test(); IF( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) || EQ_16( st->last_core, HQ_CORE ) ) /* TCX/HQ -> ACELP */ { test(); test(); test(); test(); IF( ( LE_16( st->last_L_frame, L_FRAME16k ) && LE_16( st->L_frame, L_FRAME16k ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } } } } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC IF( NE_32( st_ivas->ivas_format, SBA_FORMAT ) ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } #endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; test(); } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC if ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) #endif { st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; move16(); } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[ii] = Q11; move16(); } #endif return; } Loading
lib_com/ivas_prot_fx.h +8 −2 Original line number Diff line number Diff line Loading @@ -1576,8 +1576,11 @@ void decoder_tcx_imdct_fx( void ivas_sba_dirac_stereo_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel */ const Word16 output_frame /* i : output frame length per channel */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , const Word16 mcmasa /* i : McMASA flag */ #endif ); ivas_error ivas_osba_render_sf_fx( Loading Loading @@ -4273,8 +4276,11 @@ void ivas_ism_coh_estim_dtx_enc_fx( void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const Word16 sce_id_dtx, /* i : SCE DTX ID */ const Word16 nchan_transport, /* i : number of transport channels */ const Word16 nchan_transport /* i : number of transport channels */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , Word16 *Q_cngNoiseLevel #endif ); ivas_error stereo_dft_enc_create_fx( Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */ #define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */ #define FIX_1904_HARM_GSC_ENC /* VA: #1904 Harmonization of EVS and IVAS GSC code */ #define REMOVE_UNUSED_CODE_IVAS_DEC /* VA: remove unused code in ivas_jbm_dec_tc_fx() */() /* #################### End BE switches ################################## */ Loading
lib_dec/ivas_ism_dtx_dec_fx.c +28 −4 Original line number Diff line number Diff line Loading @@ -152,16 +152,40 @@ void ivas_ism_dtx_dec_fx( * for DTX frames where the energy of the sent noise estimate of the dominant object * is near silence, limit the other objects CNG energies to the same level *-------------------------------------------------------------------*/ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const Word16 sce_id_dtx, /* i : SCE DTX ID */ const Word16 nchan_transport, /* i : number of transport channels */ const Word16 nchan_transport /* i : number of transport channels */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , Word16 *Q_cngNoiseLevel /* i : stores Q factor of hFdCngCom->cngNoiseLevel for various channels*/ #endif ) { Word32 fac_fx, cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx; Word16 ch, cng_noise_level_len, Q_cng_noise_nrg_dominant, exp; HANDLE_FD_CNG_COM hFdCngCom; #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Word16 Q_cngNoiseLevel[MAX_SCE]; FOR( ch = 0; ch < nchan_transport; ch++ ) { IF( hSCE[ch] != NULL ) { Word16 shift = getScaleFactor32( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN ); if ( LT_16( sub( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) { shift = sub( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 ); } scale_sig32( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31-(cngNoiseLevelExp -shift) ) hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ); Q_cngNoiseLevel[ch] = sub( 31, hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ); move16(); move16(); } } #endif hFdCngCom = hSCE[sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); Loading
lib_dec/ivas_jbm_dec_fx.c +316 −220 File changed.Preview size limit exceeded, changes collapsed. Show changes
lib_dec/ivas_sba_dirac_stereo_dec_fx.c +293 −6 Original line number Diff line number Diff line Loading @@ -1231,8 +1231,11 @@ void ivas_sba_dirac_stereo_smooth_parameters_fx( void ivas_sba_dirac_stereo_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output[CPE_CHANNELS], /* i/o: output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel Q0*/ const Word16 output_frame /* i : output frame length per channel Q0*/ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , const Word16 mcmasa /* i : McMASA flag Q0*/ #endif ) { Word16 dtx_flag, fd_cng_flag; Loading @@ -1250,27 +1253,199 @@ void ivas_sba_dirac_stereo_dec_fx( SCE_DEC_HANDLE hSCE; CPE_DEC_HANDLE hCPE; STEREO_DFT_DEC_DATA_HANDLE hStereoDft; #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Word16 mcmasa; mcmasa = 0; move16(); if ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { mcmasa = 1; move16(); } #endif #ifdef REMOVE_UNUSED_CODE_IVAS_DEC hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; hStereoDft = hCPE->hStereoDft; /*----------------------------------------------------------------* * Adjust scaling of buffers *----------------------------------------------------------------*/ Decoder_State *st; Word16 i, ii, s; s = 0; move16(); FOR( i = 0; i < CPE_CHANNELS; i++ ) { #ifdef REMOVE_UNUSED_CODE_IVAS_DEC s = s_min( s, L_norm_arr( output[i], output_frame ) - Q11 ) /* Guard bits */; // L_frame should be used instead of L_FRAME48k */ #else s = s_min( s, L_norm_arr( output[i], L_FRAME48k ) - 11 ) /* Guard bits */; // L_frame should be used instead of L_FRAME48k */ #endif } FOR( i = 0; i < CPE_CHANNELS; i++ ) { #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Scale_sig32( output[i], output_frame, s ); // Q(11+s) #else Scale_sig32( output[i], L_FRAME48k, s ); // Q(11+s) #endif } hStereoDft->q_dft = add( Q11, s ); move16(); IF( EQ_16( hStereoDft->first_frame, 1 ) ) { hStereoDft->q_smoothed_nrg = Q6; // hStereoDft->q_dft; move16(); hStereoDft->q_ap_delay_mem_fx = hStereoDft->q_dft; move16(); } q = hStereoDft->q_dft; move16(); scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hStereoDft->q_dft, Q11 ) ); // q_dft FOR( i = 0; i < CPE_CHANNELS; ++i ) { scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hStereoDft->q_dft, Q11 ) ); // q_dft scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } IF( hCPE->hCoreCoder[0] != NULL ) { Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, output_frame, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q #else Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q #endif hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q; move16(); } IF( hStereoDft != NULL ) { IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; test(); test(); test(); test(); test(); IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) || ( EQ_16( st->bfi, 1 ) && EQ_16( st->core, ACELP_CORE ) && EQ_16( st->con_tcx, 1 ) ) ) { test(); test(); test(); test(); test(); test(); test(); test(); IF( ( ( ( st->last_core != ACELP_CORE ) || ( EQ_16( st->prev_bfi, 1 ) && ( st->last_core == ACELP_CORE ) && EQ_16( st->last_con_tcx, 1 ) ) ) && NE_16( st->last_core, AMR_WB_CORE ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_16( st->cng_type, FD_CNG ) ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } ELSE IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) /* ACELP -> TCX/HQ */ { IF( !st->tcxonly ) { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } } } ELSE /* ACELP core */ { test(); test(); IF( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) || EQ_16( st->last_core, HQ_CORE ) ) /* TCX/HQ -> ACELP */ { test(); test(); test(); test(); IF( ( LE_16( st->last_L_frame, L_FRAME16k ) && LE_16( st->L_frame, L_FRAME16k ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) ) { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft } } } } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC IF( NE_32( st_ivas->ivas_format, SBA_FORMAT ) ) { scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft } #endif scale_sig32( hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( hStereoDft->q_dft, hStereoDft->q_ap_fade_mem_fx ) ); // q_dft hStereoDft->q_ap_fade_mem_fx = hStereoDft->q_dft; move16(); } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC test(); if ( st_ivas->hSpar != NULL && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; move16(); } #endif IF( hSCE != NULL ) { Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mult_32_16( hCPE->hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_hb_synth_fx ) ); // q_dft hSCE->q_save_hb_synth_fx = hStereoDft->q_dft; move16(); Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mult_32_16( hCPE->hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_synth_fx ) ); // q_dft hSCE->q_save_synth_fx = hStereoDft->q_dft; move16(); } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[ii] = hStereoDft->q_dft; move16(); } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx } /*----------------------------------------------------------------* * Processing *----------------------------------------------------------------*/ #endif #ifdef REMOVE_UNUSED_CODE_IVAS_DEC FOR( i = 0; i < CPE_CHANNELS; i++ ) #else FOR( Word16 i = 0; i < CPE_CHANNELS; i++ ) #endif { set32_fx( DFT[i], 0, STEREO_DFT_BUF_MAX ); } #ifndef REMOVE_UNUSED_CODE_IVAS_DEC hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; hStereoDft = hCPE->hStereoDft; q = hCPE->hStereoDft->q_dft; #endif q = hStereoDft->q_dft; move16(); q_dft[0] = hCPE->hStereoDft->q_dft; q_dft[0] = hStereoDft->q_dft; move16(); q_dft[1] = hCPE->hStereoDft->q_dft; q_dft[1] = hStereoDft->q_dft; move16(); Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ IF( hSCE != NULL ) { Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ hSCE->q_prev_hb_synth_fx = hCPE->hStereoDft->q_dft; hSCE->q_prev_hb_synth_fx = hStereoDft->q_dft; move16(); } Loading Loading @@ -1407,5 +1582,117 @@ void ivas_sba_dirac_stereo_dec_fx( move16(); } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC /*----------------------------------------------------------------* * Adjust scaling of buffers *----------------------------------------------------------------*/ FOR( i = 0; i < CPE_CHANNELS; i++ ) { #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Scale_sig32( output[i], output_frame, negate( s ) ); #else Scale_sig32( output[i], L_FRAME48k, negate( s ) ); #endif } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( hCPE->prev_synth_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 } scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) { scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } IF( hCPE->hCoreCoder[0] != NULL ) { Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB - q ); // Q_old_wtda_LB #ifdef REMOVE_UNUSED_CODE_IVAS_DEC Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, output_frame, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); // Q_old_wtda_LB #else Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); // Q_old_wtda_LB #endif } IF( hCPE->hStereoDft != NULL ) { IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; test(); test(); test(); test(); test(); IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) || ( EQ_16( st->bfi, 1 ) && st->core == ACELP_CORE && EQ_16( st->con_tcx, 1 ) ) ) { test(); test(); test(); test(); test(); test(); test(); test(); IF( ( ( st->last_core != ACELP_CORE || ( EQ_16( st->prev_bfi, 1 ) && st->last_core == ACELP_CORE && EQ_16( st->last_con_tcx, 1 ) ) ) && NE_16( st->last_core, AMR_WB_CORE ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_16( st->cng_type, FD_CNG ) ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } ELSE IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) /* ACELP -> TCX/HQ */ { IF( !st->tcxonly ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } } } ELSE /* ACELP core */ { test(); test(); IF( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) || EQ_16( st->last_core, HQ_CORE ) ) /* TCX/HQ -> ACELP */ { test(); test(); test(); test(); IF( ( LE_16( st->last_L_frame, L_FRAME16k ) && LE_16( st->L_frame, L_FRAME16k ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } } } } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC IF( NE_32( st_ivas->ivas_format, SBA_FORMAT ) ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 } #endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; test(); } #ifdef REMOVE_UNUSED_CODE_IVAS_DEC if ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) #endif { st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; move16(); } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[ii] = Q11; move16(); } #endif return; }