Commit 83de2287 authored by vaclav's avatar vaclav
Browse files

move back destroy_SetOfHRTF()

parent fd09e35e
Loading
Loading
Loading
Loading
+0 −77
Original line number Diff line number Diff line
@@ -2719,80 +2719,3 @@ ivas_error ivas_rend_crendConvolver(
}

#endif

// VE2AT: moved here to avoid Linux build error; but should it be put somewhere else?
/*---------------------------------------------------------------------*
 * destroy_HRTF()
 *
 * Destroy the HRTF CRend handle
 *---------------------------------------------------------------------*/

static ivas_error destroy_HRTF(
    HRTFS_HANDLE *hHRTF /* i/o: HRTF CRend handle */
)
{
    uint16_t i, j;

    if ( *hHRTF != NULL && hHRTF != NULL )
    {
        for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
        {
            for ( j = 0; j < BINAURAL_CHANNELS; j++ )
            {
                if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL )
                {
                    free( ( *hHRTF )->pIndex_frequency_max[i][j] );
                }
                if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL )
                {
                    free( ( *hHRTF )->pOut_to_bin_re[i][j] );
                }
                if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL )
                {
                    free( ( *hHRTF )->pOut_to_bin_im[i][j] );
                }
            }
        }
        for ( j = 0; j < BINAURAL_CHANNELS; j++ )
        {
            if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL )
            {
                free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] );
            }
            if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL )
            {
                free( ( *hHRTF )->pOut_to_bin_diffuse_re[j] );
            }
            if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] != NULL )
            {
                free( ( *hHRTF )->pOut_to_bin_diffuse_im[j] );
            }
        }

        free( *hHRTF );
        *hHRTF = NULL;
    }

    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * destroy_SetOfHRTF()
 *
 * Destroy the HRTF data set.
 *---------------------------------------------------------------------*/

void destroy_SetOfHRTF(
    HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle              */
)
{
    if ( hSetOfHRTF != NULL )
    {
        destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_combined ) );
        destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_hoa3 ) );
        destroy_HRTF( &( hSetOfHRTF->hHRTF_brir_combined ) );
    }

    return;
}
+11 −0
Original line number Diff line number Diff line
@@ -86,6 +86,17 @@ ivas_error create_SetOfHRTF_from_binary(
);


/*---------------------------------------------------------------------*
 * destroy_SetOfHRTF()
 *
 * Destroy the HRTF data set.
 *---------------------------------------------------------------------*/

ivas_error destroy_SetOfHRTF(
    IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle              */
);


/*---------------------------------------------------------------------*
 * load_fastconv_HRTF_from_binary()
 *