diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 581421fc672ae459472896d8b06464fec27bf18e..14101fcd004efde4389387092699a8c4449e3103 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -415,8 +415,6 @@ ivas_error ivas_jbm_dec_tc_fx( move16(); nchan_out = nchan_transport; move16(); - hSpar->hMdDec->Q_mixer_mat = 31; - move16(); ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx ), ( p_output_fx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); IF( st_ivas->hSpar->hPCA != NULL ) @@ -532,8 +530,6 @@ ivas_error ivas_jbm_dec_tc_fx( hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; move16(); } - st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - move16(); FOR( Word16 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 ) ); @@ -633,8 +629,6 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; test(); } - st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - test(); FOR( Word16 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 ) ); @@ -690,9 +684,6 @@ ivas_error ivas_jbm_dec_tc_fx( Scale_sig32( p_output_fx[ch], output_frame, Q_p_output ); } - hSpar->hMdDec->Q_mixer_mat = 31; - move16(); - ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, p_output_fx, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames, Q_p_output ); FOR( Word16 c = 0; c < nchan_transport; c++ ) { @@ -964,8 +955,6 @@ ivas_error ivas_jbm_dec_tc_fx( move16(); nchan_out = nchan_transport; move16(); - hSpar->hMdDec->Q_mixer_mat = 31; - move16(); ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); IF( st_ivas->hSpar->hPCA != NULL ) @@ -1019,8 +1008,6 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; move16(); } - st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; - move32(); IF( hSCE != NULL ) { @@ -1076,8 +1063,7 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; move16(); } - st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - move16(); + FOR( Word16 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 ) ); @@ -1549,8 +1535,6 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( st_ivas->hSpar != NULL ) { - st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; - move16(); FOR( Word16 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 ) ); @@ -2314,11 +2298,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( st_ivas->hTcBuffer->q_tc_fx = 11; move16(); } - if ( st_ivas->hSpar ) - { - st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; - move16(); - } Word16 n, n_render_timeslots; push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" ); @@ -2996,11 +2975,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - hSpar->hMdDec->Q_mixer_mat = 30; - move16(); - IF( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ) != IVAS_ERR_OK ) { return error; @@ -3087,11 +3061,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) /*EXT output = individual objects + HOA3*/ { - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - hSpar->hMdDec->Q_mixer_mat = 30; - move16(); - IF( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output_fx[st_ivas->nchan_ism], 960 ) ) != IVAS_ERR_OK ) { return error; @@ -3104,10 +3073,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - hSpar->hMdDec->Q_mixer_mat = 30; - IF( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 4c1c9d00849bfd92ce9bd1807caa7215b32e7f5c..b8b1e0545e6196a0ba47a18f8c0a585878495be8 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -404,6 +404,8 @@ ivas_error ivas_spar_dec_open_fx( } } } + hSpar->hMdDec->Q_mixer_mat = Q31; + move16(); hSpar->i_subframe = 0; move16(); hSpar->AGC_flag = 0; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 80705648bca50f38d7e7658cb4f95a44701f0c37..0cecfe2e77cf9c8455fb4de7c5b0e3dc3236f9ce 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2486,7 +2486,8 @@ static void ivas_get_spar_matrices_fx( ivas_mat_col_rearrange_fx( tmp_C1_re_fx, order, i_ts, hMdDec->mixer_mat_fx, b, numch_out ); } } - + hMdDec->Q_mixer_mat = Q30; + move16(); IF( dmx_ch > 0 ) { Word32 tmpC_re_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; @@ -2723,6 +2724,8 @@ void ivas_spar_dec_gen_umx_mat_fx( } } } + hMdDec->Q_mixer_mat = Q30; + move16(); ivas_spar_dec_compute_ramp_down_post_matrix_fx( hMdDec, num_bands_out, bfi, num_md_sub_frames ); return; } @@ -4195,6 +4198,8 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix_fx( } Q_post_matrix = sub( add( Q_gain, norm_nff ), 15 ); /* apply the post matrix */ + hMdDec->Q_mixer_mat = sub( add( Q_post_matrix, hMdDec->Q_mixer_mat ), 31 ); + move16(); FOR( Word16 i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4203,13 +4208,13 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix_fx( { FOR( b = 0; b < num_bands_out; b++ ) { - hMdDec->mixer_mat_fx[i][j][add( b, i_mult( i_ts, IVAS_MAX_NUM_BANDS ) )] = Mult_32_32( hMdDec->mixer_mat_fx[i][j][add( b, i_mult( i_ts, IVAS_MAX_NUM_BANDS ) )], post_matrix_fx[i] ); + hMdDec->mixer_mat_fx[i][j][add( b, i_mult( i_ts, IVAS_MAX_NUM_BANDS ) )] = L_shl( Mult_32_32( hMdDec->mixer_mat_fx[i][j][add( b, i_mult( i_ts, IVAS_MAX_NUM_BANDS ) )], post_matrix_fx[i] ), sub( Q30, hMdDec->Q_mixer_mat ) ); // Q30 move32(); } } } } - hMdDec->Q_mixer_mat = sub( add( Q_post_matrix, hMdDec->Q_mixer_mat ), 31 ); + hMdDec->Q_mixer_mat = Q30; move16(); } }