Commit c3b58b68 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

replaced some shr_o by shr_sat

parent d15120cb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -197,7 +197,11 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
    {
        FOR( i = 0; i < L; i++ )
        {
#ifdef ISSUE_1772_replace_shr_o
            L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/
#else
            L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_o( x[i], shift, &Overflow ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/
#endif
            x[i] = round_fx_o( L_tmp, &Overflow );                                                                           /*Qx-shift*/
            move16();
        }
+8 −0
Original line number Diff line number Diff line
@@ -97,7 +97,11 @@ void ivas_fine_gain_pred_fx(

                    /*gp *= 1.0f - 0.05f / accuracy; */
                    tmp = div_s( 13107, accuracy );                /* 0.05 in Q18 */
#ifdef ISSUE_1772_replace_shr_o
                    tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
#else
                    tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */
#endif
                    tmp = sub( 32767, tmp );
                    tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
                    gp = mult_r( tmp, gp );    /*15+12+1-16=12 */
@@ -205,7 +209,11 @@ void fine_gain_pred_fx(

                    /*gp *= 1.0f - 0.05f / accuracy; */
                    tmp = div_s( 13107, accuracy );                /* 0.05 in Q18 */
#ifdef ISSUE_1772_replace_shr_o
                    tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
#else
                    tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */
#endif
                    tmp = sub( 32767, tmp );
                    tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
                    gp = mult_r( tmp, gp );    /*15+12+1-16=12 */
+10 −0
Original line number Diff line number Diff line
@@ -188,14 +188,20 @@ void syn_filt_fx(
    Word16 *yy;
    Word32 s;
    Word16 q;
#ifndef ISSUE_1772_replace_shr_o
    Flag Overflow = 0;
    move16();
#endif
    Word16 a0;

    yy = &buf[0];
    q = add( norm_s( a[0] ), 1 );

#ifdef ISSUE_1772_replace_shr_o
    a0 = shr_sat( a[0], shift ); /* input / 2^shift */
#else
    a0 = shr_o( a[0], shift, &Overflow ); /* input / 2^shift */
#endif

    /*------------------------------------------------------------------*
     * copy initial filter states into synthesis buffer and do synthesis
@@ -373,7 +379,11 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W
     *-----------------------------------------------------------------------*/
    mem += m; /*move16();*/

#ifdef ISSUE_1772_replace_shr_o
    a0 = shr_sat( a[0], shift ); /* input / 2^shift */
#else
    a0 = shr_o( a[0], shift, &Overflow ); /* input / 2^shift */
#endif
    /*-----------------------------------------------------------------------*
     * Do the filtering
     *-----------------------------------------------------------------------*/
+8 −0
Original line number Diff line number Diff line
@@ -638,7 +638,11 @@ void ivas_HQ_FEC_Mem_update_fx(
            exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] );
            tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) );
            exp = add( 15, sub( exp1, exp2 ) );
#ifdef ISSUE_1772_replace_shr_o
            *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow );
#else
            *mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow );
#endif
            move16();
        }
        *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] );
@@ -924,7 +928,11 @@ void HQ_FEC_Mem_update_fx(
            exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] );
            tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) );
            exp = add( 15, sub( exp1, exp2 ) );
#ifdef ISSUE_1772_replace_shr_o
            *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow );
#else
            *mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow );
#endif
            move16();
        }
        *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] );
+6 −0
Original line number Diff line number Diff line
@@ -1164,9 +1164,11 @@ static Word16 imax_fx( /* o: The location, relative to the
    Word16 y1, y2, y3, man, expo, edge;
    const Word16 *pY;
    Word32 numer, denom, sign, acc, y3_y1;
#ifndef ISSUE_1772_replace_shr_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    /* Seek the extremum of the parabola P(x) defined by 3 consecutive points
       so that P([-1 0 1]) = [y1 y2 y3] */
@@ -1201,7 +1203,11 @@ static Word16 imax_fx( /* o: The location, relative to the
    /* Although the output of ratio() is in Q14, adding the missing factor of 2 (See above)
     * in the denominator, the output is now considered to be in Q15. */
    man = ratio( numer, denom, &expo );   /* The mantissa is considered in Q15 */
#ifdef ISSUE_1772_replace_shr_o
    posi = shr_sat( man, expo ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */
#else
    posi = shr_o( man, expo, &Overflow ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */
#endif
    if ( sign < 0 )                       /* Restore the sign. */
    {
        posi = negate( posi );
Loading