Commit a0f3cb3b authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2249_MEMORY_LEAK_IN_SBA

parent 6539680b
Loading
Loading
Loading
Loading
+0 −55
Original line number Diff line number Diff line
@@ -159,11 +159,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;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_sec;
@@ -243,10 +238,6 @@ int main(
    enable_float_exception_trap( FLE_MASK_DENORM | FLE_MASK_UNDERFLOW );
#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;

    /*------------------------------------------------------------------------------------------*
@@ -859,13 +850,6 @@ cleanup:
#ifdef DEBUG_SBA_AUDIO_DUMP
    IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels );

#endif
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    if ( arg.hrtfReaderEnabled )
    {
        destroy_td_hrtf( hHrtfBinary.hHrtfTD );
        destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
    }
#endif

    IVAS_DEC_Close( &hIvasDec );
@@ -4162,12 +4146,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;
@@ -4190,22 +4168,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 )
                {
@@ -4214,11 +4184,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
                }
            }
        }
@@ -4291,32 +4257,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 )
            {
@@ -4325,17 +4276,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
@@ -1076,11 +1076,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 )
                {
@@ -2100,10 +2096,6 @@ cleanup:
    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
@@ -163,7 +163,6 @@
#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_1486_INIT_OUTPUT_POINTERS                   /* FhG: always initialize pointers in renderer flush */
#define FIX_2249_MEMORY_LEAK_IN_SBA                     /* OR : issue 2249 : Memory leak in SBA to BINAURAL_ROOM_REVERB with memory instrumentation */
#define FIX_1483_PEAQ_VQ_ENC_MSAN_ERROR                 /* Eri: When no PVQ bands are selected in peaq_vq_enc, the number of bands is not initialized. */
#define FIX_1480_CLANG18_MSAN_UNINIT_VARIABLE           /* Eri: Initializes a variable in HQ decoder. It is not used, but is passed uninitialized to a function which is caught by clang-18 */
#define FIX_1449_RENDERER_FRAME_SIZE_UNCLEAR_IN_ISAR    /* Dolby: Fix for issue 1449: renderer frame size unclear in ISAR */
+0 −28
Original line number Diff line number Diff line
@@ -1500,17 +1500,10 @@ 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 ( ( error = ivas_reverb_HRTF_statistics_open( &( st_ivas->hHrtfStatistics ), output_Fs ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
        if ( ( error = ivas_HRTF_statistics_init( &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 ( st_ivas->hDecoderConfig->Opt_RendConfigCustom == 0 )
@@ -2988,29 +2981,12 @@ void ivas_destroy_dec(
    ivas_combined_orientation_close( &st_ivas->hCombinedOrientationData );

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

    if ( st_ivas->hHrtfTD != NULL )
    {
        BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval );
        ivas_HRTF_binary_close( &st_ivas->hHrtfTD );
    }
#endif

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

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

    /* Fastconv HRTF filters */
    ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv );
@@ -3019,11 +2995,7 @@ void ivas_destroy_dec(
    ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin );

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

    /* Config. Renderer */
    ivas_render_config_close( &( st_ivas->hRenderConfig ) );
+0 −12
Original line number Diff line number Diff line
@@ -2923,11 +2923,7 @@ ivas_error IVAS_DEC_HRTF_binary_open(
        /* TD binaural renderer */
        if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || 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( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -2997,11 +2993,7 @@ ivas_error IVAS_DEC_HRTF_binary_close(
    {
        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            ivas_HRTF_td_binary_close( &st_ivas->hHrtfTD );
#else
            ivas_HRTF_binary_close( &st_ivas->hHrtfTD );
#endif
        }

        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
@@ -3012,10 +3004,6 @@ ivas_error IVAS_DEC_HRTF_binary_close(

        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
            /* Fastconv HRTF memories */
            ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv );
#endif
            /* Fastconv HRTF filters */
            ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv );
        }
Loading