Commit dd187ac5 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch '394-clicks-in-ism-dtx-for-cng-acelp-active-tcx-transitions' into 'main'

[non-BE] Resolve "Clicks in ISM DTX for CNG (ACELP) -> active (TCX) transitions"

See merge request !534
parents 1799dca1 530afe36
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
+7 −4
Original line number Diff line number Diff line
@@ -5860,6 +5860,9 @@ ivas_error core_switching_post_dec(
    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          */
+16 −9
Original line number Diff line number Diff line
@@ -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()
@@ -556,6 +556,9 @@ ivas_error core_switching_post_dec(
    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   */
+4 −0
Original line number Diff line number Diff line
@@ -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;
        }

lib_dec/ivas_core_dec.c

100755 → 100644
+4 −0
Original line number Diff line number Diff line
@@ -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;
        }
Loading