Commit 93562d48 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Manuel Jander
Browse files

Fix for 3GPP issue 1342: Decoder crash for Stereo at 48/64 kbps mono decoding in IMDCT_ivas_fx()

Link #1342
parent 0167cdea
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -592,11 +592,12 @@ void edxt_fx(
    const UWord16 synthesis   /* i  : nonzero for inverse Q0*/
)
{
    Word16 k, m, fac;
    Word16 k, m, fac, hdrm, tmp = 0;
    const Word16 *cosPtr, *sinPtr;
    Word16 n;
    n = 0;
    move16();
    move16();
    cosPtr = NULL;
    sinPtr = NULL;
    IF( EQ_16( length, 512 ) )
@@ -735,7 +736,23 @@ void edxt_fx(

            IF( EQ_16( length, 512 ) )
            {
                /* Scaling down re and im buffers to avoid overflow in DoRTFTn_fx if the minimum headroom is less than 4 bits */
                hdrm = s_min( L_norm_arr( re, 512 ), L_norm_arr( im, 512 ) );
                IF( LT_16( hdrm, 4 ) )
                {
                    tmp = sub( hdrm, 4 );
                    scale_sig32( re, 512, tmp );
                    scale_sig32( im, 512, tmp );
                }

                DoRTFTn_fx( re, im, 512 );

                IF( LT_16( hdrm, 4 ) )
                {
                    tmp = negate( tmp );
                    scale_sig32( re, 512, tmp );
                    scale_sig32( im, 512, tmp );
                }
            }
            ELSE /* fft() doesn't support 512 */
            {
@@ -831,7 +848,23 @@ void edxt_fx(

            IF( EQ_16( length, 512 ) )
            {
                /* Scaling down re and im buffers to avoid overflow in DoRTFTn_fx if the minimum headroom is less than 4 bits */
                hdrm = s_min( L_norm_arr( re, 512 ), L_norm_arr( im, 512 ) );
                IF( LT_16( hdrm, 4 ) )
                {
                    tmp = sub( hdrm, 4 );
                    scale_sig32( re, 512, tmp );
                    scale_sig32( im, 512, tmp );
                }

                DoRTFTn_fx( re, im, 512 );

                IF( LT_16( hdrm, 4 ) )
                {
                    tmp = negate( tmp );
                    scale_sig32( re, 512, tmp );
                    scale_sig32( im, 512, tmp );
                }
            }
            ELSE /* fft() doesn't support 512 */
            {