Commit c08bc3c4 authored by emerit's avatar emerit
Browse files

Merge branch '1741_basop_enable-new-hrtf-format' of...

Merge branch '1741_basop_enable-new-hrtf-format' of https://forge.3gpp.org/rep/sa4/audio/ivas-basop into 1741_basop_enable-new-hrtf-format
parents 468aa780 754125af
Loading
Loading
Loading
Loading
Loading
+11 −22
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ ivas_error ivas_reverb_prepare_cldfb_params(
#endif
{
    int16_t idx;
    float fc[CLDFB_NO_CHANNELS_MAX];
    float avg_pwr_left[CLDFB_NO_CHANNELS_MAX];
    float avg_pwr_right[CLDFB_NO_CHANNELS_MAX];
    float delay_diff, ln_1e6_inverted, exp_argument;
@@ -105,26 +104,20 @@ ivas_error ivas_reverb_prepare_cldfb_params(
#ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    ivas_error error;
#endif

    for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
        fc[idx] = ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) );
    }

    Word32 *pOutput_fc_fx = (Word32 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) );
    Word32 *pOutput_t60_fx = (Word32 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) );
    Word16 *pOutput_t60_e = (Word16 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word16 ) );
    Word32 *pOutput_ene_fx = (Word32 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) );
    Word16 *pOutput_ene_e = (Word16 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word16 ) );
    Word32 output_fc_fx[CLDFB_NO_CHANNELS_MAX];
    Word32 output_t60_fx[CLDFB_NO_CHANNELS_MAX];
    Word16 output_t60_e[CLDFB_NO_CHANNELS_MAX];
    Word32 output_ene_fx[CLDFB_NO_CHANNELS_MAX];
    Word16 output_ene_e[CLDFB_NO_CHANNELS_MAX];
    Word32 delay_diff_fx;

    for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
    for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
        pOutput_fc_fx[i] = (Word32) fc[i] * ONE_IN_Q16;
        output_fc_fx[idx] = (Word32) ( ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) ) ) * ONE_IN_Q16;
    }

    ivas_reverb_interpolate_acoustic_data_fx( pInput_params->nBands, pInput_params->pFc_input_fx, pInput_params->pAcoustic_rt60_fx, pInput_params->pAcoustic_dsr_fx,
                                              CLDFB_NO_CHANNELS_MAX, pOutput_fc_fx, pOutput_t60_fx, pOutput_ene_fx, pOutput_t60_e, pOutput_ene_e );
                                              CLDFB_NO_CHANNELS_MAX, output_fc_fx, output_t60_fx, output_ene_fx, output_t60_e, output_ene_e );

    /* adjust DSR for the delay difference */
    delay_diff_fx = L_sub( pInput_params->inputPreDelay_fx, pInput_params->acousticPreDelay_fx );
@@ -132,14 +125,10 @@ ivas_error ivas_reverb_prepare_cldfb_params(
    delay_diff = (float) delay_diff_fx / ONE_IN_Q27;
    for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
    {
        pOutput_t60[i] = (float) fabs( me2f( pOutput_t60_fx[i], pOutput_t60_e[i] ) );
        pOutput_ene[i] = (float) fabs( me2f( pOutput_ene_fx[i], pOutput_ene_e[i] ) );
        pOutput_t60[i] = (float) fabs( me2f( output_t60_fx[i], output_t60_e[i] ) );
        pOutput_ene[i] = (float) fabs( me2f( output_ene_fx[i], output_ene_e[i] ) );
    }
    free( pOutput_fc_fx );
    free( pOutput_t60_fx );
    free( pOutput_t60_e );
    free( pOutput_ene_fx );
    free( pOutput_ene_e );

    ln_1e6_inverted = 1.0f / logf( 1e06f );
    for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {