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

Added switch ISSUE_1751_replace_shl_ro, added casesensitive shl_sat or shr_r

parent 88107f0f
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
#define VEC_ARITH_OPT_v1
#define FIX_1486_IND_SHB_RES                   /* VA: Fix for issue 1486: align the usage of IND_SHB_RES_GS indices with float code */
#define FIX_1511_POC_RENORM                    /* NTT: Fix for issue 1511: Renorm for POC. */
#define ISSUE_1751_replace_shl_ro

#define TEST_HR
#define REMOVE_EVS_DUPLICATES                   /* remove core-coder duplicated functions, ACELP low-band decoder */
+22 −3
Original line number Diff line number Diff line
@@ -463,11 +463,30 @@ ivas_error decod_gen_voic_fx(
        test();
        test();
        test();
        IF( GT_16( shr_r_sat( enratio, sub( Qenratio, 15 ) ), 8192 ) &&       /*compare with 0.25 in Q15*/
            LT_16( shr_r_sat( enratio, sub( Qenratio, 10 ) ), 15360 ) &&      /*compare with 15.0 in Q10*/
            GT_16( shr_r_sat( sp_enratio, sub( Qsp_enratio, 15 ) ), 4915 ) && /*compare with 0.15 in Q15*/
#ifdef ISSUE_1751_replace_shl_ro
        Word16 op16_1 = sub( Qenratio, 15 );
        Word16 op16_2 = sub( Qenratio, 10 );
        Word16 op16_3 = sub( Qsp_enratio, 15 );

BASOP_SATURATE_WARNING_OFF
        op16_1 = op16_1 >= 0 ? shr_r( enratio, op16_1 ) : shl_sat( enratio, negate(op16_1) );
        op16_2 = op16_2 >= 0 ? shr_r( sp_enratio, op16_2 ) : shl_sat( sp_enratio, negate( op16_2 ) );
        op16_3 = op16_3 >= 0 ? shr_r( sp_enratio, op16_3 ) : shl_sat( sp_enratio, negate( op16_3 ) );
BASOP_SATURATE_WARNING_ON

        IF( GT_16( op16_1, 8192 ) &&       /*compare with 0.25 in Q15*/
            LT_16( op16_2, 15360 ) &&      /*compare with 15.0 in Q10*/
            GT_16( op16_3, 4915 ) &&                           /*compare with 0.15 in Q15*/
            LT_16( st_fx->bfi_pitch_fx, 9600 ) &&                             /*Q6*/
            LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) )                /*Q6*/
#else
        Flag Overflow;
        IF( GT_16( shl_ro( enratio, sub( 15, Qenratio ), &Overflow ), 8192 ) && /*compare with 0.25 in Q15*/
            LT_16( shl_ro( enratio, sub( 10, Qenratio ), &Overflow ), 15360 ) && /*compare with 15.0 in Q10*/
            GT_16( shl_ro( sp_enratio, sub( 15, Qsp_enratio ), &Overflow ), 4915 ) && /*compare with 0.15 in Q15*/
            LT_16( st_fx->bfi_pitch_fx, 9600 ) &&                             /*Q6*/
            LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) )                /*Q6*/
#endif
        {
            IF( NE_32( ( error = DTFS_new_fx( &PREVP ) ), IVAS_ERR_OK ) )
            {
+14 −1
Original line number Diff line number Diff line
@@ -135,7 +135,20 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal,
        normCC = add( normCC, 16 );
        /* scale to Q15 with saturation */
        BASOP_SATURATE_WARNING_OFF
        cc = shr_r_sat( cc, negate( add( normXY, normCC ) ) );
#ifdef ISSUE_1751_replace_shl_ro
        Word16 op1 = add( normXY, normCC );
        if ( op1 >= 0 )
        {
            cc = shl_sat( cc, add( normXY, normCC ) );
        }
        else
        {
            cc = shr_r( cc, negate( add( normXY, normCC ) ) );
        }
#else
        Flag Overflow;
        cc = shl_ro( cc, add( normXY, normCC ), &Overflow );
#endif
        BASOP_SATURATE_WARNING_ON
        *energy = L_shr_r( L_deposit_l( sqrtXY ), normXY );
    }
+27 −2
Original line number Diff line number Diff line
@@ -4085,7 +4085,19 @@ void ivas_lfe_synth_with_filters_fx(
            lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_newton( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/
            lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp );
            lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp );             // Q15-lfeGain_fx_exp
            lfeGain_fx = shr_r_sat( lfeGain_fx, negate( lfeGain_fx_exp ) ); // Q15
#ifdef ISSUE_1751_replace_shl_ro
            if ( lfeGain_fx_exp >= 0 )
            {
                lfeGain_fx = shl_sat( lfeGain_fx, lfeGain_fx_exp ); // Q15
            }
            else
            {
                lfeGain_fx = shr_r( lfeGain_fx, negate(lfeGain_fx_exp) ); // Q15
            }
#else
            Flag Overflow;
            lfeGain_fx = shl_ro( lfeGain_fx, lfeGain_fx_exp &Overflow); // Q15
#endif
        }
        IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, sub( Q31, hMasaLfeSynth->targetEneTransSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, sub( Q31, hMasaLfeSynth->transportEneSmooth_q ) ), 1 ) )
        {
@@ -4097,7 +4109,20 @@ void ivas_lfe_synth_with_filters_fx(
            transportGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneTransSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &transportGain_fx_exp ); /*Q=15-(transportGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneTransSmooth_q)*/
            transportGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneTransSmooth_q ), transportGain_fx_exp );
            transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp );             // q15-transportGain_fx_exp
            transportGain_fx = shr_r_sat( transportGain_fx, negate( transportGain_fx_exp ) ); // Q15
#ifdef ISSUE_1751_replace_shl_ro
            if ( transportGain_fx_exp >= 0 )
            {
                transportGain_fx = shl_sat( transportGain_fx, transportGain_fx_exp ); // Q15
            }
            else
            {
                transportGain_fx = shr_r( transportGain_fx, negate(transportGain_fx_exp) ); // Q15
            }
#else
            Flag Overflow;
            transportGain_fx = shl_ro( transportGain_fx, transportGain_fx_exp &Overflow); // Q15
#endif
            
        }
        j = 0;
        move16();