From 2bd3b09c96f6c7548ee45e348e89bc3a7a1694f1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Aug 2024 16:43:57 +0200 Subject: [PATCH 1/2] add 'const' to HRTF coefficients tables --- lib_rend/ivas_crend.c | 13 +- lib_rend/ivas_rom_binaural_crend_head.h | 354 ++++++++++++------------ lib_rend/ivas_stat_rend.h | 18 +- lib_util/hrtf_file_reader.c | 50 ++-- 4 files changed, 219 insertions(+), 216 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 0a811f541a..ade4321cc1 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -145,8 +145,8 @@ static void ivas_hrtf_close( { #ifdef FIX_1123_CREND_16BIT_ROM int16_t i, j; -#endif +#endif if ( hHrtf == NULL || *hHrtf == NULL ) { return; @@ -182,8 +182,8 @@ static void ivas_hrtf_close( } } } -#endif +#endif free( *hHrtf ); *hHrtf = NULL; @@ -191,7 +191,7 @@ static void ivas_hrtf_close( } /*------------------------------------------------------------------------- - * initCrend_from_rom() + * ivas_rend_initCrend() * * Allocate and initialize crend renderer handle *------------------------------------------------------------------------*/ @@ -1971,7 +1971,7 @@ static ivas_error ivas_rend_crendConvolver( int16_t nchan_in, nchan_out; const float *pIn; #ifdef FIX_CREND_SIMPLIFY_CODE - float *pFreq_filt_re, *pFreq_filt_im; + const float *pFreq_filt_re, *pFreq_filt_im; float *pFreq_buf_re = NULL, *pFreq_buf_im = NULL; float *pFreq_buf2_re = NULL, *pFreq_buf2_im = NULL; #else @@ -2088,10 +2088,7 @@ static ivas_error ivas_rend_crendConvolver( } #ifdef FIX_CREND_SIMPLIFY_CODE - pFreq_filt_re = &hCrend->freq_buffer_re[i][offset]; - pFreq_filt_im = &hCrend->freq_buffer_im[i][offset]; - - ivas_mdft( pIn, pFreq_filt_re, pFreq_filt_im, subframe_length, subframe_length ); + ivas_mdft( pIn, &hCrend->freq_buffer_re[i][offset], &hCrend->freq_buffer_im[i][offset], subframe_length, subframe_length ); #else pFreq_buf_re = &hCrend->freq_buffer_re[i][offset]; pFreq_buf_im = &hCrend->freq_buffer_im[i][offset]; diff --git a/lib_rend/ivas_rom_binaural_crend_head.h b/lib_rend/ivas_rom_binaural_crend_head.h index 56a5edf9ba..f9f080dc1d 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.h +++ b/lib_rend/ivas_rom_binaural_crend_head.h @@ -55,45 +55,45 @@ extern float CRendBin_Combined_HRIR_latency_s; /* Sample Rate = 48000 */ -extern int16_t CRendBin_Combined_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; -extern float CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; -extern uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern float CRendBin_Combined_HRIR_coeff_re_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][240]; -extern float CRendBin_Combined_HRIR_coeff_im_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][240]; -extern float *CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_Combined_HRIR_max_num_iterations_48kHz; +extern const uint16_t CRendBin_Combined_HRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; +extern const float CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; +extern const uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_Combined_HRIR_coeff_re_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_Combined_HRIR_coeff_im_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_Combined_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; -extern float CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; -extern uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern float CRendBin_Combined_HRIR_coeff_re_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][160]; -extern float CRendBin_Combined_HRIR_coeff_im_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][160]; -extern float *CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_Combined_HRIR_max_num_iterations_32kHz; +extern const uint16_t CRendBin_Combined_HRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; +extern const float CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; +extern const uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_Combined_HRIR_coeff_re_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_Combined_HRIR_coeff_im_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_Combined_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; -extern float CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; -extern uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern float CRendBin_Combined_HRIR_coeff_re_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][80]; -extern float CRendBin_Combined_HRIR_coeff_im_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][80]; -extern float *CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_Combined_HRIR_max_num_iterations_16kHz; +extern const uint16_t CRendBin_Combined_HRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; +extern const float CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; +extern const uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_Combined_HRIR_coeff_re_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_Combined_HRIR_coeff_im_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; @@ -103,141 +103,141 @@ extern float CRendBin_FOA_HRIR_latency_s; /* Sample Rate = 48000 */ -extern int16_t CRendBin_FOA_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz; -extern float CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][FOA_CHANNELS]; -extern uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern float CRendBin_FOA_HRIR_coeff_re_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][240]; -extern float CRendBin_FOA_HRIR_coeff_im_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][240]; -extern float *CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_FOA_HRIR_max_num_iterations_48kHz; +extern const uint16_t CRendBin_FOA_HRIR_num_iterations_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz; +extern const float CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][FOA_CHANNELS]; +extern const uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_FOA_HRIR_coeff_re_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_FOA_HRIR_coeff_im_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_FOA_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz; -extern float CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][FOA_CHANNELS]; -extern uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern float CRendBin_FOA_HRIR_coeff_re_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][160]; -extern float CRendBin_FOA_HRIR_coeff_im_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][160]; -extern float *CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_FOA_HRIR_max_num_iterations_32kHz; +extern const uint16_t CRendBin_FOA_HRIR_num_iterations_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz; +extern const float CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][FOA_CHANNELS]; +extern const uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_FOA_HRIR_coeff_re_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_FOA_HRIR_coeff_im_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_FOA_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz; -extern float CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][FOA_CHANNELS]; -extern uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern float CRendBin_FOA_HRIR_coeff_re_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][80]; -extern float CRendBin_FOA_HRIR_coeff_im_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][80]; -extern float *CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_FOA_HRIR_max_num_iterations_16kHz; +extern const uint16_t CRendBin_FOA_HRIR_num_iterations_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz; +extern const float CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][FOA_CHANNELS]; +extern const uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_FOA_HRIR_coeff_re_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_FOA_HRIR_coeff_im_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; /********************** CRendBin_HOA2_HRIR **********************/ -extern float CRendBin_HOA2_HRIR_latency_s; +extern const float CRendBin_HOA2_HRIR_latency_s; /* Sample Rate = 48000 */ -extern int16_t CRendBin_HOA2_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz; -extern float CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HOA2_CHANNELS]; -extern uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern float CRendBin_HOA2_HRIR_coeff_re_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][240]; -extern float CRendBin_HOA2_HRIR_coeff_im_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][240]; -extern float *CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_HOA2_HRIR_max_num_iterations_48kHz; +extern const uint16_t CRendBin_HOA2_HRIR_num_iterations_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz; +extern const float CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HOA2_CHANNELS]; +extern const uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_HOA2_HRIR_coeff_re_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_HOA2_HRIR_coeff_im_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_HOA2_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz; -extern float CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HOA2_CHANNELS]; -extern uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern float CRendBin_HOA2_HRIR_coeff_re_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][160]; -extern float CRendBin_HOA2_HRIR_coeff_im_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][160]; -extern float *CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_HOA2_HRIR_max_num_iterations_32kHz; +extern const uint16_t CRendBin_HOA2_HRIR_num_iterations_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz; +extern const float CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HOA2_CHANNELS]; +extern const uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_HOA2_HRIR_coeff_re_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_HOA2_HRIR_coeff_im_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_HOA2_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz; -extern float CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HOA2_CHANNELS]; -extern uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern float CRendBin_HOA2_HRIR_coeff_re_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][80]; -extern float CRendBin_HOA2_HRIR_coeff_im_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][80]; -extern float *CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_HOA2_HRIR_max_num_iterations_16kHz; +extern const uint16_t CRendBin_HOA2_HRIR_num_iterations_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz; +extern const float CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HOA2_CHANNELS]; +extern const uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_HOA2_HRIR_coeff_re_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_HOA2_HRIR_coeff_im_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; /********************** CRendBin_HOA3_HRIR **********************/ -extern float CRendBin_HOA3_HRIR_latency_s; +extern const float CRendBin_HOA3_HRIR_latency_s; /* Sample Rate = 48000 */ -extern int16_t CRendBin_HOA3_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; -extern float CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HOA3_CHANNELS]; -extern uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern float CRendBin_HOA3_HRIR_coeff_re_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][240]; -extern float CRendBin_HOA3_HRIR_coeff_im_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][240]; -extern float *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_HOA3_HRIR_max_num_iterations_48kHz; +extern const uint16_t CRendBin_HOA3_HRIR_num_iterations_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; +extern const float CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HOA3_CHANNELS]; +extern const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_HOA3_HRIR_coeff_re_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_HOA3_HRIR_coeff_im_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][L_FRAME48k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_HOA3_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; -extern float CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HOA3_CHANNELS]; -extern uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern float CRendBin_HOA3_HRIR_coeff_re_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][160]; -extern float CRendBin_HOA3_HRIR_coeff_im_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][160]; -extern float *CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_HOA3_HRIR_max_num_iterations_32kHz; +extern const uint16_t CRendBin_HOA3_HRIR_num_iterations_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; +extern const float CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HOA3_CHANNELS]; +extern const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_HOA3_HRIR_coeff_re_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_HOA3_HRIR_coeff_im_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][L_FRAME32k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_HOA3_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; -extern float CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HOA3_CHANNELS]; -extern uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern float CRendBin_HOA3_HRIR_coeff_re_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][80]; -extern float CRendBin_HOA3_HRIR_coeff_im_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][80]; -extern float *CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; -extern float *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; +extern const int16_t CRendBin_HOA3_HRIR_max_num_iterations_16kHz; +extern const uint16_t CRendBin_HOA3_HRIR_num_iterations_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; +extern const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; +extern const float CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HOA3_CHANNELS]; +extern const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const float CRendBin_HOA3_HRIR_coeff_re_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float CRendBin_HOA3_HRIR_coeff_im_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][L_FRAME16k/MAX_PARAM_SPATIAL_SUBFRAMES]; +extern const float *CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS]; +extern const float *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; @@ -247,63 +247,65 @@ extern float CRendBin_Combined_BRIR_latency_s; /* Sample Rate = 48000 */ -extern int16_t CRendBin_Combined_BRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]; -extern uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; -extern float CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]; -extern float CRendBin_Combined_BRIR_coeff_re_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955]; -extern float CRendBin_Combined_BRIR_coeff_im_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955]; -extern float CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS][2885]; -extern float CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS][2885]; +extern const int16_t CRendBin_Combined_BRIR_max_num_iterations_48kHz; +extern const uint16_t CRendBin_Combined_BRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]; +extern const uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; +extern const float CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]; +extern const float CRendBin_Combined_BRIR_coeff_re_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955]; +extern const float CRendBin_Combined_BRIR_coeff_im_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955]; +extern const float CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS][2885]; +extern const float CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS][2885]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_Combined_BRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]; -extern uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; -extern float CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]; -extern float CRendBin_Combined_BRIR_coeff_re_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2818]; -extern float CRendBin_Combined_BRIR_coeff_im_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2818]; -extern float CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS][2868]; -extern float CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS][2868]; +extern const int16_t CRendBin_Combined_BRIR_max_num_iterations_32kHz; +extern const uint16_t CRendBin_Combined_BRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]; +extern const uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; +extern const float CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]; +extern const float CRendBin_Combined_BRIR_coeff_re_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2818]; +extern const float CRendBin_Combined_BRIR_coeff_im_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2818]; +extern const float CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[BINAURAL_CHANNELS][2868]; +extern const float CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[BINAURAL_CHANNELS][2868]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_Combined_BRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][23]; -extern uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; -extern float CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]; -extern float CRendBin_Combined_BRIR_coeff_re_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1799]; -extern float CRendBin_Combined_BRIR_coeff_im_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1799]; -extern float CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS][2474]; -extern float CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS][2474]; +extern const int16_t CRendBin_Combined_BRIR_max_num_iterations_16kHz; +extern const uint16_t CRendBin_Combined_BRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][23]; +extern const uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; +extern const float CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[BINAURAL_CHANNELS][HRTF_LS_CHANNELS]; +extern const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]; +extern const float CRendBin_Combined_BRIR_coeff_re_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1799]; +extern const float CRendBin_Combined_BRIR_coeff_im_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1799]; +extern const float CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[BINAURAL_CHANNELS][2474]; +extern const float CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS][2474]; /********************** default HRIR reverb rom tables **********************/ /* Sample Rate = 48000 */ -extern float defaultHRIR_coherence_48kHz[LR_IAC_LENGTH_NR_FC]; -extern float defaultHRIR_left_avg_power_48kHz[LR_IAC_LENGTH_NR_FC]; -extern float defaultHRIR_right_avg_power_48kHz[LR_IAC_LENGTH_NR_FC]; +extern const float defaultHRIR_coherence_48kHz[LR_IAC_LENGTH_NR_FC]; +extern const float defaultHRIR_left_avg_power_48kHz[LR_IAC_LENGTH_NR_FC]; +extern const float defaultHRIR_right_avg_power_48kHz[LR_IAC_LENGTH_NR_FC]; + /* Sample Rate = 32000 */ -extern float defaultHRIR_coherence_32kHz[LR_IAC_LENGTH_NR_FC]; -extern float defaultHRIR_left_avg_power_32kHz[LR_IAC_LENGTH_NR_FC]; -extern float defaultHRIR_right_avg_power_32kHz[LR_IAC_LENGTH_NR_FC]; +extern const float defaultHRIR_coherence_32kHz[LR_IAC_LENGTH_NR_FC]; +extern const float defaultHRIR_left_avg_power_32kHz[LR_IAC_LENGTH_NR_FC]; +extern const float defaultHRIR_right_avg_power_32kHz[LR_IAC_LENGTH_NR_FC]; + /* Sample Rate = 16000 */ -extern float defaultHRIR_coherence_16kHz[LR_IAC_LENGTH_NR_FC_16KHZ]; -extern float defaultHRIR_left_avg_power_16kHz[LR_IAC_LENGTH_NR_FC_16KHZ]; -extern float defaultHRIR_right_avg_power_16kHz[LR_IAC_LENGTH_NR_FC_16KHZ]; +extern const float defaultHRIR_coherence_16kHz[LR_IAC_LENGTH_NR_FC_16KHZ]; +extern const float defaultHRIR_left_avg_power_16kHz[LR_IAC_LENGTH_NR_FC_16KHZ]; +extern const float defaultHRIR_right_avg_power_16kHz[LR_IAC_LENGTH_NR_FC_16KHZ]; #endif /* _IVAS_ROM_BINAURAL_CREND_HEAD_ */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 3c99dff253..4e59da75bd 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1159,15 +1159,15 @@ typedef struct typedef struct ivas_hrtfs_structure { - float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; + const float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + const float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + const float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; + const float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; float latency_s; uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; uint16_t num_iterations_diffuse[BINAURAL_CHANNELS]; - uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS]; + const uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + const uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS]; uint16_t index_frequency_max_diffuse; int16_t max_num_ir; int16_t max_num_iterations; @@ -1316,9 +1316,9 @@ typedef struct ivas_hrtfs_fastconv_struct typedef struct ivas_hrtfs_statistics_struct { - float *average_energy_l; - float *average_energy_r; - float *inter_aural_coherence; + const float *average_energy_l; + const float *average_energy_r; + const float *inter_aural_coherence; int16_t fromROM; /* Flag that indicates that the pointers point to tables in ROM (controls init/dealloc).*/ } HRTFS_STATISTICS, *HRTFS_STATISTICS_HANDLE; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index b63e9d26b7..ca32c1ffc5 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -924,6 +924,7 @@ static ivas_error load_reverb_from_binary( Word16 factorQ; Word16 tmp16; float factorQ_f; + float average_energy; #endif if ( hHrtfStatistics == NULL || f_hrtf == NULL ) @@ -1004,17 +1005,20 @@ static ivas_error load_reverb_from_binary( for ( ind = 0; ind < lr_iac_len; ind++ ) { fread( &tmp16, sizeof( Word16 ), 1, f_hrtf ); - hHrtfStatistics->average_energy_l[ind] = factorQ_f * tmp16; + average_energy = factorQ_f * tmp16; + memcpy( (float *) &hHrtfStatistics->average_energy_l[ind], &average_energy, sizeof( float ) ); } for ( ind = 0; ind < lr_iac_len; ind++ ) { fread( &tmp16, sizeof( Word16 ), 1, f_hrtf ); - hHrtfStatistics->average_energy_r[ind] = factorQ_f * tmp16; + average_energy = factorQ_f * tmp16; + memcpy( (float *) &hHrtfStatistics->average_energy_r[ind], &average_energy, sizeof( float ) ); } for ( ind = 0; ind < lr_iac_len; ind++ ) { fread( &tmp16, sizeof( Word16 ), 1, f_hrtf ); - hHrtfStatistics->inter_aural_coherence[ind] = factorQ_f * tmp16; + average_energy = factorQ_f * tmp16; + memcpy( (float *) &hHrtfStatistics->inter_aural_coherence[ind], &average_energy, sizeof( float ) ); } #else fread( hHrtfStatistics->average_energy_l, sizeof( const float ), lr_iac_len, f_hrtf ); @@ -1661,7 +1665,7 @@ static ivas_error create_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max" ); } - memcpy( ( *hHRTF )->pIndex_frequency_max[i][j], hrtf_data_rptr, mem_size ); + memcpy( (uint16_t *) ( *hHRTF )->pIndex_frequency_max[i][j], hrtf_data_rptr, mem_size ); hrtf_data_rptr += mem_size; } } @@ -1684,11 +1688,11 @@ static ivas_error create_HRTF_from_rawdata( { mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( uint16_t ); ( *hHRTF )->pIndex_frequency_max_diffuse[j] = (uint16_t *) malloc( mem_size ); - if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] == NULL ) + if ( (uint16_t *) ( *hHRTF )->pIndex_frequency_max_diffuse[j] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max_diffuse" ); } - memcpy( ( *hHRTF )->pIndex_frequency_max_diffuse[j], hrtf_data_rptr, mem_size ); + memcpy( (uint16_t *) ( *hHRTF )->pIndex_frequency_max_diffuse[j], hrtf_data_rptr, mem_size ); hrtf_data_rptr += mem_size; } } @@ -1731,9 +1735,9 @@ static ivas_error create_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_re" ); } - memset( ( *hHRTF )->pOut_to_bin_re[i][j], 0x00, mem_size ); + memset( (float *) ( *hHRTF )->pOut_to_bin_re[i][j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_re[i][j]; + pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_re[i][j]; for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ ) { @@ -1765,9 +1769,9 @@ static ivas_error create_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_im" ); } - memset( ( *hHRTF )->pOut_to_bin_im[i][j], 0x00, mem_size ); + memset( (float *) ( *hHRTF )->pOut_to_bin_im[i][j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_im[i][j]; + pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_im[i][j]; for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ ) { #ifdef FIX_1123_CREND_16BIT_FMT @@ -1804,9 +1808,9 @@ static ivas_error create_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_re" ); } - memset( ( *hHRTF )->pOut_to_bin_diffuse_re[j], 0x00, mem_size ); + memset( (uint16_t *) ( *hHRTF )->pOut_to_bin_diffuse_re[j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_re[j]; + pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_diffuse_re[j]; for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ ) { @@ -1835,9 +1839,9 @@ static ivas_error create_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" ); } - memset( ( *hHRTF )->pOut_to_bin_diffuse_im[j], 0x00, mem_size ); + memset( (uint16_t *) ( *hHRTF )->pOut_to_bin_diffuse_im[j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_im[j]; + pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_diffuse_im[j]; for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ ) { #ifdef FIX_1123_CREND_16BIT_FMT @@ -3703,15 +3707,15 @@ static void destroy_HRTF( { if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL ) { - free( ( *hHRTF )->pIndex_frequency_max[i][j] ); + free( (float *) ( *hHRTF )->pIndex_frequency_max[i][j] ); } if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL ) { - free( ( *hHRTF )->pOut_to_bin_re[i][j] ); + free( (float *) ( *hHRTF )->pOut_to_bin_re[i][j] ); } if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL ) { - free( ( *hHRTF )->pOut_to_bin_im[i][j] ); + free( (float *) ( *hHRTF )->pOut_to_bin_im[i][j] ); } } } @@ -3719,15 +3723,15 @@ static void destroy_HRTF( { if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL ) { - free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); + free( (uint16_t *) ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); } if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL ) { - free( ( *hHRTF )->pOut_to_bin_diffuse_re[j] ); + free( (uint16_t *) ( *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( (uint16_t *) ( *hHRTF )->pOut_to_bin_diffuse_im[j] ); } } @@ -3812,9 +3816,9 @@ void destroy_hrtf_statistics( { if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) ) { - free( ( *hHrtfStatistics )->average_energy_l ); - free( ( *hHrtfStatistics )->average_energy_r ); - free( ( *hHrtfStatistics )->inter_aural_coherence ); + free( (float *) ( *hHrtfStatistics )->average_energy_l ); + free( (float *) ( *hHrtfStatistics )->average_energy_r ); + free( (float *) ( *hHrtfStatistics )->inter_aural_coherence ); } ivas_HRTF_statistics_close( hHrtfStatistics ); -- GitLab From 9d0ed8c33bbe5f649b779f8192158a16faa41958 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Tue, 27 Aug 2024 18:29:03 +0200 Subject: [PATCH 2/2] fix generattion scripts --- .../generate_crend_ivas_tables_from_sofa.c | 344 +++++++++--------- .../ivas_crend_binaural_filter_design.c | 148 ++++---- 2 files changed, 244 insertions(+), 248 deletions(-) diff --git a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c index acf8506c29..cb00657403 100644 --- a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +++ b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c @@ -1306,7 +1306,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c } - #ifdef FIX_1123_CREND_FLTFX_BE int16_t factorQ[3]; make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ); @@ -2258,10 +2257,10 @@ void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherenc if ( samplerate == DEFAULT_SAMPLERATE ) { - fprintf( fp, "\n/********************** default HRIR reverb rom tables **********************/\n" ); + fprintf( fp, "\n/********************** default HRIR reverb rom tables **********************/" ); } - fprintf( fp, "\n/* Sample Rate = %ld */\n", (long) samplerate ); + fprintf( fp, "\n\n/* Sample Rate = %ld */\n", (long) samplerate ); /* float *defaultHRIR_right_avg_power_[LR_IAC_LENGTH_NR_FC];*/ fprintf( fp, "\nconst float defaultHRIR_coherence_%dkHz[%s] = \n", samplerate / 1000, len_str ); @@ -2344,7 +2343,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int pTotalNumFreqSampPerIterations[1][i] = 0; for ( j = 0; j < hrtf->num_iterations[i][0]; j++ ) { - pTotalNumFreqSampPerIterations[0][i] += hrtf->pIndex_frequency_max[i][0][j]; + pTotalNumFreqSampPerIterations[0][i] += hrtf->pIndex_frequency_max_dyn[i][0][j]; } if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[0][i] ) { @@ -2352,7 +2351,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int } for ( j = 0; j < hrtf->num_iterations[i][1]; j++ ) { - pTotalNumFreqSampPerIterations[1][i] += hrtf->pIndex_frequency_max[i][1][j]; + pTotalNumFreqSampPerIterations[1][i] += hrtf->pIndex_frequency_max_dyn[i][1][j]; } if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[1][i] ) { @@ -2365,7 +2364,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int maxTotalNumFreqSampPerIterationsDiffuse = 0; for ( j = 0; j < hrtf->num_iterations_diffuse[0]; j++ ) { - pTotalNumFreqSampPerIterationsDiffuse[0] += hrtf->pIndex_frequency_max_diffuse[0][j]; + pTotalNumFreqSampPerIterationsDiffuse[0] += hrtf->pIndex_frequency_max_diffuse_dyn[0][j]; } if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[0] ) { @@ -2373,27 +2372,27 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int } for ( j = 0; j < hrtf->num_iterations_diffuse[1]; j++ ) { - pTotalNumFreqSampPerIterationsDiffuse[1] += hrtf->pIndex_frequency_max_diffuse[1][j]; + pTotalNumFreqSampPerIterationsDiffuse[1] += hrtf->pIndex_frequency_max_diffuse_dyn[1][j]; } if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[1] ) { maxTotalNumFreqSampPerIterationsDiffuse = pTotalNumFreqSampPerIterationsDiffuse[1]; } - /*uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; */ + /*uint16_t *pIndex_frequency_max_dyn[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; */ fprintf( fp, "\nconst uint16_t %s_%s_pIndex_frequency_max_%2dkHz[%s][BINAURAL_CHANNELS][%d]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, hrtf->max_num_iterations ); for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) { fprintf( fp, "{" ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_dyn[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "," ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_dyn[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "}," ); } fprintf( fp, "{" ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_dyn[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "," ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_dyn[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "}" ); fprintf( fp, "};" ); @@ -2409,17 +2408,17 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int fprintf( fp, "}" ); fprintf( fp, ";" ); - /* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/ - if ( hrtf->pIndex_frequency_max_diffuse[0] == NULL ) + /* uint16_t *pIndex_frequency_max_diffuse_dyn[BINAURAL_CHANNELS];*/ + if ( hrtf->pIndex_frequency_max_diffuse_dyn[0] == NULL ) { fprintf( fp, "\nconst uint16_t *%s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS]={NULL,NULL};", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); } else { fprintf( fp, "\nconst uint16_t %s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, ( hrtf->num_iterations_diffuse[0] > hrtf->num_iterations_diffuse[1] ) ? hrtf->num_iterations_diffuse[0] : hrtf->num_iterations_diffuse[1] ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse[0], hrtf->num_iterations_diffuse[0], hrtf->num_iterations_diffuse[0], 0, TAB_WITH_SPACE_OR_NOT ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse_dyn[0], hrtf->num_iterations_diffuse[0], hrtf->num_iterations_diffuse[0], 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "," ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse[1], hrtf->num_iterations_diffuse[1], hrtf->num_iterations_diffuse[1], 0, TAB_WITH_SPACE_OR_NOT ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse_dyn[1], hrtf->num_iterations_diffuse[1], hrtf->num_iterations_diffuse[1], 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "};" ); } @@ -2428,15 +2427,15 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) { fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re_dyn[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re_dyn[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s},", TAB_WITH_SPACE_OR_NOT ); } fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re_dyn[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re_dyn[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s}", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); @@ -2444,45 +2443,44 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) { fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im_dyn[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im_dyn[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s},", TAB_WITH_SPACE_OR_NOT ); } fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im_dyn[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im_dyn[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s}", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); - - /* float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS];*/ - if ( hrtf->pOut_to_bin_diffuse_re[0] == NULL ) + /* float *pOut_to_bin_diffuse_re_dyn[BINAURAL_CHANNELS];*/ + if ( hrtf->pOut_to_bin_diffuse_re_dyn[0] == NULL ) { fprintf( fp, "\nconst float *%s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS]={NULL,NULL};", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); } else { fprintf( fp, "\nconst float %s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re_dyn[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re_dyn[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); } - /* float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS];*/ - if ( hrtf->pOut_to_bin_diffuse_im[0] == NULL ) + /* float *pOut_to_bin_diffuse_im_dyn[BINAURAL_CHANNELS];*/ + if ( hrtf->pOut_to_bin_diffuse_im_dyn[0] == NULL ) { fprintf( fp, "\nconst float *%s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS]={NULL,NULL};", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); } else { fprintf( fp, "\nconst float %s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im_dyn[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im_dyn[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, format_float, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); } @@ -2523,16 +2521,16 @@ void update_h_file_with_reverb( int32_t samplerate ) if ( samplerate == DEFAULT_SAMPLERATE ) { - fprintf( fp, "\n/********************** default HRIR reverb rom tables **********************/\n" ); + fprintf( fp, "\n/********************** default HRIR reverb rom tables **********************/" ); } - fprintf( fp, "\n/* Sample Rate = %ld */\n", (long) samplerate ); + fprintf( fp, "\n\n/* Sample Rate = %ld */\n", (long) samplerate ); /* float *defaultHRIR_coherence_[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ - fprintf( fp, "\nextern float defaultHRIR_coherence_%dkHz[%s];", samplerate / 1000, len_str ); + fprintf( fp, "\nextern const float defaultHRIR_coherence_%dkHz[%s];", samplerate / 1000, len_str ); /* float *defaultHRIR_left_avg_power[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ - fprintf( fp, "\nextern float defaultHRIR_left_avg_power_%dkHz[%s];", samplerate / 1000, len_str ); - fprintf( fp, "\nextern float defaultHRIR_right_avg_power_%dkHz[%s];", samplerate / 1000, len_str ); + fprintf( fp, "\nextern const float defaultHRIR_left_avg_power_%dkHz[%s];", samplerate / 1000, len_str ); + fprintf( fp, "\nextern const float defaultHRIR_right_avg_power_%dkHz[%s];", samplerate / 1000, len_str ); if ( fp ) fclose( fp ); @@ -2567,7 +2565,7 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int pTotalNumFreqSampPerIterations[1][i] = 0; for ( j = 0; j < hrtf->num_iterations[i][0]; j++ ) { - pTotalNumFreqSampPerIterations[0][i] += hrtf->pIndex_frequency_max[i][0][j]; + pTotalNumFreqSampPerIterations[0][i] += hrtf->pIndex_frequency_max_dyn[i][0][j]; } if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[0][i] ) { @@ -2575,7 +2573,7 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int } for ( j = 0; j < hrtf->num_iterations[i][1]; j++ ) { - pTotalNumFreqSampPerIterations[1][i] += hrtf->pIndex_frequency_max[i][1][j]; + pTotalNumFreqSampPerIterations[1][i] += hrtf->pIndex_frequency_max_dyn[i][1][j]; } if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[1][i] ) { @@ -2588,7 +2586,7 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int maxTotalNumFreqSampPerIterationsDiffuse = 0; for ( j = 0; j < hrtf->num_iterations_diffuse[0]; j++ ) { - pTotalNumFreqSampPerIterationsDiffuse[0] += hrtf->pIndex_frequency_max_diffuse[0][j]; + pTotalNumFreqSampPerIterationsDiffuse[0] += hrtf->pIndex_frequency_max_diffuse_dyn[0][j]; } if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[0] ) { @@ -2596,7 +2594,7 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int } for ( j = 0; j < hrtf->num_iterations_diffuse[1]; j++ ) { - pTotalNumFreqSampPerIterationsDiffuse[1] += hrtf->pIndex_frequency_max_diffuse[1][j]; + pTotalNumFreqSampPerIterationsDiffuse[1] += hrtf->pIndex_frequency_max_diffuse_dyn[1][j]; } if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[1] ) { @@ -2607,60 +2605,60 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int { /* float latency_s; */ fprintf( fp, "\n\n/********************** %s_%s **********************/\n", DECLARATION_NAME, lscfg.name ); - fprintf( fp, "\nextern float %s_%s_latency_s;", DECLARATION_NAME, lscfg.name ); + fprintf( fp, "\nextern const float %s_%s_latency_s;", DECLARATION_NAME, lscfg.name ); } fprintf( fp, "\n\n/* Sample Rate = %ld */\n", (long) samplerate ); /* int16_t max_num_iterations; */ - fprintf( fp, "\nextern int16_t %s_%s_max_num_iterations_%2dkHz;", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); + fprintf( fp, "\nextern const int16_t %s_%s_max_num_iterations_%2dkHz;", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); /* uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ - fprintf( fp, "\nextern uint16_t %s_%s_num_iterations_%2dkHz[%s][BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name ); + fprintf( fp, "\nextern const uint16_t %s_%s_num_iterations_%2dkHz[%s][BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name ); /* uint16_t num_iterations_diffuse[BINAURAL_CHANNELS];*/ - fprintf( fp, "\nextern uint16_t %s_%s_num_iterations_diffuse_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); + fprintf( fp, "\nextern const uint16_t %s_%s_num_iterations_diffuse_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); - /*uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; */ - fprintf( fp, "\nextern uint16_t %s_%s_pIndex_frequency_max_%2dkHz[%s][BINAURAL_CHANNELS][%d];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, hrtf->max_num_iterations ); + /*uint16_t *pIndex_frequency_max_dyn[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; */ + fprintf( fp, "\nextern const uint16_t %s_%s_pIndex_frequency_max_%2dkHz[%s][BINAURAL_CHANNELS][%d];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, hrtf->max_num_iterations ); /* uint16_t index_frequency_max_diffuse; */ - fprintf( fp, "\nextern uint16_t %s_%s_index_frequency_max_diffuse_%2dkHz;", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); + fprintf( fp, "\nextern const uint16_t %s_%s_index_frequency_max_diffuse_%2dkHz;", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); /* float inv_diffuse_weight[BINAURAL_CHANNELS][MAX_INTERN_CHANNELS]; */ - fprintf( fp, "\nextern float %s_%s_inv_diffuse_weight_%2dkHz[BINAURAL_CHANNELS][%s];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name ); + fprintf( fp, "\nextern const float %s_%s_inv_diffuse_weight_%2dkHz[BINAURAL_CHANNELS][%s];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name ); - /* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/ - if ( hrtf->pIndex_frequency_max_diffuse[0] == NULL ) + /* uint16_t *pIndex_frequency_max_diffuse_dyn[BINAURAL_CHANNELS];*/ + if ( hrtf->pIndex_frequency_max_diffuse_dyn[0] == NULL ) { - fprintf( fp, "\nextern uint16_t *%s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); + fprintf( fp, "\nextern const uint16_t *%s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); } else { - fprintf( fp, "\nextern uint16_t %s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, ( hrtf->num_iterations_diffuse[0] > hrtf->num_iterations_diffuse[1] ) ? hrtf->num_iterations_diffuse[0] : hrtf->num_iterations_diffuse[1] ); + fprintf( fp, "\nextern const uint16_t %s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, ( hrtf->num_iterations_diffuse[0] > hrtf->num_iterations_diffuse[1] ) ? hrtf->num_iterations_diffuse[0] : hrtf->num_iterations_diffuse[1] ); } /* float *pOut_to_bin[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ - fprintf( fp, "\nextern float %s_%s_coeff_re_%2dkHz[%s][BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, maxTotalNumFreqSampPerIterations ); - fprintf( fp, "\nextern float %s_%s_coeff_im_%2dkHz[%s][BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, maxTotalNumFreqSampPerIterations ); + fprintf( fp, "\nextern const float %s_%s_coeff_re_%2dkHz[%s][BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, maxTotalNumFreqSampPerIterations ); + fprintf( fp, "\nextern const float %s_%s_coeff_im_%2dkHz[%s][BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, maxTotalNumFreqSampPerIterations ); - /* float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS];*/ - if ( hrtf->pOut_to_bin_diffuse_re[0] == NULL ) + /* float *pOut_to_bin_diffuse_re_dyn[BINAURAL_CHANNELS];*/ + if ( hrtf->pOut_to_bin_diffuse_re_dyn[0] == NULL ) { - fprintf( fp, "\nextern float *%s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); + fprintf( fp, "\nextern const float *%s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); } else { - fprintf( fp, "\nextern float %s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); + fprintf( fp, "\nextern const float %s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); } - /* float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS];*/ - if ( hrtf->pOut_to_bin_diffuse_im[0] == NULL ) + /* float *pOut_to_bin_diffuse_im_dyn[BINAURAL_CHANNELS];*/ + if ( hrtf->pOut_to_bin_diffuse_im_dyn[0] == NULL ) { - fprintf( fp, "\nextern float *%s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); + fprintf( fp, "\nextern const float *%s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000 ); } else { - fprintf( fp, "\nextern float %s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); + fprintf( fp, "\nextern const float %s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); } if ( fp ) @@ -2704,12 +2702,12 @@ void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimension { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - if ( hrtf->pIndex_frequency_max[iIR][iChan] != NULL ) + if ( hrtf->pIndex_frequency_max_dyn[iIR][iChan] != NULL ) { total_num_fsamp_per_iteration = 0; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - total_num_fsamp_per_iteration += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + total_num_fsamp_per_iteration += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } if ( hrtf_table_dims->max_total_num_fsamp_per_iteration < total_num_fsamp_per_iteration ) { @@ -2722,14 +2720,14 @@ void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimension hrtf_table_dims->max_total_num_fsamp_per_iteration_diff = 0; for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - if ( hrtf->pIndex_frequency_max_diffuse[iChan] != NULL ) + if ( hrtf->pIndex_frequency_max_diffuse_dyn[iChan] != NULL ) { total_num_fsamp_per_iteration_diff = 0; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - total_num_fsamp_per_iteration_diff += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + total_num_fsamp_per_iteration_diff += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } if ( hrtf_table_dims->max_total_num_fsamp_per_iteration_diff < total_num_fsamp_per_iteration_diff ) { @@ -2757,14 +2755,14 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr hrtf_data_size += sizeof( uint16_t ); // BINAURAL_CHANNELS hrtf_data_size += sizeof( int16_t ); // max_num_iterations hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations - hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * hrtf->max_num_iterations * sizeof( uint16_t ); // pIndex_frequency_max + hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * hrtf->max_num_iterations * sizeof( uint16_t ); // pIndex_frequency_max_dyn hrtf_data_size += sizeof( int16_t ); // max_num_iterations_diffuse if ( hrtf_table_dims->max_num_iterations_diffuse != 0 ) { hrtf_data_size += BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations_diffuse - // The size of pIndex_frequency_max_diffuse depends on num_iterations_diffuse + // The size of pIndex_frequency_max_diffuse_dyn depends on num_iterations_diffuse for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { hrtf_data_size += hrtf->num_iterations_diffuse[iChan] * sizeof( uint16_t ); @@ -2780,7 +2778,7 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr hrtf_data_size += sizeof( uint32_t ); // max_total_num_fsamp_per_iteration hrtf_data_size += sizeof( int16_t ); // Q factor - // The sizes of coeff_re & coeff_im depend on pIndex_frequency_max + // The sizes of coeff_re & coeff_im depend on pIndex_frequency_max_dyn for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) @@ -2788,9 +2786,9 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { #ifdef FIX_1123_CREND_16BIT_FMT - hrtf_data_size += 2 * hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( int16_t ); // 2* : re & im + hrtf_data_size += 2 * hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int16_t ); // 2* : re & im #else - hrtf_data_size += 2 * hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( int32_t ); // 2* : re & im + hrtf_data_size += 2 * hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int32_t ); // 2* : re & im #endif } } @@ -2799,15 +2797,15 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr hrtf_data_size += sizeof( uint32_t ); // max_total_num_fsamp_per_iteration_diff if ( hrtf_table_dims->max_total_num_fsamp_per_iteration_diff != 0 ) { - // The sizes of coeff_diffuse_re & coeff_diffuse_im depend on pIndex_frequency_max + // The sizes of coeff_diffuse_re & coeff_diffuse_im depend on pIndex_frequency_max_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_1123_CREND_16BIT_FMT - hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( int16_t ); // 2* : re & im + hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int16_t ); // 2* : re & im #else - hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( int32_t ); // 2* : re & im + hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int32_t ); // 2* : re & im #endif } } @@ -2833,14 +2831,14 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr hrtf_data_size += sizeof( uint16_t ); // BINAURAL_CHANNELS hrtf_data_size += sizeof( int16_t ); // max_num_iterations hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations - hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * hrtf->max_num_iterations * sizeof( uint16_t ); // pIndex_frequency_max + hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * hrtf->max_num_iterations * sizeof( uint16_t ); // pIndex_frequency_max_dyn hrtf_data_size += sizeof( int16_t ); // max_num_iterations_diffuse if ( hrtf_table_dims->max_num_iterations_diffuse != 0 ) { hrtf_data_size += BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations_diffuse - // The size of pIndex_frequency_max_diffuse depends on num_iterations_diffuse + // The size of pIndex_frequency_max_diffuse_dyn depends on num_iterations_diffuse for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { hrtf_data_size += hrtf->num_iterations_diffuse[iChan] * sizeof( uint16_t ); @@ -2856,14 +2854,14 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration #endif - // The sizes of coeff_re & coeff_im depend on pIndex_frequency_max + // The sizes of coeff_re & coeff_im depend on pIndex_frequency_max_dyn for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - hrtf_data_size += 2 * hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); // 2* : re & im + hrtf_data_size += 2 * hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); // 2* : re & im } } } @@ -2875,12 +2873,12 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr #endif if ( hrtf_table_dims->max_total_num_fsamp_per_iteration_diff != 0 ) { - // The sizes of coeff_diffuse_re & coeff_diffuse_im depend on pIndex_frequency_max + // The sizes of coeff_diffuse_re & coeff_diffuse_im depend on pIndex_frequency_max_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); // 2* : re & im + hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); // 2* : re & im } } } @@ -2982,18 +2980,18 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_re[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_re_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { if ( maxVal < fabsf( coeff_rptr[iTap] ) ) { maxVal = fabsf( coeff_rptr[iTap] ); } } - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } @@ -3001,18 +2999,18 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_im[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_im_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { if ( maxVal < fabsf( coeff_rptr[iTap] ) ) { maxVal = fabsf( coeff_rptr[iTap] ); } } - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } @@ -3023,35 +3021,35 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_re[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_re_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { if ( maxVal < fabsf( coeff_rptr[iTap] ) ) { maxVal = fabsf( coeff_rptr[iTap] ); } } - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_im[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_im_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { if ( maxVal < fabsf( coeff_rptr[iTap] ) ) { maxVal = fabsf( coeff_rptr[iTap] ); } } - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } } @@ -3080,16 +3078,16 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const } #endif - // pOut_to_bin_re (The size depends on pIndex_frequency_max) + // pOut_to_bin_re_dyn (The size depends on pIndex_frequency_max_dyn) for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_re[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_re_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3105,7 +3103,7 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const maxDiff = diff; } } - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } @@ -3114,11 +3112,11 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_im[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_im_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3134,7 +3132,7 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const maxDiff = diff; } } - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } @@ -3142,14 +3140,14 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const if ( hrtf_table_dims.max_total_num_fsamp_per_iteration_diff != 0 ) { - // pOut_to_bin_diffuse_re : The size depends on pIndex_frequency_max_diffuse + // pOut_to_bin_diffuse_re_dyn : The size depends on pIndex_frequency_max_diffuse_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_re[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_re_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3165,18 +3163,18 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const maxDiff = diff; } } - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } - // pOut_to_bin_diffuse_im : The size depends on pIndex_frequency_max_diffuse + // pOut_to_bin_diffuse_im_dyn : The size depends on pIndex_frequency_max_diffuse_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_im[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_im_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3192,7 +3190,7 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const maxDiff = diff; } } - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } } @@ -3235,11 +3233,11 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, max_num_iterations => int16_t num_iterations => uint16_t[max_num_ir][BINAURAL_CHANNELS] - pIndex_frequency_max => uint16_t[max_num_ir][BINAURAL_CHANNELS][max_num_iterations] (Pointer) + pIndex_frequency_max_dyn => uint16_t[max_num_ir][BINAURAL_CHANNELS][max_num_iterations] (Pointer) max_num_iterations_diffuse => int16_t num_iterations_diffuse => uint16_t[BINAURAL_CHANNELS] - pIndex_frequency_max_diffuse => uint16_t[BINAURAL_CHANNELS][max_num_iterations_diffuse] (Pointer) + pIndex_frequency_max_diffuse_dyn => uint16_t[BINAURAL_CHANNELS][max_num_iterations_diffuse] (Pointer) index_frequency_max_diffuse => uint16_t inv_diffuse_weight Q scaling factor => Wor16 @@ -3289,13 +3287,13 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, memcpy( hrtf_bin_wptr, hrtf->num_iterations, data_size_tmp ); // num_iterations hrtf_bin_wptr += data_size_tmp; - // pIndex_frequency_max + // pIndex_frequency_max_dyn data_size_tmp = hrtf->max_num_iterations * sizeof( uint16_t ); for ( int iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max[iIR][iChan], data_size_tmp ); + memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_dyn[iIR][iChan], data_size_tmp ); hrtf_bin_wptr += data_size_tmp; } } @@ -3309,11 +3307,11 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, memcpy( hrtf_bin_wptr, hrtf->num_iterations_diffuse, data_size_tmp ); // num_iterations_diffuse hrtf_bin_wptr += data_size_tmp; - // pIndex_frequency_max_diffuse (the size depends on num_iterations_diffuse) + // pIndex_frequency_max_diffuse_dyn (the size depends on num_iterations_diffuse) for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { data_size_tmp = hrtf->num_iterations_diffuse[iChan] * sizeof( uint16_t ); - memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_diffuse[iChan], data_size_tmp ); + memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_diffuse_dyn[iChan], data_size_tmp ); hrtf_bin_wptr += data_size_tmp; } } @@ -3357,21 +3355,21 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, ( (int16_t *) hrtf_bin_wptr )[0] = factorQ[2]; // Q factor for filters hrtf_bin_wptr += sizeof( int16_t ); - // pOut_to_bin_re (The size depends on pIndex_frequency_max) + // pOut_to_bin_re_dyn (The size depends on pIndex_frequency_max_dyn) for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_re[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_re_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { #ifdef FIX_1123_CREND_16BIT_FMT - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( int16_t ); + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int16_t ); #else - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( int32_t ); + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int32_t ); #endif // memcpy( hrtf_bin_wptr, coeff_rptr, data_size_tmp ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3388,25 +3386,25 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, } } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } - // pOut_to_bin_im (The size depends on pIndex_frequency_max) + // pOut_to_bin_im_dyn (The size depends on pIndex_frequency_max_dyn) for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_im[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_im_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { #ifdef FIX_1123_CREND_16BIT_FMT - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( int16_t ); + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int16_t ); #else - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( int32_t ); + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int32_t ); #endif - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3423,7 +3421,7 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, } } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } @@ -3433,19 +3431,19 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, if ( hrtf_table_dims.max_total_num_fsamp_per_iteration_diff != 0 ) { - // pOut_to_bin_diffuse_re : The size depends on pIndex_frequency_max_diffuse + // pOut_to_bin_diffuse_re_dyn : The size depends on pIndex_frequency_max_diffuse_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_re[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_re_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_1123_CREND_16BIT_FMT - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( int16_t ); + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int16_t ); #else - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( int32_t ); + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int32_t ); #endif // memcpy( hrtf_bin_wptr, coeff_rptr, data_size_tmp ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3462,22 +3460,22 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, } } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } - // pOut_to_bin_diffuse_im : The size depends on pIndex_frequency_max_diffuse + // pOut_to_bin_diffuse_im_dyn : The size depends on pIndex_frequency_max_diffuse_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_im[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_im_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_1123_CREND_16BIT_FMT - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( int16_t ); + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int16_t ); #else - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( int32_t ); + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int32_t ); #endif - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { tmp = coeff_rptr[iTap]; #ifdef FIX_1123_CREND_16BIT_FMT @@ -3494,7 +3492,7 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, } } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } } @@ -3557,11 +3555,11 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, max_num_iterations => int16_t num_iterations => uint16_t[max_num_ir][BINAURAL_CHANNELS] - pIndex_frequency_max => uint16_t[max_num_ir][BINAURAL_CHANNELS][max_num_iterations] (Pointer) + pIndex_frequency_max_dyn => uint16_t[max_num_ir][BINAURAL_CHANNELS][max_num_iterations] (Pointer) max_num_iterations_diffuse => int16_t num_iterations_diffuse => uint16_t[BINAURAL_CHANNELS] - pIndex_frequency_max_diffuse => uint16_t[BINAURAL_CHANNELS][max_num_iterations_diffuse] (Pointer) + pIndex_frequency_max_diffuse_dyn => uint16_t[BINAURAL_CHANNELS][max_num_iterations_diffuse] (Pointer) index_frequency_max_diffuse => uint16_t inv_diffuse_weight => float[BINAURAL_CHANNELS][max_num_ir] @@ -3613,13 +3611,13 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, memcpy( hrtf_bin_wptr, hrtf->num_iterations, data_size_tmp ); // num_iterations hrtf_bin_wptr += data_size_tmp; - // pIndex_frequency_max + // pIndex_frequency_max_dyn data_size_tmp = hrtf->max_num_iterations * sizeof( uint16_t ); for ( int iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max[iIR][iChan], data_size_tmp ); + memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_dyn[iIR][iChan], data_size_tmp ); hrtf_bin_wptr += data_size_tmp; } } @@ -3633,11 +3631,11 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, memcpy( hrtf_bin_wptr, hrtf->num_iterations_diffuse, data_size_tmp ); // num_iterations_diffuse hrtf_bin_wptr += data_size_tmp; - // pIndex_frequency_max_diffuse (the size depends on num_iterations_diffuse) + // pIndex_frequency_max_diffuse_dyn (the size depends on num_iterations_diffuse) for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { data_size_tmp = hrtf->num_iterations_diffuse[iChan] * sizeof( uint16_t ); - memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_diffuse[iChan], data_size_tmp ); + memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_diffuse_dyn[iChan], data_size_tmp ); hrtf_bin_wptr += data_size_tmp; } } @@ -3680,17 +3678,17 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, #endif - // pOut_to_bin_re (The size depends on pIndex_frequency_max) + // pOut_to_bin_re_dyn (The size depends on pIndex_frequency_max_dyn) for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_re[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_re_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); // memcpy( hrtf_bin_wptr, coeff_rptr, data_size_tmp ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { #ifdef FIX_POINT_HRTF_FILE_FORMAT ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap]; @@ -3701,21 +3699,21 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, #endif } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } - // pOut_to_bin_im (The size depends on pIndex_frequency_max) + // pOut_to_bin_im_dyn (The size depends on pIndex_frequency_max_dyn) for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) { for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_im[iIR][iChan]; + coeff_rptr = hrtf->pOut_to_bin_im_dyn[iIR][iChan]; for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max[iIR][iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max[iIR][iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ ) { #ifdef FIX_POINT_HRTF_FILE_FORMAT ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap]; @@ -3726,7 +3724,7 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, #endif } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max[iIR][iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; } } } @@ -3741,14 +3739,14 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, if ( hrtf_table_dims.max_total_num_fsamp_per_iteration_diff != 0 ) { - // pOut_to_bin_diffuse_re : The size depends on pIndex_frequency_max_diffuse + // pOut_to_bin_diffuse_re_dyn : The size depends on pIndex_frequency_max_diffuse_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_re[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_re_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { #ifdef FIX_POINT_HRTF_FILE_FORMAT ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap]; @@ -3759,18 +3757,18 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, #endif } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } - // pOut_to_bin_diffuse_im : The size depends on pIndex_frequency_max_diffuse + // pOut_to_bin_diffuse_im_dyn : The size depends on pIndex_frequency_max_diffuse_dyn for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ ) { - coeff_rptr = hrtf->pOut_to_bin_diffuse_im[iChan]; + coeff_rptr = hrtf->pOut_to_bin_diffuse_im_dyn[iChan]; for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ ) { - data_size_tmp = hrtf->pIndex_frequency_max_diffuse[iChan][iIter] * sizeof( float ); - for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; iTap++ ) + data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); + for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ ) { #ifdef FIX_POINT_HRTF_FILE_FORMAT ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap]; @@ -3781,7 +3779,7 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, #endif } hrtf_bin_wptr += data_size_tmp; - coeff_rptr += hrtf->pIndex_frequency_max_diffuse[iChan][iIter]; + coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; } } } diff --git a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c index 5ec0215c6d..6031780fb5 100644 --- a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c +++ b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c @@ -42,7 +42,7 @@ #ifdef DEBUG_BINAURAL_FILTER_DESIGN /*------------------------------ Debug utilities ---------------------------------------------- */ -static void printBuf_float32( float *buf, int32_t size1 ) +static void printBuf_float32( const float *buf, int32_t size1 ) { int32_t ii; for ( ii = 0; ii < size1; ++ii ) @@ -53,7 +53,7 @@ static void printBuf_float32( float *buf, int32_t size1 ) return; } -static void printBuf_uint16( uint16_t *buf, uint16_t size1 ) +static void printBuf_uint16( const uint16_t *buf, uint16_t size1 ) { uint16_t ii; for ( ii = 0; ii < size1; ++ii ) @@ -139,10 +139,10 @@ static void printfAudioBufferOutFilterParams( printf( "\n" ); printf( "\nDirect Fc : " ); - printBuf_uint16( pParam->pIndex_frequency_max[0][0], pParam->num_iterations[0][0] ); + printBuf_uint16( pParam->pIndex_frequency_max_dyn[0][0], pParam->num_iterations[0][0] ); printf( "\n" ); printf( "\nDiffuse Fc : " ); - printBuf_uint16( pParam->pIndex_frequency_max_diffuse[0], pParam->num_iterations_diffuse[0] ); + printBuf_uint16( pParam->pIndex_frequency_max_diffuse_dyn[0], pParam->num_iterations_diffuse[0] ); printf( "\nmax Diffuse Fc : %u", pParam->index_frequency_max_diffuse ); printf( "\n" ); printf( "\nInverse Diffuse Weights :" ); @@ -201,39 +201,39 @@ ivas_error ivas_hrtf_close( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( hHRTF->pIndex_frequency_max[i][j] != NULL ) + if ( hHRTF->pIndex_frequency_max_dyn[i][j] != NULL ) { - free( hHRTF->pIndex_frequency_max[i][j] ); - hHRTF->pIndex_frequency_max[i][j] = NULL; + free( hHRTF->pIndex_frequency_max_dyn[i][j] ); + hHRTF->pIndex_frequency_max_dyn[i][j] = NULL; } - if ( hHRTF->pOut_to_bin_re[i][j] != NULL ) + if ( hHRTF->pOut_to_bin_re_dyn[i][j] != NULL ) { - free( hHRTF->pOut_to_bin_re[i][j] ); - hHRTF->pOut_to_bin_re[i][j] = NULL; + free( hHRTF->pOut_to_bin_re_dyn[i][j] ); + hHRTF->pOut_to_bin_re_dyn[i][j] = NULL; } - if ( hHRTF->pOut_to_bin_im[i][j] != NULL ) + if ( hHRTF->pOut_to_bin_im_dyn[i][j] != NULL ) { - free( hHRTF->pOut_to_bin_im[i][j] ); - hHRTF->pOut_to_bin_im[i][j] = NULL; + free( hHRTF->pOut_to_bin_im_dyn[i][j] ); + hHRTF->pOut_to_bin_im_dyn[i][j] = NULL; } } } for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( hHRTF->pIndex_frequency_max_diffuse[j] != NULL ) + if ( hHRTF->pIndex_frequency_max_diffuse_dyn[j] != NULL ) { - free( hHRTF->pIndex_frequency_max_diffuse[j] ); - hHRTF->pIndex_frequency_max_diffuse[j] = NULL; + free( hHRTF->pIndex_frequency_max_diffuse_dyn[j] ); + hHRTF->pIndex_frequency_max_diffuse_dyn[j] = NULL; } - if ( hHRTF->pOut_to_bin_diffuse_re[j] != NULL ) + if ( hHRTF->pOut_to_bin_diffuse_re_dyn[j] != NULL ) { - free( hHRTF->pOut_to_bin_diffuse_re[j] ); - hHRTF->pOut_to_bin_diffuse_re[j] = NULL; + free( hHRTF->pOut_to_bin_diffuse_re_dyn[j] ); + hHRTF->pOut_to_bin_diffuse_re_dyn[j] = NULL; } - if ( hHRTF->pOut_to_bin_diffuse_im[j] != NULL ) + if ( hHRTF->pOut_to_bin_diffuse_im_dyn[j] != NULL ) { - free( hHRTF->pOut_to_bin_diffuse_im[j] ); - hHRTF->pOut_to_bin_diffuse_im[j] = NULL; + free( hHRTF->pOut_to_bin_diffuse_im_dyn[j] ); + hHRTF->pOut_to_bin_diffuse_im_dyn[j] = NULL; } } @@ -749,7 +749,7 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { for ( i_ear = 0; i_ear < BINAURAL_CHANNELS; i_ear++ ) { - pParam->pIndex_frequency_max[i_chan][i_ear] = (uint16_t *) malloc( (size_t) pParam->num_iterations[i_chan][i_ear] * sizeof( uint16_t ) ); + pParam->pIndex_frequency_max_dyn[i_chan][i_ear] = (uint16_t *) malloc( (size_t) pParam->num_iterations[i_chan][i_ear] * sizeof( uint16_t ) ); } } @@ -757,11 +757,11 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { if ( pParam->num_iterations_diffuse[i_ear] > 0 ) { - pParam->pIndex_frequency_max_diffuse[i_ear] = (uint16_t *) malloc( (size_t) pParam->num_iterations_diffuse[i_ear] * sizeof( uint16_t ) ); + pParam->pIndex_frequency_max_diffuse_dyn[i_ear] = (uint16_t *) malloc( (size_t) pParam->num_iterations_diffuse[i_ear] * sizeof( uint16_t ) ); } else { - pParam->pIndex_frequency_max_diffuse[i_ear] = NULL; + pParam->pIndex_frequency_max_diffuse_dyn[i_ear] = NULL; } } @@ -772,8 +772,8 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { for ( i_ear = 0; i_ear < BINAURAL_CHANNELS; i_ear++ ) { - pParam->pOut_to_bin_re[i_chan][i_ear] = (float *) malloc( (size_t) pParam->num_iterations[i_chan][i_ear] * frame_len * sizeof( float ) ); - pParam->pOut_to_bin_im[i_chan][i_ear] = (float *) malloc( (size_t) pParam->num_iterations[i_chan][i_ear] * frame_len * sizeof( float ) ); + pParam->pOut_to_bin_re_dyn[i_chan][i_ear] = (float *) malloc( (size_t) pParam->num_iterations[i_chan][i_ear] * frame_len * sizeof( float ) ); + pParam->pOut_to_bin_im_dyn[i_chan][i_ear] = (float *) malloc( (size_t) pParam->num_iterations[i_chan][i_ear] * frame_len * sizeof( float ) ); } } @@ -810,18 +810,18 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( /* Compute block spectrum and take magnitude */ - ivas_mdft( pBlock, pParam->pOut_to_bin_re[i_chan][i_ear], pParam->pOut_to_bin_im[i_chan][i_ear], frame_len, frame_len ); + ivas_mdft( pBlock, pParam->pOut_to_bin_re_dyn[i_chan][i_ear], pParam->pOut_to_bin_im_dyn[i_chan][i_ear], frame_len, frame_len ); for ( i_tap = 0; i_tap < frame_len; i_tap++ ) { - pParam->pOut_to_bin_re[i_chan][i_ear][i_tap] = mdft_scale_fact * pParam->pOut_to_bin_re[i_chan][i_ear][i_tap]; - pParam->pOut_to_bin_im[i_chan][i_ear][i_tap] = mdft_scale_fact * pParam->pOut_to_bin_im[i_chan][i_ear][i_tap]; + pParam->pOut_to_bin_re_dyn[i_chan][i_ear][i_tap] = mdft_scale_fact * pParam->pOut_to_bin_re_dyn[i_chan][i_ear][i_tap]; + pParam->pOut_to_bin_im_dyn[i_chan][i_ear][i_tap] = mdft_scale_fact * pParam->pOut_to_bin_im_dyn[i_chan][i_ear][i_tap]; } - FFT_Complex_to_Mag( pParam->pOut_to_bin_re[i_chan][i_ear], pBlockSpectrum_i, pBlockSpectrum_Mag, frame_len ); /* compute Magnitude */ + FFT_Complex_to_Mag( pParam->pOut_to_bin_re_dyn[i_chan][i_ear], pBlockSpectrum_i, pBlockSpectrum_Mag, frame_len ); /* compute Magnitude */ /* Recompute filter energy (to Nyquist freq only) */ - pParam->pIndex_frequency_max[i_chan][i_ear][0] = frame_len; + pParam->pIndex_frequency_max_dyn[i_chan][i_ear][0] = frame_len; } } } @@ -901,8 +901,8 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { indFreq = frame_len; } - pParam->pIndex_frequency_max[i_chan][i_ear][i_block] = indFreq; - // pParam->pIndex_frequency_max[i_chan][i_ear][i_block] = framelen; + pParam->pIndex_frequency_max_dyn[i_chan][i_ear][i_block] = indFreq; + // pParam->pIndex_frequency_max_dyn[i_chan][i_ear][i_block] = framelen; } } } @@ -911,9 +911,9 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { for ( i_block = pParam->num_iterations[i_chan][0] - 1; i_block > 0; --i_block ) { - if ( pParam->pIndex_frequency_max[i_chan][0][i_block - 1] > pParam->pIndex_frequency_max[i_chan][0][i_block] ) + if ( pParam->pIndex_frequency_max_dyn[i_chan][0][i_block - 1] > pParam->pIndex_frequency_max_dyn[i_chan][0][i_block] ) { - pParam->pIndex_frequency_max[i_chan][1][i_block - 1] = pParam->pIndex_frequency_max[i_chan][0][i_block - 1] = pParam->pIndex_frequency_max[i_chan][0][i_block]; + pParam->pIndex_frequency_max_dyn[i_chan][1][i_block - 1] = pParam->pIndex_frequency_max_dyn[i_chan][0][i_block - 1] = pParam->pIndex_frequency_max_dyn[i_chan][0][i_block]; } } }*/ @@ -924,9 +924,9 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( totSizeFreq[i_chan] = 0; for ( i_block = 0; i_block < pParam->num_iterations[i_chan][0]; ++i_block ) { - indFreqMaxi = max( pParam->pIndex_frequency_max[i_chan][0][i_block], pParam->pIndex_frequency_max[i_chan][1][i_block] ); - pParam->pIndex_frequency_max[i_chan][0][i_block] = indFreqMaxi; - pParam->pIndex_frequency_max[i_chan][1][i_block] = indFreqMaxi; + indFreqMaxi = max( pParam->pIndex_frequency_max_dyn[i_chan][0][i_block], pParam->pIndex_frequency_max_dyn[i_chan][1][i_block] ); + pParam->pIndex_frequency_max_dyn[i_chan][0][i_block] = indFreqMaxi; + pParam->pIndex_frequency_max_dyn[i_chan][1][i_block] = indFreqMaxi; totSizeFreq[i_chan] = totSizeFreq[i_chan] + indFreqMaxi; } } @@ -936,8 +936,8 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { for ( i_ear = 0; i_ear < BINAURAL_CHANNELS; ++i_ear ) { - pParam->pOut_to_bin_re[i_chan][i_ear] = (float *) malloc( totSizeFreq[i_chan] * sizeof( float ) ); - pParam->pOut_to_bin_im[i_chan][i_ear] = (float *) malloc( totSizeFreq[i_chan] * sizeof( float ) ); + pParam->pOut_to_bin_re_dyn[i_chan][i_ear] = (float *) malloc( totSizeFreq[i_chan] * sizeof( float ) ); + pParam->pOut_to_bin_im_dyn[i_chan][i_ear] = (float *) malloc( totSizeFreq[i_chan] * sizeof( float ) ); offset = 0; for ( i_block = 0; i_block < pParam->num_iterations[i_chan][i_ear]; ++i_block ) { @@ -972,12 +972,12 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( pBlockSpectrum_i[i_tap] = mdft_scale_fact * pBlockSpectrum_i[i_tap]; } - for ( i_tap = 0; i_tap < pParam->pIndex_frequency_max[i_chan][i_ear][i_block]; i_tap++ ) + for ( i_tap = 0; i_tap < pParam->pIndex_frequency_max_dyn[i_chan][i_ear][i_block]; i_tap++ ) { - pParam->pOut_to_bin_re[i_chan][i_ear][offset + i_tap] = pBlockSpectrum_r[i_tap]; - pParam->pOut_to_bin_im[i_chan][i_ear][offset + i_tap] = pBlockSpectrum_i[i_tap]; + pParam->pOut_to_bin_re_dyn[i_chan][i_ear][offset + i_tap] = pBlockSpectrum_r[i_tap]; + pParam->pOut_to_bin_im_dyn[i_chan][i_ear][offset + i_tap] = pBlockSpectrum_i[i_tap]; } - offset = offset + pParam->pIndex_frequency_max[i_chan][i_ear][i_block]; + offset = offset + pParam->pIndex_frequency_max_dyn[i_chan][i_ear][i_block]; } } } @@ -986,8 +986,8 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( { if ( pParam->num_iterations_diffuse[i_ear] == 0 ) { - pParam->pOut_to_bin_diffuse_re[i_ear] = NULL; - pParam->pOut_to_bin_diffuse_im[i_ear] = NULL; + pParam->pOut_to_bin_diffuse_re_dyn[i_ear] = NULL; + pParam->pOut_to_bin_diffuse_im_dyn[i_ear] = NULL; } } @@ -1203,16 +1203,16 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( } /* Set the frequency value(in Hz) in the output parameter "diffuseFc" */ - pParam->pIndex_frequency_max_diffuse[1][i_block] = pParam->pIndex_frequency_max_diffuse[0][i_block] = indFreqMaxi; - // pParam->pIndex_frequency_max_diffuse[1][i_block] = pParam->pIndex_frequency_max_diffuse[0][i_block] = framelen; + pParam->pIndex_frequency_max_diffuse_dyn[1][i_block] = pParam->pIndex_frequency_max_diffuse_dyn[0][i_block] = indFreqMaxi; + // pParam->pIndex_frequency_max_diffuse_dyn[1][i_block] = pParam->pIndex_frequency_max_diffuse_dyn[0][i_block] = framelen; // reset indFreqMaxi } for ( i_block = pParam->num_iterations_diffuse[0] - 1; i_block > 0; --i_block ) { - if ( pParam->pIndex_frequency_max_diffuse[0][i_block - 1] > pParam->pIndex_frequency_max_diffuse[0][i_block] ) + if ( pParam->pIndex_frequency_max_diffuse_dyn[0][i_block - 1] > pParam->pIndex_frequency_max_diffuse_dyn[0][i_block] ) { - pParam->pIndex_frequency_max_diffuse[1][i_block - 1] = pParam->pIndex_frequency_max_diffuse[0][i_block - 1] = pParam->pIndex_frequency_max_diffuse[0][i_block]; + pParam->pIndex_frequency_max_diffuse_dyn[1][i_block - 1] = pParam->pIndex_frequency_max_diffuse_dyn[0][i_block - 1] = pParam->pIndex_frequency_max_diffuse_dyn[0][i_block]; } } @@ -1220,11 +1220,11 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( totSizeFreqDiffuse = 0; for ( i_block = 0; i_block < pParam->num_iterations_diffuse[0]; ++i_block ) { - if ( pParam->index_frequency_max_diffuse < pParam->pIndex_frequency_max_diffuse[0][i_block] ) + if ( pParam->index_frequency_max_diffuse < pParam->pIndex_frequency_max_diffuse_dyn[0][i_block] ) { - pParam->index_frequency_max_diffuse = pParam->pIndex_frequency_max_diffuse[0][i_block]; + pParam->index_frequency_max_diffuse = pParam->pIndex_frequency_max_diffuse_dyn[0][i_block]; } - totSizeFreqDiffuse = totSizeFreqDiffuse + pParam->pIndex_frequency_max_diffuse[0][i_block]; + totSizeFreqDiffuse = totSizeFreqDiffuse + pParam->pIndex_frequency_max_diffuse_dyn[0][i_block]; } /**************************/ @@ -1232,8 +1232,8 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( /* For each block, find the index from which cumulative spectral power (end to begin) is under the threshold */ for ( i_ear = 0; i_ear < BINAURAL_CHANNELS; ++i_ear ) { - pParam->pOut_to_bin_diffuse_re[i_ear] = (float *) malloc( totSizeFreqDiffuse * sizeof( float ) ); - pParam->pOut_to_bin_diffuse_im[i_ear] = (float *) malloc( totSizeFreqDiffuse * sizeof( float ) ); + pParam->pOut_to_bin_diffuse_re_dyn[i_ear] = (float *) malloc( totSizeFreqDiffuse * sizeof( float ) ); + pParam->pOut_to_bin_diffuse_im_dyn[i_ear] = (float *) malloc( totSizeFreqDiffuse * sizeof( float ) ); offset = 0; for ( i_block = 0; i_block < pParam->num_iterations_diffuse[0]; ++i_block ) { @@ -1278,12 +1278,12 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( pBlockSpectrum_i[i_tap] *= -1.414f * sinf( delayf * ( (float) i_tap + 0.5f ) ); } } - for ( i_tap = 0; i_tap < pParam->pIndex_frequency_max_diffuse[i_ear][i_block]; i_tap++ ) + for ( i_tap = 0; i_tap < pParam->pIndex_frequency_max_diffuse_dyn[i_ear][i_block]; i_tap++ ) { - pParam->pOut_to_bin_diffuse_re[i_ear][offset + i_tap] = pBlockSpectrum_r[i_tap]; - pParam->pOut_to_bin_diffuse_im[i_ear][offset + i_tap] = pBlockSpectrum_i[i_tap]; + pParam->pOut_to_bin_diffuse_re_dyn[i_ear][offset + i_tap] = pBlockSpectrum_r[i_tap]; + pParam->pOut_to_bin_diffuse_im_dyn[i_ear][offset + i_tap] = pBlockSpectrum_i[i_tap]; } - offset = offset + pParam->pIndex_frequency_max_diffuse[i_ear][i_block]; + offset = offset + pParam->pIndex_frequency_max_diffuse_dyn[i_ear][i_block]; } } @@ -1333,19 +1333,18 @@ ivas_error ivas_set_hrtf_fr( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - crend_hrtf->pOut_to_bin_re[i][j] = (float *) malloc( ( ( (size_t) crend_hrtf->num_iterations[i][j] * output_frame ) ) * sizeof( float ) ); - if ( crend_hrtf->pOut_to_bin_re[i][j] == NULL ) + crend_hrtf->pOut_to_bin_re_dyn[i][j] = (float *) malloc( ( ( (size_t) crend_hrtf->num_iterations[i][j] * output_frame ) ) * sizeof( float ) ); + if ( crend_hrtf->pOut_to_bin_re_dyn[i][j] == NULL ) { return IVAS_ERR_FAILED_ALLOC; } - crend_hrtf->pOut_to_bin_im[i][j] = (float *) malloc( ( ( (size_t) crend_hrtf->num_iterations[i][j] * output_frame ) ) * sizeof( float ) ); - if ( crend_hrtf->pOut_to_bin_im[i][j] == NULL ) + crend_hrtf->pOut_to_bin_im_dyn[i][j] = (float *) malloc( ( ( (size_t) crend_hrtf->num_iterations[i][j] * output_frame ) ) * sizeof( float ) ); + if ( crend_hrtf->pOut_to_bin_im_dyn[i][j] == NULL ) { return IVAS_ERR_FAILED_ALLOC; } - n = 0; tmp_ir_len = 0; @@ -1369,14 +1368,13 @@ ivas_error ivas_set_hrtf_fr( } tmp_ir_len -= in_len; - ivas_mdft( data_ir_flt, &crend_hrtf->pOut_to_bin_re[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], - &crend_hrtf->pOut_to_bin_im[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], output_frame, output_frame ); - - v_multc( &crend_hrtf->pOut_to_bin_re[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], mdft_scale_fact, - &crend_hrtf->pOut_to_bin_re[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], output_frame ); - v_multc( &crend_hrtf->pOut_to_bin_im[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], mdft_scale_fact, - &crend_hrtf->pOut_to_bin_im[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], output_frame ); + ivas_mdft( data_ir_flt, &crend_hrtf->pOut_to_bin_re_dyn[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], + &crend_hrtf->pOut_to_bin_im_dyn[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], output_frame, output_frame ); + v_multc( &crend_hrtf->pOut_to_bin_re_dyn[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], mdft_scale_fact, + &crend_hrtf->pOut_to_bin_re_dyn[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], output_frame ); + v_multc( &crend_hrtf->pOut_to_bin_im_dyn[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], mdft_scale_fact, + &crend_hrtf->pOut_to_bin_im_dyn[i][j][( crend_hrtf->num_iterations[i][j] - 1 - m ) * output_frame], output_frame ); } } } @@ -1385,14 +1383,14 @@ ivas_error ivas_set_hrtf_fr( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - crend_hrtf->pIndex_frequency_max[i][j] = (uint16_t *) malloc( (size_t) crend_hrtf->num_iterations[i][j] * sizeof( uint16_t ) ); - if ( crend_hrtf->pIndex_frequency_max[i][j] == NULL ) + crend_hrtf->pIndex_frequency_max_dyn[i][j] = (uint16_t *) malloc( (size_t) crend_hrtf->num_iterations[i][j] * sizeof( uint16_t ) ); + if ( crend_hrtf->pIndex_frequency_max_dyn[i][j] == NULL ) { return IVAS_ERR_FAILED_ALLOC; } for ( m = 0; m < crend_hrtf->num_iterations[i][j]; m++ ) { - crend_hrtf->pIndex_frequency_max[i][j][m] = output_frame; + crend_hrtf->pIndex_frequency_max_dyn[i][j][m] = output_frame; } } } -- GitLab