diff --git a/lib_com/options.h b/lib_com/options.h index a6a4b4944d2337852a2c88a917df8abe2f86b4ea..ba44aa63b9bec86b95ab89e0408f24eeceb4a588 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,8 @@ #define FIX_390_EXT_REND_MASA_META_COPY /* Nokia: Issue 390: Fixes MASA metadata copying to renderer. */ #define FIX_392_LATE_REVERB /* DLB : Issue 392: keep late reverb by default off when output config is not BINAURAL_ROOM*/ +#define FIX_ISM_DTX_CLICKS /* FhG: fix for clicks in ISM DTX for inactive to active TCX transitions */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index e89037076e09d444ba077fe2b10759fdfece64ec..51d1cb1e20c4df051f2a4f0df8b1ddd961df1176 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5856,10 +5856,13 @@ void core_switching_post_enc( ); ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ +#ifdef FIX_ISM_DTX_CLICKS + const IVAS_FORMAT ivas_format, /* i : IVAS format */ +#endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index c2a3955afba78484d27ac1a564e75a6a9f4d6113..fc331a2e9feddf5613d7087db069c065ce0e6b09 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -51,7 +51,7 @@ *---------------------------------------------------------------------*/ static void core_switch_lb_upsamp( Decoder_State *st, float *output ); -static void smoothTransitionMdctStereoDtx( float synth[], const int16_t output_frame, const int16_t delay_comp ); +static void smoothTransitionDtxToTcx( float synth[], const int16_t output_frame, const int16_t delay_comp ); /*---------------------------------------------------------------------* * core_switching_pre_dec() @@ -552,10 +552,13 @@ ivas_error core_switching_pre_dec( *---------------------------------------------------------------------*/ ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ +#ifdef FIX_ISM_DTX_CLICKS + const IVAS_FORMAT ivas_format, /* i : IVAS format */ +#endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ @@ -677,10 +680,14 @@ ivas_error core_switching_post_dec( synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta; } +#ifdef FIX_ISM_DTX_CLICKS + if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) +#else if ( st->element_mode == IVAS_CPE_MDCT && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) +#endif { /* smooth transitions to avoid pops in car noise items */ - smoothTransitionMdctStereoDtx( synth, output_frame, delay_comp ); + smoothTransitionDtxToTcx( synth, output_frame, delay_comp ); } /* Reset memories of CLDFBs */ @@ -1245,16 +1252,16 @@ static void core_switch_lb_upsamp( } /*---------------------------------------------------------------------* - * smoothTransitionMdctStereoDtx() + * smoothTransitionDtxToTcx() * - * apply smoothing to the transition part for MDCT-Stereo DTX + * apply smoothing to the transition part for inactive to active transitions in DTX *---------------------------------------------------------------------*/ #define TRANSITION_SMOOTHING_LEN_16k 15 #define TRANSITION_SMOOTHING_LEN_32k 31 #define TRANSITION_SMOOTHING_LEN_48k 47 -static void smoothTransitionMdctStereoDtx( +static void smoothTransitionDtxToTcx( float synth[], /* i/o: synthesis */ const int16_t output_frame, /* i : output frame length */ const int16_t delay_comp /* i : delay compensation in samples */ diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 23914302375ae1e39dd2cf8bccdc03c1a485d997..0dbc0feafc07ebb98963d8314b762d5e20de0e76 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -276,7 +276,11 @@ ivas_error evs_dec( * Postprocessing for ACELP/MDCT core switching *---------------------------------------------------------------------*/ +#ifdef FIX_ISM_DTX_CLICKS + if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, MONO_FORMAT, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c old mode 100755 new mode 100644 index 0811f9957afe9bb87019a364829083b89bc8d2b7..05c1f41727e87111757dd6ca304ae100226350cc --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -451,7 +451,11 @@ ivas_error ivas_core_dec( mvr2r( synth[n], hSCE->save_synth, output_frame ); } +#ifdef FIX_ISM_DTX_CLICKS + if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( 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 ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index f39951e0878b8b44fdef53a6cddc0ba6afe4d0f0..eeecd4d8fa38a1b1b501ff5c3e01ee58ae2a0144 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -243,7 +243,11 @@ ivas_error ivas_mct_dec( } /* Postprocessing for ACELP/MDCT core switching and synchronization */ +#ifdef FIX_ISM_DTX_CLICKS + if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#endif { return error; }