Loading lib_com/cnst.h +0 −2 Original line number Diff line number Diff line Loading @@ -668,9 +668,7 @@ enum #define ACELP_TCX_TRANS_NS 1250000 /* Duration of the ACELP->TCX overlap - 1.25 ms */ #define L_FRAME_MAX L_FRAME48k /* Max 20ms frame size @48kHz */ #define L_FRAME_PLUS 1200 /* Max frame size (long TCX frame) */ #ifdef FIX_1320_STACK_CPE_DECODER #define L_FRAME_PLUS_INTERNAL 800 /* Max frame size (long TCX frame) at maximum internal sampling rate */ #endif #define L_MDCT_OVLP_MAX NS2SA( 48000, ACELP_LOOK_NS ) /* = Max mdct overlap */ #define N_TCX10_MAX 480 /* Max size of TCX10 MDCT spectrum */ #define BITS_TEC 1 /* number of bits for TEC */ Loading lib_com/options.h +0 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,6 @@ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ #define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */ #define NONBE_FIX_1376_MDCT_CONCEALMENT /* FhG: fix concealment artifact in MDCT Stereo with DTX, in case transition frame gets lost */ #define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ Loading lib_dec/dec_LPD_fx.c +0 −8 Original line number Diff line number Diff line Loading @@ -36,11 +36,7 @@ void decoder_LPD_fx( ) { Word16 *param_lpc; #ifdef FIX_1320_STACK_CPE_DECODER Word16 synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M]; #else Word16 synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; #endif Word16 *synth; Word16 synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; Word16 *synthFB; Loading Loading @@ -118,11 +114,7 @@ void decoder_LPD_fx( synth = synth_buf + hTcxDec->old_synth_len; /*st->old_synth: Q_0*/ Copy( hTcxDec->old_synth, synth_buf, hTcxDec->old_synth_len ); #ifdef FIX_1320_STACK_CPE_DECODER set16_fx( synth, 0, L_FRAME_PLUS_INTERNAL + M ); #else set16_fx( synth, 0, L_FRAME_PLUS + M ); #endif synthFB = synth_bufFB + hTcxDec->old_synth_lenFB; Copy( hTcxDec->old_synthFB_fx, synth_bufFB, hTcxDec->old_synth_lenFB ); Loading lib_dec/ivas_core_dec_fx.c +0 −91 Original line number Diff line number Diff line Loading @@ -76,12 +76,8 @@ ivas_error ivas_core_dec_fx( set16_fx( tmp_buffer_fx, 0, L_FRAME48k ); Word16 tmps, incr; #ifdef FIX_1320_STACK_CPE_DECODER Word16 flag_bwe_bws, flaf_swb_tbe; Word32 *bwe_exc_extended_fx[CPE_CHANNELS] = { NULL, NULL }; #else Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; #endif Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; // Q15 Word16 core_switching_flag[CPE_CHANNELS]; Loading Loading @@ -296,9 +292,7 @@ ivas_error ivas_core_dec_fx( set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k ); set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k ); set16_fx( hb_synth_16_fx[n], 0, L_FRAME48k ); #ifdef FIX_1320_STACK_CPE_DECODER bwe_exc_extended_fx[n] = hb_synth_32_fx[n]; /* note: reuse the buffer */ #endif /*------------------------------------------------------------------* * Decision matrix (selection of technologies) Loading Loading @@ -1003,7 +997,6 @@ ivas_error ivas_core_dec_fx( Word16 Q_input, Q_hb_synth_fx, Q_synth_fx; Word16 Q_syn_hb, sf; #ifdef FIX_1320_STACK_CPE_DECODER flaf_swb_tbe = 0; move16(); test(); Loading @@ -1019,7 +1012,6 @@ ivas_error ivas_core_dec_fx( flaf_swb_tbe = 1; move16(); } #endif sf = getScaleFactor32( output_32_fx[n], L_FRAME48k ); Loading Loading @@ -1058,14 +1050,10 @@ ivas_error ivas_core_dec_fx( } /* Memories Re-Scaling */ #ifdef FIX_1320_STACK_CPE_DECODER IF( !flaf_swb_tbe ) { #endif Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11 #ifdef FIX_1320_STACK_CPE_DECODER } #endif Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 // Q_input can get value <= -5 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], output_frame, sub( Q11, Q_synth_fx ) ); // Q11 Loading @@ -1083,42 +1071,19 @@ ivas_error ivas_core_dec_fx( * SWB(FB) BWE decoding *---------------------------------------------------------------------*/ #ifdef FIX_1320_STACK_CPE_DECODER test(); test(); test(); test(); flag_bwe_bws = ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && st->bfi == 0 ); move16(); #endif Q_white_exc = 0; move16(); #ifdef FIX_1320_STACK_CPE_DECODER test(); test(); IF( flaf_swb_tbe ) #else test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); IF( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) ) #endif { /* SWB TBE decoder */ ivas_swb_tbe_dec_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc ); Loading @@ -1139,11 +1104,7 @@ ivas_error ivas_core_dec_fx( fb_tbe_dec_ivas_fx( st, tmp_buffer_fx /*fb_exc*/, Q_white_exc, hb_synth_32_fx[n], 0, tmp_buffer_fx /*fb_synth_ref*/, Q_white_exc, output_frame ); } } #ifdef FIX_1320_STACK_CPE_DECODER ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || flag_bwe_bws ) #else ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) ) #endif { /* SWB BWE decoder */ 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 ); Loading @@ -1153,7 +1114,6 @@ ivas_error ivas_core_dec_fx( Copy_Scale_sig_32_16( hBWE_FD->L_old_wtda_swb_fx32, hBWE_FD->L_old_wtda_swb_fx, output_frame, sub( hBWE_FD->old_wtda_swb_fx_exp, Q11 ) ); // old_wtda_swb_fx_exp } #ifdef FIX_1320_STACK_CPE_DECODER test(); test(); test(); Loading @@ -1161,7 +1121,6 @@ ivas_error ivas_core_dec_fx( { set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k ); } #endif /*---------------------------------------------------------------------* * FEC - recovery after lost HQ core (smoothing of the BWE component) Loading Loading @@ -1253,38 +1212,6 @@ ivas_error ivas_core_dec_fx( } } #ifndef FIX_1320_STACK_CPE_DECODER IF( EQ_16( st->element_mode, EVS_MONO ) ) { /*----------------------------------------------------------------* * BFI waveform adjustment *----------------------------------------------------------------*/ test(); test(); test(); test(); test(); test(); test(); test(); IF( EQ_16( st->core, ACELP_CORE ) && !st->bfi && st->prev_bfi && GE_32( st->last_total_brate, HQ_48k ) && EQ_16( st->last_codec_mode, MODE2 ) && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) && LT_16( st->hPlcInfo->nbLostCmpt, 4 ) ) { tmps = NS2SA_FX2( output_Fs, DELAY_CLDFB_NS ); IF( st->hTonalMDCTConc->q_lastPcmOut != 0 ) { Scale_sig( st->hTonalMDCTConc->secondLastPcmOut, shr( st->hPlcInfo->L_frameTCX, 1 ), negate( st->hTonalMDCTConc->q_lastPcmOut ) ); Scale_sig( st->hTonalMDCTConc->lastPcmOut, st->hPlcInfo->L_frameTCX, negate( st->hTonalMDCTConc->q_lastPcmOut ) ); st->hTonalMDCTConc->q_lastPcmOut = 0; move16(); } waveform_adj2_fix( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, tmps, add( st->hPlcInfo->nbLostCmpt, 1 ), st->bfi ); st->hPlcInfo->Pitch_fx = 0; move16(); } } #endif /*----------------------------------------------------------------* * Transition and synchronization of BWE components *----------------------------------------------------------------*/ Loading @@ -1303,21 +1230,8 @@ ivas_error ivas_core_dec_fx( } ELSE { #ifndef FIX_1320_STACK_CPE_DECODER test(); IF( EQ_16( st->extl, SWB_BWE_HIGHRATE ) || EQ_16( st->extl, FB_BWE_HIGHRATE ) ) { /* HR SWB BWE on top of ACELP@16kHz */ tmps = NS2SA_FX2( output_Fs, DELAY_BWE_TOTAL_NS ); } ELSE { #endif /* TBE on top of ACELP@16kHz */ tmps = NS2SA_FX2( output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS ); #ifndef FIX_1320_STACK_CPE_DECODER } #endif } /* Smooth transitions when switching between different technologies */ Loading Loading @@ -1542,12 +1456,7 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); #ifdef FIX_1320_STACK_CPE_DECODER IF( st->hTcxDec != NULL && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) ) #else test(); IF( ( EQ_16( st->codec_mode, MODE1 ) && st->hTcxDec != NULL ) && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) ) #endif { Word16 exp_prev_synth_buffer = 0, exp_old_out = 0, exp_delay_buf_out = 0, exp_ouput = 0, exp_synth_history = 0; move16(); Loading lib_dec/ivas_cpe_dec_fx.c +0 −182 Original line number Diff line number Diff line Loading @@ -51,9 +51,7 @@ static void read_stereo_mode_and_bwidth_fx( CPE_DEC_HANDLE hCPE, const Decoder_S static void stereo_mode_combined_format_dec_fx( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); #ifdef FIX_1320_STACK_CPE_DECODER static ivas_error stereo_dft_dec_main( CPE_DEC_HANDLE hCPE, const Word32 ivas_total_brate, const Word16 n_channels, Word32 *p_res_buf_fx, Word32 *output[], Word32 outputHB[][L_FRAME48k], const Word16 output_frame, const Word32 output_Fs ); #endif /*--------------------------------------------------------------------------* Loading @@ -75,12 +73,7 @@ ivas_error ivas_cpe_dec_fx( Word16 last_bwidth; Word16 tdm_ratio_idx; Word32 outputHB_fx[CPE_CHANNELS][L_FRAME48k]; /* buffer for output HB synthesis, both channels */ /* Q11 */ #ifdef FIX_1320_STACK_CPE_DECODER Word32 *res_buf_fx = NULL; /* Q8 */ #else Word16 q_res_buf; Word32 res_buf_fx[STEREO_DFT_N_8k]; /* Q(q_res_buf) */ #endif CPE_DEC_HANDLE hCPE; STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft; Decoder_State **sts; Loading @@ -91,10 +84,6 @@ ivas_error ivas_cpe_dec_fx( error = IVAS_ERR_OK; move32(); #ifndef FIX_1320_STACK_CPE_DECODER q_res_buf = Q8; move16(); #endif push_wmops( "ivas_cpe_dec" ); Loading Loading @@ -353,10 +342,8 @@ ivas_error ivas_cpe_dec_fx( } ELSE { #ifdef FIX_1320_STACK_CPE_DECODER res_buf_fx = outputHB_fx[0]; /* note: temporarily reused buffer */ #endif test(); IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { Loading Loading @@ -619,177 +606,10 @@ ivas_error ivas_cpe_dec_fx( test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hConfigDft->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) ) { #ifdef FIX_1320_STACK_CPE_DECODER IF( NE_32( ( error = stereo_dft_dec_main( hCPE, ivas_total_brate, n_channels, res_buf_fx, output, outputHB_fx, output_frame, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) { return error; } #else Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; // q_dft set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX ); set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX ); /* core decoder */ IF( NE_32( ( error = ivas_core_dec_fx( NULL, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, DFT_fx, 0 ) ), IVAS_ERR_OK ) ) { return error; } // Scaling of DFT's Word16 shift; Word32 tmp1, tmp2; Word16 shift1, shift2; maximum_abs_32_fx( DFT_fx[0], STEREO_DFT_BUF_MAX, &tmp1 ); maximum_abs_32_fx( DFT_fx[1], STEREO_DFT_BUF_MAX, &tmp2 ); IF( tmp1 == 0 ) { shift1 = Q31; move16(); } ELSE { shift1 = norm_l( tmp1 ); } IF( tmp2 == 0 ) { shift2 = Q31; move16(); } ELSE { shift2 = norm_l( tmp2 ); } shift = s_min( shift1, shift2 ); IF( NE_16( shift, 31 ) ) { shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */ IF( GT_16( shift, hCPE->hStereoDft->q_dft ) ) { Scale_sig32( DFT_fx[0], STEREO_DFT_BUF_MAX, sub( shift, hCPE->hStereoDft->q_dft ) ); // shift Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, sub( shift, hCPE->hStereoDft->q_dft ) ); // shift hCPE->hStereoDft->q_dft = shift; move16(); } } ELSE { hCPE->hStereoDft->q_dft = Q8; move16(); } /* DFT Stereo residual decoding */ test(); IF( hCPE->hStereoDft->res_cod_band_max > 0 && !st_ivas->bfi ) { Word16 q; Word16 q_out_DFT[2]; q = Q11; move16(); Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, ( ( 2 * NB_SUBFR16k ) + 2 ), -( Q10 ) ); // Q16->Q6 stereo_dft_dec_res_fx( hCPE, res_buf_fx, q_res_buf, output[1] ); Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, ( ( 2 * NB_SUBFR16k ) + 2 ), 10 ); // Q6->Q16 Scale_sig32( output[1], L_FRAME8k, ( Q11 - Q15 ) ); // Q15 -> Q11 q_out_DFT[0] = q_out_DFT[1] = hCPE->hStereoDft->q_dft; move16(); move16(); stereo_dft_dec_analyze_fx( hCPE, output[1], DFT_fx, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0, &q, q_out_DFT ); Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, sub( hCPE->hStereoDft->q_dft, q_out_DFT[1] ) ); // q_dft } /* DFT stereo CNG */ { Word16 q_dft; q_dft = hCPE->hStereoDft->q_dft; move16(); stereo_dtf_cng_fx( hCPE, ivas_total_brate, DFT_fx, output_frame, q_dft ); } /* decoding */ IF( EQ_16( hCPE->nchan_out, 1 ) ) { IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; move16(); FOR( Word16 ii = 0; ii < (Word16) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ) ); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } hCPE->hStereoDft->first_frame = 0; move16(); } scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // q_dft hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; move16(); stereo_dft_unify_dmx_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata ); scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q15, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // Q15 hCPE->hStereoDft->q_res_cod_mem_fx = Q15; move16(); } ELSE { { IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; move16(); FOR( Word16 ii = 0; ii < (Word16) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ) ); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } hCPE->hStereoDft->first_frame = 0; move16(); } scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // q_dft hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; move16(); } stereo_dft_dec_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q15, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // Q15 hCPE->hStereoDft->q_res_cod_mem_fx = Q15; move16(); } FOR( n = 0; n < hCPE->nchan_out; n++ ) { Scale_sig32( output[n], L_FRAME48k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[n] = hCPE->hStereoDft->q_dft; move16(); } /* synthesis iFFT */ FOR( n = 0; n < hCPE->nchan_out; n++ ) { stereo_dft_dec_synthesize_fx( hCPE, DFT_fx, n, output[n], output_frame ); } // delete below FOR( n = 0; n < hCPE->nchan_out; n++ ) { Scale_sig32( output[n], L_FRAME48k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[n] = Q11; move16(); } #endif } ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { Loading Loading @@ -893,7 +713,6 @@ ivas_error ivas_cpe_dec_fx( return error; } #ifdef FIX_1320_STACK_CPE_DECODER /*------------------------------------------------------------------------- * stereo_dft_dec_main() Loading Loading @@ -1099,7 +918,6 @@ static ivas_error stereo_dft_dec_main( return IVAS_ERR_OK; } #endif /*------------------------------------------------------------------------- * create_cpe_dec_fx() Loading Loading
lib_com/cnst.h +0 −2 Original line number Diff line number Diff line Loading @@ -668,9 +668,7 @@ enum #define ACELP_TCX_TRANS_NS 1250000 /* Duration of the ACELP->TCX overlap - 1.25 ms */ #define L_FRAME_MAX L_FRAME48k /* Max 20ms frame size @48kHz */ #define L_FRAME_PLUS 1200 /* Max frame size (long TCX frame) */ #ifdef FIX_1320_STACK_CPE_DECODER #define L_FRAME_PLUS_INTERNAL 800 /* Max frame size (long TCX frame) at maximum internal sampling rate */ #endif #define L_MDCT_OVLP_MAX NS2SA( 48000, ACELP_LOOK_NS ) /* = Max mdct overlap */ #define N_TCX10_MAX 480 /* Max size of TCX10 MDCT spectrum */ #define BITS_TEC 1 /* number of bits for TEC */ Loading
lib_com/options.h +0 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,6 @@ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ #define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */ #define NONBE_FIX_1376_MDCT_CONCEALMENT /* FhG: fix concealment artifact in MDCT Stereo with DTX, in case transition frame gets lost */ #define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ Loading
lib_dec/dec_LPD_fx.c +0 −8 Original line number Diff line number Diff line Loading @@ -36,11 +36,7 @@ void decoder_LPD_fx( ) { Word16 *param_lpc; #ifdef FIX_1320_STACK_CPE_DECODER Word16 synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M]; #else Word16 synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; #endif Word16 *synth; Word16 synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; Word16 *synthFB; Loading Loading @@ -118,11 +114,7 @@ void decoder_LPD_fx( synth = synth_buf + hTcxDec->old_synth_len; /*st->old_synth: Q_0*/ Copy( hTcxDec->old_synth, synth_buf, hTcxDec->old_synth_len ); #ifdef FIX_1320_STACK_CPE_DECODER set16_fx( synth, 0, L_FRAME_PLUS_INTERNAL + M ); #else set16_fx( synth, 0, L_FRAME_PLUS + M ); #endif synthFB = synth_bufFB + hTcxDec->old_synth_lenFB; Copy( hTcxDec->old_synthFB_fx, synth_bufFB, hTcxDec->old_synth_lenFB ); Loading
lib_dec/ivas_core_dec_fx.c +0 −91 Original line number Diff line number Diff line Loading @@ -76,12 +76,8 @@ ivas_error ivas_core_dec_fx( set16_fx( tmp_buffer_fx, 0, L_FRAME48k ); Word16 tmps, incr; #ifdef FIX_1320_STACK_CPE_DECODER Word16 flag_bwe_bws, flaf_swb_tbe; Word32 *bwe_exc_extended_fx[CPE_CHANNELS] = { NULL, NULL }; #else Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; #endif Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; // Q15 Word16 core_switching_flag[CPE_CHANNELS]; Loading Loading @@ -296,9 +292,7 @@ ivas_error ivas_core_dec_fx( set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k ); set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k ); set16_fx( hb_synth_16_fx[n], 0, L_FRAME48k ); #ifdef FIX_1320_STACK_CPE_DECODER bwe_exc_extended_fx[n] = hb_synth_32_fx[n]; /* note: reuse the buffer */ #endif /*------------------------------------------------------------------* * Decision matrix (selection of technologies) Loading Loading @@ -1003,7 +997,6 @@ ivas_error ivas_core_dec_fx( Word16 Q_input, Q_hb_synth_fx, Q_synth_fx; Word16 Q_syn_hb, sf; #ifdef FIX_1320_STACK_CPE_DECODER flaf_swb_tbe = 0; move16(); test(); Loading @@ -1019,7 +1012,6 @@ ivas_error ivas_core_dec_fx( flaf_swb_tbe = 1; move16(); } #endif sf = getScaleFactor32( output_32_fx[n], L_FRAME48k ); Loading Loading @@ -1058,14 +1050,10 @@ ivas_error ivas_core_dec_fx( } /* Memories Re-Scaling */ #ifdef FIX_1320_STACK_CPE_DECODER IF( !flaf_swb_tbe ) { #endif Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11 #ifdef FIX_1320_STACK_CPE_DECODER } #endif Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 // Q_input can get value <= -5 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], output_frame, sub( Q11, Q_synth_fx ) ); // Q11 Loading @@ -1083,42 +1071,19 @@ ivas_error ivas_core_dec_fx( * SWB(FB) BWE decoding *---------------------------------------------------------------------*/ #ifdef FIX_1320_STACK_CPE_DECODER test(); test(); test(); test(); flag_bwe_bws = ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && st->bfi == 0 ); move16(); #endif Q_white_exc = 0; move16(); #ifdef FIX_1320_STACK_CPE_DECODER test(); test(); IF( flaf_swb_tbe ) #else test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); IF( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) ) #endif { /* SWB TBE decoder */ ivas_swb_tbe_dec_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc ); Loading @@ -1139,11 +1104,7 @@ ivas_error ivas_core_dec_fx( fb_tbe_dec_ivas_fx( st, tmp_buffer_fx /*fb_exc*/, Q_white_exc, hb_synth_32_fx[n], 0, tmp_buffer_fx /*fb_synth_ref*/, Q_white_exc, output_frame ); } } #ifdef FIX_1320_STACK_CPE_DECODER ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || flag_bwe_bws ) #else ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) ) #endif { /* SWB BWE decoder */ 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 ); Loading @@ -1153,7 +1114,6 @@ ivas_error ivas_core_dec_fx( Copy_Scale_sig_32_16( hBWE_FD->L_old_wtda_swb_fx32, hBWE_FD->L_old_wtda_swb_fx, output_frame, sub( hBWE_FD->old_wtda_swb_fx_exp, Q11 ) ); // old_wtda_swb_fx_exp } #ifdef FIX_1320_STACK_CPE_DECODER test(); test(); test(); Loading @@ -1161,7 +1121,6 @@ ivas_error ivas_core_dec_fx( { set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k ); } #endif /*---------------------------------------------------------------------* * FEC - recovery after lost HQ core (smoothing of the BWE component) Loading Loading @@ -1253,38 +1212,6 @@ ivas_error ivas_core_dec_fx( } } #ifndef FIX_1320_STACK_CPE_DECODER IF( EQ_16( st->element_mode, EVS_MONO ) ) { /*----------------------------------------------------------------* * BFI waveform adjustment *----------------------------------------------------------------*/ test(); test(); test(); test(); test(); test(); test(); test(); IF( EQ_16( st->core, ACELP_CORE ) && !st->bfi && st->prev_bfi && GE_32( st->last_total_brate, HQ_48k ) && EQ_16( st->last_codec_mode, MODE2 ) && ( EQ_16( st->last_core_bfi, TCX_20_CORE ) || EQ_16( st->last_core_bfi, TCX_10_CORE ) ) && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) && LT_16( st->hPlcInfo->nbLostCmpt, 4 ) ) { tmps = NS2SA_FX2( output_Fs, DELAY_CLDFB_NS ); IF( st->hTonalMDCTConc->q_lastPcmOut != 0 ) { Scale_sig( st->hTonalMDCTConc->secondLastPcmOut, shr( st->hPlcInfo->L_frameTCX, 1 ), negate( st->hTonalMDCTConc->q_lastPcmOut ) ); Scale_sig( st->hTonalMDCTConc->lastPcmOut, st->hPlcInfo->L_frameTCX, negate( st->hTonalMDCTConc->q_lastPcmOut ) ); st->hTonalMDCTConc->q_lastPcmOut = 0; move16(); } waveform_adj2_fix( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, tmps, add( st->hPlcInfo->nbLostCmpt, 1 ), st->bfi ); st->hPlcInfo->Pitch_fx = 0; move16(); } } #endif /*----------------------------------------------------------------* * Transition and synchronization of BWE components *----------------------------------------------------------------*/ Loading @@ -1303,21 +1230,8 @@ ivas_error ivas_core_dec_fx( } ELSE { #ifndef FIX_1320_STACK_CPE_DECODER test(); IF( EQ_16( st->extl, SWB_BWE_HIGHRATE ) || EQ_16( st->extl, FB_BWE_HIGHRATE ) ) { /* HR SWB BWE on top of ACELP@16kHz */ tmps = NS2SA_FX2( output_Fs, DELAY_BWE_TOTAL_NS ); } ELSE { #endif /* TBE on top of ACELP@16kHz */ tmps = NS2SA_FX2( output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS ); #ifndef FIX_1320_STACK_CPE_DECODER } #endif } /* Smooth transitions when switching between different technologies */ Loading Loading @@ -1542,12 +1456,7 @@ ivas_error ivas_core_dec_fx( test(); test(); test(); #ifdef FIX_1320_STACK_CPE_DECODER IF( st->hTcxDec != NULL && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) ) #else test(); IF( ( EQ_16( st->codec_mode, MODE1 ) && st->hTcxDec != NULL ) && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) ) #endif { Word16 exp_prev_synth_buffer = 0, exp_old_out = 0, exp_delay_buf_out = 0, exp_ouput = 0, exp_synth_history = 0; move16(); Loading
lib_dec/ivas_cpe_dec_fx.c +0 −182 Original line number Diff line number Diff line Loading @@ -51,9 +51,7 @@ static void read_stereo_mode_and_bwidth_fx( CPE_DEC_HANDLE hCPE, const Decoder_S static void stereo_mode_combined_format_dec_fx( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); #ifdef FIX_1320_STACK_CPE_DECODER static ivas_error stereo_dft_dec_main( CPE_DEC_HANDLE hCPE, const Word32 ivas_total_brate, const Word16 n_channels, Word32 *p_res_buf_fx, Word32 *output[], Word32 outputHB[][L_FRAME48k], const Word16 output_frame, const Word32 output_Fs ); #endif /*--------------------------------------------------------------------------* Loading @@ -75,12 +73,7 @@ ivas_error ivas_cpe_dec_fx( Word16 last_bwidth; Word16 tdm_ratio_idx; Word32 outputHB_fx[CPE_CHANNELS][L_FRAME48k]; /* buffer for output HB synthesis, both channels */ /* Q11 */ #ifdef FIX_1320_STACK_CPE_DECODER Word32 *res_buf_fx = NULL; /* Q8 */ #else Word16 q_res_buf; Word32 res_buf_fx[STEREO_DFT_N_8k]; /* Q(q_res_buf) */ #endif CPE_DEC_HANDLE hCPE; STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft; Decoder_State **sts; Loading @@ -91,10 +84,6 @@ ivas_error ivas_cpe_dec_fx( error = IVAS_ERR_OK; move32(); #ifndef FIX_1320_STACK_CPE_DECODER q_res_buf = Q8; move16(); #endif push_wmops( "ivas_cpe_dec" ); Loading Loading @@ -353,10 +342,8 @@ ivas_error ivas_cpe_dec_fx( } ELSE { #ifdef FIX_1320_STACK_CPE_DECODER res_buf_fx = outputHB_fx[0]; /* note: temporarily reused buffer */ #endif test(); IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { Loading Loading @@ -619,177 +606,10 @@ ivas_error ivas_cpe_dec_fx( test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hConfigDft->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) ) { #ifdef FIX_1320_STACK_CPE_DECODER IF( NE_32( ( error = stereo_dft_dec_main( hCPE, ivas_total_brate, n_channels, res_buf_fx, output, outputHB_fx, output_frame, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) { return error; } #else Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; // q_dft set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX ); set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX ); /* core decoder */ IF( NE_32( ( error = ivas_core_dec_fx( NULL, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, DFT_fx, 0 ) ), IVAS_ERR_OK ) ) { return error; } // Scaling of DFT's Word16 shift; Word32 tmp1, tmp2; Word16 shift1, shift2; maximum_abs_32_fx( DFT_fx[0], STEREO_DFT_BUF_MAX, &tmp1 ); maximum_abs_32_fx( DFT_fx[1], STEREO_DFT_BUF_MAX, &tmp2 ); IF( tmp1 == 0 ) { shift1 = Q31; move16(); } ELSE { shift1 = norm_l( tmp1 ); } IF( tmp2 == 0 ) { shift2 = Q31; move16(); } ELSE { shift2 = norm_l( tmp2 ); } shift = s_min( shift1, shift2 ); IF( NE_16( shift, 31 ) ) { shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */ IF( GT_16( shift, hCPE->hStereoDft->q_dft ) ) { Scale_sig32( DFT_fx[0], STEREO_DFT_BUF_MAX, sub( shift, hCPE->hStereoDft->q_dft ) ); // shift Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, sub( shift, hCPE->hStereoDft->q_dft ) ); // shift hCPE->hStereoDft->q_dft = shift; move16(); } } ELSE { hCPE->hStereoDft->q_dft = Q8; move16(); } /* DFT Stereo residual decoding */ test(); IF( hCPE->hStereoDft->res_cod_band_max > 0 && !st_ivas->bfi ) { Word16 q; Word16 q_out_DFT[2]; q = Q11; move16(); Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, ( ( 2 * NB_SUBFR16k ) + 2 ), -( Q10 ) ); // Q16->Q6 stereo_dft_dec_res_fx( hCPE, res_buf_fx, q_res_buf, output[1] ); Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, ( ( 2 * NB_SUBFR16k ) + 2 ), 10 ); // Q6->Q16 Scale_sig32( output[1], L_FRAME8k, ( Q11 - Q15 ) ); // Q15 -> Q11 q_out_DFT[0] = q_out_DFT[1] = hCPE->hStereoDft->q_dft; move16(); move16(); stereo_dft_dec_analyze_fx( hCPE, output[1], DFT_fx, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0, &q, q_out_DFT ); Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, sub( hCPE->hStereoDft->q_dft, q_out_DFT[1] ) ); // q_dft } /* DFT stereo CNG */ { Word16 q_dft; q_dft = hCPE->hStereoDft->q_dft; move16(); stereo_dtf_cng_fx( hCPE, ivas_total_brate, DFT_fx, output_frame, q_dft ); } /* decoding */ IF( EQ_16( hCPE->nchan_out, 1 ) ) { IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; move16(); FOR( Word16 ii = 0; ii < (Word16) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ) ); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } hCPE->hStereoDft->first_frame = 0; move16(); } scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // q_dft hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; move16(); stereo_dft_unify_dmx_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata ); scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q15, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // Q15 hCPE->hStereoDft->q_res_cod_mem_fx = Q15; move16(); } ELSE { { IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; move16(); FOR( Word16 ii = 0; ii < (Word16) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ) ); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } hCPE->hStereoDft->first_frame = 0; move16(); } scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // q_dft hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; move16(); } stereo_dft_dec_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q15, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // Q15 hCPE->hStereoDft->q_res_cod_mem_fx = Q15; move16(); } FOR( n = 0; n < hCPE->nchan_out; n++ ) { Scale_sig32( output[n], L_FRAME48k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[n] = hCPE->hStereoDft->q_dft; move16(); } /* synthesis iFFT */ FOR( n = 0; n < hCPE->nchan_out; n++ ) { stereo_dft_dec_synthesize_fx( hCPE, DFT_fx, n, output[n], output_frame ); } // delete below FOR( n = 0; n < hCPE->nchan_out; n++ ) { Scale_sig32( output[n], L_FRAME48k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[n] = Q11; move16(); } #endif } ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { Loading Loading @@ -893,7 +713,6 @@ ivas_error ivas_cpe_dec_fx( return error; } #ifdef FIX_1320_STACK_CPE_DECODER /*------------------------------------------------------------------------- * stereo_dft_dec_main() Loading Loading @@ -1099,7 +918,6 @@ static ivas_error stereo_dft_dec_main( return IVAS_ERR_OK; } #endif /*------------------------------------------------------------------------- * create_cpe_dec_fx() Loading