Commit db3de200 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

add FIX_1123_CREND_FLTFX_BE to allow selection between quantized and...

add FIX_1123_CREND_FLTFX_BE to allow selection between quantized and unquantized values for CREND ROM tables
parent 08784904
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@
#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*#define FIX_1123_CREND_16BIT_ROM*/                    /* Ora: update CREND ROM tables to 16 bit */
#define FIX_1123_CREND_16BIT_FMT                        /* Ora: update CREND binary file format to 16 bit */
#define FIX_1123_CREND_FLTFX_BE                         /* Ora: make CREND FLT ROM tables BE to FX file */
/*#define FIX_1123_TDREN_16BIT_ROM*/                    /* Eri,Ora: update TD Object Renderer tables to 16 bit */
/*#define FIX_1123_FASTCONV_16BIT_ROM*/                 /* FhG: issue 1123: update FastConv ROM tables to 16 bit (must regenerate ROM file!) */
#define FIX_1123_FASTCONV_16BIT_FMT                     /* FhG: issue 1123: update FastConv binary file format and scripts to 16 bit */
+24 −13
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ 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 );
#ifdef FIX_POINT_HRTF_FILE_FORMAT
#ifdef FIX_1123_CREND_FLTFX_BE
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_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, 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 );
#else
@@ -1305,10 +1305,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
            latency_48k_optim = hrtf_data.latency_s;
        }

#ifdef FIX_POINT_HRTF_FILE_FORMAT
        int16_t factorQ[3];
        make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
#endif

#ifdef FIX_1123_CREND_16BIT_ROM
        hrtf_data.latency_s_fx = float2int32_t( hrtf_data.latency_s, factorQ[0] );
@@ -1353,16 +1349,24 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
        }
#endif

#ifdef FIX_1123_CREND_FLTFX_BE
        int16_t factorQ[3];
        make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
#endif
        if ( lib_rend_path != NULL )
        {
            update_h_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len );
#ifdef FIX_POINT_HRTF_FILE_FORMAT
#ifdef FIX_1123_CREND_FLTFX_BE
            update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
#else
            update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len );
#endif
        }

#if defined( FIX_1123_CREND_16BIT_FMT ) && !defined( FIX_1123_CREND_FLTFX_BE )
        int16_t factorQ[3];
        make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
#endif
        if ( binary_file_path != NULL )
        {
#ifdef FIX_POINT_HRTF_FILE_FORMAT
@@ -1902,7 +1906,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path )
        pCoherence = (float *) malloc( sizeof( float * ) * nr_fc_fft_filter );
        memset( p_avg_lr, 0, sizeof( float ) * nr_fc_fft_filter * 2 );
        memset( pCoherence, 0, sizeof( float ) * nr_fc_fft_filter );
#ifdef FIX_1123_CREND_16BIT_ROM
#ifdef FIX_POINT_HRTF_FILE_FORMAT
        p_avg_lr_fx = (int16_t *) malloc( sizeof( int16_t * ) * nr_fc_fft_filter * 2 );
        pCoherence_fx = (int16_t *) malloc( sizeof( int16_t * ) * nr_fc_fft_filter );
        memset( p_avg_lr_fx, 0, sizeof( int16_t ) * nr_fc_fft_filter * 2 );
@@ -1949,26 +1953,33 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path )
        ivas_reverb_get_hrtf_set_properties( pHrtf_set_l_re, pHrtf_set_l_im, pHrtf_set_r_re, pHrtf_set_r_im, IVAS_AUDIO_CONFIG_5_1, sofa_M, nr_fc_fft_filter,
                                             nr_fc_fft_filter, p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence );

#ifdef FIX_POINT_HRTF_FILE_FORMAT
#ifdef FIX_1123_CREND_FLTFX_BE
        make_reverb_fx_be( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], &factorQ );
#ifdef FIX_1123_CREND_16BIT_ROM
        for ( i = 0; i < nr_fc_fft_filter; i++ )
        {
            p_avg_lr_fx[i] = float2int16_t( p_avg_lr[i], factorQ );
            p_avg_lr_fx[i + nr_fc_fft_filter] = float2int16_t( p_avg_lr[i + nr_fc_fft_filter], factorQ );
            pCoherence_fx[i] = float2int16_t( pCoherence[i], factorQ );
        }
#endif
#endif
        if ( lib_rend_path != NULL )
        {
            update_h_file_with_reverb( sample_rates[indSR] );
#ifdef FIX_POINT_HRTF_FILE_FORMAT
#ifdef FIX_1123_CREND_FLTFX_BE
            update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, p_avg_lr_fx, &p_avg_lr_fx[nr_fc_fft_filter], pCoherence_fx, factorQ, sample_rates[indSR], nr_fc_fft_filter );
#else
            update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], nr_fc_fft_filter );
#endif
        }
#if defined( FIX_1123_CREND_16BIT_FMT ) && !defined( FIX_1123_CREND_FLTFX_BE )
        make_reverb_fx_be( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], &factorQ );
        for ( i = 0; i < nr_fc_fft_filter; i++ )
        {
            p_avg_lr_fx[i] = float2int16_t( p_avg_lr[i], factorQ );
            p_avg_lr_fx[i + nr_fc_fft_filter] = float2int16_t( p_avg_lr[i + nr_fc_fft_filter], factorQ );
            pCoherence_fx[i] = float2int16_t( pCoherence[i], factorQ );
        }
#endif
        if ( binary_file_path != NULL )
        {
#ifdef FIX_POINT_HRTF_FILE_FORMAT
@@ -2270,7 +2281,7 @@ void write_array_int16_t_to_file( FILE *fp, int16_t *vec, int32_t size_vec, int3
/*---------------------------------------------------------------------*
 *update_c_file_with_reverb();
 *---------------------------------------------------------------------*/
#ifdef FIX_POINT_HRTF_FILE_FORMAT
#ifdef FIX_1123_CREND_FLTFX_BE
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, 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 )
#else
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len )
@@ -2348,7 +2359,7 @@ void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherenc
/*---------------------------------------------------------------------*
 *update_c_file();
 *---------------------------------------------------------------------*/
#ifdef FIX_POINT_HRTF_FILE_FORMAT
#ifdef FIX_1123_CREND_FLTFX_BE
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] )
#else
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )