Loading apps/decoder.c +10 −4 Original line number Diff line number Diff line Loading @@ -767,8 +767,7 @@ int main( } else { dealloc_HRTF_binary( *hHrtfTD ); *hHrtfTD = NULL; destroy_td_hrtf( hHrtfTD ); } } #else Loading Loading @@ -814,8 +813,7 @@ int main( } else { destroy_SetOfHRTF( *hSetOfHRTF ); *hSetOfHRTF = NULL; destroy_SetOfHRTF( hSetOfHRTF ); } } #else Loading Loading @@ -978,7 +976,11 @@ cleanup: IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); if ( hHrtfTD != NULL ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING destroy_td_hrtf( hHrtfTD ); #else dealloc_HRTF_binary( *hHrtfTD ); #endif } #ifdef NONBE_FIX_BINARY_BINAURAL_READING IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL; Loading @@ -988,7 +990,11 @@ cleanup: IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); if ( hSetOfHRTF != NULL ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING destroy_SetOfHRTF( hSetOfHRTF ); #else destroy_SetOfHRTF( *hSetOfHRTF ); #endif } } Loading apps/renderer.c +4 −6 Original line number Diff line number Diff line Loading @@ -1074,8 +1074,7 @@ int main( } else { dealloc_HRTF_binary( *hHrtfTD ); *hHrtfTD = NULL; destroy_td_hrtf( hHrtfTD ); } } Loading Loading @@ -1105,8 +1104,7 @@ int main( } else { destroy_SetOfHRTF( *hSetOfHRTF ); *hSetOfHRTF = NULL; destroy_SetOfHRTF( hSetOfHRTF ); } } Loading Loading @@ -2268,11 +2266,11 @@ cleanup: #ifdef NONBE_FIX_BINARY_BINAURAL_READING if ( hSetOfHRTF != NULL && *hSetOfHRTF != NULL ) { destroy_SetOfHRTF( *hSetOfHRTF ); destroy_SetOfHRTF( hSetOfHRTF ); } if ( hHrtfTD != NULL && *hHrtfTD != NULL ) { dealloc_HRTF_binary( *hHrtfTD ); destroy_td_hrtf( hHrtfTD ); } #endif IVAS_REND_Close( &hIvasRend ); Loading lib_rend/ivas_hrtf.c +23 −0 Original line number Diff line number Diff line Loading @@ -50,12 +50,24 @@ ivas_error ivas_HRTF_binary_open( TDREND_HRFILT_FiltSet_t **hHrtfTD ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING uint32_t ind; char *pTmp; #endif /* Allocate HR filter set for headphones configuration */ *hHrtfTD = (TDREND_HRFILT_FiltSet_t *) malloc( sizeof( TDREND_HRFILT_FiltSet_t ) ); if ( *hHrtfTD == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" ); } #ifdef NONBE_FIX_BINARY_BINAURAL_READING pTmp = (char *) *hHrtfTD; for ( ind = 0; ind < sizeof( TDREND_HRFILT_FiltSet_t ); ind++ ) { pTmp[ind] = 0; } #endif return IVAS_ERR_OK; } Loading Loading @@ -179,14 +191,25 @@ void ivas_HRTF_fastconv_binary_close( ivas_error ivas_HRTF_parambin_binary_open( HRTFS_PARAMBIN **hHrtfParambin ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING uint32_t ind; char *pTmp; #endif *hHrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ); if ( *hHrtfParambin == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" ); } #ifdef NONBE_FIX_BINARY_BINAURAL_READING pTmp = (char *) *hHrtfParambin; for ( ind = 0; ind < sizeof( HRTFS_PARAMBIN ); ind++ ) { pTmp[ind] = 0; } ( *hHrtfParambin )->allocatedFromFile = 1; #endif return IVAS_ERR_OK; } Loading lib_rend/ivas_objectRenderer_mix.c +4 −0 Original line number Diff line number Diff line Loading @@ -147,7 +147,11 @@ void TDREND_MIX_Dealloc( hBinRendererTd->Listener_p = NULL; } /* Dealloc HR filter set */ #ifdef NONBE_FIX_BINARY_BINAURAL_READING if ( ( *hBinRendererTd->pHrFiltSet_p != NULL ) && ( hBinRendererTd->HrFiltSet_p != NULL ) ) #else if ( hBinRendererTd->HrFiltSet_p != NULL ) #endif { if ( hBinRendererTd->HrFiltSet_p->FilterMethod == TDREND_HRFILT_Method_BSplineModel ) { Loading lib_util/hrtf_file_reader.c +91 −2 Original line number Diff line number Diff line Loading @@ -837,7 +837,78 @@ static void HRTF_energy_sections_precalc( return; } #ifdef NONBE_FIX_BINARY_BINAURAL_READING /*---------------------------------------------------------------------* * dealloc_HRTF_binary() * * Deallocated memory allocated by load_HRTF_binary *---------------------------------------------------------------------*/ ivas_error destroy_td_hrtf( IVAS_DEC_HRTF_HANDLE *hHrtf /* i/o: HRTF handle */ ) { int16_t i; ivas_error error; error = IVAS_ERR_OK; if ( ( hHrtf == NULL ) || ( *hHrtf == NULL ) ) { return error; } if ( !( *hHrtf )->ModelParams.modelROM ) { if ( ( *hHrtf )->ModelParams.UseItdModel ) { free( ( *hHrtf )->ModelParamsITD.elevKSeq_dyn ); free( ( *hHrtf )->ModelParamsITD.azimKSeq_dyn ); free( ( *hHrtf )->ModelParamsITD.W_dyn ); free( ( *hHrtf )->ModelParamsITD.azimBsShape_dyn ); free( ( *hHrtf )->ModelParamsITD.elevBsShape_dyn ); } free( ( *hHrtf )->ModelParams.elevKSeq_dyn ); free( ( *hHrtf )->ModelParams.azim_start_idx_dyn ); free( ( *hHrtf )->ModelParams.azimDim2_dyn ); free( ( *hHrtf )->ModelParams.azimDim3_dyn ); free( ( *hHrtf )->ModelParams.AlphaL_dyn ); free( ( *hHrtf )->ModelParams.AlphaR_dyn ); free( ( *hHrtf )->ModelParams.azimSegSamples_dyn ); free( ( *hHrtf )->ModelParams.azimShapeIdx_dyn ); free( ( *hHrtf )->ModelParams.azimShapeSampFactor_dyn ); free( ( *hHrtf )->ModelParams.elevBsShape_dyn ); for ( i = 0; i < ( *hHrtf )->ModelParams.num_unique_azim_splines; i++ ) { free( ( *hHrtf )->ModelParams.azimBsShape_dyn[i] ); } free( ( *hHrtf )->ModelParams.azimBsShape_dyn ); free( (void *) ( *hHrtf )->ModelParams.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. */ for ( i = 0; i < ( *hHrtf )->ModelParams.elevDim3; i++ ) { free( ( *hHrtf )->ModelParams.azimKSeq[i] ); } free( ( *hHrtf )->ModelParams.azimKSeq ); free( ( *hHrtf )->ModelParams.EL_dyn ); free( ( *hHrtf )->ModelParams.ER_dyn ); free( ( *hHrtf )->ModelEval.hrfModL ); free( ( *hHrtf )->ModelEval.hrfModR ); for ( i = 0; i < 3; i++ ) { free( ( *hHrtf )->lr_energy_and_iac_dyn[i] ); } } ivas_HRTF_binary_close( hHrtf ); return error; } #else /*---------------------------------------------------------------------* * dealloc_HRTF_binary() * Loading @@ -845,7 +916,7 @@ static void HRTF_energy_sections_precalc( *---------------------------------------------------------------------*/ ivas_error dealloc_HRTF_binary( IVAS_DEC_HRTF_HANDLE hHrtf /* i/o: HRTF handle */ IVAS_DEC_HRTF_HANDLE( *hHrtf ) /* i/o: HRTF handle */ ) { int16_t i; Loading Loading @@ -906,7 +977,7 @@ ivas_error dealloc_HRTF_binary( return error; } #endif /*---------------------------------------------------------------------* * create_HRTF_from_rawdata() Loading Loading @@ -1974,6 +2045,23 @@ static ivas_error destroy_HRTF( * Destroy the HRTF data set. *---------------------------------------------------------------------*/ #ifdef NONBE_FIX_BINARY_BINAURAL_READING ivas_error destroy_SetOfHRTF( HRTFS_CREND_HANDLE *hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ) { if ( ( hSetOfHRTF != NULL ) && ( *hSetOfHRTF != NULL ) ) { destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_combined ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_hoa3 ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_hoa2 ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_foa ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_brir_combined ) ); } ivas_HRTF_CRend_binary_close( hSetOfHRTF ); return IVAS_ERR_OK; } #else ivas_error destroy_SetOfHRTF( HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ) Loading @@ -1989,6 +2077,7 @@ ivas_error destroy_SetOfHRTF( return IVAS_ERR_OK; } #endif #ifdef NONBE_FIX_BINARY_BINAURAL_READING Loading Loading
apps/decoder.c +10 −4 Original line number Diff line number Diff line Loading @@ -767,8 +767,7 @@ int main( } else { dealloc_HRTF_binary( *hHrtfTD ); *hHrtfTD = NULL; destroy_td_hrtf( hHrtfTD ); } } #else Loading Loading @@ -814,8 +813,7 @@ int main( } else { destroy_SetOfHRTF( *hSetOfHRTF ); *hSetOfHRTF = NULL; destroy_SetOfHRTF( hSetOfHRTF ); } } #else Loading Loading @@ -978,7 +976,11 @@ cleanup: IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); if ( hHrtfTD != NULL ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING destroy_td_hrtf( hHrtfTD ); #else dealloc_HRTF_binary( *hHrtfTD ); #endif } #ifdef NONBE_FIX_BINARY_BINAURAL_READING IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL; Loading @@ -988,7 +990,11 @@ cleanup: IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); if ( hSetOfHRTF != NULL ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING destroy_SetOfHRTF( hSetOfHRTF ); #else destroy_SetOfHRTF( *hSetOfHRTF ); #endif } } Loading
apps/renderer.c +4 −6 Original line number Diff line number Diff line Loading @@ -1074,8 +1074,7 @@ int main( } else { dealloc_HRTF_binary( *hHrtfTD ); *hHrtfTD = NULL; destroy_td_hrtf( hHrtfTD ); } } Loading Loading @@ -1105,8 +1104,7 @@ int main( } else { destroy_SetOfHRTF( *hSetOfHRTF ); *hSetOfHRTF = NULL; destroy_SetOfHRTF( hSetOfHRTF ); } } Loading Loading @@ -2268,11 +2266,11 @@ cleanup: #ifdef NONBE_FIX_BINARY_BINAURAL_READING if ( hSetOfHRTF != NULL && *hSetOfHRTF != NULL ) { destroy_SetOfHRTF( *hSetOfHRTF ); destroy_SetOfHRTF( hSetOfHRTF ); } if ( hHrtfTD != NULL && *hHrtfTD != NULL ) { dealloc_HRTF_binary( *hHrtfTD ); destroy_td_hrtf( hHrtfTD ); } #endif IVAS_REND_Close( &hIvasRend ); Loading
lib_rend/ivas_hrtf.c +23 −0 Original line number Diff line number Diff line Loading @@ -50,12 +50,24 @@ ivas_error ivas_HRTF_binary_open( TDREND_HRFILT_FiltSet_t **hHrtfTD ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING uint32_t ind; char *pTmp; #endif /* Allocate HR filter set for headphones configuration */ *hHrtfTD = (TDREND_HRFILT_FiltSet_t *) malloc( sizeof( TDREND_HRFILT_FiltSet_t ) ); if ( *hHrtfTD == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" ); } #ifdef NONBE_FIX_BINARY_BINAURAL_READING pTmp = (char *) *hHrtfTD; for ( ind = 0; ind < sizeof( TDREND_HRFILT_FiltSet_t ); ind++ ) { pTmp[ind] = 0; } #endif return IVAS_ERR_OK; } Loading Loading @@ -179,14 +191,25 @@ void ivas_HRTF_fastconv_binary_close( ivas_error ivas_HRTF_parambin_binary_open( HRTFS_PARAMBIN **hHrtfParambin ) { #ifdef NONBE_FIX_BINARY_BINAURAL_READING uint32_t ind; char *pTmp; #endif *hHrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ); if ( *hHrtfParambin == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" ); } #ifdef NONBE_FIX_BINARY_BINAURAL_READING pTmp = (char *) *hHrtfParambin; for ( ind = 0; ind < sizeof( HRTFS_PARAMBIN ); ind++ ) { pTmp[ind] = 0; } ( *hHrtfParambin )->allocatedFromFile = 1; #endif return IVAS_ERR_OK; } Loading
lib_rend/ivas_objectRenderer_mix.c +4 −0 Original line number Diff line number Diff line Loading @@ -147,7 +147,11 @@ void TDREND_MIX_Dealloc( hBinRendererTd->Listener_p = NULL; } /* Dealloc HR filter set */ #ifdef NONBE_FIX_BINARY_BINAURAL_READING if ( ( *hBinRendererTd->pHrFiltSet_p != NULL ) && ( hBinRendererTd->HrFiltSet_p != NULL ) ) #else if ( hBinRendererTd->HrFiltSet_p != NULL ) #endif { if ( hBinRendererTd->HrFiltSet_p->FilterMethod == TDREND_HRFILT_Method_BSplineModel ) { Loading
lib_util/hrtf_file_reader.c +91 −2 Original line number Diff line number Diff line Loading @@ -837,7 +837,78 @@ static void HRTF_energy_sections_precalc( return; } #ifdef NONBE_FIX_BINARY_BINAURAL_READING /*---------------------------------------------------------------------* * dealloc_HRTF_binary() * * Deallocated memory allocated by load_HRTF_binary *---------------------------------------------------------------------*/ ivas_error destroy_td_hrtf( IVAS_DEC_HRTF_HANDLE *hHrtf /* i/o: HRTF handle */ ) { int16_t i; ivas_error error; error = IVAS_ERR_OK; if ( ( hHrtf == NULL ) || ( *hHrtf == NULL ) ) { return error; } if ( !( *hHrtf )->ModelParams.modelROM ) { if ( ( *hHrtf )->ModelParams.UseItdModel ) { free( ( *hHrtf )->ModelParamsITD.elevKSeq_dyn ); free( ( *hHrtf )->ModelParamsITD.azimKSeq_dyn ); free( ( *hHrtf )->ModelParamsITD.W_dyn ); free( ( *hHrtf )->ModelParamsITD.azimBsShape_dyn ); free( ( *hHrtf )->ModelParamsITD.elevBsShape_dyn ); } free( ( *hHrtf )->ModelParams.elevKSeq_dyn ); free( ( *hHrtf )->ModelParams.azim_start_idx_dyn ); free( ( *hHrtf )->ModelParams.azimDim2_dyn ); free( ( *hHrtf )->ModelParams.azimDim3_dyn ); free( ( *hHrtf )->ModelParams.AlphaL_dyn ); free( ( *hHrtf )->ModelParams.AlphaR_dyn ); free( ( *hHrtf )->ModelParams.azimSegSamples_dyn ); free( ( *hHrtf )->ModelParams.azimShapeIdx_dyn ); free( ( *hHrtf )->ModelParams.azimShapeSampFactor_dyn ); free( ( *hHrtf )->ModelParams.elevBsShape_dyn ); for ( i = 0; i < ( *hHrtf )->ModelParams.num_unique_azim_splines; i++ ) { free( ( *hHrtf )->ModelParams.azimBsShape_dyn[i] ); } free( ( *hHrtf )->ModelParams.azimBsShape_dyn ); free( (void *) ( *hHrtf )->ModelParams.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. */ for ( i = 0; i < ( *hHrtf )->ModelParams.elevDim3; i++ ) { free( ( *hHrtf )->ModelParams.azimKSeq[i] ); } free( ( *hHrtf )->ModelParams.azimKSeq ); free( ( *hHrtf )->ModelParams.EL_dyn ); free( ( *hHrtf )->ModelParams.ER_dyn ); free( ( *hHrtf )->ModelEval.hrfModL ); free( ( *hHrtf )->ModelEval.hrfModR ); for ( i = 0; i < 3; i++ ) { free( ( *hHrtf )->lr_energy_and_iac_dyn[i] ); } } ivas_HRTF_binary_close( hHrtf ); return error; } #else /*---------------------------------------------------------------------* * dealloc_HRTF_binary() * Loading @@ -845,7 +916,7 @@ static void HRTF_energy_sections_precalc( *---------------------------------------------------------------------*/ ivas_error dealloc_HRTF_binary( IVAS_DEC_HRTF_HANDLE hHrtf /* i/o: HRTF handle */ IVAS_DEC_HRTF_HANDLE( *hHrtf ) /* i/o: HRTF handle */ ) { int16_t i; Loading Loading @@ -906,7 +977,7 @@ ivas_error dealloc_HRTF_binary( return error; } #endif /*---------------------------------------------------------------------* * create_HRTF_from_rawdata() Loading Loading @@ -1974,6 +2045,23 @@ static ivas_error destroy_HRTF( * Destroy the HRTF data set. *---------------------------------------------------------------------*/ #ifdef NONBE_FIX_BINARY_BINAURAL_READING ivas_error destroy_SetOfHRTF( HRTFS_CREND_HANDLE *hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ) { if ( ( hSetOfHRTF != NULL ) && ( *hSetOfHRTF != NULL ) ) { destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_combined ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_hoa3 ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_hoa2 ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_foa ) ); destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_brir_combined ) ); } ivas_HRTF_CRend_binary_close( hSetOfHRTF ); return IVAS_ERR_OK; } #else ivas_error destroy_SetOfHRTF( HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ) Loading @@ -1989,6 +2077,7 @@ ivas_error destroy_SetOfHRTF( return IVAS_ERR_OK; } #endif #ifdef NONBE_FIX_BINARY_BINAURAL_READING Loading