Commit 94783724 authored by emerit's avatar emerit
Browse files

on going

parent ab6e3859
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -681,9 +681,9 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx(
                Copy( hrtfShCoeffsIm_fx[i][j], hrtfParambin->hrtfShCoeffsIm_fx[i][j], HRTF_NUM_BINS );
            }
        }
        Copy32( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX );
        Copy32( parametricReverberationEneCorrections_fx, hrtfParambin->parametricReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX );
        Copy32( parametricEarlyPartEneCorrection_fx, hrtfParambin->parametricEarlyPartEneCorrection_fx, CLDFB_NO_CHANNELS_MAX );
        Copy( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX );
        Copy( parametricReverberationEneCorrections_fx, hrtfParambin->parametricReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX );
        Copy( parametricEarlyPartEneCorrection_fx, hrtfParambin->parametricEarlyPartEneCorrection_fx, CLDFB_NO_CHANNELS_MAX );
        *hHrtfParambin = hrtfParambin;
    }

@@ -721,8 +721,8 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
            }
        }

        Copy32( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX );
        Copy32( parametricReverberationEneCorrections_fx, hrtfParambin->parametricReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX );
        Copy( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX );
        Copy( parametricReverberationEneCorrections_fx, hrtfParambin->parametricReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX );
        mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX );

        *hHrtfParambin = hrtfParambin;
@@ -1451,9 +1451,9 @@ static void ivas_dirac_dec_binaural_internal(
    }

#if 1
    Word16 q_earlyPartEneCorrection = Q_factor_arrL( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    Word16 q_earlyPartEneCorrection = Q_factor_arr( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection;
    floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    floatToFixed_arr16( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands );

    FOR( j = 0; j < nBins; j++ )
@@ -3208,7 +3208,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices(
                }

#ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT
                getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked, *hDiracDecBin->phHrtfParambin );
                getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[chB], isHeadtracked, *hDiracDecBin->phHrtfParambin );
#else
                getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[chB], isHeadtracked );
#endif
@@ -5970,10 +5970,10 @@ static void hrtfShGetHrtf_fx(
        FOR( k = 0; k < HRTF_SH_CHANNELS; k++ )
        {

            *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28
            *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) );             // Q28
            *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28
            *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) );             // Q28
            *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsReInt[0][k][bin] ), 1 ) ); // Q28
            *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsImInt[0][k][bin] ) );             // Q28
            *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsReInt[1][k][bin] ), 1 ) ); // Q28
            *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsImInt[1][k][bin] ) );             // Q28
        }
    }
    ELSE
