Commit c4a3bacf authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

fixed definitions of type float

parent a8606299
Loading
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1284,10 +1284,12 @@ static void set_reverb_acoustic_data_fx(
    Word32 ln_1e6_inverted_fx, delay_diff_fx, L_tmp;
    Word16 exp_argument_fx, tmp, tmp_flag, exp_argument_e;
    Word16 pow_exp;
#ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    Word32 *pHrtf_set_l_re_fx[MAX_INTERN_CHANNELS];
    Word32 *pHrtf_set_l_im_fx[MAX_INTERN_CHANNELS];
    Word32 *pHrtf_set_r_re_fx[MAX_INTERN_CHANNELS];
    Word32 *pHrtf_set_r_im_fx[MAX_INTERN_CHANNELS];
#endif

    Word32 *pFc_input_fx = pRoomAcoustics->pFc_input_fx;
    Word32 *pAcoustic_rt60_fx = pRoomAcoustics->pAcoustic_rt60_fx;
@@ -1298,9 +1300,8 @@ static void set_reverb_acoustic_data_fx(
    Word16 *pRt60_e = pParams->pRt60_e;
    Word32 *pDsr_fx = pParams->pDsr_fx;
    Word16 *pDsr_e = pParams->pDsr_e;
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
#else

#ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    /* use crend hrtf filters */
    IF( hHrtf != NULL )
    {
@@ -2519,7 +2520,7 @@ ivas_error ivas_binaural_reverb_init(

    return error;
}
#endif
#else

/*-------------------------------------------------------------------------
 * ivas_binaural_reverb_open_fastconv()
@@ -2621,6 +2622,7 @@ ivas_error ivas_binaural_reverb_open_parambin(
    return error;
}

#endif
/*-------------------------------------------------------------------------
 * ivas_binaural_reverb_close()
 *
+14 −12
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ typedef struct cldfb_convolver_state
} cldfb_convolver_state;

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
static void ivas_reverb_set_energies( const Word32 *avg_pwr_l, const Word32 *avg_pwr_r, const int32_t sampling_rate, float *avg_pwr_l_out, float *avg_pwr_r_out );
static void ivas_reverb_set_energies( const Word32 *avg_pwr_l, const Word32 *avg_pwr_r, const int32_t sampling_rate, Word32 *avg_pwr_l_out, Word32 *avg_pwr_r_out );
#else
static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( const HRTFS_FASTCONV_HANDLE hHrtfFastConv, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right );
#endif
@@ -76,19 +76,24 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( const HRTFS_FASTCO
 * Prepares reverb parameters for CLDFB-based reverberator
 *-----------------------------------------------------------------------------------------*/

ivas_error ivas_reverb_prepare_cldfb_params(

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
ivas_error ivas_reverb_prepare_cldfb_params(
    const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params,
    const HRTFS_STATISTICS_HANDLE hHrtfStatistics,
    const int32_t output_Fs,
    float *pOutput_t60,
    float *pOutput_ene )
#else
ivas_error ivas_reverb_prepare_cldfb_params(
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params,
    const HRTFS_FASTCONV_HANDLE hHrtfFastConv,
    const AUDIO_CONFIG input_audio_config,
    const int16_t use_brir,
#endif
    const int32_t output_Fs,
    float *pOutput_t60,
    float *pOutput_ene )
#endif
{
    int16_t idx;
    float fc[CLDFB_NO_CHANNELS_MAX];
@@ -103,7 +108,7 @@ ivas_error ivas_reverb_prepare_cldfb_params(

    for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
        fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) );
        fc[idx] = ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) );
    }
    Word32 *fc_fx = (Word32 *) malloc( pInput_params->nBands * sizeof( Word32 * ) );
    Word32 *pOutput_t60_fx = (Word32 *) malloc( pInput_params->nBands * sizeof( Word32 * ) );
@@ -144,6 +149,7 @@ ivas_error ivas_reverb_prepare_cldfb_params(
        pOutput_ene[idx] *= expf( exp_argument );
    }
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES

    ivas_reverb_set_energies( hHrtfStatistics->average_energy_l, hHrtfStatistics->average_energy_r, output_Fs, avg_pwr_left, avg_pwr_right );
#else
    if ( ( error = ivas_reverb_get_fastconv_hrtf_set_energies( hHrtfFastConv, input_audio_config, use_brir, output_Fs, avg_pwr_left, avg_pwr_right ) ) != IVAS_ERR_OK )
@@ -299,8 +305,8 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies(
    const int16_t use_brir,
#endif
    const int32_t sampling_rate,
    float *avg_pwr_left,
    float *avg_pwr_right )
    Word32 *avg_pwr_left,
    Word32 *avg_pwr_right )
{
    int16_t freq_idx;
#ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
@@ -332,9 +338,7 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies(
    Word32 *input_fc_fx = (Word32 *) malloc( 60 * sizeof( Word32 * ) );

    Word32 *output_fc_fx = (Word32 *) malloc( 257 * sizeof( Word32 * ) );
    Word32 *avg_pwr_left_fx = (Word32 *) malloc( 257 * sizeof( Word32 * ) );
    Word16 *avg_pwr_left_e = (Word16 *) malloc( 257 * sizeof( Word16 * ) );
    Word32 *avg_pwr_right_fx = (Word32 *) malloc( 257 * sizeof( Word32 * ) );
    Word16 *avg_pwr_right_e = (Word16 *) malloc( 257 * sizeof( Word16 * ) );

    for ( int i = 0; i < 60; i++ )
@@ -348,13 +352,11 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies(
    }

    ivas_reverb_interpolate_acoustic_data_fx( FFT_SPECTRUM_SIZE, input_fc_fx, avg_pwr_l, avg_pwr_r,
                                              CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e );
                                              CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left, avg_pwr_right, avg_pwr_left_e, avg_pwr_right_e );

    free( input_fc_fx );
    free( output_fc_fx );
    free( avg_pwr_left_fx );
    free( avg_pwr_left_e );
    free( avg_pwr_right_fx );
    free( avg_pwr_right_e );

#else
+3 −3
Original line number Diff line number Diff line
@@ -813,13 +813,13 @@ static ivas_error load_reverb_from_binary(
        hHrtfStatistics->inter_aural_coherence = hHrtfStatistics->inter_aural_coherence_dyn;

        fread( hrtf_prop_local, sizeof( float ), lr_iac_len, f_hrtf );
        floatToFixed_arr32( hrtf_prop_local, hHrtfStatistics->average_energy_l, Q27, lr_iac_len );
        floatToFixed_arr32( hrtf_prop_local, hHrtfStatistics->average_energy_l_dyn, Q27, lr_iac_len );

        fread( hrtf_prop_local, sizeof( float ), lr_iac_len, f_hrtf );
        floatToFixed_arr32( hrtf_prop_local, hHrtfStatistics->average_energy_r, Q27, lr_iac_len );
        floatToFixed_arr32( hrtf_prop_local, hHrtfStatistics->average_energy_r_dyn, Q27, lr_iac_len );

        fread( hrtf_prop_local, sizeof( float ), lr_iac_len, f_hrtf );
        floatToFixed_arr32( hrtf_prop_local, hHrtfStatistics->inter_aural_coherence, Q23, lr_iac_len );
        floatToFixed_arr32( hrtf_prop_local, hHrtfStatistics->inter_aural_coherence_dyn, Q23, lr_iac_len );

        hHrtfStatistics->fromROM = FALSE;
        free( hrtf_prop_local );