Commit 959add56 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Changing all 1 / sqrt() to inv_sqrt()

parent 45e82ca3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -152,7 +152,11 @@ static void house_refl(
            pu[0] -= 1;
        }

#ifdef FIX_I120_INV_SQRT
        _rcp = inv_sqrt( fabsf( pu[0] ) );
#else
        _rcp = 1.f / sqrtf( fabsf( pu[0] ) );
#endif

        for ( i = 0; i < sizex; i++ )
        {
@@ -645,7 +649,11 @@ static void norm_quat(

    norm_q = dotp( q, q, IVAS_PCA_INTERP );

#ifdef FIX_I120_INV_SQRT
    norm_q = inv_sqrt( norm_q ); // VE: TBV: possible division by 0
#else
    norm_q = 1 / sqrtf( norm_q ); // VE: TBV: possible division by 0
#endif

    for ( i = 0; i < IVAS_PCA_INTERP; i++ )
    {
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@
#define SPAR_SCALING_HARMONIZATION                      /* Issue 80: Changes to harmonize scaling in spar */
#define SBA_INTERN_CONFIG_FIX_HOA2                      /* Issue 99 : Fix for incorrect internal_config when output format is HOA2 or FOA*/
#define FIX_I98_HANDLES_TO_NULL                         /* Issue 98: do the setting of all handles to NULL in one place */
#define FIX_I120_INV_SQRT                               /* Issue 120: inv_sqrt() shall be used instead of 1 / sqrt() to measure the correct complexity */

#define QUANTISE_REAL_FCN_CLEAN_UP                      /*Clean up the ivas_quantise_real_values() function*/

+4 −0
Original line number Diff line number Diff line
@@ -308,7 +308,11 @@ void calc_tilt_bwe(
        }
    }

#ifdef FIX_I120_INV_SQRT
    *tilt = r1 * inv_sqrt( r0 );
#else
    *tilt = (float) ( r1 / sqrt( r0 ) );
#endif

    return;
}
+12 −0
Original line number Diff line number Diff line
@@ -74,15 +74,27 @@ void lsf_weight_2st(

        if ( mode == 0 )
        {
#ifdef FIX_I120_INV_SQRT
            w[i] = (float) ( 60.0f / ( freq_div * inv_sqrt( d[i] * d[i + 1] ) ) ); /* abs */
#else
            w[i] = (float) ( 60.0f / ( freq_div / sqrt( d[i] * d[i + 1] ) ) ); /* abs */
#endif
        }
        else if ( mode == 1 )
        {
#ifdef FIX_I120_INV_SQRT
            w[i] = (float) ( 65.0f / ( freq_div * inv_sqrt( d[i] * d[i + 1] ) ) ); /* mid */
#else
            w[i] = (float) ( 65.0f / ( freq_div / sqrt( d[i] * d[i + 1] ) ) ); /* mid */
#endif
        }
        else
        {
#ifdef FIX_I120_INV_SQRT
            w[i] = (float) ( 63.0f / ( freq_div * inv_sqrt( d[i] * d[i + 1] ) ) ); /* rel2 */
#else
            w[i] = (float) ( 63.0f / ( freq_div / sqrt( d[i] * d[i + 1] ) ) ); /* rel2 */
#endif
        }
    }

+8 −0
Original line number Diff line number Diff line
@@ -2514,7 +2514,11 @@ static void initDiffuseResponses(
    if ( output_config == AUDIO_CONFIG_MONO )
    {
        diffuse_response_function[0] = 1.0f;
#ifdef FIX_I120_INV_SQRT
        diffuse_response_function[1] = inv_sqrt( 3.0f );
#else
        diffuse_response_function[1] = 1.0f / sqrtf( 3.0f );
#endif
    }
    else if ( !( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) )
    {
@@ -2596,7 +2600,11 @@ static void initDiffuseResponses(
        {
            for ( k = 0; k < ( 2 * l + 1 ); k++ )
            {
#ifdef FIX_I120_INV_SQRT
                diffuse_response_function[idx++] = inv_sqrt( 2.0f * l + 1.0f );
#else
                diffuse_response_function[idx++] = 1.0f / sqrtf( 2.0f * l + 1.0f );
#endif
            }
        }
    }
Loading