Commit 7c6c6feb authored by vaclav's avatar vaclav
Browse files

fix FIX_1995_REVERB_INIT

parent cb50e441
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@
#define FIX_1980_CRASH_FDCNG_ENCODESID                       /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */
#define FIX_1987_CRASH_OMASA_ENERGY                          /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */
#define FIX_1985_SBA_714_HF_LOSS                             /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/
#define FIX_1995_REVERB_INIT                                 /* issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */

/* #################### Start BASOP porting switches ############################ */

+15 −5
Original line number Diff line number Diff line
@@ -2426,6 +2426,7 @@ static ivas_error ivas_binaural_reverb_open_fx(
 * Allocate and initialize binaural room reverberator handle
 * for CLDFB renderers
 *------------------------------------------------------------------------*/

ivas_error ivas_binaural_reverb_init(
    REVERB_STRUCT_HANDLE *hReverbPr,                      /* i/o: binaural reverb handle               */
    const HRTFS_STATISTICS_HANDLE hHrtfStatistics,        /* i  : HRTF statistics handle               */
@@ -2434,8 +2435,7 @@ ivas_error ivas_binaural_reverb_init(
    const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters            */
    const Word32 sampling_rate,                           /* i  : sampling rate                        */
    const Word32 *defaultTimes,                           /* i  : default reverberation times          */
    const Word32 *defaultEne                              /* i  : default reverberation energies       */
    ,
    const Word32 *defaultEne,                             /* i  : default reverberation energies       */
    Word32 *earlyEne                                      /* i/o: Early part energies to be modified   */
)
{
@@ -2455,12 +2455,16 @@ ivas_error ivas_binaural_reverb_init(
            return error;
        }

        temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, ( ( IVAS_48k / CLDFB_NO_CHANNELS_MAX ) >> 1 ) ); // Q11
        temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, ( ( 48000 / CLDFB_NO_CHANNELS_MAX ) >> 1 ) ); // Q11
        preDelay = extract_l( L_shr( L_add( temp32, L_shl( 1, 10 ) ), 11 ) );                                  // Q0
    }
    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];
            move32();
@@ -2470,7 +2474,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. */
@@ -2522,6 +2530,8 @@ ivas_error ivas_binaural_reverb_init(

    return error;
}


/*-------------------------------------------------------------------------
 * ivas_binaural_reverb_close_fx()
 *