Commit b6dcb714 authored by vaclav's avatar vaclav
Browse files

simplification

parent 7738e1ea
Loading
Loading
Loading
Loading
+11 −31
Original line number Diff line number Diff line
@@ -5811,18 +5811,19 @@ void non_linearity_ivas_fx(
    Word16 sc_factor;
#ifdef HARM_NON_LINEARITY
    Word16 cond;
    Word32 prev_scale_factor;
#endif

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
        nframes = 5;
        nframes = NB_SUBFR16k;
        move16();
        ths = 17817;
        move16(); /* 0.87*5 in Q12 */
    }
    ELSE
    {
        nframes = 4;
        nframes = NB_SUBFR;
        move16();
        ths = 15400;
        move16(); /* 0.94*4 in Q12 */
@@ -5870,29 +5871,19 @@ void non_linearity_ivas_fx(
    }

#ifdef HARM_NON_LINEARITY
    cond = 0;
    move16();
    IF( element_mode == EVS_MONO )
    {
        if ( GT_32( Mult_32_16( prev_scale, 32 ), scale ) )
        {
            cond = 1;
            move16();
        }
        prev_scale_factor = Mult_32_16( prev_scale, 32 );
    }
    ELSE
    {
        sc_factor = s_max( sub( 13, norm_s( add( j, 1 ) ) ), 0 );                    /* Adapt the scaling factor allowed depending of max position  */
        sc_factor = s_max( sc_factor, 1 );                                           /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */
        if ( GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) )
        {
            cond = 1;
            move16();
        }
        prev_scale_factor = L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ); /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */
    }

    test();
    IF( prev_scale <= 0 || cond ) /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */
    IF( prev_scale <= 0 || ( GT_32( prev_scale_factor, scale /*Q31*/ ) ) )
#else
    sc_factor = s_max( sub( 13, norm_s( add( j, 1 ) ) ), 0 ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = s_max( sc_factor, 1 );                        /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */
@@ -5981,30 +5972,19 @@ void non_linearity_ivas_fx(
    }

#ifdef HARM_NON_LINEARITY
    cond = 0;
    move16();
    IF( element_mode == EVS_MONO )
    {
        if ( GT_32( Mult_32_16( prev_scale, 32 ), scale ) )
        {
            cond = 1;
            move16();
        }
        prev_scale_factor = Mult_32_16( prev_scale, 32 );
    }
    ELSE
    {
        sc_factor = s_max( sub( 12, norm_s( add( sub( j, length_half ), 1 ) ) ), 0 ); /* allowed intra frame jump is smaller */
        sc_factor = s_max( sc_factor, 1 );                                            /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */

        if ( GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) ) /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */
        {
            cond = 1;
            move16();
        }
        prev_scale_factor = L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ );  /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */
    }

    test();
    IF( prev_scale <= 0 || cond )
    IF( prev_scale <= 0 || ( GT_32( prev_scale_factor, scale /*Q31*/ ) ) )
#else
    /* if ( element_mode > EVS_MONO ) */                                                                     /* element mode is not needed because the function is duplicated for IVAS */
    sc_factor = s_max( sub( 12, norm_s( add( sub( j, length_half ), 1 ) ) ), 0 );                            /* allowed intra frame jump is smaller */