diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 7d5a85cd5b0f2dcca7b8ef361f6a28853a0f00fa..85dffae41a84ba9fe7212b6991b8f143318fbd25 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -105,14 +105,14 @@ ivas_error ivas_core_dec( STEREO_ICBWE_DEC_HANDLE hStereoICBWE; STEREO_TD_DEC_DATA_HANDLE hStereoTD; int16_t sharpFlag[CPE_CHANNELS]; - float synth[CPE_CHANNELS][L_FRAME48k]; - float tmp_buffer[L_FRAME48k]; + //float synth[CPE_CHANNELS][L_FRAME48k]; + //float tmp_buffer[L_FRAME48k]; //float output[CPE_CHANNELS][L_FRAME48k]; //fixedToFloat_arrL(output_32_fx[0],output[0],Q11,L_FRAME48k); //if(n_channels > 1)fixedToFloat_arrL(output_32_fx[1],output[1],Q11,L_FRAME48k); #ifdef IVAS_FLOAT_FIXED //Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; - set_zero( tmp_buffer, L_FRAME48k ); + //set_zero( tmp_buffer, L_FRAME48k ); Word16 tmp_buffer_fx[L_FRAME48k]; //Word32 tmp_buffer_fx_32[L_FRAME48k]; set_s(tmp_buffer_fx, 0, L_FRAME48k); @@ -173,6 +173,8 @@ ivas_error ivas_core_dec( Word16 hb_synth_16_fx[CPE_CHANNELS][L_FRAME48k]; //Word32 hb_synth_32_fx[CPE_CHANNELS][L_FRAME48k]; + Word16 synth_16_fx[CPE_CHANNELS][L_FRAME48k]; + Word32 synth_32_fx[CPE_CHANNELS][L_FRAME48k]; FOR( i = 0; i < CPE_CHANNELS; i++ ) { @@ -184,7 +186,7 @@ ivas_error ivas_core_dec( #ifdef IVAS_FLOAT_FIXED //Word16 hb_synth_fx[6][L_FRAME48k]; /*not sure about number of channels so kept it as 6 will change it later*/ //Word16 output_16fx[CPE_CHANNELS][L_FRAME48k]; - Word16 synth_16fx[CPE_CHANNELS][L_FRAME48k]; + //Word16 synth_16fx[CPE_CHANNELS][L_FRAME48k]; Word32 pitch_buf_32fx[CPE_CHANNELS][NB_SUBFR16k]; Word16 tdm_lsfQ_PCh_fx[M], tdm_lspQ_PCh_fx[M]; Word32 conceal_eof_gain32; @@ -631,7 +633,7 @@ ivas_error ivas_core_dec( IF ( st->core == ACELP_CORE ) { /* ACELP core decoder */ - Word16 /*output_fx[L_FRAME48k],*/ synth_fxl[L_FRAME48k], old_syn_12k8_16k_fx_16[L_FRAME16k]; + Word16 /*output_fx[L_FRAME48k],*//* synth_fxl[L_FRAME48k],*/ old_syn_12k8_16k_fx_16[L_FRAME16k]; set_s(output_16_fx[n], 0, L_FRAME48k); Word16 save_hb_synth_fx_arr[L_FRAME48k], *save_hb_synth_16_fx; IF (save_hb_synth_32_fx) { @@ -647,7 +649,6 @@ ivas_error ivas_core_dec( //if (hStereoTD) { // floatToFixed_arr(hStereoTD->tdm_Pri_pitch_buf, hStereoTD->tdm_Pri_pitch_buf_fx, Q6, NB_SUBFR); //} - IF( st->hFdCngDec != NULL ) { Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) ); @@ -656,7 +657,7 @@ ivas_error ivas_core_dec( Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, M + 1, norm_s( st->hFdCngDec->hFdCngCom->A_cng[0] - 1 ) - 3 ); } - IF ( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_fxl, save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) + IF( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) { return error; } @@ -666,7 +667,7 @@ ivas_error ivas_core_dec( Scale_sig(output_16_fx[n], L_FRAME48k, -st->Q_syn2); acelp_decoder_state_fix2float(st, hCPE == NULL ? NULL : hCPE->hStereoCng); //fixedToFloat_arr(output_16_fx[n], output[n], 0, L_FRAME48k); - fixedToFloat_arr(synth_fxl, synth[n], 0, L_FRAME48k); + //fixedToFloat_arr(synth_16_fx[n], synth[n], 0, L_FRAME48k); if ( save_hb_synth_32_fx ) { Copy_Scale_sig_16_32( save_hb_synth_16_fx, save_hb_synth_32_fx, output_frame, Q11 ); @@ -692,11 +693,11 @@ ivas_error ivas_core_dec( Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); st->hFdCngDec->msNoiseEst_exp = 27; - stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); + stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); //fixedToFloat_arr( output_16_fx[n], output[n], 0, st->L_frame ); Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k,Q11); - fixedToFloat_arr( synth_16fx[n], synth[n], 0, st->hTcxDec->L_frameTCX ); + //fixedToFloat_arr( synth_16_fx[n], synth[n], 0, st->hTcxDec->L_frameTCX ); //fixedToFloat_arrL( pitch_buf_32fx[n], pitch_buf[n], Q6, NB_SUBFR16k ); Copy_Scale_sig_32_16(pitch_buf_32fx[n], pitch_buf_fx[n],NB_SUBFR16k,0); @@ -708,7 +709,7 @@ ivas_error ivas_core_dec( if ( st->core == HQ_CORE ) { /* HQ core decoder */ - Word16 synth_fxl[L_FRAME48k]; + //Word16 synth_fxl[L_FRAME48k]; //Word16 output_fx[L_FRAME48k]; Q_synth = 0; Word16 Q_output = 0; @@ -720,7 +721,7 @@ ivas_error ivas_core_dec( st->hHQ_core->Q_old_wtda = -1; st->hHQ_core->Q_old_wtda_LB = -1; - floatToFixed_arr( synth[n], synth_fxl, st->Q_syn, L_FRAME48k ); + //floatToFixed_arr( synth[n], synth_16_fx[n], st->Q_syn, L_FRAME48k ); //floatToFixed_arr( output[n], output_16_fx[n], st->Q_syn, L_FRAME48k ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED @@ -730,11 +731,12 @@ ivas_error ivas_core_dec( //floatToFixed_arr( st->hTcxDec->prev_good_synth - tmp_size, st->hTcxDec->prev_good_synth_fx - tmp_size, 0, 2 * output_frame + tmp_size ); #endif - ivas_hq_core_dec_fx( st, synth_fxl, &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); + ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32(output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_output); + Scale_sig(synth_16_fx[n], L_FRAME48k, -Q_synth); Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); - fixedToFloat_arr( synth_fxl, synth[n], Q_synth, L_FRAME48k ); + //fixedToFloat_arr( synth_16_fx[n], synth[n], 0, L_FRAME48k ); //fixedToFloat_arr( output_16_fx[n], output[n], 0, L_FRAME48k ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED @@ -793,7 +795,7 @@ ivas_error ivas_core_dec( #if 1 Word16 e_sig = 17; //Word32 *output_fx[CPE_CHANNELS]; - Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; + //Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; Word16 ch; sts = hCPE->hCoreCoder; Word16 will_estimate_noise_on_channel[CPE_CHANNELS]; @@ -928,7 +930,7 @@ ivas_error ivas_core_dec( } } #endif - stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_fx_16 ); + stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); #if 1 // Fix to float conversion IF( st_ivas->hLsSetUpConversion ) @@ -1064,8 +1066,11 @@ ivas_error ivas_core_dec( fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, s_min( 480, st->hTonalMDCTConc->nSamples / 2 ) ); } - fixedToFloat_arr( synth_fx_16[0], synth[0], 15 - e_sig, 960 ); - fixedToFloat_arr( synth_fx_16[1], synth[1], 15 - e_sig, 960 ); + Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); + Scale_sig(synth_16_fx[1],L_FRAME48k,e_sig - 15); + + //fixedToFloat_arr( synth_16_fx[0], synth[0], 0, 960 ); + //fixedToFloat_arr( synth_16_fx[1], synth[1], 0, 960 ); //fixedToFloat_arrL( output_32_fx[0], output[0], Q11, 960 ); //fixedToFloat_arrL( output_32_fx[1], output[1], Q11, 960 ); #endif @@ -1076,8 +1081,8 @@ ivas_error ivas_core_dec( { #ifdef IVAS_FLOAT_FIXED /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */ - double max_synth = 0.0f; - Word16 Q_syn = 15, synth_fxl[CPE_CHANNELS][L_FRAME48k]; + //double max_synth = 0.0f; + //Word16 Q_syn = 15/*, synth_fxl[CPE_CHANNELS][L_FRAME48k]*/; //double max_output = 0.0f; //Word16 Q_output = 31; //Word32 output_fx[CPE_CHANNELS][L_FRAME48k]; @@ -1087,19 +1092,19 @@ ivas_error ivas_core_dec( if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - for ( int jj = 0; jj < output_frame; jj++ ) + /*for ( int jj = 0; jj < output_frame; jj++ ) { max_synth = max( max_synth, fabs( synth[0][jj] ) ); } if ( (Word16) max_synth != 0 ) { Q_syn = norm_s( (Word16) max_synth ); - } + }*/ - for ( int jj = 0; jj < output_frame; jj++ ) + /*for ( int jj = 0; jj < output_frame; jj++ ) { - synth_fxl[0][jj] = float_to_fix16( synth[0][jj], Q_syn ); - } + synth_16_fx[0][jj] = float_to_fix16( synth[0][jj], 0 ); + }*/ //for ( int jj = 0; jj < output_frame; jj++ ) //{ @@ -1126,7 +1131,7 @@ ivas_error ivas_core_dec( f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); } - updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_fxl ); + updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { @@ -1144,13 +1149,13 @@ ivas_error ivas_core_dec( // } //} - for ( i = 1; i < CPE_CHANNELS; i++ ) + /*for ( i = 1; i < CPE_CHANNELS; i++ ) { for ( int jj = 0; jj < output_frame; jj++ ) { - synth[i][jj] = fix16_to_float( synth_fxl[i][jj], Q_syn ); + synth[i][jj] = fix16_to_float( synth_16_fx[i][jj], 0 ); } - } + }*/ #else updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth ); #endif @@ -1289,13 +1294,13 @@ ivas_error ivas_core_dec( /*------------------fix-to-fix-end-----------------------*/ - Word16 *synth_fx16; + //Word16 *synth_fx16; //Word16 *output_mem_fx; Word16 output_mem_16_fx[L_FRAME48k]; Word16 *p_output_mem_16; - synth_fx16 = (Word16 *)malloc(L_FRAME48k * sizeof(Word16)); + //synth_fx16 = (Word16 *)malloc(L_FRAME48k * sizeof(Word16)); //Word32 output_fx32[L_FRAME48k]; //output_mem_fx = (Word16 *)malloc(NS2SA(st->output_Fs, 3125000) * sizeof(Word16)); @@ -1314,7 +1319,7 @@ ivas_error ivas_core_dec( set16_fx(output_mem_16_fx, 0, NS2SA(st->output_Fs, 3125000)); } - floatToFixed_arr(synth[n], synth_fx16, Q_synth, L_FRAME48k); + //floatToFixed_arr(synth[n], synth_16_fx[n], Q_synth, L_FRAME48k); //floatToFixed_arrL(output[n], output_32_fx[n], Q11, L_FRAME48k); Scale_sig32(output_32_fx[n], L_FRAME48k, Q4 - Q11); @@ -1360,7 +1365,9 @@ ivas_error ivas_core_dec( Word16 q_audio, old_syn_fx; old_syn_fx = Q11; q_audio = Q12; - + if (hSCE != NULL) { + if(hSCE->save_synth != NULL)floatToFixed_arrL(hSCE->save_synth, hSCE->save_synth_fx, Q11, output_frame); + } #endif test(); test(); test(); test(); IF ( EQ_16(st->last_core, ACELP_CORE) && (EQ_16(st->core, TCX_20_CORE) || EQ_16(st->core, TCX_10_CORE) || EQ_16(st->core, HQ_CORE) ) && st->hBWE_TD != NULL ) @@ -1403,10 +1410,10 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && NE_16(st->element_mode, IVAS_CPE_MDCT) && !(EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG))) { - Copy_Scale_sig_16_32(synth_fx16, hSCE->save_synth_fx, output_frame, 0); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11); } - IF ( ( error = core_switching_post_dec_ivas_fx( st, synth_fx16, output_32_fx[n], p_output_mem_16, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE, &Q_synth ) ) != IVAS_ERR_OK ) + IF ( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE, &Q_synth ) ) != IVAS_ERR_OK ) { return error; } @@ -1415,7 +1422,7 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && hSCE && EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG)) { - Copy_Scale_sig_16_32(synth_fx16, hSCE->save_synth_fx, output_frame, 0); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11); } /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */ @@ -1442,9 +1449,13 @@ ivas_error ivas_core_dec( //fixedToFloat_arrL(hb_synth_32_fx[ch_ind], hb_synth[ch_ind], 11, L_FRAME48k); } } - if (sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !(st->core_brate == SID_2k40 && st->cng_type == FD_CNG)) + if (hSCE != NULL) { + if (hSCE->save_synth != NULL)fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11, output_frame); + } + if (sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !(st->core_brate == SID_2k40 && st->cng_type == FD_CNG)) { - mvr2r(synth[n], hSCE->save_synth, output_frame); + //mvr2r(synth[n], hSCE->save_synth, output_frame); + //fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11,output_frame); } /*-------------------cldfb-start-------------------------*/ @@ -1464,8 +1475,8 @@ ivas_error ivas_core_dec( } /*-------------------cldfb-end---------------------------*/ - - fixedToFloat_arr(synth_fx16, synth[n], Q_synth, L_FRAME48k); + Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); + //fixedToFloat_arr(synth_16_fx[n], synth[n], 0, L_FRAME48k); //fixedToFloat_arrL(output_32_fx[n], output[n], Q11, L_FRAME48k); IF(st->hHQ_core != NULL) { @@ -1487,12 +1498,13 @@ ivas_error ivas_core_dec( st->hBWE_FD->prev_flag = st->hBWE_FD->prev_flag; } - free(synth_fx16); + //free(synth_fx16); //free(output_mem_fx); if (sba_dirac_stereo_flag && hSCE && st->core_brate == SID_2k40 && st->cng_type == FD_CNG) { - mvr2r(synth[n], hSCE->save_synth, output_frame); + //mvr2r(synth[n], hSCE->save_synth, output_frame); + //fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11,output_frame); } #endif @@ -1506,10 +1518,10 @@ ivas_error ivas_core_dec( //Word16 hb_synth_fx_16[CPE_CHANNELS][L_FRAME48k]; //Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; //Word16 output_fx_16[CPE_CHANNELS][L_FRAME48k]; - Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; + //Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; Word16 Q_input, Q_hb_synth_fx, Q_synth_fx; - Word32 synth_fx32[L_FRAME48k]; + //Word32 synth_fx32[L_FRAME48k]; //Word32 hb_synth_fx32[L_FRAME48k]; Word16 Q_syn_hb; @@ -1531,7 +1543,7 @@ ivas_error ivas_core_dec( Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, negate(Q11)); //floatToFixed_arr( hb_synth[n], hb_synth_16_fx[n], Q_hb_synth_fx, L_FRAME48k ); //floatToFixed_arr( output[n], output_16_fx[n], Q_input, L_FRAME48k ); - floatToFixed_arr( synth[n], synth_fx_16[n], Q_synth_fx, L_FRAME48k ); + //floatToFixed_arr( synth[n], synth_16_fx[n], Q_synth_fx, L_FRAME48k ); IF( hBWE_TD != NULL ) { @@ -1557,13 +1569,13 @@ ivas_error ivas_core_dec( ELSE IF( EQ_16( st->extl, WB_BWE ) && EQ_16( st->bws_cnt, 0 ) ) { /* WB BWE decoder */ - Q_hb_synth_fx = ivas_wb_bwe_dec_fx( st, output_16_fx[n], synth_fx_16[n], hb_synth_16_fx[n], use_cldfb_for_dft, output_frame, voice_factors_fx[n], pitch_buf_fx[n], &Q_synth_fx ); + Q_hb_synth_fx = ivas_wb_bwe_dec_fx( st, output_16_fx[n], synth_16_fx[n], hb_synth_16_fx[n], use_cldfb_for_dft, output_frame, voice_factors_fx[n], pitch_buf_fx[n], &Q_synth_fx ); } /* Memories Re-Scaling */ Copy_Scale_sig_16_32( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, Q11 - Q_hb_synth_fx ); Copy_Scale_sig_16_32( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_input ); - Copy_Scale_sig_16_32( synth_fx_16[n], synth_fx32, L_FRAME48k, Q11 - Q_synth_fx ); + Copy_Scale_sig_16_32( synth_16_fx[n], synth_32_fx[n], L_FRAME48k, Q11 - Q_synth_fx ); IF( hBWE_FD != NULL ) { @@ -1613,7 +1625,7 @@ ivas_error ivas_core_dec( ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && EQ_16( st->core, ACELP_CORE ) && GT_16( st->bwidth, NB ) && GT_16( st->bws_cnt, 0 ) && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) ) { /* SWB BWE decoder */ - Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_fx32, hb_synth_32_fx[n], use_cldfb_for_dft, output_frame ); + Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], use_cldfb_for_dft, output_frame ); // Output Scale_sig32( hb_synth_32_fx[n], output_frame, Q11 - Q_syn_hb ); @@ -1663,7 +1675,7 @@ ivas_error ivas_core_dec( Word16 q = 2; //st->prev_Q_bwe_syn2 = 0; Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -(Q11 + q)); - Copy_Scale_sig_32_16(synth_fx32, synth_fxl, L_FRAME48k, -(Q11 + q)); + Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, L_FRAME48k, -(Q11 + q)); Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, (Q8 - st->prev_Q_bwe_syn)); Scale_sig32(st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, (st->prev_Q_bwe_syn2 - Q11)); Copy_Scale_sig_32_16(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, 2 * ALLPASSSECTIONS_STEEP, (st->prev_Q_bwe_syn2 - Q11)); @@ -1671,7 +1683,7 @@ ivas_error ivas_core_dec( swb_CNG_dec_ivas_fx( st, synth_fxl, hb_synth_16_fx[n], sid_bw[n], -q ); Copy_Scale_sig_16_32(hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, (Q11 + q)); - Copy_Scale_sig_16_32(synth_fxl, synth_fx32, L_FRAME48k, (Q11 + q)); + Copy_Scale_sig_16_32(synth_fxl, synth_32_fx[n], L_FRAME48k, (Q11 + q)); Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, -(Q8 - st->prev_Q_bwe_syn)); Scale_sig32(st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, -(st->prev_Q_bwe_syn2 - Q11)); Copy_Scale_sig_16_32(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -(st->prev_Q_bwe_syn2 - Q11)); @@ -1681,7 +1693,8 @@ ivas_error ivas_core_dec( //fixedToFloat_arrL(hb_synth_32_fx[n], hb_synth[n], Q11, L_FRAME48k); //fixedToFloat_arrL(output_32_fx[n], output[n], Q11, L_FRAME48k); - fixedToFloat_arrL(synth_fx32, synth[n], Q11, L_FRAME48k); + //fixedToFloat_arrL(synth_32_fx[n], synth[n], Q11, L_FRAME48k); + //Copy_Scale_sig_32_16(synth_32_fx[n],synth_16_fx[n],L_FRAME48k,negate(Q11)); IF(hBWE_TD != NULL) { @@ -1746,7 +1759,7 @@ ivas_error ivas_core_dec( { tmps = NS2SA_fx2( output_Fs, DELAY_CLDFB_NS ); - waveform_adj2_fix( st->hTonalMDCTConc->secondLastPcmOut, synth_16fx[n] + tmps, st->plcInfo.data_noise, &st->plcInfo.outx_new_n1_fx, + waveform_adj2_fix( st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, st->plcInfo.data_noise, &st->plcInfo.outx_new_n1_fx, &st->plcInfo.nsapp_gain_fx, &st->plcInfo.nsapp_gain_n_fx, &st->plcInfo.recovery_gain, st->plcInfo.step_concealgain_fx, st->plcInfo.Pitch_fx, st->plcInfo.FrameSize, tmps, st->hPlcInfo->nbLostCmpt + 1, st->bfi ); @@ -1968,7 +1981,7 @@ ivas_error ivas_core_dec( #ifdef IVAS_FLOAT_FIXED // TO DO delete below //Word32 output_fx[CPE_CHANNELS][L_FRAME48k]; - Word32 synth_fxg[CPE_CHANNELS][L_FRAME48k]; + //Word32 synth_fxg[CPE_CHANNELS][L_FRAME48k]; //Word32 hb_synth_fxg[CPE_CHANNELS][L_FRAME48k]; FOR(int ch_ind = 0; ch_ind < n_channels; ch_ind++) @@ -1976,7 +1989,7 @@ ivas_error ivas_core_dec( FOR(int ind = 0; ind < L_FRAME48k; ind++) { //output_32_fx[ch_ind][ind] = (Word32)(output[ch_ind][ind] * (1 << 11)); - synth_fxg[ch_ind][ind] = (Word32)(synth[ch_ind][ind] * (1 << 11)); + //synth_32_fx[ch_ind][ind] = (Word32)(synth[ch_ind][ind] * (1 << 11)); //hb_synth_32_fx[ch_ind][ind] = (Word32)(hb_synth[ch_ind][ind] * (1 << 11)); } } @@ -2136,7 +2149,7 @@ ivas_error ivas_core_dec( IF ( NE_16(st->element_mode, IVAS_CPE_MDCT) || sba_dirac_stereo_flag ) { - ivas_post_proc_fx( hSCE, hCPE, n, synth_fxg[n], NULL, output_frame, sba_dirac_stereo_flag ); + ivas_post_proc_fx( hSCE, hCPE, n, synth_32_fx[n], NULL, output_frame, sba_dirac_stereo_flag ); } /* update OLA buffers - needed for switching to DFT stereo */ @@ -2144,7 +2157,7 @@ ivas_error ivas_core_dec( { IF ( hCPE != NULL ) { - stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_fxg[n], hb_synth_32_fx[n], output_frame ); + stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], output_frame ); } } } @@ -2153,11 +2166,11 @@ ivas_error ivas_core_dec( Word16 q = 11; IF ( EQ_16(hCPE->last_element_mode, IVAS_CPE_MDCT )) { - stereo_mdct2dft_update_fx( hCPE, output_32_fx[0], synth_fxg[0] ); + stereo_mdct2dft_update_fx( hCPE, output_32_fx[0], synth_32_fx[0] ); } Word16 q_DFT[2] = { 3, 3 }; - stereo_dft_dec_core_switching_fx( hCPE, output_32_fx[0], synth_fxg[0], hb_synth_32_fx[0], DFT_fx, output_frame, use_cldfb_for_dft, 0, &q, q_DFT ); + stereo_dft_dec_core_switching_fx( hCPE, output_32_fx[0], synth_32_fx[0], hb_synth_32_fx[0], DFT_fx, output_frame, use_cldfb_for_dft, 0, &q, q_DFT ); hCPE->hStereoDft->q_dft = s_min( q_DFT[0], q_DFT[1] ); @@ -2170,11 +2183,11 @@ ivas_error ivas_core_dec( IF( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) { /* mono output for non-residual coding modes uses CLDFB instead of DFT - requires DFT buffer update in case of bitrate switching */ - stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_fxg[n], hb_synth_32_fx[n], output_frame ); + stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], output_frame ); } } - Copy32( synth_fxg[n], output_32_fx[n], output_frame ); + Copy32( synth_32_fx[n], output_32_fx[n], output_frame ); /*--------------------------------------------------------* * Common updates @@ -2232,7 +2245,7 @@ ivas_error ivas_core_dec( FOR( i = 0; i < L_FRAME48k; i++ ) { //output[ch_ind][i] = fixedToFloat(output_32_fx[ch_ind][i], 11); - synth[ch_ind][i] = (float) synth_fxg[ch_ind][i] / (float) ( 1 << 11 ); + //synth[ch_ind][i] = (float) synth_32_fx[ch_ind][i] / (float) ( 1 << 11 ); //hb_synth[ch_ind][i] = (float) hb_synth_32_fx[ch_ind][i] / (float) ( 1 << 11 ); } } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 168be610c0a668df876df3fcccf3235aa7dc2a5b..8a50563343e2a2874ad4770a7cd5f2b4143b8b82 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -239,15 +239,6 @@ ivas_error ivas_sce_dec_fx( /*----------------------------------------------------------------* * Decoder *----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - float *output_flt[1]; - float outputHB_flt[1][960]; - output_flt[0] = malloc( sizeof( Word32 ) * L_FRAME48k ); - set_f( output_flt[0], 0, L_FRAME48k ); - FOR( int k = 0; k < L_FRAME48k; k++ ) - { - output_flt[0][k] = (float) output[0][k] / ONE_IN_Q11; - } #ifndef TO_BE_REMOVED_CONVERSION //Word16 k; @@ -278,20 +269,11 @@ ivas_error ivas_sce_dec_fx( #endif set32_fx(output[0], 0, L_FRAME48k); -#endif // !IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( ( error = ivas_core_dec( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR( int k = 0; k < L_FRAME48k; k++ ) - { - //output[0][k] = (Word32) ( output_flt[0][k] * ONE_IN_Q11 ); - //outputHB[0][k] = (Word32) ( outputHB_flt[0][k] * ONE_IN_Q11 ); - } - free( output_flt[0] ); -#endif // !IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( st_ivas->sba_dirac_stereo_flag && ( GT_32( st->core_brate, SID_2k40 ) || EQ_16( st->cng_type, LP_CNG ) ) ) {