Commit e4847ed9 authored by vaclav's avatar vaclav
Browse files

Merge branch '1936-basop-PortFlpMr2133' into 'main'

[non-BE] [allow regression] porting MR2133 from float to BASOP

Closes #1936

See merge request !2138
parents ca3146eb ec0b84c9
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -176,6 +176,8 @@
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */

#define FIX_1959_assert_in_gain_enc_mless_fx            /* VA: Fix saturation introduced by the usage of the non-EVS basop operators =, the saturation was expected */
#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328  */

/* #################### End BASOP porting switches ############################ */

#endif
+25 −6
Original line number Diff line number Diff line
@@ -6061,7 +6061,9 @@ void non_linearity_ivas_fx(
    move32();
#endif
#endif

#ifdef NONBE_1328_FIX_NON_LINEARITY
    Word16 sc_factor;
#endif

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
@@ -6121,9 +6123,17 @@ void non_linearity_ivas_fx(
        scale = 1438814044;
        move32(); /* Q31; 0.67 in Q31 */
    }
#ifdef NONBE_1328_FIX_NON_LINEARITY
    /* sc_factor = 32; */                                                      /* Here we divise 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( 15, max( 13 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = s_min( sc_factor, 16384 );

    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#else
    test();
    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#endif
    {
        scale_step = 16384;
        move16();                       /* Q14 */
@@ -6209,7 +6219,16 @@ void non_linearity_ivas_fx(
    }

    test();
#ifdef NONBE_1328_FIX_NON_LINEARITY
    /* sc_factor = 32; */                                                      /* Here we divise 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( 15, max( 12 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = s_min( sc_factor, 16384 );

    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
#else
    IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ), scale ) )
#endif
    {
        scale_step = 16384;
        move16();                       /*Q14 */