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

Merge branch '3gpp_issue_1507_fix' into 'main'

Fix for 3GPP issue 1507: BASOP decoder asserts in ivas_hq_phase_ecu_fx with...

See merge request !1455
parents ed912517 d380e91f
Loading
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -188,6 +188,8 @@ Word32 imax_pos_fx(
    Word32 posi, y1, y2, y3, y3_y1, y2i;
    Word32 ftmp_den1, ftmp_den2;
    Word16 q_div_2i, q_div_posi;
    Word64 W_tmp;
    Word16 shift1, shift2;
    /* Seek the extrema of the parabola P(x) defined by 3 consecutive points so that P([-1 0 1]) = [y1 y2 y3] */
    y1 = y[0]; /* Qx */
    move32();
@@ -196,8 +198,12 @@ Word32 imax_pos_fx(
    y3 = y[2]; /* Qx */
    move32();
    y3_y1 = L_sub( y3, y1 );                          /* Qx */
    ftmp_den1 = L_sub( L_add( y1, y3 ), L_shl( y2, 1 ) );             /* Qx */
    ftmp_den2 = L_shl( L_sub( L_sub( L_shl( y2, 1 ), y1 ), y3 ), 1 ); /* Qx */
    W_tmp = W_sub( W_add( y1, y3 ), W_shl( y2, 1 ) ); /* Qx */
    shift1 = W_norm( W_tmp );
    ftmp_den1 = W_extract_h( W_shl( W_tmp, shift1 ) );            /* Qx + shift1 - 32 */
    W_tmp = W_shl( W_sub( W_sub( W_shl( y2, 1 ), y1 ), y3 ), 1 ); /* Qx */
    shift2 = W_norm( W_tmp );
    ftmp_den2 = W_extract_h( W_shl( W_tmp, shift2 ) ); /* Qx + shift2 - 32 */

    test();
    IF( ( ftmp_den2 == 0 ) || ( ftmp_den1 == 0 ) )
@@ -206,6 +212,7 @@ Word32 imax_pos_fx(
    }

    y2i = Mpy_32_16_1( Mpy_32_16_1( y3_y1, BASOP_Util_Divide3232_Scale( y3_y1, ftmp_den1, &q_div_2i ) ), (Word16) ( 0xF000 ) ); /* q_div_2i */
    q_div_2i = sub( add( q_div_2i, shift1 ), 32 );
    IF( q_div_2i < 0 )
    {
        y2i = L_shl( y2i, q_div_2i );
@@ -219,6 +226,7 @@ Word32 imax_pos_fx(
    }
    /* their corresponding normalized locations */
    posi = BASOP_Util_Divide3232_Scale( y3_y1, ( ftmp_den2 ), &q_div_posi ); /* q_div_posi */
    q_div_posi = sub( add( q_div_posi, shift2 ), 32 );
    IF( ( q_div_posi != 0 ) )
    {
        posi = L_shl( posi, q_div_posi );