diff --git a/lib_com/options.h b/lib_com/options.h index b27b5da4c3e31b39f5baa95fc8ffc2c1b225b493..7976d55ed38872eaff721d16b919104efaa9a040 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,6 +102,7 @@ #define FIX_2488_PREVENT_NEG_PITCH /* VA: Fix for 2488, use saturation to prevent possible wrap-around, thus negative pitch values */ #define FIX_1547_ISMDTX_HANDLE /* VA: float issue 1547: fix use of 'hISMDTX' handle */ #define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API /* Expose Payload Type setting in RTP Header */ +#define FIX_BASOP_2491_MDCT_JBM_CLICK /* FhG: BASOP #2491: Fix Q_synth after TCX concealment (using ACELP concealment) */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 0eecfedee5ce85c5cb02452fb4e690b4c1de224e..867ecda5137846437287f8a02a960409c6fdc9d5 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -941,6 +941,9 @@ void con_tcx_fx( } ELSE { +#ifdef FIX_BASOP_2491_MDCT_JBM_CLICK + tmp_deemph = shl_sat( tmp_deemph, Q_syn ); /*Q_syn*/ +#else IF( NE_16( st->element_mode, EVS_MONO ) ) // to keep evs bit-exactness { if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) @@ -953,6 +956,7 @@ void con_tcx_fx( { tmp_deemph = shl_sat( tmp_deemph, Q_syn ); /*Q_syn*/ } +#endif st->Q_syn_factor = 0; move16(); st->Q_syn = Q_syn; diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 40688cf919ed9544c4e9b96ec261e00e53621a91..56e283a3be98c2249b3edb965426938f96bd7723 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -766,7 +766,18 @@ ivas_error ivas_core_dec_fx( *---------------------------------------------------------------------*/ /*core_switching_post_dec*/ +#ifdef FIX_BASOP_2491_MDCT_JBM_CLICK + IF( EQ_16( sts[n]->element_mode, IVAS_CPE_MDCT ) && GT_32( sts[n]->core_brate, SID_2k40 ) ) // In this case, st->Q_syn_factor was already applied earlier in ivas_mdct_core_reconstruct_fx() + { + Q_synth = sub( 15, e_sig[0] ); + } + ELSE + { + Q_synth = add( sub( 15, e_sig[0] ), st->Q_syn_factor ); + } +#else Q_synth = add( sub( 15, e_sig[0] ), st->Q_syn_factor ); +#endif IF( st->cldfbSyn != NULL ) { diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index bec9811e984287a4c37ae8aec1e14ddc43d3d2a0..58056843eb6fc00397370916450dd4c7d3b2be26 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1306,7 +1306,7 @@ typedef struct Decoder_State Word16 Q_syn; Word16 Q_syn2; Word16 Q_syn_cng; - Word16 Q_syn_factor; // This q_factor is used to avoid using fix Q0 for synth[] at the output of con_tcx_ivas_fx() and ivas_core_dec_fx(). For con_tcx_ivas_fx, it is used for two consecutive TCX concealment processes and It cannot be greater than 0. + Word16 Q_syn_factor; // This q_factor is used to avoid using fix Q0 for synth[] at the output of con_tcx_fx() and ivas_core_dec_fx(). For con_tcx_fx, it is used for two consecutive TCX concealment processes and It cannot be greater than 0. Word16 prev_Q_syn; Word16 prev_Q_bwe_exc;