Commit d7397993 authored by Serdar Buyuksarac's avatar Serdar Buyuksarac
Browse files

Add pre-computed energies to HRTFS_PARAMBIN_HANDLE

parent 0efd4a4e
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -868,7 +868,7 @@ ivas_error ivas_dirac_dec_config(
        {
            if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC )
            {
                if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
                if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin, output_Fs ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
+1 −1
Original line number Diff line number Diff line
@@ -1955,7 +1955,7 @@ ivas_error ivas_init_decoder(
    {
        if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC )
        {
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
            {
                return error;
            }
+2 −2
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
        )
        {
            /* open the parametric binaural renderer */
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
            {
                return error;
            }
@@ -292,7 +292,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
        if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
        {
            /* open the parametric binaural renderer */
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
            {
                return error;
            }
+22 −4
Original line number Diff line number Diff line
@@ -241,8 +241,7 @@ ivas_error ivas_dirac_dec_init_binaural_data(
        if ( hDiracDecBin->hReverb == NULL )
#endif
            {
                /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */
                if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac ) ) != IVAS_ERR_OK )
                if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
@@ -411,8 +410,8 @@ void ivas_dirac_dec_close_binaural_data(
 *------------------------------------------------------------------------*/

ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
    HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */
)
    HRTFS_PARAMBIN_HANDLE *hHrtfParambin, /* i/o: HRTF structure for rendering */
    const int32_t output_Fs /* output sampling rate */ )
{
    int16_t i, j;
    if ( hHrtfParambin != NULL && *hHrtfParambin != NULL )
@@ -443,6 +442,25 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
        mvr2r( parametricReverberationEneCorrections, hrtfParambin->parametricReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX );
        mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX );

        switch ( output_Fs )
        {
            case 48000:
                hrtfParambin->lr_energy_and_iac[0] = defaultHRIR_left_avg_power_48kHz;
                hrtfParambin->lr_energy_and_iac[1] = defaultHRIR_right_avg_power_48kHz;
                hrtfParambin->lr_energy_and_iac[2] = defaultHRIR_coherence_48kHz;
                break;
            case 32000:
                hrtfParambin->lr_energy_and_iac[0] = defaultHRIR_left_avg_power_32kHz;
                hrtfParambin->lr_energy_and_iac[1] = defaultHRIR_right_avg_power_32kHz;
                hrtfParambin->lr_energy_and_iac[2] = defaultHRIR_coherence_32kHz;
                break;
            case 16000:
                hrtfParambin->lr_energy_and_iac[0] = defaultHRIR_left_avg_power_16kHz;
                hrtfParambin->lr_energy_and_iac[1] = defaultHRIR_right_avg_power_16kHz;
                hrtfParambin->lr_energy_and_iac[2] = defaultHRIR_coherence_16kHz;
                break;
        }

        *hHrtfParambin = hrtfParambin;
    }

+3 −3
Original line number Diff line number Diff line
@@ -225,7 +225,8 @@ void ivas_dirac_dec_close_binaural_data(
);

ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
    HRTFS_PARAMBIN_HANDLE *hHrtfParambin                        /* i/o: HRTF structure for rendering            */
    HRTFS_PARAMBIN_HANDLE *hHrtfParambin,                       /* i/o: HRTF structure for rendering            */
    const int32_t output_Fs                                     /* output sampling rate */
);

/*! r: Configured reqularization factor value */
@@ -979,8 +980,7 @@ ivas_error ivas_binaural_reverb_open_parambin(
    const int16_t numCldfbSlotsPerFrame,                        /* i  : number of CLDFB slots per frame         */
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics,             /* i/o: room acoustics parameters               */
    const int32_t sampling_rate,                                /* i  : sampling rate                           */
    const HRTFS_PARAMBIN_HANDLE hHrtfParambin,                  /* i  : Parametric binauralizer HRTF handle     */
    const float *lr_energy_and_iac[]                            /* i  : precomuputed lr energies and iac  */
    const HRTFS_PARAMBIN_HANDLE hHrtfParambin                   /* i  : Parametric binauralizer HRTF handle     */
);

void ivas_binaural_reverb_close(
Loading