@@ -6912,9 +6912,9 @@ static void ivas_masa_ext_rend_parambin_internal(
    hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom;
    Word32 *output_fx[MAX_OUTPUT_CHANNELS];
    Word32 output_fx_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    Word16 q_earlyPartEneCorrection = Q_factor_arrL( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    Word16 q_earlyPartEneCorrection = Q_factor_arr( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection;
    floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    floatToFixed_arr16( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands );
    floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands );
    FOR( j = 0; j < hSpatParamRendCom->num_freq_bands; j++ )
    {
+1 −1
Original line number Diff line number Diff line
@@ -1350,7 +1350,7 @@ ivas_error ivas_td_binaural_open_ext_fx(
        directivity_fx = hRendCfg->directivity_fx;
    }

    return ivas_td_binaural_open_unwrap_fx( &pTDRend->hHrtfTD, outFs, *num_src, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd );
    return ivas_td_binaural_open_unwrap_fx( pTDRend->hHrtfTD, outFs, *num_src, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd );
}
#else
ivas_error ivas_td_binaural_open_ext(
+27 −10
Original line number Diff line number Diff line
@@ -154,9 +154,9 @@ typedef struct ivas_reverb_params_t
    // const float *pHrtf_inter_aural_coherence_const;                                                                                                                       /* The HRTF set's inter-aural coherence for diffuse sound                               */

#ifdef IVAS_FLOAT_FIXED
    Word16 *pHrtf_avg_pwr_response_l_fx;                /* The HRTF set's average left  ear power response                                      */
    Word16 *pHrtf_avg_pwr_response_r_fx;                /* The HRTF set's average right ear power response                                      */
    Word16 *pHrtf_inter_aural_coherence_fx;             /* The HRTF set's inter-aural coherence for diffuse sound                               */
    Word32 *pHrtf_avg_pwr_response_l_fx;                /* The HRTF set's average left  ear power response                                      */
    Word32 *pHrtf_avg_pwr_response_r_fx;                /* The HRTF set's average right ear power response                                      */
    Word32 *pHrtf_inter_aural_coherence_fx;             /* The HRTF set's inter-aural coherence for diffuse sound                               */
    const Word16 *pHrtf_avg_pwr_response_l_const_fx;    /* The HRTF set's average left  ear power response                                      */
    const Word16 *pHrtf_avg_pwr_response_r_const_fx;    /* The HRTF set's average right ear power response                                      */
    const Word16 *pHrtf_inter_aural_coherence_const_fx; /* The HRTF set's inter-aural coherence for diffuse sound                               */
@@ -2039,12 +2039,14 @@ static void set_reverb_acoustic_data_fx(
    const Word16 nr_fc_input,
    const Word16 nr_fc_fft_filter )
{
    Word16 nr_out_ch, hrtf_idx, offset, iter_idx, bin_idx;
#ifndef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT
    Word16 nr_out_ch, hrtf_idx, offset, iter_idx, bin_idx;
    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];
#else
    Word16 bin_idx;
#endif
    Word32 ln_1e6_inverted_fx, delay_diff_fx, L_tmp;
    Word16 exp_argument_fx, tmp, tmp_flag, exp_argument_e;
@@ -2442,15 +2444,13 @@ ivas_error ivas_reverb_open_fx(
    set_fft_and_datablock_sizes_fx( pState, subframe_len );
    nr_fc_fft_filter = add( extract_l( L_shr( pState->fft_size, 1 ) ), 1 );

#ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT
    /* === 'Control logic': compute the reverb processing parameters from the              === */
    /* === room, source and listener acoustic information provided in the reverb config    === */
    /* Setting up shared temporary buffers for fc, RT60, DSR, etc.                             */
    params.pHrtf_avg_pwr_response_l_fx = &pFft_wf_filter_ch0_fx[0][0];
    params.pHrtf_avg_pwr_response_r_fx = params.pHrtf_avg_pwr_response_l_fx + nr_fc_fft_filter;
    params.pRt60_fx = &pFft_wf_filter_ch1_fx[0][0];
    params.pDsr_fx = params.pRt60_fx + nr_fc_fft_filter;
    params.pFc_fx = &pState->fft_filter_color_0.fft_spectrum_fx[0];
    params.pHrtf_inter_aural_coherence_fx = &pState->fft_filter_color_1.fft_spectrum_fx[0];
    /* Note: these temp buffers can only be used before the final step of the FFT filter design :     */
    /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */

@@ -2460,12 +2460,29 @@ ivas_error ivas_reverb_open_fx(
    {
        params.pFc_fx[bin_idx] = W_extract_l( W_mult0_32_32( freq_step_fx, bin_idx ) ); /*Q14*/
    }
#ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT
    set_reverb_acoustic_data_fx( &params, &hRenderConfig->roomAcoustics, nr_fc_input, nr_fc_fft_filter );
    params.pHrtf_avg_pwr_response_l_const_fx = hHrtfStatistics->average_energy_l_fx;
    params.pHrtf_avg_pwr_response_r_const_fx = hHrtfStatistics->average_energy_r_fx;
    params.pHrtf_inter_aural_coherence_const_fx = hHrtfStatistics->inter_aural_coherence_fx;
#else
    /* === 'Control logic': compute the reverb processing parameters from the              === */
    /* === room, source and listener acoustic information provided in the reverb config    === */
    /* Setting up shared temporary buffers for fc, RT60, DSR, etc.                             */
    params.pHrtf_avg_pwr_response_l_fx = &pFft_wf_filter_ch0_fx[0][0];
    params.pHrtf_avg_pwr_response_r_fx = params.pHrtf_avg_pwr_response_l_fx + nr_fc_fft_filter;
    params.pRt60_fx = &pFft_wf_filter_ch1_fx[0][0];
    params.pDsr_fx = params.pRt60_fx + nr_fc_fft_filter;
    params.pFc_fx = &pState->fft_filter_color_0.fft_spectrum_fx[0];
    params.pHrtf_inter_aural_coherence_fx = &pState->fft_filter_color_1.fft_spectrum_fx[0];
    /* Note: these temp buffers can only be used before the final step of the FFT filter design :     */
    /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */

    /* set the uniform frequency grid for FFT filtering                                               */
    freq_step_fx = L_mult0( extract_l( L_shr( output_Fs, 2 ) ), div_s( 1, ( nr_fc_fft_filter - 1 ) ) ); /*Q14:0.5f * output_Fs / ( nr_fc_fft_filter - 1 )*/
    FOR( bin_idx = 0; bin_idx < nr_fc_fft_filter; bin_idx++ )
    {
        params.pFc_fx[bin_idx] = W_extract_l( W_mult0_32_32( freq_step_fx, bin_idx ) ); /*Q14*/
    }
    IF( hHrtf == NULL && lr_energy_and_iac_fx != NULL )
    {
        params.pHrtf_avg_pwr_response_l_const_fx = lr_energy_and_iac_fx[0];
@@ -2629,7 +2646,7 @@ ivas_error ivas_reverb_open_fx(
        pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], 31 - q_pFft_wf_filter_ch1_fx );
    }

    Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/
    Copy_Scale_sig_16_32( params.pHrtf_inter_aural_coherence_const_fx, params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/
    Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 );                                                                              /*Scaling  ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/

    /* Copying the computed FFT colorations filters to the fft_filter components */
+3 −3
Original line number Diff line number Diff line
@@ -125,9 +125,9 @@ extern float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX];
 * with the above binaural rendering data set based on HRIRs for parametric
 * renderer */
#ifdef IVAS_FLOAT_FIXED
extern const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX];          /* Q31 */
extern const Word32 parametricReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */
extern const Word32 parametricEarlyPartEneCorrection_fx[CLDFB_NO_CHANNELS_MAX];      /* Q28 */
extern const Word16 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX];          /* Q31 */
extern const Word16 parametricReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */
extern const Word16 parametricEarlyPartEneCorrection_fx[CLDFB_NO_CHANNELS_MAX];      /* Q28 */
#else
extern const float parametricReverberationTimes[CLDFB_NO_CHANNELS_MAX];
extern const float parametricReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX];