Commit 439d7a9c authored by norvell's avatar norvell Committed by multrus
Browse files

Added missing fix NONBE_1328_FIX_NON_LINEARITY for first half-frame

parent c4b31ad5
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -6125,13 +6125,21 @@ void non_linearity_ivas_fx(
    }

#ifdef NONBE_1328_FIX_NON_LINEARITY
#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
    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 */
#else
    /* sc_factor = 32; */                                                      /* Here we divide prev_scale, so 32 == 2 << (15-10)  1024.0 corresponds to 10 bits and 32 to 5 bits  */
    /* if ( element_mode > EVS_MONO ) */                                       /* element mode is not needed because the function is duplicated for IVAS */
    sc_factor = shl_sat( 1, sub( 16, max( 13 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 );                    /* note: The thresholding is purposely different between float and BASOP implementations. */

#endif
    test();
#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
    IF( prev_scale <= 0 || 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 */
#else
    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#endif
#else
    test();
    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
@@ -6221,19 +6229,20 @@ void non_linearity_ivas_fx(
    }

#ifdef NONBE_1328_FIX_NON_LINEARITY
    /* sc_factor = 32; */                /* Here we divide prev_scale, so 32 == 2 << (15-10)  1024.0 corresponds to 10 bits and 32 to 5 bits  */
    /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */
#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
    /* 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 */
    sc_factor = s_max( sc_factor, 1 );
    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 */
#else
    /* sc_factor = 32; */                                                      /* Here we divide prev_scale, so 32 == 2 << (15-10)  1024.0 corresponds to 10 bits and 32 to 5 bits  */
    /* if ( element_mode > EVS_MONO ) */                                       /* element mode is not needed because the function is duplicated for IVAS */
    sc_factor = shl_sat( 1, sub( 16, max( 12 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 );                    /* note: The thresholding is purposely different between float and BASOP implementations. */
#endif

    test();
#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
    IF( prev_scale <= 0 || GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) )
    IF( prev_scale <= 0 || 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 */
#else
    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#endif