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

bring destroy_hrtf_statistics() logic closer to the float

parent 29162188
Loading
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -790,9 +790,7 @@ cleanup:
    if ( arg.hrtfReaderEnabled )
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfBinary.hHrtfTD );
        destroy_td_hrtf( hHrtfBinary.hHrtfTD );
        IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary.hHrtfStatistics );
        destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
#else
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
@@ -812,11 +810,15 @@ cleanup:

#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD
    // TODO:
    /* This free differs from float version and is done always. This should be safe to do even though we leave a return
     * value as not handled. This is needed as HRTF statistics from ROM are currently converted from float values. */
    /* This free differs from float version. 
       This is needed as HRTF statistics from ROM are currently converted from Word16 values to Word32 values. */
#ifdef FIX_CREND_SIMPLIFY_CODE
    IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary.hHrtfStatistics );
    destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
    else
    {
        IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics;
        IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
        destroy_hrtf_statistics( hHrtfStatistics );
    }
#else
    IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
    destroy_hrtf_statistics( hHrtfStatistics );
+2 −0
Original line number Diff line number Diff line
@@ -3478,6 +3478,7 @@ void ivas_destroy_dec_fx(
    {
        ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
    }

#ifdef FIX_CREND_SIMPLIFY_CODE
    IF( st_ivas->hHrtfTD != NULL )
#else
@@ -3485,6 +3486,7 @@ void ivas_destroy_dec_fx(
#endif
    {
        BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval );

        ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD );
    }

+3 −7
Original line number Diff line number Diff line
@@ -341,13 +341,6 @@ ivas_error ivas_HRTF_statistics_binary_open_fx(
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for statistics HRTF tables!" );
    }

#ifdef FIX_CREND_SIMPLIFY_CODE
    ( *hHrtfStatistics )->average_energy_l_dyn = NULL;
    ( *hHrtfStatistics )->average_energy_r_dyn = NULL;
    ( *hHrtfStatistics )->inter_aural_coherence_dyn = NULL;
    ( *hHrtfStatistics )->fromROM = 1;
#endif

    return IVAS_ERR_OK;
}

@@ -499,6 +492,9 @@ ivas_error ivas_HRTF_statistics_init_fx(
            BREAK;
    }
    HrtfStatistics->fromROM = TRUE;
#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD
    HrtfStatistics->fromROM = FALSE; // TODO: temporary hack until HRTF statistics ROM tables are converted from Word16 to Word32
#endif

    *hHrtfStatistics = HrtfStatistics;

+4 −0
Original line number Diff line number Diff line
@@ -3457,7 +3457,11 @@ void destroy_hrtf_statistics(
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle  */
)
{
#ifdef FIX_CREND_SIMPLIFY_CODE
    if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) )
#else
    if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) )
#endif
    {
        if ( ( *hHrtfStatistics )->average_energy_l_dyn != NULL )
        {