Commit 7141aa98 authored by emerit's avatar emerit
Browse files

fix bugs

parent 76c2bbd8
Loading
Loading
Loading
Loading
+45 −7
Original line number Diff line number Diff line
@@ -67,6 +67,18 @@
#define IVAS_NB_AUDIO_CONFIG 4
#define IVAS_NB_SAMPLERATE   3


#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
const HRTF_READER_RENDERER_TYPE rend_types[IVAS_NB_RENDERER_TYPE] = {
    RENDERER_BINAURAL_FASTCONV,
    RENDERER_BINAURAL_FASTCONV_ROOM,
    RENDERER_BINAURAL_PARAMETRIC,
    RENDERER_BINAURAL_MIXER_CONV,
    RENDERER_BINAURAL_MIXER_CONV_ROOM,
    RENDERER_BINAURAL_OBJECTS_TD,
    HRTF_READER_RENDERER_BINAURAL_REVERB_ALL
};
#else
const RENDERER_TYPE rend_types[IVAS_NB_RENDERER_TYPE] = {
    RENDERER_BINAURAL_FASTCONV,
    RENDERER_BINAURAL_FASTCONV_ROOM,
@@ -74,10 +86,10 @@ const RENDERER_TYPE rend_types[IVAS_NB_RENDERER_TYPE] = {
    RENDERER_BINAURAL_MIXER_CONV,
    RENDERER_BINAURAL_MIXER_CONV_ROOM,
    RENDERER_BINAURAL_OBJECTS_TD,
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
    RENDERER_BINAURAL_REVERB_ALL
#endif
};
#endif

const BINAURAL_INPUT_AUDIO_CONFIG input_cfgs[IVAS_NB_AUDIO_CONFIG] = {
    BINAURAL_INPUT_AUDIO_CONFIG_COMBINED,
    BINAURAL_INPUT_AUDIO_CONFIG_HOA3,
@@ -135,18 +147,28 @@ void convert_backslash( char *str );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
char *create_reverb( int32_t frequency, int32_t *hrtf_size );
#endif
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, int32_t *hrtf_size /*OUT*/ );
char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t *hrtf_size );
#else
char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, int32_t *hrtf_size /*OUT*/ );
char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t *hrtf_size );
#endif
char *create_hrtf_parametric( int32_t *hrtf_size );
char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size /*OUT*/ );

int32_t read_hrtf_size( char *hrtf );
int16_t check_bin_file( FILE *hrtf_bin_file );
int16_t check_hrtf_data( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, char *hrtf_data_in, int32_t hrtf_size_in );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, char *hrtf_data_in, int32_t hrtf_size_in );
/*---------------------------------------------------------------------*/

int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, crend_hrtf_tables_pointers *hrtf_table_ptrs /*OUT*/, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ );
#else
int16_t check_hrtf_data( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, char *hrtf_data_in, int32_t hrtf_size_in );
/*---------------------------------------------------------------------*/

int16_t get_crend_hrtf_tables( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, crend_hrtf_tables_pointers *hrtf_table_ptrs /*OUT*/, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ );
#endif
int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptrs, crend_hrtf_tables_dimensions *hrtf_table_dims );

/*---------------------------------------------------------------------*
@@ -515,7 +537,7 @@ int main( int argc, char *argv[] )
                    }
                    break;
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
                case RENDERER_BINAURAL_REVERB_ALL:
                case HRTF_READER_RENDERER_BINAURAL_REVERB_ALL:
                    if ( ( input_reverb_file_path != NULL ) && ( input_reverb_file_name != NULL ) )
                    {
                        setOfHRTF[nbHRTF] = create_reverb( freq_ptr[k], &hrtf_size );
@@ -638,7 +660,11 @@ int main( int argc, char *argv[] )
 * create_hrtf_crend()
 *
 *---------------------------------------------------------------------*/
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, int32_t *hrtf_size )
#else
char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, int32_t *hrtf_size )
#endif
{
    int32_t mixerconv_hrtf_header_size, mixerconv_hrtf_data_size;
    char *mixerconv_hrtf = NULL, *mixerconv_hrtf_wptr;
@@ -1215,7 +1241,7 @@ char *create_reverb( int32_t frequency, int32_t *hrtf_size )
        // Get the HRTF header

        // Renderer type
        *( (int32_t *) ( reverb_wptr ) ) = RENDERER_BINAURAL_REVERB_ALL;
        *( (int32_t *) ( reverb_wptr ) ) = HRTF_READER_RENDERER_BINAURAL_REVERB_ALL;
        reverb_wptr += sizeof( int32_t );

        // Decoder output format
@@ -1265,7 +1291,11 @@ char *create_reverb( int32_t frequency, int32_t *hrtf_size )
 * create_hrtf_fastconv()
 *
 *---------------------------------------------------------------------*/
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t *hrtf_size )
#else
char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t *hrtf_size )
#endif
{
    char *fastconv_hrtf = NULL, *fastconv_hrtf_wptr;
    int32_t fastconv_hrtf_data_size;
@@ -2119,7 +2149,11 @@ char *create_hrtf_parametric( int32_t *hrtf_size )
 * get_crend_hrtf_tables()
 *
 *---------------------------------------------------------------------*/
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, crend_hrtf_tables_pointers *hrtf_table_ptrs /*OUT*/, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ )
#else
int16_t get_crend_hrtf_tables( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, crend_hrtf_tables_pointers *hrtf_table_ptrs /*OUT*/, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ )
#endif
{
    int16_t result = -1;
    uint16_t iChan, iIR, iIter, iIndex, max_num_iterations;
@@ -2716,7 +2750,11 @@ int16_t check_bin_file( FILE *hrtf_bin_file )
 *
 *---------------------------------------------------------------------*/

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, char *hrtf_data_in, int32_t hrtf_size_in )
#else
int16_t check_hrtf_data( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, char *hrtf_data_in, int32_t hrtf_size_in )
#endif
{
    int16_t result;
    int32_t hrtf_data_size, ctrl_size, iChan, iIR, iIndex, iIter;
@@ -2727,7 +2765,7 @@ int16_t check_hrtf_data( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in
    crend_hrtf_tables_pointers tabs_ptrs;

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
    if ( rend_type == RENDERER_BINAURAL_OBJECTS_TD || rend_type == RENDERER_BINAURAL_REVERB_ALL ||
    if ( rend_type == RENDERER_BINAURAL_OBJECTS_TD || rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ||
         rend_type == RENDERER_BINAURAL_FASTCONV || rend_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
         rend_type == RENDERER_BINAURAL_PARAMETRIC || rend_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
    {