Commit 23ab02e5 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

High MLD issue fix

parent d54739f5
Loading
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -951,7 +951,7 @@ static void sp2cart_fx(
    q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15
    q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15
    q[1] = mult( getCosWord16( ph2 ), s1 );   // q15
    q[0] = getCosWord16( ph1 );               // q14
    q[0] = shl_sat(getCosWord16( ph1 ), 1);   //q15

    return;
}
@@ -975,12 +975,12 @@ static Word16 calc_n2_fx(
    const Word16 ph1 )
{
    Word16 n2;
    Word16 temp = mult( 23040, getSinWord16( ph1 ) ); // q8
    Word32 temp = L_mult( 23040, getSinWord16( ph1 ) ); // q8
    n2 = round_fx( temp );

    n2 = shr(n2, 7);
    IF( EQ_16( s_and( n2, 1 ), 0 ) )
    {
        n2 = add( n2, ONE_IN_Q8 );
        n2 = add( n2, 1 );
    }

    return n2;
@@ -1015,19 +1015,21 @@ static Word16 calc_n3_fx(
    const Word16 ph2 )
{
    Word16 n3;
    Word16 temp1 = mult( 23040, getSinWord16( ph1 ) );   // q7 + q15 - q15
    n3 = round_fx( mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15
    Word16 temp1 = mult( getSinWord16( ph2 ), getSinWord16( ph1 ) );   // q7 + q15 - q15
    n3 = round_fx( L_mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15

    n3 = shr(n3, 8);

    IF( EQ_16( n3, 0 ) )
    {
        n3 = ONE_IN_Q7;
        n3 = 1;
        move16();
    }
    ELSE
    {
        IF( ( s_and( n3, 1 ) ) == 1 )
        {
            n3 = add( n3, ONE_IN_Q7 );
            n3 = add( n3, 1 );
        }
    }

@@ -1438,7 +1440,7 @@ void pca_dec_s3_fx(
    Word16 num_fx = 12868;

    d_fx = idiv1616( num_fx, n1 );   // Q12
    ph1_q_fx = mult( index1, d_fx ); // Q12
    ph1_q_fx = i_mult( index1, d_fx ); // Q12

    n2 = calc_n2_fx( ph1_q_fx );

@@ -1467,8 +1469,8 @@ void pca_dec_s3_fx(

        num_fx = 12868;
        move16();
        d_fx = idiv1616( num_fx, n1 );   // Q12
        ph2_q_fx = mult( index2, d_fx ); // Q12
        d_fx = idiv1616( num_fx, sub(n2, 1) );   // Q12
        ph2_q_fx = i_mult( index2, d_fx ); // Q12
    }

    j = L_sub(j, ivas_pca_offset_index2[index2 + get_pca_offset_n2_fx( index1 )]);
@@ -1486,8 +1488,9 @@ void pca_dec_s3_fx(
    {
        num_fx = 6434;
        move16();
        d_fx = idiv1616( num_fx, n3 );   // Q11
        ph3_q_fx = mult( index3, d_fx ); // Q11
        d_fx = idiv1616( num_fx, n3 );   // Q10
        ph3_q_fx = round_fx(L_mult( index3, d_fx )); // Q10
        //ph3_q_fx = shl(ph3_q_fx, 2);
    }
    sp2cart_fx( ph1_q_fx, ph2_q_fx, ph3_q_fx, q_fx );

+9 −9
Original line number Diff line number Diff line
@@ -246,10 +246,10 @@ void ivas_pca_dec_fx(
        }
        ELSE
        {
            pca_dec_inv_transform_fx( hPCA, ql_fx, ql_fx, output_frame, n_channels, pcm_out_fx );
            pca_dec_inv_transform_fx( hPCA, ql_fx, qr_fx, output_frame, n_channels, pcm_out_fx );
        }

        pca_dec_update_dquat_fx( hPCA, ql_fx, ql_fx );
        pca_dec_update_dquat_fx( hPCA, ql_fx, qr_fx );
        hPCA->prev_pca_bypass = add(hPCA->prev_pca_bypass, 1);
        move16();

@@ -276,7 +276,7 @@ void ivas_pca_dec_fx(

    IF( EQ_16(pca_bypass, PCA_MODE_INACTIVE ))
    {
        pca_dec_reset_dquat_fx( ql_fx, ql_fx );
        pca_dec_reset_dquat_fx( ql_fx, qr_fx );

        IF( GT_16(hPCA->prev_pca_bypass, 1 )) //&& (hPCA->pca_off_hangover == 0))
        {
@@ -285,10 +285,10 @@ void ivas_pca_dec_fx(
        }
        ELSE
        {
            pca_dec_inv_transform_fx( hPCA, ql_fx, ql_fx, output_frame, n_channels, pcm_out_fx );
            pca_dec_inv_transform_fx( hPCA, ql_fx, qr_fx, output_frame, n_channels, pcm_out_fx );
        }

        pca_dec_update_dquat_fx( hPCA, ql_fx, ql_fx );
        pca_dec_update_dquat_fx( hPCA, ql_fx, qr_fx );

        hPCA->prev_pca_bypass = add(hPCA->prev_pca_bypass , 1);
        hPCA->prev_pca_bypass = min( hPCA->prev_pca_bypass, 2 );
@@ -299,19 +299,19 @@ void ivas_pca_dec_fx(
    IF( !bfi )
    {
        pca_dec_s3_fx( hPCA->index[0], ql_fx );
        pca_dec_s3_fx( hPCA->index[1], ql_fx );
        pca_dec_s3_fx( hPCA->index[1], qr_fx );
    }
    ELSE
    {
        /* freeze */
        // todo : check if update of prev_ql_fx is required
        Copy( hPCA->prev_ql_fx, ql_fx, IVAS_PCA_INTERP );
        Copy( hPCA->prev_qr_fx, ql_fx, IVAS_PCA_INTERP );
        Copy( hPCA->prev_qr_fx, qr_fx, IVAS_PCA_INTERP );
    }
    pca_dec_inv_transform_fx( hPCA, ql_fx, ql_fx, output_frame, n_channels, pcm_out_fx );
    pca_dec_inv_transform_fx( hPCA, ql_fx, qr_fx, output_frame, n_channels, pcm_out_fx );

    /* update for next frame */
    pca_dec_update_dquat_fx( hPCA, ql_fx, ql_fx );
    pca_dec_update_dquat_fx( hPCA, ql_fx, qr_fx );

    hPCA->prev_pca_bypass = 0;
    move16();