Commit fd838700 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Add switch to surround changes.

parent 573222f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@
#endif

#define FIX_818_DOUBLE_PREC_KERNEN_SW                   /* FhG: Issue 818: Avoid double precision in kernel switching */

#define FIX_822_REFACTOR_BIN_REVERB_OPEN                /* Nokia: Addresses first step of issue 822 by refactoring ivas_binaural_reverb_open */

/* #################### End BE switches ################################## */

+4 −0
Original line number Diff line number Diff line
@@ -1230,7 +1230,11 @@ ivas_error ivas_binRenderer_open(
    /* Allocate memories needed for reverb module */
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
#ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN
        if ( ( error = ivas_binaural_reverb_open_fastconv( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
+4 −0
Original line number Diff line number Diff line
@@ -234,8 +234,12 @@ ivas_error ivas_dirac_dec_init_binaural_data(
        if ( hDiracDecBin->hReverb == NULL )
#endif
            {
#ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN
                /* 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, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_binaural_reverb_open( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
+14 −0
Original line number Diff line number Diff line
@@ -882,6 +882,7 @@ ivas_error ivas_rend_crendProcessSubframe(
 * Reverberator
 *----------------------------------------------------------------------------------*/

#ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN
ivas_error ivas_binaural_reverb_open_fastconv(
    REVERB_STRUCT_HANDLE *hReverbPr,                /* i/o: binaural reverb handle               */
    const int16_t numBins,                          /* i  : number of CLDFB bins                 */
@@ -900,6 +901,19 @@ ivas_error ivas_binaural_reverb_open_parambin(
    const int32_t sampling_rate,                    /* i  : sampling rate                        */
    const HRTFS_PARAMBIN_HANDLE hHrtfParambin       /* i  : Parametric binauralizer HRTF handle  */
);
#else
ivas_error ivas_binaural_reverb_open(
    REVERB_STRUCT_HANDLE *hReverbPr,                            /* i/o: binaural reverb handle                  */
    const int16_t numBins,                                      /* i  : number of CLDFB bins                    */
    const int16_t numCldfbSlotsPerFrame,                        /* i  : number of CLDFB slots per frame         */
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics,             /* i/o: room acoustics parameters               */
    const AUDIO_CONFIG output_config,                           /* i  : output audio configuration              */
    const int32_t sampling_rate,                                /* i  : sampling rate                           */
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                           */
    const HRTFS_FASTCONV_HANDLE hHrtfFastConv,                  /* i  : FastConv HRTF handle                    */
    const HRTFS_PARAMBIN_HANDLE hHrtfParambin                   /* i  : Parametric binauralizer HRTF handle     */
);
#endif

void ivas_binaural_reverb_close(
    REVERB_STRUCT_HANDLE *hReverb                               /* i/o: binaural reverb handle                  */
+64 −0
Original line number Diff line number Diff line
@@ -1777,6 +1777,7 @@ void ivas_binaural_reverb_processSubframe(
 * Allocate and initialize binaural room reverberator handle
 *------------------------------------------------------------------------*/

#ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN
static ivas_error ivas_binaural_reverb_open(
    REVERB_STRUCT_HANDLE *hReverbPr,     /* i/o: binaural reverb handle                                  */
    const int16_t numBins,               /* i  : number of CLDFB bins                                    */
@@ -1786,9 +1787,28 @@ static ivas_error ivas_binaural_reverb_open(
    const float *revEnes,                /* i  : spectrum for reverberated sound at each CLDFB bin       */
    const int16_t preDelay               /* i  : reverb pre-delay in CLDFB slots                         */
)
#else
ivas_error ivas_binaural_reverb_open(
    REVERB_STRUCT_HANDLE *hReverbPr,                /* i/o: binaural reverb handle               */
    const int16_t numBins,                          /* i  : number of CLDFB bins                 */
    const int16_t numCldfbSlotsPerFrame,            /* i  : number of CLDFB slots per frame      */
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters            */
    const AUDIO_CONFIG output_config,               /* i  : output audio configuration           */
    const int32_t sampling_rate,                    /* i  : sampling rate                        */
    const RENDERER_TYPE renderer_type,              /* i  : renderer type                        */
    const HRTFS_FASTCONV_HANDLE hHrtfFastConv,      /* i  : FastConv HRTF handle                 */
    const HRTFS_PARAMBIN_HANDLE hHrtfParambin       /* i  : Parametric binauralizer HRTF handle  */
)
#endif
{
    int16_t bin, chIdx, k, len;
    REVERB_STRUCT_HANDLE hReverb;
#ifndef FIX_822_REFACTOR_BIN_REVERB_OPEN
    const float *revTimes;
    float t60[CLDFB_NO_CHANNELS_MAX];
    float ene[CLDFB_NO_CHANNELS_MAX];
    ivas_error error;
#endif

    if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) malloc( sizeof( REVERB_STRUCT ) ) ) == NULL )
    {
@@ -1810,6 +1830,23 @@ static ivas_error ivas_binaural_reverb_open(
        set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins );
    }

#ifndef FIX_822_REFACTOR_BIN_REVERB_OPEN
    if ( renderer_type == RENDERER_BINAURAL_FASTCONV )
    {
        if ( !roomAcoustics->override )
        {
            revTimes = hHrtfFastConv->fastconvReverberationTimes;
        }
        else
        {
            revTimes = t60;
        }
    }
    else
    {
        revTimes = hHrtfParambin->parametricReverberationTimes;
    }
#endif
    for ( bin = 0; bin < hReverb->numBins; bin++ )
    {
        /* Loop Buffer */
@@ -1872,13 +1909,39 @@ static ivas_error ivas_binaural_reverb_open(
        }
    }

#ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN
    ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, revTimes, revEnes );
    ivas_binaural_reverb_setPreDelay( hReverb, preDelay );
#else
    if ( ( roomAcoustics ) && ( roomAcoustics->override ) )
    {
        if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, false, sampling_rate, t60, ene ) ) != IVAS_ERR_OK )
        {
            return error;
        }
        ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene );
        ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) );
    }
    else
    {
        if ( renderer_type == RENDERER_BINAURAL_FASTCONV )
        {
            ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections );
            ivas_binaural_reverb_setPreDelay( hReverb, 10 );
        }
        else
        {
            ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections );
            ivas_binaural_reverb_setPreDelay( hReverb, 10 );
        }
    }
#endif

    return IVAS_ERR_OK;
}


#ifdef FIX_822_REFACTOR_BIN_REVERB_OPEN
/*-------------------------------------------------------------------------
 * ivas_binaural_reverb_open_fastconv()
 *
@@ -1973,6 +2036,7 @@ ivas_error ivas_binaural_reverb_open_parambin(

    return error;
}
#endif

/*-------------------------------------------------------------------------
 * ivas_binaural_reverb_close()