Commit 9b4f2ec7 authored by vaclav's avatar vaclav
Browse files

fix FIX_1995_REVERB_INIT

parent 43472153
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1995_REVERB_INIT                            /* issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */

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

+1 −2
Original line number Diff line number Diff line
@@ -945,8 +945,7 @@ ivas_error ivas_binaural_reverb_init(
    const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics,       /* i/o: room acoustics parameters               */
    const int32_t sampling_rate,                                /* i  : sampling rate                           */
    const float *defaultTimes,                                  /* i  : default reverberation times             */
    const float *defaultEne                                     /* i  : default reverberation energies          */
    ,
    const float *defaultEne,                                    /* i  : default reverberation energies          */
    float *earlyEne                                             /* i/o: Early part energies to be modified      */
);

+17 −13
Original line number Diff line number Diff line
@@ -1859,12 +1859,13 @@ static ivas_error ivas_binaural_reverb_open(
    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------------
 * ivas_binaural_reverb_init()
 *
 * Allocate and initialize binaural room reverberator handle
 * for CLDFB renderers
 * Initialize binaural room reverberator handle for FastConv renderer
 *------------------------------------------------------------------------*/

ivas_error ivas_binaural_reverb_init(
    REVERB_STRUCT_HANDLE *hReverbPr,                      /* i/o: binaural reverb handle               */
    const HRTFS_STATISTICS_HANDLE hHrtfStatistics,        /* i  : HRTF statistics handle               */
@@ -1873,8 +1874,7 @@ ivas_error ivas_binaural_reverb_init(
    const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters            */
    const int32_t sampling_rate,                          /* i  : sampling rate                        */
    const float *defaultTimes,                            /* i  : default reverberation times          */
    const float *defaultEne                               /* i  : default reverberation energies       */
    ,
    const float *defaultEne,                              /* i  : default reverberation energies       */
    float *earlyEne                                       /* i/o: Early part energies to be modified   */
)
{
@@ -1883,24 +1883,23 @@ ivas_error ivas_binaural_reverb_init(
    float revTimes[CLDFB_NO_CHANNELS_MAX];
    float revEne[CLDFB_NO_CHANNELS_MAX];

    error = IVAS_ERR_OK;

    if ( roomAcoustics != NULL )
    {

        if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics,
                                                         hHrtfStatistics,
                                                         sampling_rate,
                                                         revTimes,
                                                         revEne ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfStatistics, sampling_rate, revTimes, revEne ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        /* preDelay parameter = acousticPreDelay * sampling_rate / numBins */
        preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX );
    }
    else
    {
#ifdef FIX_1995_REVERB_INIT
        for ( bin = 0; bin < numBins; bin++ )
#else
        for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ )
#endif
        {
            revTimes[bin] = defaultTimes[bin];
            revEne[bin] = defaultEne[bin];
@@ -1908,7 +1907,11 @@ ivas_error ivas_binaural_reverb_init(
        preDelay = 10;
    }

#ifdef FIX_1995_REVERB_INIT
    for ( bin = 0; bin < numBins; bin++ )
#else
    for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ )
#endif
    {
        /* Adjust the room effect parameters when the reverberation time is less than a threshold value, to avoid
           spectral artefacts with the synthetic reverberator. */
@@ -1943,6 +1946,7 @@ ivas_error ivas_binaural_reverb_init(
    return error;
}


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