Commit b6615a96 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fixes some of the high MLD cases in Multichannel format test cases

parent aa6da634
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5964,7 +5964,7 @@ void TonalMDCTConceal_Apply(
void TonalMDCTConceal_Apply_ivas_fx(
    TonalMDCTConcealPtr hTonalMDCTConc,  /*IN */
    Word32 *mdctSpectrum,                /*IN/OUT*/
    Word16 *mdctSpectrum_exp,           /*IN */
    Word16 mdctSpectrum_exp[L_FRAME48k], /*IN */
    const PsychoacousticParameters *psychParamsCurrent );

/* Conceals the lost frame using the FD signal previously stored using
+14 −23
Original line number Diff line number Diff line
@@ -4911,42 +4911,33 @@ void decoder_tcx_noiseshaping_igf_fx(
        set32_fx( x_fx + L_spec, 0, sub( L_frameTCX, L_spec ) );
    }

    Word16 prev_x_e, curr_x_e;
    prev_x_e = *x_e;
    move16();

    /* PLC: [TCX: Tonal Concealment] */
    test();
    test();
    IF( bfi && st->tonal_mdct_plc_active && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
    {
        TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, x_e, st->hTcxCfg->psychParamsCurrent );
        Word16 tmp_x_fx_exp[L_FRAME48k], temp = -MAX_16, i;
        move16();

        set16_fx( tmp_x_fx_exp, *x_e, L_frameTCX );
        TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, tmp_x_fx_exp, st->hTcxCfg->psychParamsCurrent );

        /* If exponent has been updated after TonalMDCTConceal_Apply, then shift the spectrum to common exponent. */
        curr_x_e = *x_e;
        move16();
        IF( NE_16( curr_x_e, prev_x_e ) )
        {
            *x_e = s_max( curr_x_e, prev_x_e );
        FOR( i = 0; i < L_frameTCX; i++ )
        {
                Word16 n_idx = st->hTonalMDCTConc->pTCI->numIndexes;
                Word16 l_idx = st->hTonalMDCTConc->pTCI->lowerIndex[0];
                Word16 u_idx = st->hTonalMDCTConc->pTCI->upperIndex[n_idx - 1];
                test();
                IF( GE_16( i, l_idx ) && LE_16( i, u_idx ) )
                {
                    x_fx[i] = L_shr( x_fx[i], sub( *x_e, curr_x_e ) );
                    move32();
            temp = s_max( temp, tmp_x_fx_exp[i] );
        }
                ELSE

        {
                    x_fx[i] = L_shr( x_fx[i], sub( *x_e, prev_x_e ) );
            *x_e = temp;
            move16();
            FOR( i = 0; i < L_frameTCX; i++ )
            {
                x_fx[i] = L_shr( x_fx[i], sub( temp, tmp_x_fx_exp[i] ) );
                move32();
            }
        }
    }
    }

    test();
    IF( st->hTonalMDCTConc != NULL && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
+14 −30
Original line number Diff line number Diff line
@@ -2654,45 +2654,29 @@ void ivas_mdct_core_tns_ns_fx(

        IF( ( bfi != 0 ) && ( st->tonal_mdct_plc_active != 0 ) )
        {
            Word16 q_x, q_x_old;
            FOR( Word16 i = 0; i < FDNS_NPTS; i++ )
            Word16 tmp_x_fx_exp[L_FRAME48k], temp = -MAX_16, i;
            move16();
            FOR( i = 0; i < FDNS_NPTS; i++ )
            {
                st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e = s_max( st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i] );
            }
            q_x_old = sub( 31, x_e[ch][0] );
            TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx[ch][0], &x_e[ch][0], st->hTcxCfg->psychParamsCurrent );
            q_x = sub( 31, x_e[ch][0] );
            // Fix to float
            IF( LT_16( q_x_old, q_x ) )
            {
                x_e[ch][0] = sub( 31, q_x_old );
                move16();
                FOR( Word16 i = 0; i < st->hTonalMDCTConc->pTCI->numIndexes; i++ )
                {
                    FOR( Word16 l = st->hTonalMDCTConc->pTCI->lowerIndex[i]; l <= st->hTonalMDCTConc->pTCI->upperIndex[i]; l++ )

            set16_fx( tmp_x_fx_exp, x_e[ch][0], L_FRAME48k );
            TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx[ch][0], tmp_x_fx_exp, st->hTcxCfg->psychParamsCurrent );

            FOR( i = 0; i < L_FRAME48k; i++ )
            {
                        x_fx[ch][0][l] = L_shr( x_fx[ch][0][l], sub( q_x, q_x_old ) );
                        move32();
                    }
                temp = s_max( temp, tmp_x_fx_exp[i] );
            }
            }
            ELSE

            {
                x_e[ch][0] = sub( 31, q_x );
                x_e[ch][0] = temp;
                move16();
                FOR( Word16 i = 0; i < st->hTonalMDCTConc->pTCI->numIndexes; i++ )
                {
                    FOR( Word16 l = 0; l < st->hTonalMDCTConc->pTCI->lowerIndex[i]; l++ )
                FOR( i = 0; i < L_FRAME48k; i++ )
                {
                        x_fx[ch][0][l] = L_shr( x_fx[ch][0][l], sub( q_x_old, q_x ) );
                    x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], sub( temp, tmp_x_fx_exp[i] ) );
                    move32();
                }
                    FOR( Word16 l = st->hTonalMDCTConc->pTCI->upperIndex[i] + 1; l < L_spec[ch]; l++ )
                    {
                        x_fx[ch][0][l] = L_shr( x_fx[ch][0][l], sub( q_x_old, q_x ) );
                        move32();
                    }
                }
            }
        }

+5 −4
Original line number Diff line number Diff line
@@ -2915,7 +2915,7 @@ void TonalMDCTConceal_Apply(
void TonalMDCTConceal_Apply_ivas_fx(
    TonalMDCTConcealPtr hTonalMDCTConc,   /*IN */
    Word32 *mdctSpectrum,                 /*IN/OUT*/
    Word16 *mdctSpectrum_exp,           /*IN */
    Word16 mdctSpectrum_exp[L_FRAME_MAX], /*IN */
    const PsychoacousticParameters *psychParamsCurrent )

{
@@ -3081,7 +3081,8 @@ void TonalMDCTConceal_Apply_ivas_fx(
                /* getCosWord16 returns 1Q14*/
                mdctSpectrum[l] = Mpy_32_16_1( powerSpectrum[l], getCosWord16( extract_l( currentPhase ) ) );
                move32();
                *mdctSpectrum_exp = add( powerSpectrum_exp, 1 ); // getCosWord16 returns Q14 (exp is 1)
                mdctSpectrum_exp[l] = add( powerSpectrum_exp, 1 ); // getCosWord16 returns Q14 (exp is 1)d
                move16();
            }
        }
    }