Commit 3d5c339b authored by Jan Kiene's avatar Jan Kiene
Browse files

move scripts folder over from main

parent 424e52ce
Loading
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.
-->
# Modeling tool for all IVAS binaural renderer
# Allows to convert SOFA file(s) to rom tables files (*.c|h) or binaural binary file(s)
# Modeling tool for all IVAS binaural renderers
# Allows to convert SOFA file(s) to ROM tables files (*.c|h) or binaural binary file(s)

## Requirements
- MATLAB >= R2017b
@@ -55,7 +55,7 @@
     ```
   - `generate_crend_ivas_tables` executable shall be in folder [`../../scripts/binauralRenderer_interface`](../../scripts/binauralRenderer_interface)  
   - On Windows this executable requires DLL from MATLAB, you need to add to your path `*/matlab/version/bin/win64`
   - For more details on `generate_crend_ivas_tables` see [`mixer_conv_sofa_to_rom_table_converter_readme.txt`](mixer_conv_sofa_to_rom_table_converter_readme.txt).
   - For more details on `generate_crend_ivas_tables` see [`ivas_crend_sofa_to_rom_table_converter_readme.txt`](ivas_crend_sofa_to_rom_table_converter_readme.txt).
   - On Apple Silicon Mac with Intel MATLAB, it is necessary to add `SET(CMAKE_OSX_ARCHITECTURES "x86_64")` in the `CMakeLists.txt` near the top of the file. This forces the compilation to use Intel architecture instead ofo the native one.
   - if find_package do not find matlab, at the beginning of the cmakelists.txt file you can set the search path with the folowing line set(Matlab_ROOT_DIR matlab_path), for example on linux set(Matlab_ROOT_DIR ~/MATLAB/R2023b) on mac set(Matlab_ROOT_DIR /Applications/MATLAB_R2023b.app) 	 

@@ -109,11 +109,4 @@ See [`scripts/ThirdPartyLegalNotices`](../../scripts/ThirdPartyLegalNotices) for
→ Generated files are in folder [`binaural_renderers_hrtf_data`](binaural_renderers_hrtf_data)
- Generated files :
 - `ivas_binaural_*kHz.bin`: file containing all tables values for all IVAS binaural renderers for one sample rate.
 - `ivas_binaural_td_*kHz.bin`: file containing tables values for IVAS td binaural renderer for one sample rate.
 - `ivas_binaural_reverb_*kHz.bin`: file containing tables values for IVAS td reverberation process for one sample rate.
 - `ivas_binaural_fastconv_*kHz.bin`: file containing tables values for IVAS fastconv binaural renderers. Files for all sampling rate files are the same.
 - `ivas_binaural_parambin_*kHz.bin`: file containing tables values for IVAS prametric binaural renderers. Files for all sampling rate files are the same.
 - `ivas_binaural_td_*kHz.bin`: file containing tables values for IVAS td binaural renderers for one sample rate.
 - `ivas_binaural_mixconv_hrir_*kHz.bin`: file containing tables values for IVAS mixer conv binaural renderer for HRIR for one sample rate.
 - `ivas_binaural_mixconv_brir_*kHz.bin`: file containing tables values for IVAS mixer conv binaural renderer for BRIR for one sample rate.
+0 −15
Original line number Diff line number Diff line
@@ -73,21 +73,6 @@ const HRTF_READER_RENDERER_TYPE rend_types[IVAS_NB_RENDERER_TYPE] = {
    HRTF_READER_RENDERER_BINAURAL_REVERB_ALL
};

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
typedef enum
{
    BINAURAL_INPUT_AUDIO_CONFIG_INVALID,
    BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, /* 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 */
    BINAURAL_INPUT_AUDIO_CONFIG_HOA3,     /* HOA3 */
    BINAURAL_INPUT_AUDIO_CONFIG_HOA2,     /* HOA2 */
    BINAURAL_INPUT_AUDIO_CONFIG_FOA,      /* FOA */
    BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED /* Not used */

} BINAURAL_INPUT_AUDIO_CONFIG;

#endif


const BINAURAL_INPUT_AUDIO_CONFIG input_cfgs[IVAS_NB_AUDIO_CONFIG] = {
    BINAURAL_INPUT_AUDIO_CONFIG_COMBINED,
    BINAURAL_INPUT_AUDIO_CONFIG_HOA3,
+17 −17
Original line number Diff line number Diff line
@@ -127,12 +127,12 @@ char *to_upper( char *str );
void usage_gen_crend_tables( void );
void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct );
int generate_crend_ivas_tables_from_sofa( const char *sofa_file_path, ConfigReader *cfgReader );
void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
void update_h_file( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
void update_c_file( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len );
void update_h_file_with_reverb( const int32_t samplerate );
void update_h_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
void update_c_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
void update_h_file_fx( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
void update_c_file_fx( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
void update_c_file_with_reverb_fx( int16_t *pEner_l_fx, int16_t *pEner_r_fx, int16_t *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len );
void update_h_file_with_reverb_fx( const int32_t samplerate );
int generate_reverb_ivas_tables_from_sofa( const char *file_path );
@@ -140,11 +140,11 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path );
extern int32_t float2int32_t( float, int16_t );
extern int16_t float2int16_t( float, int16_t );

void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ );
uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims );
ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
void get_binary_tables_dimensions( HRTFS_CREND_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ );
uint32_t compute_binary_size( HRTFS_CREND_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims );
ivas_error make_fx_be( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, int16_t *factorQ );
ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
ivas_error write_binary_file( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, int16_t factorQ, const int32_t samplerate );

/*---------------------------------------------------------------------*
@@ -1635,7 +1635,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
            }
        }

        HRTFS_DATA hrtf_data = { 0 };
        HRTFS_CREND_DATA hrtf_data = { 0 };
        int32_t index_start, index_end, max_ir_len;

        hrtf_data.max_num_ir = ivas_hrtf->m;
@@ -2774,7 +2774,7 @@ void update_c_file_with_reverb_fx( int16_t *pEner_l_fx, int16_t *pEner_r_fx, int
/*---------------------------------------------------------------------*
 *update_c_file();
 *---------------------------------------------------------------------*/
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
void update_c_file( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
{

    if ( c_file_path == NULL )
@@ -3015,7 +3015,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
/*---------------------------------------------------------------------*
 *update_c_file();
 *---------------------------------------------------------------------*/
void update_c_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factor_Q[3] )
void update_c_file_fx( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factor_Q[3] )
{

    if ( c_file_path_fx == NULL )
@@ -3297,7 +3297,7 @@ void update_h_file_with_reverb( int32_t samplerate )
/*---------------------------------------------------------------------*
 *update_h_file();
 *---------------------------------------------------------------------*/
void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
void update_h_file( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
{
    uint16_t i, j;
    uint32_t *pTotalNumFreqSampPerIterations[2], maxTotalNumFreqSampPerIterations;
@@ -3490,7 +3490,7 @@ void update_h_file_with_reverb_fx( int32_t samplerate )
/*---------------------------------------------------------------------*
 *update_h_file();
 *---------------------------------------------------------------------*/
void update_h_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
void update_h_file_fx( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
{
    uint16_t i, j;
    uint32_t *pTotalNumFreqSampPerIterations[2], maxTotalNumFreqSampPerIterations;
@@ -3650,7 +3650,7 @@ void update_h_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
/*---------------------------------------------------------------------*
 * get_tables_dimensions();
 *---------------------------------------------------------------------*/
void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ )
void get_binary_tables_dimensions( HRTFS_CREND_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ )
{
    int16_t iIR, iIter, iChan;
    uint32_t total_num_fsamp_per_iteration, total_num_fsamp_per_iteration_diff;
@@ -3713,7 +3713,7 @@ void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimension
/*---------------------------------------------------------------------*
 * compute_binary_size();
 *---------------------------------------------------------------------*/
uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims )
uint32_t compute_binary_size( HRTFS_CREND_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims )
{
    int16_t iIR, iIter, iChan;
    uint32_t hrtf_data_size;
@@ -3780,7 +3780,7 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr
/*---------------------------------------------------------------------*
 * make_fx_be();
 *---------------------------------------------------------------------*/
ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
ivas_error make_fx_be( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
{
    int16_t iIR, iIter, iChan, iTap;
    uint32_t data_size_tmp;
@@ -4060,7 +4060,7 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
/*---------------------------------------------------------------------*
 * write_binary_file();
 *---------------------------------------------------------------------*/
ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
ivas_error write_binary_file( HRTFS_CREND_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
{
    FILE *output_binary_file;

+11 −11
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ static void printMatrix_int32_t(int32_t** buf, int32_t size1, int32_t size2)


static void printfAudioBufferOutFilterParams(
    HRTFS_DATA *pParam,
    HRTFS_CREND_DATA *pParam,
    int32_t index_start,
    int32_t index_end )
{
@@ -199,7 +199,7 @@ int16_t float2int16_t( float val, int16_t Q )
}

ivas_error ivas_hrtf_close(
    HRTFS_HANDLE hHRTF /* i/o: HRTF handle         */
    HRTFS_CREND_HANDLE hHRTF /* i/o: HRTF handle         */
)
{
    int16_t i, j;
@@ -279,7 +279,7 @@ static void FFT_Complex_to_Mag(
 *   @param    pFirData      : source ptr to ivas_hrtf_t struct
 *    @param      framelen        : size of the blocks linked to sample rate and fft size
 *    @param      framelen        : index of channel LFE if any. if no LFE channel set the value to -1
 *   @param    pParam        : dest ptr to a HRTFS_DATA struct for storing computed params
 *   @param    pParam        : dest ptr to a HRTFS_CREND_DATA struct for storing computed params
 *
 *   @return    0 if no error, 1 otherwise
 */
@@ -287,7 +287,7 @@ static void FFT_Complex_to_Mag(
ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
    ivas_hrtf_t *pFirData,
    const int16_t framelen,
    HRTFS_DATA *pParam,
    HRTFS_CREND_DATA *pParam,
    int32_t *index_start,
    int32_t *index_end,
    int32_t *max_ir_len,
@@ -700,8 +700,8 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
 *
 *   @param    pFirData      : source ptr to ivas_hrtf_t struct
 *   @param    framelen      : size of the blocks linked to sample rate and fft size
 *   @param    pParam        : dest ptr to a HRTFS_DATA struct for storing computed params
 *   @param    pParam        : dest ptr to a HRTFS_DATA struct for storing computed params
 *   @param    pParam        : dest ptr to a HRTFS_CREND_DATA struct for storing computed params
 *   @param    pParam        : dest ptr to a HRTFS_CREND_DATA struct for storing computed params
 *   @param    index_start   : index of first sample to use in IRs
 *   @param    index_end     : index of first sample to use in IRs
 *   @param    *max_ir_len   : return max if length
@@ -713,7 +713,7 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
    ivas_hrtf_t *pFirData,
    const int16_t frame_len,
    float mdft_scale_fact,
    HRTFS_DATA *pParam,
    HRTFS_CREND_DATA *pParam,
    int32_t index_start,
    int32_t index_end,
    int32_t *max_ir_len,
@@ -1322,12 +1322,12 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
 * ivas_hrtf_t **hrtf
 *
 * Outputs -
 * HRTFS_DATA *crend_hrtf
 * HRTFS_CREND_DATA *crend_hrtf
 *
 *-----------------------------------------------------------------------------------------*/

ivas_error ivas_set_hrtf_fr(
    HRTFS_DATA *crend_hrtf,
    HRTFS_CREND_DATA *crend_hrtf,
    ivas_hrtf_t *hrtf,
    const int16_t output_frame,
    float mdft_scale_fact )
@@ -1418,12 +1418,12 @@ ivas_error ivas_set_hrtf_fr(
 * ivas_hrtf_t **hrtf
 *
 * Outputs -
 * HRTFS_DATA *crend_hrtf
 * HRTFS_CREND_DATA *crend_hrtf
 *-----------------------------------------------------------------------------------------*/

ivas_error ivas_get_hrtf_lens(
    ivas_hrtf_t *hrtf,
    HRTFS_DATA *crend_hrtf,
    HRTFS_CREND_DATA *crend_hrtf,
    const int16_t frame_len )
{
    int32_t i, j, k, tmp_ir_len;
+9 −18
Original line number Diff line number Diff line
@@ -57,21 +57,12 @@ typedef struct ivas_hrtf_t
 * function declarations
 *------------------------------------------------------------------------------------------*/

ivas_error ivas_get_hrtf_lens( ivas_hrtf_t *hrtf, HRTFS_DATA *crend_hrtf, const int16_t frame_len );
ivas_error ivas_set_hrtf_fr( HRTFS_DATA *crend_hrtf, ivas_hrtf_t *hrtf, const int16_t frame_len
                             ,
                             float mdft_scale_fact
);
ivas_error ivas_get_hrtf_lens( ivas_hrtf_t *hrtf, HRTFS_CREND_DATA *crend_hrtf, const int16_t frame_len );
ivas_error ivas_set_hrtf_fr( HRTFS_CREND_DATA *crend_hrtf, ivas_hrtf_t *hrtf, const int16_t frame_len, float mdft_scale_fact );

ivas_error ivas_crend_binaural_filter_design_compute_filters_params( ivas_hrtf_t *pFirData, const int16_t framelen, HRTFS_DATA *pParam, int32_t *index_start, int32_t *index_end, int32_t *max_ir_len, ConfigReader *cfgReader );
ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_hrtf_t *pFirData, const int16_t frame_len,
                                                          float mdft_scale_fact,
                                                          HRTFS_DATA *pParam,
                                                          int32_t index_start,
                                                          int32_t index_end,
                                                          int32_t *max_ir_len,
                                                          ConfigReader *cfgReader );
ivas_error ivas_crend_binaural_filter_design_compute_filters_params( ivas_hrtf_t *pFirData, const int16_t framelen, HRTFS_CREND_DATA *pParam, int32_t *index_start, int32_t *index_end, int32_t *max_ir_len, ConfigReader *cfgReader );
ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_hrtf_t *pFirData, const int16_t frame_len, float mdft_scale_fact, HRTFS_CREND_DATA *pParam, int32_t index_start, int32_t index_end, int32_t *max_ir_len, ConfigReader *cfgReader );

ivas_error ivas_hrtf_close( HRTFS_HANDLE hHRTF );
ivas_error ivas_hrtf_close( HRTFS_CREND_HANDLE hHRTF );

#endif /* IVAS_SOFA_PARSER_H_ */
Loading