Commit 167d9b1f authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for crash issue Multi-channel 7_1_4 at 256 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5

parent cd92a07b
Loading
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -804,6 +804,44 @@ Word16 getScaleFactor32( /* o: measured headroom in range [
    return i;
}

Word16 getScaleFactor32_copy(                      /* o: measured headroom in range [0..31], 0 if all x[i] == 0 */
                              const Word32 *x,     /* i: array containing 32-bit data */
                              const Word32 len_x ) /* i: length of the array to scan  */
{
    Word32 i;
    Word16 i_min, i_max;
    Word32 x_min, x_max;


    x_max = 0;
    move32();
    x_min = 0;
    move32();
    FOR( i = 0; i < len_x; i++ )
    {
        if ( x[i] >= 0 )
            x_max = L_max( x_max, x[i] );
        if ( x[i] < 0 )
            x_min = L_min( x_min, x[i] );
    }

    i_max = 0x20;
    move16();
    i_min = 0x20;
    move16();

    if ( x_max != 0 )
        i_max = norm_l( x_max );

    if ( x_min != 0 )
        i_min = norm_l( x_min );

    i_max = s_and( s_min( i_max, i_min ), 0x1F );


    return i_max;
}

Word16 normalize16( Word16 mantissa, Word16 *pexponent )
{
    Word16 tmp;
+3 −0
Original line number Diff line number Diff line
@@ -235,6 +235,9 @@ Word16 getScaleFactor32(
    const Word32 *x,      /* i  : array containing 32-bit data */
    const Word16 len_x ); /* i  : length of the array to scan  */

Word16 getScaleFactor32_copy(                       /* o: measured headroom in range [0..31], 0 if all x[i] == 0 */
                              const Word32 *x,      /* i: array containing 32-bit data */
                              const Word32 len_x ); /* i: length of the array to scan  */

/**
 * \brief normalize mantissa and update the exponent accordingly.
+1 −1
Original line number Diff line number Diff line
@@ -892,7 +892,7 @@ UWord8 apa_exec_ivas_fx(
    UWord32 statsResetThreshold, statsResetShift;
    Word16 Q_a_out;

    Q_a_out = add( getScaleFactor32( a_in, i_mult( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 );
    Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 );
    statsResetThreshold = 1637;
    move32();
    statsResetShift = 2;