Commit 14e7c538 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2249_MEMORY_LEAK_IN_SBA

parent 1f4de7d9
Loading
Loading
Loading
Loading
+0 −63
Original line number Diff line number Diff line
@@ -142,11 +142,6 @@ typedef struct
    hrtfFileReader *hrtfReader;
    char *hrtfFileName;

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD;

    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics;
#endif

    IVAS_BIN_RENDERER_TYPE binaural_renderer;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_old;
@@ -209,10 +204,6 @@ int main(
    reset_mem( USE_BYTES );
#endif

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    hHrtfBinary.hHrtfTD = NULL;         /* just to avoid compilation warning */
    hHrtfBinary.hHrtfStatistics = NULL; /* just to avoid compilation warning */
#endif

    splitRendBits.bits_buf = splitRendBitsBuf;

@@ -741,21 +732,6 @@ cleanup:
        free( arg.aeSequence.pValidity );
    }

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    if ( arg.hrtfReaderEnabled )
    {
        destroy_td_hrtf( hHrtfBinary.hHrtfTD );
        destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
    }
#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD
    // TODO:
    /* This free differs from float version.
       This is needed as HRTF statistics from ROM are currently converted from Word16 values to scaled Word32 values. */
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
    IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
    destroy_hrtf_statistics( hHrtfStatistics );
#endif
#endif
    IVAS_DEC_Close( &hIvasDec );
    CustomLsReader_close( &hLsCustomReader );
    hrtfFileReader_close( &hrtfReader );
@@ -3769,12 +3745,6 @@ static ivas_error load_hrtf_from_file(
        /*------------------------------------------------------------------------------------------*
         * Release HRTF binary data
         *------------------------------------------------------------------------------------------*/
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && binaural_renderer_sec != IVAS_BIN_RENDERER_TYPE_TDREND && hHrtfBinary->hHrtfTD != NULL )
        {
            destroy_td_hrtf( hHrtfBinary->hHrtfTD );
        }
