Commit 889b7fd5 authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

Fixed declarations and refs

parent 849959bb
Loading
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1480,9 +1480,12 @@ typedef struct ivas_hrtfs_parambin_struct
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
typedef struct ivas_hrtfs_statistics_struct
{
    Word32 *average_energy_l;
    Word32 *average_energy_r;
    Word32 *inter_aural_coherence;
    const Word32 *average_energy_l;
    const Word32 *average_energy_r;
    const Word32 *inter_aural_coherence;
    Word32 *average_energy_l_dyn;
    Word32 *average_energy_r_dyn;
    Word32 *inter_aural_coherence_dyn;
    int16_t fromROM; /*  Flag that indicates that the pointers point to tables in ROM (controls init/dealloc).*/
} HRTFS_STATISTICS, *HRTFS_STATISTICS_HANDLE;
#endif
+26 −13
Original line number Diff line number Diff line
@@ -797,17 +797,21 @@ static ivas_error load_reverb_from_binary(
    if ( is_reverb )
    {
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        hHrtfStatistics->average_energy_l = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) );
        hHrtfStatistics->average_energy_r = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) );
        hHrtfStatistics->inter_aural_coherence = (Word32 *) malloc( lr_iac_len * sizeof( Word32) );
        hHrtfStatistics->average_energy_l_dyn = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) );
        hHrtfStatistics->average_energy_r_dyn = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) );
        hHrtfStatistics->inter_aural_coherence_dyn = (Word32 *) malloc( lr_iac_len * sizeof( Word32) );

        if ( hHrtfStatistics->average_energy_l == NULL || hHrtfStatistics->average_energy_r == NULL || hHrtfStatistics->inter_aural_coherence == NULL )
        if ( hHrtfStatistics->average_energy_l_dyn == NULL || hHrtfStatistics->average_energy_r_dyn == NULL || hHrtfStatistics->inter_aural_coherence_dyn == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" );
        }
        fread( hHrtfStatistics->average_energy_l, sizeof( const Word32 ), lr_iac_len, f_hrtf );
        fread( hHrtfStatistics->average_energy_r, sizeof( const Word32 ), lr_iac_len, f_hrtf );
        fread( hHrtfStatistics->inter_aural_coherence, sizeof( const Word32 ), lr_iac_len, f_hrtf );
        hHrtfStatistics->average_energy_l = hHrtfStatistics->average_energy_l_dyn;
        hHrtfStatistics->average_energy_r = hHrtfStatistics->average_energy_r_dyn;
        hHrtfStatistics->inter_aural_coherence = hHrtfStatistics->inter_aural_coherence_dyn;
        fread( hHrtfStatistics->average_energy_l_dyn, sizeof( const Word32 ), lr_iac_len, f_hrtf );
        fread( hHrtfStatistics->average_energy_r_dyn, sizeof( const Word32 ), lr_iac_len, f_hrtf );
        fread( hHrtfStatistics->inter_aural_coherence_dyn, sizeof( const Word32 ), lr_iac_len, f_hrtf );


        hHrtfStatistics->fromROM = FALSE;
#else
@@ -2366,18 +2370,27 @@ void destroy_SetOfHRTF(
 * Destroy the HRTF statistics set.
 *---------------------------------------------------------------------*/

ivas_error destroy_hrtf_statistics(
void destroy_hrtf_statistics(
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle  */
)
{
    if ( hHrtfStatistics != NULL && ( *hHrtfStatistics )->fromROM == FALSE )
    if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) )
    {
        if ( ( *hHrtfStatistics )->average_energy_l != NULL )
        {
        free( ( *hHrtfStatistics )->average_energy_l );
        free( ( *hHrtfStatistics )->average_energy_r );
        free( ( *hHrtfStatistics )->inter_aural_coherence );
            free( ( *hHrtfStatistics )->average_energy_l_dyn );
        }
        if ( ( *hHrtfStatistics )->average_energy_r != NULL )
        {
            free( ( *hHrtfStatistics )->average_energy_r_dyn );
        }
        if ( ( *hHrtfStatistics )->inter_aural_coherence != NULL )
        {
            free( ( *hHrtfStatistics )->inter_aural_coherence_dyn );
        }

    }
    ivas_HRTF_statistics_close( hHrtfStatistics );
    return IVAS_ERR_OK;
}
#endif

+2 −14
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ ivas_error load_HRTF_binary(

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
/*---------------------------------------------------------------------*
 * load_reverb_from_binary()
 * load_reverb_binary()
 *
 * Load reverb binary data into the HRTF handle
 *---------------------------------------------------------------------*/
@@ -186,7 +186,7 @@ ivas_error load_parambin_HRTF_from_binary(
 * free memory allocated for HRTF statistics binary data
 *---------------------------------------------------------------------*/

ivas_error destroy_hrtf_statistics(
void destroy_hrtf_statistics(
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle  */
);
#endif
@@ -206,18 +206,6 @@ void destroy_parambin_hrtf(
    IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* i/o: Parambin HRTF handle               */
);

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
/*---------------------------------------------------------------------*
 * destroy_hrtf_statistics()
 *
 * free memory allocated for HRTF statistics binary data
 *---------------------------------------------------------------------*/

ivas_error destroy_hrtf_statistics(
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle  */
);
#endif

/*---------------------------------------------------------------------*
 * destroy_td_hrtf()
 *