Commit d312b4bc authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_1781_SPECTRAL_GAPS

parent e24fcdf2
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@

#define ISSUE_1836_replace_overflow_libcom                   /* FhG: replace overflow operators by non-overflow-alternatives in lib_com - BE */

#define FIX_1781_SPECTRAL_GAPS                               /* FhG: Change internal calculation of tcx_noise_factor_ivas_fx() to 32-bit*/
#define FIX_ISSUE_1811_EXCEEDING_W_SHIFTS                    /* FhG: limit exceeding 64bit shifts */
#define FIX_1843_IO_QFACTOR_INIT                             /* FhG: initialize CRend's io_qfactor also in IVAS_rend */

+0 −29
Original line number Diff line number Diff line
@@ -2485,12 +2485,8 @@ void tcx_noise_factor_ivas_fx(
    Word16 i, k, win, segmentOffset, j;
    Word32 sqErrorNrg = 0, n;
    move32();
#ifdef FIX_1781_SPECTRAL_GAPS
    Word32 inv_gain2, tilt_factor;
    Word16 inv_gain2_e, nTransWidth_1, exp_sqErrorNrg = 0;
#else
    Word16 inv_gain2, inv_gain2_e, tilt_factor, nTransWidth_1, exp_sqErrorNrg = 0;
#endif
    move16();
    Word32 accu1, accu2, tmp32;
    Word16 tmp1, tmp2, s;
@@ -2520,25 +2516,13 @@ void tcx_noise_factor_ivas_fx(
    /* tilt_factor = 1.0f /(float)pow(max(0.375f, tiltCompFactor), 1.0f/(float)L_frame); */
    tmp32 = BASOP_Util_Log2( L_deposit_h( s_max( 0x3000, tiltCompFactor ) ) ); /* 6Q25 */
    tmp32 = L_shr( Mpy_32_16_1( tmp32, negate( tmp1 ) ), 6 );
#ifdef FIX_1781_SPECTRAL_GAPS
    tilt_factor = BASOP_Util_InvLog2( L_sub( tmp32, 0x2000000 ) ); /* 1Q30 */
#else
    tilt_factor = round_fx( BASOP_Util_InvLog2( L_sub( tmp32, 0x2000000 ) ) ); /* 1Q14 */
#endif

    /* inv_gain2 = 1.0f / ((float)(nTransWidth * nTransWidth) * gain_tcx); */
    tmp32 = L_mult( imult1616( nTransWidth, nTransWidth ), gain_tcx ); /* 15Q16 */
#ifdef FIX_1781_SPECTRAL_GAPS
    inv_gain2 = BASOP_Util_Divide3232_Scale_newton( MAX_32, tmp32, &inv_gain2_e );
#else
    inv_gain2 = BASOP_Util_Divide3232_Scale( MAX_32, tmp32, &inv_gain2_e );
#endif
    inv_gain2_e = add( inv_gain2_e, sub( 0, add( 15, gain_tcx_e ) ) );
#ifdef FIX_1781_SPECTRAL_GAPS
    inv_gain2 = L_shr( inv_gain2, 2 ); /* 2 bits headroom */
#else
    inv_gain2 = shr( inv_gain2, 2 ); /* 2 bits headroom */
#endif
    inv_gain2_e = add( inv_gain2_e, 2 );

    /* find last nonzero line below iFirstLine, use it as start offset */
@@ -2564,11 +2548,7 @@ void tcx_noise_factor_ivas_fx(
        /* inv_gain2 *= (float)pow(tilt_factor, (float)i); */
        FOR( k = 0; k < i; k++ )
        {
#ifdef FIX_1781_SPECTRAL_GAPS
            inv_gain2 = L_shl( Mpy_32_32( inv_gain2, tilt_factor ), 1 );
#else
            inv_gain2 = shl( mult( inv_gain2, tilt_factor ), 1 );
#endif
        }

        i = add( i, 1 );
@@ -2632,11 +2612,7 @@ void tcx_noise_factor_ivas_fx(

    FOR( ; i < lowpassLine; i++ )
    {
#ifdef FIX_1781_SPECTRAL_GAPS
        inv_gain2 = L_shl( Mpy_32_32( inv_gain2, tilt_factor ), 1 );
#else
        inv_gain2 = shl( mult( inv_gain2, tilt_factor ), 1 );
#endif

        IF( sqQ[i] != 0 ) /* current line is not zero, so reset pointers */
        {
@@ -2704,12 +2680,7 @@ void tcx_noise_factor_ivas_fx(
                win = add( win, 1 );
            }
            /* update segment sum: magnitudes scaled by smoothing function */
#ifdef FIX_1781_SPECTRAL_GAPS
            sqQ[i] = Mpy_32_32( imult3216( L_abs( x_orig[i] ), win ), inv_gain2 );
#else
            sqQ[i] = Mpy_32_16_1( imult3216( L_abs( x_orig[i] ), win ), inv_gain2 );
            move32();
#endif
            exp_spQ[i] = add( x_orig_e, inv_gain2_e );
            move16();
        }