Commit 09aceded authored by vaclav's avatar vaclav
Browse files

fixes

parent e0d9f800
Loading
Loading
Loading
Loading
+11 −16
Original line number Diff line number Diff line
@@ -4289,8 +4289,7 @@ static ivas_error load_hrtf_from_file(
    {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
        int16_t initFromRom;
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics, &initFromRom ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK )
#endif
@@ -4298,9 +4297,8 @@ static ivas_error load_hrtf_from_file(
            fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            return error;
        }

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( initFromRom )
        {
        if ( ( error = load_reverb_binary( *hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
        if ( ( error = load_reverb_binary( *hHrtfBinary->hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
@@ -4320,9 +4318,6 @@ static ivas_error load_hrtf_from_file(
#endif
            }
        }
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        }
#endif
    }

    return IVAS_ERR_OK;
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2249_MEMORY_LEAK_IN_SBA                     /* OR : issue 2249 : Memory leak in SBA to BINAURAL_ROOM_REVERB with memory instrumentation */
#define FIX_2249_HRTF_INIT_HARMONIZATION                /* VA: issue 2249: harmonize HRTFs init. between ROM and binary representations */

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

+7 −1
Original line number Diff line number Diff line
@@ -504,13 +504,19 @@ static ivas_error ivas_binaural_hrtf_open(
        /* Initialise tables from ROM */
        HRTFS_FASTCONV *HrtfFastConv;

#ifdef FIX_2249_HRTF_INIT_HARMONIZATION
        if ( ( error = ivas_HRTF_fastconv_binary_open( &HrtfFastConv ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
        if ( ( HrtfFastConv = (HRTFS_FASTCONV *) malloc( sizeof( HRTFS_FASTCONV ) ) ) == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for FastConv HRTF tables" );
        }

        ivas_init_binaural_hrtf( HrtfFastConv );

#endif
        if ( input_config == IVAS_AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV )
        {
            HrtfFastConv->FASTCONV_latency_s = FASTCONV_HRIR_latency_s;
+3 −10
Original line number Diff line number Diff line
@@ -1501,23 +1501,16 @@ ivas_error ivas_init_decoder(
    if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( st_ivas->hHrtfStatistics == NULL )
        {
            /* Allocate HRTF statistics */
            if ( ( error = ivas_HRTF_statistics_binary_open( &( st_ivas->hHrtfStatistics ) ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_reverb_HRTF_statistics_open( &( st_ivas->hHrtfStatistics ), output_Fs ) ) != IVAS_ERR_OK )
        {
            return error;
        }
        }

        /* Init HRTF statistics */
        if ( ( error = ivas_HRTF_statistics_init_from_rom( &st_ivas->hHrtfStatistics, output_Fs ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_HRTF_statistics_init( &st_ivas->hHrtfStatistics, output_Fs ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
#endif

        /* Get default reverb values based on format, if custom values were not given */
        if ( st_ivas->hDecoderConfig->Opt_RendConfigCustom == 0 )
+2 −13
Original line number Diff line number Diff line
@@ -2898,26 +2898,15 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle(

ivas_error IVAS_DEC_GetHrtfStatisticsHandle(
    IVAS_DEC_HANDLE hIvasDec,                         /* i/o: IVAS decoder handle       */
    IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    ,                          /* o  : HRTF statistics handle    */
    int16_t *intialisedFromRom /* o  : int16_t handle    */
#endif
    IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o  : HRTF statistics handle    */
)
{
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfStatistics == NULL || intialisedFromRom == NULL )
#else
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfStatistics == NULL )
#endif
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    *hHrtfStatistics = &hIvasDec->st_ivas->hHrtfStatistics;
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    *intialisedFromRom = hIvasDec->st_ivas->hHrtfStatistics->fromROM;
#endif

    return IVAS_ERR_OK;
}
Loading