#endif
        if ( ( error = IVAS_DEC_HRTF_binary_close( hIvasDec, hHrtfBinary->binaural_renderer_old ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -3797,22 +3767,14 @@ static ivas_error load_hrtf_from_file(
        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_sec == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD = NULL;
            if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfBinary->hHrtfTD ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfTDrendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_TDrend_HRTF_binary( *hHrtfBinary->hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
@@ -3821,11 +3783,7 @@ static ivas_error load_hrtf_from_file(
                }
                else
                {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
                    destroy_td_hrtf( hHrtfTD );
#else
                    destroy_td_hrtf( hHrtfBinary->hHrtfTD );
#endif
                }
            }
        }
@@ -3898,32 +3856,17 @@ static ivas_error load_hrtf_from_file(
                }
            }
        }
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    }
#endif

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#else
        if ( hHrtfBinary->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
    {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            return error;
        }

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( ( error = load_HrtfStatistics_from_binary( *hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_reverb_binary( *hHrtfBinary->hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#endif
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
@@ -3932,17 +3875,11 @@ static ivas_error load_hrtf_from_file(
            }
            else
            {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
                destroy_hrtf_statistics( hHrtfStatistics );
#else
                    destroy_hrtf_statistics( hHrtfBinary->hHrtfStatistics );
#endif
            }
        }
    }
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
}
#endif

return IVAS_ERR_OK;
}
+0 −8
Original line number Diff line number Diff line
@@ -1107,11 +1107,7 @@ int main(
            fprintf( stderr, "\nIVAS_REND_GetHrtfStatisticsHandle failed\n\n" );
            goto cleanup;
        }
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( ( error = load_HrtfStatistics_from_binary( *hHrtfStatistics, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK )
#else
        if ( ( error = load_reverb_binary( *hHrtfStatistics, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK )
#endif
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
@@ -2203,10 +2199,6 @@ cleanup:
    RotationFileReader_close( &externalOrientationFileReader );
    RotationFileReader_close( &referenceRotReader );
    Vector3PairFileReader_close( &referenceVectorReader );
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    destroy_td_hrtf( hHrtfTD );
    destroy_hrtf_statistics( hHrtfStatistics );
#endif
    IVAS_REND_Close( &hIvasRend );
    IsmPositionProvider_close( positionProvider );
    RenderConfigReader_close( &renderConfigReader );
+0 −1
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@
#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK       /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
#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_2252_SCALING_SAVE_HB_SYNTH                  /* VA: issue 2252: fix use-of-uninit-value in save_hb_synth_fx[] scaling in FOA decoding with bitstream that starts with an SID */
#define FIX_2248_EVS_ASSERT                             /* VA: Include _sat in an EVS related part of the code */
#define FIX_2254_IMPROV_COMPLEXITY_BE                   /* VA: BE small complexity reduction  */
+0 −29
Original line number Diff line number Diff line
@@ -1799,18 +1799,11 @@ ivas_error ivas_init_decoder_fx(
    IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
        /* Init HRTF statistics */
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        /* Allocate HRTF and init statistics */
        IF( NE_32( ( error = ivas_reverb_HRTF_statistics_open_fx( &( st_ivas->hHrtfStatistics ), output_Fs ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
#else
        IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
#endif

        /* Get default reverb values based on format, if custom values were not given */
        IF( EQ_16( st_ivas->hDecoderConfig->Opt_RendConfigCustom, 0 ) )
@@ -3549,30 +3542,12 @@ void ivas_destroy_dec_fx(
    ivas_combined_orientation_close_fx( &st_ivas->hCombinedOrientationData );

    /* Time Domain binaural renderer handle */
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
    ivas_HRTF_td_binary_close_fx( &st_ivas->hHrtfTD );
#else
    IF( st_ivas->hBinRendererTd != NULL )
    {
        ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
    }

    IF( st_ivas->hHrtfTD != NULL )
    {
        BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval );

        ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD );
    }
#endif

    /* CRend binaural renderer handle */
    ivas_HRTF_CRend_binary_close_fx( &st_ivas->hHrtfCrend );

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    /* Fastconv HRTF memories */
    ivas_binaural_hrtf_close_fx( &st_ivas->hHrtfFastConv );
#endif

    /* Fastconv HRTF filters */
    ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv );
@@ -3581,11 +3556,7 @@ void ivas_destroy_dec_fx(
    ivas_HRTF_parambin_binary_close_fx( &st_ivas->hHrtfParambin );

/* HRTF statistics */
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    ivas_HRTF_statistics_binary_close_fx( &st_ivas->hHrtfStatistics );
#else
    ivas_HRTF_statistics_close_fx( &st_ivas->hHrtfStatistics );
#endif

    /* Config. Renderer */
    ivas_render_config_close_fx( &( st_ivas->hRenderConfig ) );
+0 −12
Original line number Diff line number Diff line
@@ -2483,11 +2483,7 @@ ivas_error IVAS_DEC_HRTF_binary_open(
        test();
        IF( ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_TDREND ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) && st_ivas->hHrtfTD == NULL )
        {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            IF( ( error = ivas_HRTF_td_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
#else
            IF( ( error = ivas_HRTF_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -2569,11 +2565,7 @@ ivas_error IVAS_DEC_HRTF_binary_close(
        test();
        IF( !( EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_TDREND ) || EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) )
        {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            ivas_HRTF_td_binary_close_fx( &st_ivas->hHrtfTD );
#else
            ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD );
#endif
        }

        test();
@@ -2586,10 +2578,6 @@ ivas_error IVAS_DEC_HRTF_binary_close(
        test();
        IF( !( EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_FASTCONV ) || EQ_32( binaural_renderer_old, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) )
        {
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
            /* Fastconv HRTF memories */
            ivas_binaural_hrtf_close_fx( &st_ivas->hHrtfFastConv );
#endif

            /* Fastconv HRTF filters */
            ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv );
Loading