Commit 7de528e3 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Manuel Jander
Browse files

Fix for 3GPP issue 1480: BASOP assert in MDCT-Stereo Stereo pre-processing with music signal

Link #1480
parent c9eb9105
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -901,8 +901,8 @@ static UWord16 enc_ste_pre_mdct(
        absMagnR_fx = Sqrt32( L_add( Mpy_32_32( sigR1_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI1_fx[s], sigI1_fx[s] ) ), &absMagnR_e );

        corr_fx = L_add( corr_fx, L_add( Mpy_32_32( sigR0_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI0_fx[s], sigI1_fx[s] ) ) ); // q_com*2 - 31
        sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) );                             // q_com -1
        sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) );                             // q_com - 1
        sumL_64fx = W_add( sumL_64fx, W_add( sigR0_fx[s], sigI0_fx[s] ) );                                                 // q_com
        sumR_64fx = W_add( sumR_64fx, W_add( sigR1_fx[s], sigI1_fx[s] ) );                                                 // q_com
        sumMagnL_fx = BASOP_Util_Add_Mant32Exp( sumMagnL_fx, sumMagnL_e, absMagnL_fx, absMagnL_e, &sumMagnL_e );
        sumMagnR_fx = BASOP_Util_Add_Mant32Exp( sumMagnR_fx, sumMagnR_e, absMagnR_fx, absMagnR_e, &sumMagnR_e );
        sumPrdLR_fx = BASOP_Util_Add_Mant32Exp( sumPrdLR_fx, sumPrdLR_e, Mpy_32_32( absMagnL_fx, absMagnR_fx ), add( absMagnL_e, absMagnR_e ), &sumPrdLR_e );
@@ -914,7 +914,14 @@ static UWord16 enc_ste_pre_mdct(
    temp1 = L_shl( preproLen, x1 );
    corr_fx = Mpy_32_32( corr_fx, temp1 );
    x1 = sub( 62, add( shl( *q_com, 1 ), x1 ) );
    corr_fx = BASOP_Util_Add_Mant32Exp( corr_fx, x1, Mpy_32_32( sumL_fx, sumR_fx ), sub( 62, shl( sub( *q_com, 1 ), 1 ) ), &x1 );

    x2 = W_norm( sumL_64fx );
    sumL_fx = W_extract_h( W_shl( sumL_64fx, x2 ) );

    x3 = W_norm( sumR_64fx );
    sumR_fx = W_extract_h( W_shl( sumR_64fx, x3 ) );

    corr_fx = BASOP_Util_Add_Mant32Exp( corr_fx, x1, Mpy_32_32( sumL_fx, sumR_fx ), sub( 62, add( sub( add( *q_com, x2 ), 32 ), sub( add( *q_com, x3 ), 32 ) ) ), &x1 );

    IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( corr_fx, x1, -maxSqrValue_fx, 52 ), -1 ) )
    {