Commit 1a2c179e authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2480-TonalMDCTConceal_Detect_fx' into 'main'

Fixes issue: 2480 "Harmonize TonalMDCTConceal_Detect_fx() and TonalMDCTConceal_Detect_ivas_fx()"

See merge request !2895
parents 6f6001c2 26d69d3a
Loading
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1681,6 +1681,7 @@ void ivas_mdct_tcx10_bit_distribution_fx(
    const Word16 nTnsBitsTCX10[NB_DIV]                          /* i  : TNS bits                                */
);

#ifndef FIX_2480_HARM_TONALMDCT
void TonalMDCTConceal_Detect_ivas_fx(
    const TonalMDCTConcealPtr hTonalMDCTConc,
    const Word32 pitchLag,
@@ -1688,7 +1689,15 @@ void TonalMDCTConceal_Detect_ivas_fx(
    const PsychoacousticParameters *psychParamsCurrent,
    Word16 element_mode 
);

#else
void TonalMDCTConceal_Detect_fx(
    const TonalMDCTConcealPtr hTonalMDCTConc,
    const Word32 pitchLag,
    Word16* numIndices,
    const PsychoacousticParameters* psychParamsCurrent,
    Word16 element_mode
);
#endif // !FIX_2480_HARM_TONALMDCT
ivas_error stereo_dft_dec_create_fx(
    STEREO_DFT_DEC_DATA_HANDLE *hStereoDft,                     /* i/o: decoder DFT stereo handle               */
    const Word32 element_brate,                                 /* i  : element bitrate                         */
+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@
#define FIX_2455_HARMONIZE_configureFdCngEnc            /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */
#define FIX_2463_EVS_BWE_LSF                            /* VA: basop issue 2463: harmonize calling of Quant_BWE_LSF_fx() */
#define FIX_2452_HQ_CORE_PEAQ_AVR_RATIO_HARM            /* Eri: Basop issue 2453: Fix alignment of peak_avrg_ratio_fx */
#define FIX_2480_HARM_TONALMDCT                         /* FhG: basop issue 2480: Harmonize TonalMDCTConceal_Detect_fx() and TonalMDCTConceal_Detect_ivas_fx() */

/* #################### End BE switches ################################## */

+2 −0
Original line number Diff line number Diff line
@@ -5708,12 +5708,14 @@ void TonalMDCTConceal_UpdateState_fx(
    const Word16 badBlock,
    const Word8 tonalConcealmentActive );

#ifndef FIX_2480_HARM_TONALMDCT
void TonalMDCTConceal_Detect_fx(
    const TonalMDCTConcealPtr self, /*IN */
    const Word32 pitchLag,          /*IN */
    Word16 *umIndices,              /*OUT*/
    const Word16 element_mode       /* IN */
);
#endif // !FIX_2480_HARM_TONALMDCT

void TonalMDCTConceal_Apply_fx(
    const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
+5 −0
Original line number Diff line number Diff line
@@ -449,6 +449,7 @@ Word16 GetPLCModeDecision_fx(
                    {
                        pitch = L_add( st->old_fpitch, 0 ); /*Q16*/
                    }
#ifndef FIX_2480_HARM_TONALMDCT
                    IF( NE_16( st->element_mode, EVS_MONO ) )
                    {
                        TonalMDCTConceal_Detect_ivas_fx( st->hTonalMDCTConc, pitch, &numIndices, ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ), st->element_mode );
@@ -457,6 +458,10 @@ Word16 GetPLCModeDecision_fx(
                    {
                        TonalMDCTConceal_Detect_fx( st->hTonalMDCTConc, pitch, &numIndices, st->element_mode );
                    }
#else
                    TonalMDCTConceal_Detect_fx( st->hTonalMDCTConc, pitch, &numIndices, ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ), st->element_mode );
#endif // !FIX_2480_HARM_TONALMDCT


                    test();
                    test();
+54 −3
Original line number Diff line number Diff line
@@ -927,6 +927,7 @@ static void CalcMDXT(
    return;
}

#ifndef FIX_2480_HARM_TONALMDCT
void TonalMDCTConceal_Detect_fx(
    const TonalMDCTConcealPtr hTonalMDCTConc,
    const Word32 pitchLag, /*15Q16*/
@@ -1052,31 +1053,58 @@ void TonalMDCTConceal_Detect_fx(

    return;
}

#endif // !FIX_2480_HARM_TONALMDCT
#ifndef FIX_2480_HARM_TONALMDCT
void TonalMDCTConceal_Detect_ivas_fx(
    const TonalMDCTConcealPtr hTonalMDCTConc,
    const Word32 pitchLag, /*15Q16*/
    Word16 *numIndices,
    const PsychoacousticParameters *psychParamsCurrent,
    Word16 element_mode )
#else
void TonalMDCTConceal_Detect_fx(
    const TonalMDCTConcealPtr hTonalMDCTConc,
    const Word32 pitchLag, /*15Q16*/
    Word16 *numIndices,
    const PsychoacousticParameters *psychParamsCurrent,
    Word16 element_mode )
#endif // !FIX_2480_HARM_TONALMDCT
{
    Word32 secondLastMDST[L_FRAME_MAX];
    set32_fx( secondLastMDST, 0, L_FRAME_MAX );


    Word32 secondLastMDCT[L_FRAME_MAX];
    Word16 secondLastMDCT_exp;
    Word32 *powerSpectrum = secondLastMDST;
    Word16 i, powerSpectrum_exp, secondLastMDST_exp, s;
    Word16 nSamples;
    // Word16 nBands;
    Word32 sns_int_scf_fx[FDNS_NPTS];
    set32_fx( sns_int_scf_fx, 0, FDNS_NPTS );


    nSamples = hTonalMDCTConc->nSamples;
    move16();

#ifndef FIX_2480_HARM_TONALMDCT
    secondLastMDST_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/
    move16();
    secondLastMDCT_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/
    move16();
#else
    IF( EQ_16( element_mode, EVS_MONO ) )
    {
        secondLastMDST_exp = 16; /*time signal Q-1*/
        secondLastMDCT_exp = 16; /*time signal Q-1*/
    }
    ELSE
    {
        secondLastMDST_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/
        secondLastMDCT_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/
    }
#endif // !FIX_2480_HARM_TONALMDCT
    move16();
    move16();
    test();
    test();
    test();
@@ -1108,8 +1136,15 @@ void TonalMDCTConceal_Detect_ivas_fx(
                move16();
                nSamples = hTonalMDCTConc->nNonZeroSamples;
                move16();

#ifndef FIX_2480_HARM_TONALMDCT
                s = sub( getScaleFactor32( secondLastMDST, nSamples ), 1 );
#else
                s = getScaleFactor32( secondLastMDST, nSamples );
                IF( NE_16( element_mode, EVS_MONO ) )
                {
                    s = sub( s, 1 );
                }
#endif // !FIX_2480_HARM_TONALMDCT

                FOR( i = 0; i < nSamples; i++ )
                {
@@ -1118,7 +1153,15 @@ void TonalMDCTConceal_Detect_ivas_fx(
                }
                secondLastMDST_exp = sub( secondLastMDST_exp, s );
                move16();
#ifndef FIX_2480_HARM_TONALMDCT
                s = sub( getScaleFactor32( secondLastMDCT, nSamples ), 1 );
#else
                s = getScaleFactor32( secondLastMDCT, nSamples );
                IF( NE_16( element_mode, EVS_MONO ) )
                {
                    s = sub( s, 1 );
                }
#endif // !FIX_2480_HARM_TONALMDCT

                FOR( i = 0; i < nSamples; i++ )
                {
@@ -1136,8 +1179,16 @@ void TonalMDCTConceal_Detect_ivas_fx(
                Word16 temp_power_spectrum_q = 0;
                nSamples = hTonalMDCTConc->nNonZeroSamples;
                move16();
#ifndef FIX_2480_HARM_TONALMDCT
                Copy_Scale_sig_16_32_DEPREC( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 );
                temp_power_spectrum_q = add( Q15, sub( 15, hTonalMDCTConc->secondLastPowerSpectrum_exp ) );
#else
                IF( NE_16( element_mode, EVS_MONO ) )
                {
                    Copy_Scale_sig_16_32_DEPREC( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 );
                    temp_power_spectrum_q = add( Q15, sub( 15, hTonalMDCTConc->secondLastPowerSpectrum_exp ) );
                }
#endif // !FIX_2480_HARM_TONALMDCT
                IF( psychParamsCurrent == NULL )
                {
                    mdct_shaping_16( hTonalMDCTConc->secondLastPowerSpectrum, hTonalMDCTConc->nSamplesCore, nSamples,