diff --git a/lib_com/options.h b/lib_com/options.h index 02e0476f5fddee21609243511fd9a22f9d7b5740..311624140804888cad46e84a22a7f70884db7ba3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -87,6 +87,7 @@ #define HARMONIZE_TBE2 /* VA: basop issue 2399: Remove duplicated code: TBE, step 2 */ #define HARMONIZE_2427_GETPLC /* FhG: basop issue : 2427 Harmonizing getPLCDecision functions:*/ #define HARM_FD_BWE /* VA: harmonize core-coder FD BWE function duplications */ +#define FIX_2429_POST_DECODER #define FIX_FLOAT_1526_DIRAC_MEM_LEAK /* FhG: float issue 1526: potential memory leak in DirAC handles in case of format switching */ #define FIX_2437_HARMONIZE_ENCODERINDEX /* FhG: basop issue 2437 EncoderIndex_ivas_fx() and EncoderIndex_fx()*/ #define FIX_2385_GETTCXONLY /* FhG: issue 2385 : harmonizing getTcxonly_ivas_fx() and getTcxonly_ivas_fx() functions */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index dd0315055eebd4ec7c13d02b6c5e95371af9b189..4845e22750999a2a2ff406803ddb65bc8ca263d7 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -7394,6 +7394,7 @@ Word16 FEC_pos_dec_fx( const Word16 nBits_es_Pred /* i : number of bits for Es_pred Q */ ); +#ifndef FIX_2429_POST_DECODER void post_decoder( Decoder_State *st, Word16 synth_buf[], /* Q0 */ @@ -7404,6 +7405,9 @@ void post_decoder( ); void post_decoder_ivas_fx( +#else +void post_decoder_fx( +#endif Decoder_State *st, Word16 synth_buf[], // Q0 Word16 pit_gain[], // Q14 diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 0bc96a369d3551a2a9e869b5b34e8a8e4a82bbb6..d8eb395c56eb9e443b676283aaa43322a79fe372 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -954,7 +954,11 @@ void decoder_LPD_fx( st->last_is_cng = 0; /* Postfiltering */ +#ifdef FIX_2429_POST_DECODER + post_decoder_fx( st, synth_buf, pit_gain, pitch, signal_out, bpf_noise_buf ); +#else post_decoder( st, synth_buf, pit_gain, pitch, signal_out, bpf_noise_buf ); +#endif IF( signal_outFB ) { diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 07fb3593eb021bf09dcd893941b37b61add58974..39694bdcb070a65abea97a6d0d805fd6c01fc26b 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1402,7 +1402,11 @@ void ivas_mdct_core_reconstruct_fx( Copy_Scale_sig_32_16( st->p_bpf_noise_buf_32, st->p_bpf_noise_buf, st->L_frame, -Q11 ); // Q11 -> Q0 } +#ifdef FIX_2429_POST_DECODER + post_decoder_fx( st, synth_buf_fx, pit_gain_fx[ch], pitch[ch], x_fx_16, st->p_bpf_noise_buf ); +#else post_decoder_ivas_fx( st, synth_buf_fx, pit_gain_fx[ch], pitch[ch], x_fx_16, st->p_bpf_noise_buf ); +#endif IF( st->p_bpf_noise_buf_32 ) { diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index c3d9b2911f756467f4bd2b2b560cb2ddd038d551..19025b4031211ea9deb377bd6e50a69153a46cfb 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -788,7 +788,11 @@ void stereo_tcx_core_dec_fx( /* Postfiltering */ +#ifdef FIX_2429_POST_DECODER + post_decoder_fx( st, synth_buf_fx, pit_gain_fx, pitch, signal_out_fx, st->p_bpf_noise_buf ); +#else post_decoder( st, synth_buf_fx, pit_gain_fx, pitch, signal_out_fx, st->p_bpf_noise_buf ); +#endif test(); IF( st->p_bpf_noise_buf_32 && st->tcxonly == 0 ) diff --git a/lib_dec/post_dec_fx.c b/lib_dec/post_dec_fx.c index 8bf9380b3fbe89ad809c452874a919b35cb61be8..6d89900c27b9befc3db9f145960430be1d71e1b2 100644 --- a/lib_dec/post_dec_fx.c +++ b/lib_dec/post_dec_fx.c @@ -20,6 +20,7 @@ static void bass_pf_1sf_delay( Word16 *syn, Word16 *T_sf, Word16 *gainT_sf, Word * Perform post-processing *---------------------------------------------------------------------*/ +#ifndef FIX_2429_POST_DECODER void post_decoder( Decoder_State *st, Word16 synth_buf[], /* Q0 */ @@ -173,6 +174,9 @@ void post_decoder( void post_decoder_ivas_fx( +#else +void post_decoder_fx( +#endif Decoder_State *st, Word16 synth_buf[], // Q0 Word16 pit_gain[], // Q14 @@ -234,11 +238,29 @@ void post_decoder_ivas_fx( IF( pfstat_on_previous ) { Copy( st->hPFstat->mem_pf_in + L_SYN_MEM - M, synth - M, M ); +#ifdef FIX_2429_POST_DECODER + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + Residu3_fx( st->old_Aq_12_8_fx, synth, synth_buf, L_SUBFR, 1 ); + E_UTIL_synthesis( 1, st->old_Aq_12_8_fx, synth_buf, synth2, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); + scale_st_fx( synth, synth2, &st->hPFstat->gain_prec, L_SUBFR ); + blend_subfr2_fx( synth2 + L_SUBFR / 2, synth + L_SUBFR / 2, synth2 + L_SUBFR / 2 ); + } + ELSE + { + Word16 L_subfr = idiv1616( st->L_frame, st->nb_subfr ); + Residu3_fx( st->old_Aq_12_8_fx, synth, synth_buf, L_subfr, 1 ); + E_UTIL_synthesis( 1, st->old_Aq_12_8_fx, synth_buf, synth2, L_subfr, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); + scale_st_fx( synth, synth2, &st->hPFstat->gain_prec, L_subfr ); + blend_subfr2_fx( synth2 + shr( L_subfr, 1 ), synth + shr( L_subfr, 1 ), synth2 + shr( L_subfr, 1 ) ); + } +#else Word16 L_subfr = idiv1616( st->L_frame, st->nb_subfr ); Residu3_fx( st->old_Aq_12_8_fx, synth, synth_buf, L_subfr, 1 ); E_UTIL_synthesis( 1, st->old_Aq_12_8_fx, synth_buf, synth2, L_subfr, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); scale_st_fx( synth, synth2, &st->hPFstat->gain_prec, L_subfr ); blend_subfr2_fx( synth2 + shr( L_subfr, 1 ), synth + shr( L_subfr, 1 ), synth2 + shr( L_subfr, 1 ) ); +#endif } } ELSE diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index 27983b42e469050c699741b2e31c1c0e20c55090..6130388759319652b214f977909e0af69db4215a 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -1028,7 +1028,11 @@ void update_decoder_LPD_cng( st->bpf_gain_param = 0; move16(); +#ifdef FIX_2429_POST_DECODER + post_decoder_fx( st, buf_synth, pf_gain, pf_pitch, timeDomainBuffer, bpf_noise_buf ); +#else post_decoder( st, buf_synth, pf_gain, pf_pitch, timeDomainBuffer, bpf_noise_buf ); +#endif return; }