Commit 0df12434 authored by vaclav's avatar vaclav
Browse files

patch for Linux build

parent db9d95d3
Loading
Loading
Loading
Loading
+77 −0
Original line number Diff line number Diff line
@@ -2721,3 +2721,80 @@ 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;
}
+0 −79
Original line number Diff line number Diff line
@@ -126,87 +126,8 @@ void ivas_HRTF_CRend_binary_close(

    return;
}
#endif


/*---------------------------------------------------------------------*
 * 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;
}


#ifdef HRTF_BINARY_FILE
/*-----------------------------------------------------------------------*
 * ivas_HRTF_fastconv_binary_open()
 *
+8 −7
Original line number Diff line number Diff line
@@ -496,10 +496,10 @@ void HRTF_model_precalc(

    maximum_s( model->azimDim3, model->elevDim3, &model->azimDim3Max );


    return;
}


/*-------------------------------------------------------------------*
 * BSplineModelEvalDealloc()
 *
@@ -513,6 +513,7 @@ void BSplineModelEvalDealloc(
{
    /* Allocated in LoadBSplineBinary() */
    int16_t i;

    if ( model->modelROM )
    {
        free( (void *) model->azimBsShape ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */
+1 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
#include <stdio.h>
#include <string.h>
#include "prot.h"
#include "ivas_prot.h"
//#include "ivas_prot.h"
#include "ivas_prot_rend.h"
#ifdef HRTF_BINARY_FILE
//#include "lib_dec.h"
@@ -1559,7 +1559,6 @@ ivas_error create_SetOfHRTF_from_binary(

    if ( ( ( *hSetOfHRTF ).hHRTF_hrir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_brir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_hrir_hoa3 == NULL ) )
    {
        // VE2AT: Makefile build returns "undefined reference to `destroy_SetOfHRTF'"; MSCV is happy...
        destroy_SetOfHRTF( hSetOfHRTF );
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create all the HRTF from binary file" );
    }
+0 −2
Original line number Diff line number Diff line
@@ -84,10 +84,8 @@ ivas_error create_SetOfHRTF_from_binary(
    const hrtfFileReader *hrtfReader,      /* i: pointer to hrtfFileReader handle */
    int32_t output_Fs                      /* i: Output sampling frequency    */
);
#endif


#ifdef HRTF_BINARY_FILE
/*---------------------------------------------------------------------*
 * load_fastconv_HRTF_from_binary()
 *