Commit 630123db authored by emerit's avatar emerit
Browse files

ready for test

parent ff509b50
Loading
Loading
Loading
Loading
+39 −2
Original line number Diff line number Diff line
@@ -142,9 +142,11 @@ 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;
@@ -207,8 +209,10 @@ 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;

@@ -730,11 +734,13 @@ 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 );
    }
#endif
#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD
    // TODO:
    /* This free differs from float version.
@@ -3756,12 +3762,12 @@ 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;
@@ -3783,13 +3789,23 @@ 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 )
                {
@@ -3798,7 +3814,11 @@ 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
                }
            }
        }
@@ -3873,15 +3893,28 @@ static ivas_error load_hrtf_from_file(
        }
    }

#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_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 )
#endif
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
@@ -3890,7 +3923,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
            }
        }
    }
+2 −0
Original line number Diff line number Diff line
@@ -2192,8 +2192,10 @@ 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 );
+22 −1
Original line number Diff line number Diff line
@@ -1799,7 +1799,18 @@ 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 statistics */
        IF( NE_32( ( error = ivas_HRTF_statistics_binary_open_fx( &( st_ivas->hHrtfStatistics ) ) ), IVAS_ERR_OK ) )
        {
            return error;
        }

        /* Init HRTF statistics */
        IF( NE_32( ( error = ivas_HRTF_statistics_init_from_rom_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) )
#else
        IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) )
#endif
        {
            return error;
        }
@@ -3548,16 +3559,22 @@ void ivas_destroy_dec_fx(

    IF( st_ivas->hHrtfTD != NULL )
    {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        ivas_HRTF_td_binary_close_fx( &st_ivas->hHrtfTD );
#else
        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 );
@@ -3566,7 +3583,11 @@ 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 ) );
+11 −1
Original line number Diff line number Diff line
/******************************************************************************************************
/******************************************************************************************************

   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
@@ -2516,7 +2516,11 @@ 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;
            }
@@ -2598,7 +2602,11 @@ 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();
@@ -2611,8 +2619,10 @@ 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 );
+3 −0
Original line number Diff line number Diff line
@@ -1812,8 +1812,11 @@ void ivas_rend_closeCldfbRend(
        pCldfbRend->hCldfbRend->hInputSetup = NULL;
    }


    ivas_binRenderer_close_fx( &pCldfbRend->hCldfbRend );
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    ivas_binaural_hrtf_close_fx( &pCldfbRend->hHrtfFastConv );
#endif
    ivas_HRTF_fastconv_binary_close_fx( &pCldfbRend->hHrtfFastConv );

    return;
Loading