Skip to content
...@@ -104,6 +104,27 @@ static ivas_error read_txt_float( ...@@ -104,6 +104,27 @@ static ivas_error read_txt_float(
return IVAS_ERR_OK; return IVAS_ERR_OK;
} }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
/*-----------------------------------------------------------------------------------------*
* Function read_txt_uint32()
* Reads a float value from a line
*-----------------------------------------------------------------------------------------*/
static ivas_error read_txt_int32(
const char *pLine, /* i : String to read from */
int32_t *pTarget /* o : Output pointer */
)
{
int32_t val = 0;
if ( sscanf( pLine, "%d", &val ) != 1 )
{
return IVAS_ERR_INVALID_RENDER_CONFIG;
}
*pTarget = val;
return IVAS_ERR_OK;
}
#endif
/*-----------------------------------------------------------------------------------------* /*-----------------------------------------------------------------------------------------*
* Function read_txt_vector() * Function read_txt_vector()
...@@ -273,6 +294,10 @@ ivas_error ConfigReader_read( ...@@ -273,6 +294,10 @@ ivas_error ConfigReader_read(
hRenderConfig->diffuseEnergyThreshold = DEFAULT_DIFFUSE_ENERGY_THRESHOLD; hRenderConfig->diffuseEnergyThreshold = DEFAULT_DIFFUSE_ENERGY_THRESHOLD;
hRenderConfig->diffuseCutOffFreqThreshold = DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD; hRenderConfig->diffuseCutOffFreqThreshold = DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD;
hRenderConfig->directCutOffFreqThreshold = DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD; hRenderConfig->directCutOffFreqThreshold = DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD;
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
hRenderConfig->maxNumDirectBlocks = DEFAULT_MAX_NUM_DIRECT_BLOCKS;
hRenderConfig->maxNumDiffuseBlocks = DEFAULT_MAX_NUM_DIFFUSE_BLOCKS;
#endif
/* read file line by line */ /* read file line by line */
while ( fgets( pConfig_str, file_size, pConfigFile ) != NULL ) while ( fgets( pConfig_str, file_size, pConfigFile ) != NULL )
{ {
...@@ -391,6 +416,24 @@ ivas_error ConfigReader_read( ...@@ -391,6 +416,24 @@ ivas_error ConfigReader_read(
return IVAS_ERR_INVALID_RENDER_CONFIG; return IVAS_ERR_INVALID_RENDER_CONFIG;
} }
} }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
else if ( strcmp( item, "MAXNUMDIRECTBLOCKS" ) == 0 )
{
if ( read_txt_int32( pValue, &hRenderConfig->maxNumDirectBlocks ) != IVAS_ERR_OK )
{
errorHandler( item, ERROR_VALUE_INVALID );
return IVAS_ERR_INVALID_RENDER_CONFIG;
}
}
else if ( strcmp( item, "MAXNUMDIFFUSEBLOCKS" ) == 0 )
{
if ( read_txt_int32( pValue, &hRenderConfig->maxNumDiffuseBlocks ) != IVAS_ERR_OK )
{
errorHandler( item, ERROR_VALUE_INVALID );
return IVAS_ERR_INVALID_RENDER_CONFIG;
}
}
#endif
} }
free( pValue ); free( pValue );
} }
......
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
#define DEFAULT_DIFFUSE_ENERGY_THRESHOLD ( -25.f ) #define DEFAULT_DIFFUSE_ENERGY_THRESHOLD ( -25.f )
#define DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD ( -20.f ) #define DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD ( -20.f )
#define DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD ( -20.f ) #define DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD ( -20.f )
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
#define DEFAULT_MAX_NUM_DIRECT_BLOCKS ( 40 )
#define DEFAULT_MAX_NUM_DIFFUSE_BLOCKS ( 40 )
#endif
typedef struct ConfigReader typedef struct ConfigReader
...@@ -57,6 +61,10 @@ typedef struct ConfigReader ...@@ -57,6 +61,10 @@ typedef struct ConfigReader
float diffuseEnergyThreshold; /* use to find the time end limit of the diffuse part (te). diffuse part. It is a ratio in dB between diffuse part after te and complete diffuse HRIR/BRIR energies. The more the value is near zero the smallest is te, complexity decrease. */ float diffuseEnergyThreshold; /* use to find the time end limit of the diffuse part (te). diffuse part. It is a ratio in dB between diffuse part after te and complete diffuse HRIR/BRIR energies. The more the value is near zero the smallest is te, complexity decrease. */
float diffuseCutOffFreqThreshold; /* threshold in dB to determine the cut off (fcdiff) frequency for each slice of the diffuse IR. ratio in dB between the energy after fcdiff and the total energy. The more the value is near zero the smallest is fcdiff, complexity decrease */ float diffuseCutOffFreqThreshold; /* threshold in dB to determine the cut off (fcdiff) frequency for each slice of the diffuse IR. ratio in dB between the energy after fcdiff and the total energy. The more the value is near zero the smallest is fcdiff, complexity decrease */
float directCutOffFreqThreshold; /* threshold in dB to determine the cut off (fcdirect) frequency for each slice of the direct IR. Do not applied to first slice. ratio in dB between the energy after fcdirect and the total energy. The more the value is near zero the smallest is fcdirect, complexity decrease */ float directCutOffFreqThreshold; /* threshold in dB to determine the cut off (fcdirect) frequency for each slice of the direct IR. Do not applied to first slice. ratio in dB between the energy after fcdirect and the total energy. The more the value is near zero the smallest is fcdirect, complexity decrease */
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
int32_t maxNumDirectBlocks; /* max number of direct blocks */
int32_t maxNumDiffuseBlocks; /* max number of diffuse blocks */
#endif
} ConfigReader, *ConfigReaderHandle; } ConfigReader, *ConfigReaderHandle;
typedef enum typedef enum
......
...@@ -47,10 +47,11 @@ header.chunksize = 0; ...@@ -47,10 +47,11 @@ header.chunksize = 0;
%% parse IVAS enum %% parse IVAS enum
% read the file % read the file
ivas_cnst_path = fullfile(ivas_path, 'lib_com/ivas_cnst.h'); % must be replaced if this file is moved hrtf_file_reader_path = fullfile(ivas_path, 'lib_util/hrtf_file_reader.h'); % must be replaced if this file is moved
c = fileread(hrtf_file_reader_path); c = fileread(hrtf_file_reader_path);
% regex for RENDERER_TYPE % regex for RENDERER_TYPE
rt_expr = '^\s+(RENDERER\w+)'; rt_expr = '^\s+(HRTF_READER_RENDERER\w+)';
rt_tok = regexp(c, rt_expr, 'tokens', 'dotexceptnewline', 'lineanchors'); rt_tok = regexp(c, rt_expr, 'tokens', 'dotexceptnewline', 'lineanchors');
renderer_types = convertCharsToStrings(cat(1,rt_tok{:})); renderer_types = convertCharsToStrings(cat(1,rt_tok{:}));
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#define MAX_DIFF_AZI 1 /* angle in degree */ #define MAX_DIFF_AZI 1 /* angle in degree */
#define MAX_DIFF_ELE 10 /* angle in degree */ #define MAX_DIFF_ELE 10 /* angle in degree */
#define DEFAULT_SAMPLERATE 48000 /* Hz */ #define DEFAULT_SAMPLERATE 48000 /* Hz */
#define LAST_SAMPLERATE 16000 /* Hz */
#define TEMPLTATE_C_ROM_FILE_NAME "ivas_license_header.template" #define TEMPLTATE_C_ROM_FILE_NAME "ivas_license_header.template"
#define ROM_FILE_NAME "ivas_rom_binaural_crend_head" #define ROM_FILE_NAME "ivas_rom_binaural_crend_head"
#define FORMAT_FLOAT "%8.6f" #define FORMAT_FLOAT "%8.6f"
...@@ -101,6 +102,7 @@ struct ivas_layout_config ...@@ -101,6 +102,7 @@ struct ivas_layout_config
{ {
AUDIO_CONFIG audio_config; AUDIO_CONFIG audio_config;
char name[32]; char name[32];
char output_config_num_channel_name[32];
int nb_channel; int nb_channel;
float azi[MAX_CICP_CHANNELS]; float azi[MAX_CICP_CHANNELS];
float ele[MAX_CICP_CHANNELS]; float ele[MAX_CICP_CHANNELS];
...@@ -131,11 +133,19 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -131,11 +133,19 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
int generate_crend_ivas_tables_from_sofa( const char *sofa_file_path, ConfigReader *cfgReader ); 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_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 ); void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
int generate_reverb_ivas_tables_from_sofa( const char *file_path );
void update_h_file_with_reverb( const int32_t samplerate );
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len );
#endif
void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ ); 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 ); uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims );
void write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len ); void write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
void write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate );
#endif
/*---------------------------------------------------------------------* /*---------------------------------------------------------------------*
* *
...@@ -204,6 +214,9 @@ void usage_gen_crend_tables( void ) ...@@ -204,6 +214,9 @@ void usage_gen_crend_tables( void )
fprintf( stdout, "-lib_rend_path : path where header and c files will be created (if missing rom files not generated)\n" ); fprintf( stdout, "-lib_rend_path : path where header and c files will be created (if missing rom files not generated)\n" );
fprintf( stdout, "-binary_files_path : path where binary files will be created (if missing binary files not generated)\n" ); fprintf( stdout, "-binary_files_path : path where binary files will be created (if missing binary files not generated)\n" );
fprintf( stdout, "-binary_common_file_name : common name for binary files that will be created (crend_hrir-53_brir-Fhg for example)\n" ); fprintf( stdout, "-binary_common_file_name : common name for binary files that will be created (crend_hrir-53_brir-Fhg for example)\n" );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
fprintf( stdout, "-compute_reverb_rom sofa_file_path : if present reverb rom tables and binary files are computed using sofa_file_path as input HRIRs\n" );
#endif
fprintf( stdout, "-brir_optim_config_path config_file_path : if present brir optimisation process uses parameters stored in config_file_path \n\t\t\t\t\t\tConfiguration example files are provided in folder :\n\t\t\t\t\t\t-brir_no_optim.cfg : for exact convolution of the BRIR by IVAS decoder or renderer\n\t\t\t\t\t\t-brir_default_optim.cfg : default values BRIR optimisation used by IVAS decoder or renderer\n\t\t\t\t\t\t-brir_low_complexity_optim.cfg : values for BRIR optimisation reducing IVAS decoder or renderer complexity\n" ); fprintf( stdout, "-brir_optim_config_path config_file_path : if present brir optimisation process uses parameters stored in config_file_path \n\t\t\t\t\t\tConfiguration example files are provided in folder :\n\t\t\t\t\t\t-brir_no_optim.cfg : for exact convolution of the BRIR by IVAS decoder or renderer\n\t\t\t\t\t\t-brir_default_optim.cfg : default values BRIR optimisation used by IVAS decoder or renderer\n\t\t\t\t\t\t-brir_low_complexity_optim.cfg : values for BRIR optimisation reducing IVAS decoder or renderer complexity\n" );
fprintf( stdout, "example:\n" ); fprintf( stdout, "example:\n" );
#ifdef _WIN32 #ifdef _WIN32
...@@ -247,6 +260,9 @@ int main( int argc, char *argv[] ) ...@@ -247,6 +260,9 @@ int main( int argc, char *argv[] )
char *binary_common_file_name = NULL; char *binary_common_file_name = NULL;
int binPathNotEndingWithSeparator = 0; int binPathNotEndingWithSeparator = 0;
char *brir_optim_config_path = NULL; char *brir_optim_config_path = NULL;
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
char *sofa_file_path_for_reverb = NULL;
#endif
bool add_define = false; bool add_define = false;
int notEndingWithFileSeparator = 0; int notEndingWithFileSeparator = 0;
char *sofa_name = NULL; char *sofa_name = NULL;
...@@ -260,6 +276,10 @@ int main( int argc, char *argv[] ) ...@@ -260,6 +276,10 @@ int main( int argc, char *argv[] )
cfgBrirOptim.endEnergyThreshold = DEFAULT_END_ENERGY_THRESHOLD; cfgBrirOptim.endEnergyThreshold = DEFAULT_END_ENERGY_THRESHOLD;
cfgBrirOptim.harmonizeLateReverbBinauralGain = 1; cfgBrirOptim.harmonizeLateReverbBinauralGain = 1;
cfgBrirOptim.optimize = 1; cfgBrirOptim.optimize = 1;
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
cfgBrirOptim.maxNumDirectBlocks = DEFAULT_MAX_NUM_DIRECT_BLOCKS;
cfgBrirOptim.maxNumDiffuseBlocks = DEFAULT_MAX_NUM_DIFFUSE_BLOCKS;
#endif
for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
{ {
...@@ -285,6 +305,22 @@ int main( int argc, char *argv[] ) ...@@ -285,6 +305,22 @@ int main( int argc, char *argv[] )
notEndingWithFileSeparator = ( ( argv[i][strlen( argv[i] ) - 1] == '\\' ) || ( ( argv[i][strlen( argv[i] ) - 1] == '/' ) ) ) ? 0 : 1; notEndingWithFileSeparator = ( ( argv[i][strlen( argv[i] ) - 1] == '\\' ) || ( ( argv[i][strlen( argv[i] ) - 1] == '/' ) ) ) ? 0 : 1;
i++; i++;
} }
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
else if ( strcmp( to_upper( argv[i] ), "-COMPUTE_REVERB_ROM" ) == 0 )
{
i++;
if ( strlen( argv[i] ) == 0 )
{
fprintf( stderr, "Wrong sofa file path for reverb: %s\n\n", argv[i] );
usage_gen_crend_tables();
return -1;
}
convert_backslash( argv[i] );
sofa_file_path_for_reverb = malloc( strlen( argv[i] ) + 1 );
strcpy( sofa_file_path_for_reverb, argv[i] );
i++;
}
#endif
else if ( strcmp( to_upper( argv[i] ), "-BINARY_FILES_PATH" ) == 0 ) else if ( strcmp( to_upper( argv[i] ), "-BINARY_FILES_PATH" ) == 0 )
{ {
i++; i++;
...@@ -313,6 +349,27 @@ int main( int argc, char *argv[] ) ...@@ -313,6 +349,27 @@ int main( int argc, char *argv[] )
strcpy( binary_common_file_name, argv[i] ); strcpy( binary_common_file_name, argv[i] );
i++; i++;
} }
#ifdef FIX_INV_DIFFUSE_WEIGHT
else if ( strcmp( to_upper( argv[i] ), "-BRIR_OPTIM_CONFIG_PATH" ) == 0 )
{
i++;
if ( strlen( argv[i] ) == 0 )
{
fprintf( stderr, "Wrong file path: %s\n\n", argv[i] );
usage_gen_crend_tables();
return -1;
}
brir_optim_config_path = malloc( strlen( argv[i] ) + 1 );
strcpy( brir_optim_config_path, argv[i] );
if ( ConfigReader_read( brir_optim_config_path, &cfgBrirOptim ) != IVAS_ERR_OK )
{
fprintf( stderr, "cannot read file : %s\n\n", argv[i] );
usage_gen_crend_tables();
return -1;
}
i++;
}
#endif
else if ( strcmp( to_upper( argv[i] ), "-ADD_DEFINE" ) == 0 ) else if ( strcmp( to_upper( argv[i] ), "-ADD_DEFINE" ) == 0 )
{ {
add_define = true; add_define = true;
...@@ -336,6 +393,10 @@ int main( int argc, char *argv[] ) ...@@ -336,6 +393,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
frame_len_ms = atoi( argv[i++] ); frame_len_ms = atoi( argv[i++] );
...@@ -350,6 +411,10 @@ int main( int argc, char *argv[] ) ...@@ -350,6 +411,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
...@@ -369,6 +434,10 @@ int main( int argc, char *argv[] ) ...@@ -369,6 +434,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
...@@ -404,6 +473,10 @@ int main( int argc, char *argv[] ) ...@@ -404,6 +473,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
fp = fopen( c_file_path, "w" ); fp = fopen( c_file_path, "w" );
...@@ -419,6 +492,10 @@ int main( int argc, char *argv[] ) ...@@ -419,6 +492,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
fclose( fp ); fclose( fp );
...@@ -455,6 +532,10 @@ int main( int argc, char *argv[] ) ...@@ -455,6 +532,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
fp = fopen( h_file_path, "w" ); fp = fopen( h_file_path, "w" );
...@@ -472,6 +553,10 @@ int main( int argc, char *argv[] ) ...@@ -472,6 +553,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
fclose( fp ); fclose( fp );
...@@ -532,6 +617,10 @@ int main( int argc, char *argv[] ) ...@@ -532,6 +617,10 @@ int main( int argc, char *argv[] )
free( binary_path ); free( binary_path );
if ( binary_common_file_name ) if ( binary_common_file_name )
free( binary_common_file_name ); free( binary_common_file_name );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return -1; return -1;
} }
} }
...@@ -714,6 +803,14 @@ int main( int argc, char *argv[] ) ...@@ -714,6 +803,14 @@ int main( int argc, char *argv[] )
} }
} }
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb != NULL )
{
err = generate_reverb_ivas_tables_from_sofa( sofa_file_path_for_reverb );
if ( err != 0 )
return err;
}
#endif
if ( ( h_file_path != NULL ) && ( c_file_path != NULL ) ) if ( ( h_file_path != NULL ) && ( c_file_path != NULL ) )
{ {
...@@ -745,6 +842,11 @@ int main( int argc, char *argv[] ) ...@@ -745,6 +842,11 @@ int main( int argc, char *argv[] )
if ( binary_file_path ) if ( binary_file_path )
free( binary_file_path ); free( binary_file_path );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( sofa_file_path_for_reverb )
free( sofa_file_path_for_reverb );
#endif
return err; return err;
} }
...@@ -968,10 +1070,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -968,10 +1070,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
fprintf( stderr, "Database: %s\n", sofaDataBaseName ); fprintf( stderr, "Database: %s\n", sofaDataBaseName );
fprintf( stderr, "Listener: %s\n", sofaListenerName ); fprintf( stderr, "Listener: %s\n", sofaListenerName );
if ( lscfg.isloudspeaker && ( lscfg.nb_channel > 11 ) )
{
long nearest = 0;
}
/* get index to a position given in t (in spherical) */ /* get index to a position given in t (in spherical) */
int *index_pos = (int *) malloc( sizeof( int ) * lscfg.nb_channel ); int *index_pos = (int *) malloc( sizeof( int ) * lscfg.nb_channel );
uint32_t maxDel48kHz = 0; uint32_t maxDel48kHz = 0;
...@@ -993,12 +1091,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -993,12 +1091,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
} }
t[1] = lscfg.ele[i]; /* elevation in deg */ t[1] = lscfg.ele[i]; /* elevation in deg */
t[2] = sofa_src_pos_val[2]; /* radius in m */ t[2] = sofa_src_pos_val[2]; /* radius in m */
// double *tmp = (double *) PyArray_DATA( dir_t );
// tmp[0] = t[0];
// tmp[1] = t[1];
// tmp[2] = t[2];
// fprintf( stderr, "Wanted Position: %lf, %lf, %lf\n", t[0], t[1], t[2] );
// fprintf( stderr, "Wanted Position: %lf, %lf, %lf\n", tmp[0], tmp[1], tmp[2] );
nearest = find_pos_spheric( sofa_src_pos_cart_val, sofa_M, t ); nearest = find_pos_spheric( sofa_src_pos_cart_val, sofa_M, t );
if ( ( nearest >= 0 ) && ( nearest < sofa_M ) ) if ( ( nearest >= 0 ) && ( nearest < sofa_M ) )
{ {
...@@ -1051,6 +1143,9 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -1051,6 +1143,9 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
{ {
uint16_t frame_len = L_FRAME48k; uint16_t frame_len = L_FRAME48k;
int32_t maxDel = maxDel48kHz * DEFAULT_SAMPLERATE / sample_rates[indSR]; int32_t maxDel = maxDel48kHz * DEFAULT_SAMPLERATE / sample_rates[indSR];
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
float mdft_scale_fact;
#endif
switch ( sample_rates[indSR] ) switch ( sample_rates[indSR] )
{ {
case 8000: case 8000:
...@@ -1067,45 +1162,20 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -1067,45 +1162,20 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
frame_len = L_FRAME48k; frame_len = L_FRAME48k;
break; break;
} }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
mdft_scale_fact = (float) L_FRAME48k / (float) frame_len;
#endif
if ( frame_len_ms == 5 ) if ( frame_len_ms == 5 )
{ {
frame_len = frame_len >> 2; frame_len = frame_len >> 2;
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
mdft_scale_fact = (float) ( L_FRAME48k * 0.25f ) / (float) frame_len;
#endif
} }
data_IR_current = sofa_data_IR_val_48k; data_IR_current = sofa_data_IR_val_48k;
sofa_N = sofa_N_48k; sofa_N = sofa_N_48k;
if ( sample_rates[indSR] != DEFAULT_SAMPLERATE )
{
char *file_path = (char *) malloc( sizeof( char ) * ( strlen( sofa_file_path ) + 1 ) );
strcpy( file_path, sofa_file_path );
char *fstr = strstr( file_path, "48000" );
if ( fstr )
{
switch ( sample_rates[indSR] )
{
case 32000:
strncpy( fstr, "32000", 5 );
break;
case 16000:
strncpy( fstr, "16000", 5 );
break;
default:
break;
}
}
else
{
strcpy( file_path, "" );
}
FILE *fp = fopen( file_path, "rb" );
if ( fp )
{
fclose( fp );
}
else
{
switch ( sample_rates[indSR] ) switch ( sample_rates[indSR] )
{ {
case 32000: case 32000:
...@@ -1121,10 +1191,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -1121,10 +1191,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
sofa_N = sofa_N_48k; sofa_N = sofa_N_48k;
break; break;
} }
}
if ( file_path )
free( file_path );
}
struct ivas_hrtf_t *ivas_hrtf = NULL; struct ivas_hrtf_t *ivas_hrtf = NULL;
ivas_hrtf = malloc( sizeof( ivas_hrtf_t ) ); ivas_hrtf = malloc( sizeof( ivas_hrtf_t ) );
...@@ -1220,11 +1286,19 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -1220,11 +1286,19 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
{ {
ivas_crend_binaural_filter_design_compute_filters_params( ivas_hrtf, frame_len, &hrtf_data, &index_start, &index_end, &max_ir_len, cfgReader ); ivas_crend_binaural_filter_design_compute_filters_params( ivas_hrtf, frame_len, &hrtf_data, &index_start, &index_end, &max_ir_len, cfgReader );
ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_hrtf, frame_len, ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_hrtf, frame_len,
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
mdft_scale_fact,
#endif
&hrtf_data, index_start, index_end, &max_ir_len, cfgReader ); &hrtf_data, index_start, index_end, &max_ir_len, cfgReader );
} }
else else
{ {
ivas_set_hrtf_fr( &hrtf_data, ivas_hrtf, frame_len ); ivas_set_hrtf_fr( &hrtf_data, ivas_hrtf, frame_len
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
,
mdft_scale_fact
#endif
);
} }
hrtf_data.latency_s += 0.000000001f; hrtf_data.latency_s += 0.000000001f;
...@@ -1285,208 +1359,884 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ...@@ -1285,208 +1359,884 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
return 0; return 0;
} }
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
/*---------------------------------------------------------------------* #ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
*write_array_float_to_file();
*---------------------------------------------------------------------*/
void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t sample_per_ligne, const char *format, const int num_tab, const char *tab )
{
int32_t k, l, num_iter, remaining_samples;
int16_t i;
num_iter = size_vec / sample_per_ligne; #define IVAS_REVERB_FFT_SIZE_48K ( 512 )
remaining_samples = size_vec % sample_per_ligne; #define IVAS_REVERB_FFT_SIZE_32K ( 512 )
if ( remaining_samples == 0 ) #define IVAS_REVERB_FFT_SIZE_16K ( 256 )
{
num_iter--;
remaining_samples = sample_per_ligne;
}
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
fprintf( fp, "{" );
for ( k = 0; k < num_iter; k++ ) /*-----------------------------------------------------------------------------------------*
{ * Function set_fft_and_datablock_sizes()
if ( k != 0 ) *
* Sets frame size and fft-filter related sizes
*-----------------------------------------------------------------------------------------*/
static uint16_t get_fft_size(
const uint16_t subframe_len )
{ {
for ( i = 0; i < num_tab; i++ ) if ( subframe_len == L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES )
{ {
fprintf( fp, "%s", tab ); return IVAS_REVERB_FFT_SIZE_48K;
}
} }
for ( l = 0; l < sample_per_ligne; l++ ) else if ( subframe_len == L_FRAME32k / MAX_PARAM_SPATIAL_SUBFRAMES )
{ {
fprintf( fp, format, vec[k * sample_per_ligne + l] ); return IVAS_REVERB_FFT_SIZE_32K;
fprintf( fp, "f, " );
}
fprintf( fp, "\n" );
} }
for ( i = 0; i < num_tab; i++ ) else if ( subframe_len == L_FRAME16k / MAX_PARAM_SPATIAL_SUBFRAMES )
{ {
fprintf( fp, "%s", tab ); return IVAS_REVERB_FFT_SIZE_16K;
} }
for ( l = 0; l < remaining_samples - 1; l++ ) else
{ {
fprintf( fp, format, vec[k * sample_per_ligne + l] ); assert( 0 ); /* unsupported block size */
fprintf( fp, "f, " );
} }
fprintf( fp, format, vec[k * sample_per_ligne + l] );
fprintf( fp, "f}" ); return 0;
} }
/*---------------------------------------------------------------------* #endif
*write_array_float_to_file();
*---------------------------------------------------------------------*/
void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int32_t sample_per_ligne, const int num_tab, const char *tab )
{
int32_t k, l, num_iter, remaining_samples;
int16_t i;
num_iter = size_vec / sample_per_ligne; /*-------------------------------------------------------------------*
remaining_samples = size_vec % sample_per_ligne; * ivas_reverb_get_hrtf_set_properties()
if ( remaining_samples == 0 ) *
* Function analyses the HRTF set and computes avarage left/right power spectrum
* and frequency-dependent IA coherence. Expects frequency-domain HRTF input
*-------------------------------------------------------------------*/
void ivas_reverb_get_hrtf_set_properties(
float **ppHrtf_set_L_re,
float **ppHrtf_set_L_im,
float **ppHrtf_set_R_re,
float **ppHrtf_set_R_im,
const AUDIO_CONFIG input_audio_config,
const int16_t hrtf_count,
const int16_t in_freq_count,
const int16_t out_freq_count,
float *pOut_avg_pwr_L,
float *pOut_avg_pwr_R,
float *out_i_a_coherence )
{
const float foa_sum_coeffs[4][3] = {
{ 1.0, 1.0f, 0.0f },
{ 1.0, -1.0f, 0.0f },
{ 1.0, 0.0f, 1.0f },
{ 1.0, 0.0f, -1.0f }
};
const float inp_freq_step = 0.5f / (float) in_freq_count;
const float inp_freq_offset = 0.5f * inp_freq_step;
const float out_freq_step = 0.5f / (float) ( out_freq_count - 1 );
int16_t used_hrtf_count, base_idx, freq_idx, hrtf_idx, out_bin_idx, ch_index, is_ambisonics;
float hrtf_count_inverted, relative_pos, weight_1st;
float avg_pwr_left[2];
float avg_pwr_right[2];
float IA_coherence[2];
if ( input_audio_config == IVAS_AUDIO_CONFIG_FOA || input_audio_config == IVAS_AUDIO_CONFIG_HOA2 || input_audio_config == IVAS_AUDIO_CONFIG_HOA3 )
{ {
num_iter--; is_ambisonics = 1;
remaining_samples = sample_per_ligne; used_hrtf_count = 4; /* Using only 1st order HRTFs */
} }
for ( i = 0; i < num_tab; i++ ) else
{ {
fprintf( fp, "%s", tab ); is_ambisonics = 0;
used_hrtf_count = hrtf_count;
} }
fprintf( fp, "{" ); /* Interpolation (linear to a new grid) */
for ( k = 0; k < num_iter; k++ ) base_idx = 0;
{ relative_pos = 0.0f;
if ( k != 0 ) hrtf_count_inverted = 1.0f / (float) used_hrtf_count;
/* Loop over output frequency bins */
for ( out_bin_idx = 0; out_bin_idx < out_freq_count; out_bin_idx++ )
{ {
for ( i = 0; i < num_tab; i++ ) /* Computing normalized frequency for the current bin (1.0 corresponds to sampling rate) */
const float norm_freq = out_freq_step * out_bin_idx;
/* Computing the bin index in the source data */
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
if ( in_freq_count == out_freq_count )
{ {
fprintf( fp, "%s", tab ); base_idx = out_bin_idx;
}
} }
for ( l = 0; l < sample_per_ligne; l++ ) else
{ {
fprintf( fp, "%u", vec[k * sample_per_ligne + l] ); #endif
fprintf( fp, ", " ); const float tbl_index = ( norm_freq - inp_freq_offset ) / inp_freq_step;
}
fprintf( fp, "\n" ); if ( tbl_index <= 0.0f ) /* In case of extrapolation (below 1st bin), choose nearest */
}
for ( i = 0; i < num_tab; i++ )
{ {
fprintf( fp, "%s", tab ); base_idx = 0;
relative_pos = 0.0f;
} }
for ( l = 0; l < remaining_samples - 1; l++ ) else
{ {
fprintf( fp, "%u", vec[k * sample_per_ligne + l] ); base_idx = (int16_t) floorf( tbl_index );
fprintf( fp, ", " ); relative_pos = tbl_index - base_idx;
} if ( base_idx > ( in_freq_count - 2 ) ) /* In case of extrapolation (above last bin), choose nearest */
fprintf( fp, "%u", vec[k * sample_per_ligne + l] );
for ( i = 0; i < num_tab; i++ )
{ {
fprintf( fp, "%s", tab ); base_idx = in_freq_count - 2;
relative_pos = 1.0f;
} }
fprintf( fp, "}" );
} }
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
}
#endif
/* Computing 2 bins data for later interpolation */
/*---------------------------------------------------------------------* /* Zeroing before accumalation for average value computing */
*update_c_file(); avg_pwr_left[0] = 0.0f;
*---------------------------------------------------------------------*/ avg_pwr_left[1] = 0.0f;
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len ) avg_pwr_right[0] = 0.0f;
{ avg_pwr_right[1] = 0.0f;
IA_coherence[0] = 0.0f;
if ( c_file_path == NULL ) IA_coherence[1] = 0.0f;
return;
FILE *fp = fopen( c_file_path, "a" );
int16_t i, j;
uint32_t *pTotalNumFreqSampPerIterations[2], maxTotalNumFreqSampPerIterations;
uint32_t pTotalNumFreqSampPerIterationsDiffuse[2], maxTotalNumFreqSampPerIterationsDiffuse;
pTotalNumFreqSampPerIterations[0] = malloc( sizeof( float ) * hrtf->max_num_ir );
pTotalNumFreqSampPerIterations[1] = malloc( sizeof( float ) * hrtf->max_num_ir );
if ( fp == NULL )
return;
if ( hrtf == NULL )
return;
if ( samplerate == DEFAULT_SAMPLERATE ) /* Get power spectra and cross - correlation between left and right hrtfs */
/* Loop over all the HRTFs available */
for ( hrtf_idx = 0; hrtf_idx < used_hrtf_count; hrtf_idx++ )
{ {
/* float latency_s; */ /* Pointers to current HRTF data */
fprintf( fp, "\n\n/********************** %s_%s **********************/\n", DECLARATION_NAME, lscfg.name ); float *current_base_L_ptr_re, *current_base_L_ptr_im, *current_base_R_ptr_re, *current_base_R_ptr_im;
fprintf( fp, "\nconst float %s_%s_latency_s = %10.9ff;", DECLARATION_NAME, lscfg.name, hrtf->latency_s );
}
fprintf( fp, "\n\n/* Sample Rate = %ld */\n", (long) samplerate ); /* combined HRTF data used for FOA */
float combined_channels_L_re[2];
float combined_channels_L_im[2];
float combined_channels_R_re[2];
float combined_channels_R_im[2];
/* int16_t max_num_iterations; */ /* Process the frequency bins containing both real and img parts */
fprintf( fp, "\nconst int16_t %s_%s_max_num_iterations_%2dkHz = %d;", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_iterations ); /* In case of 5.1 or 7.1 formats, use the available HRTF paires directly*/
/* uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ if ( !is_ambisonics )
fprintf( fp, "\nconst uint16_t %s_%s_num_iterations_%2dkHz[%d][BINAURAL_CHANNELS]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir );
for ( i = 0; i < hrtf->max_num_ir - 1; i++ )
{ {
fprintf( fp, "{%u, %u}, ", hrtf->num_iterations[i][0], hrtf->num_iterations[i][1] ); current_base_L_ptr_re = ppHrtf_set_L_re[hrtf_idx] + base_idx;
current_base_R_ptr_re = ppHrtf_set_R_re[hrtf_idx] + base_idx;
current_base_L_ptr_im = ppHrtf_set_L_im[hrtf_idx] + base_idx;
current_base_R_ptr_im = ppHrtf_set_R_im[hrtf_idx] + base_idx;
} }
fprintf( fp, "{%u, %u} ", hrtf->num_iterations[i][0], hrtf->num_iterations[i][1] );
fprintf( fp, "};" );
/* uint16_t num_iterations_diffuse[BINAURAL_CHANNELS];*/
fprintf( fp, "\nconst uint16_t %s_%s_num_iterations_diffuse_%2dkHz[BINAURAL_CHANNELS] = {%u, %u};", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->num_iterations_diffuse[0], hrtf->num_iterations_diffuse[1] );
maxTotalNumFreqSampPerIterations = 0; /* In case of FOA format, combine the W channel with the X/Y channels */
for ( i = 0; i < hrtf->max_num_ir; i++ ) else
{
pTotalNumFreqSampPerIterations[0][i] = 0;
pTotalNumFreqSampPerIterations[1][i] = 0;
for ( j = 0; j < hrtf->num_iterations[i][0]; j++ )
{ {
pTotalNumFreqSampPerIterations[0][i] += hrtf->pIndex_frequency_max[i][0][j]; for ( freq_idx = 0; freq_idx < 2; freq_idx++ )
}
if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[0][i] )
{ {
maxTotalNumFreqSampPerIterations = pTotalNumFreqSampPerIterations[0][i]; combined_channels_L_re[freq_idx] = 0.0f;
} combined_channels_R_re[freq_idx] = 0.0f;
for ( j = 0; j < hrtf->num_iterations[i][1]; j++ ) combined_channels_L_im[freq_idx] = 0.0f;
combined_channels_R_im[freq_idx] = 0.0f;
for ( ch_index = 0; ch_index < 3; ch_index++ )
{ {
pTotalNumFreqSampPerIterations[1][i] += hrtf->pIndex_frequency_max[i][1][j]; combined_channels_L_re[freq_idx] += foa_sum_coeffs[hrtf_idx][ch_index] * ppHrtf_set_L_re[ch_index][base_idx + freq_idx];
combined_channels_R_re[freq_idx] += foa_sum_coeffs[hrtf_idx][ch_index] * ppHrtf_set_R_re[ch_index][base_idx + freq_idx];
combined_channels_L_im[freq_idx] += foa_sum_coeffs[hrtf_idx][ch_index] * ppHrtf_set_L_im[ch_index][base_idx + freq_idx];
combined_channels_R_im[freq_idx] += foa_sum_coeffs[hrtf_idx][ch_index] * ppHrtf_set_R_im[ch_index][base_idx + freq_idx];
} }
if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[1][i] )
{
maxTotalNumFreqSampPerIterations = pTotalNumFreqSampPerIterations[1][i];
} }
current_base_L_ptr_re = &combined_channels_L_re[0];
current_base_R_ptr_re = &combined_channels_R_re[0];
current_base_L_ptr_im = &combined_channels_L_im[0];
current_base_R_ptr_im = &combined_channels_R_im[0];
} }
pTotalNumFreqSampPerIterationsDiffuse[0] = 0; for ( freq_idx = 0; freq_idx < 2; freq_idx++ )
pTotalNumFreqSampPerIterationsDiffuse[1] = 0;
maxTotalNumFreqSampPerIterationsDiffuse = 0;
for ( j = 0; j < hrtf->num_iterations_diffuse[0]; j++ )
{ {
pTotalNumFreqSampPerIterationsDiffuse[0] += hrtf->pIndex_frequency_max_diffuse[0][j]; float L_re, L_im, R_re, R_im, C_re;
L_re = current_base_L_ptr_re[freq_idx];
R_re = current_base_R_ptr_re[freq_idx];
L_im = current_base_L_ptr_im[freq_idx];
R_im = current_base_R_ptr_im[freq_idx];
avg_pwr_left[freq_idx] += L_re * L_re + L_im * L_im;
avg_pwr_right[freq_idx] += R_re * R_re + R_im * R_im;
/* Cross product (Re part) */
C_re = L_re * R_re + L_im * R_im;
IA_coherence[freq_idx] += C_re;
} }
if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[0] )
{
maxTotalNumFreqSampPerIterationsDiffuse = pTotalNumFreqSampPerIterationsDiffuse[0];
} }
for ( j = 0; j < hrtf->num_iterations_diffuse[1]; j++ )
/* Compute the averages and the IA coherence */
for ( freq_idx = 0; freq_idx < 2; freq_idx++ )
{ {
pTotalNumFreqSampPerIterationsDiffuse[1] += hrtf->pIndex_frequency_max_diffuse[1][j]; avg_pwr_left[freq_idx] *= hrtf_count_inverted;
avg_pwr_right[freq_idx] *= hrtf_count_inverted;
IA_coherence[freq_idx] = hrtf_count_inverted * IA_coherence[freq_idx] /
sqrtf( avg_pwr_left[freq_idx] * avg_pwr_right[freq_idx] );
/* Limiting to (0...1) range in case of small numerical errors or negative values */
IA_coherence[freq_idx] = min( IA_coherence[freq_idx], 1.0f );
IA_coherence[freq_idx] = max( IA_coherence[freq_idx], 0.0f );
} }
if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[1] )
{ /* Computing weighted average of 2 nearest values (1 below + 1 above) for linear interpolation */
maxTotalNumFreqSampPerIterationsDiffuse = pTotalNumFreqSampPerIterationsDiffuse[1]; weight_1st = 1.0f - relative_pos;
pOut_avg_pwr_L[out_bin_idx] = weight_1st * avg_pwr_left[0] + relative_pos * avg_pwr_left[1];
pOut_avg_pwr_R[out_bin_idx] = weight_1st * avg_pwr_right[0] + relative_pos * avg_pwr_right[1];
out_i_a_coherence[out_bin_idx] = weight_1st * IA_coherence[0] + relative_pos * IA_coherence[1];
} }
/*uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; */ return;
fprintf( fp, "\nconst uint16_t %s_%s_pIndex_frequency_max_%2dkHz[%d][BINAURAL_CHANNELS][%d]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, hrtf->max_num_iterations ); }
for ( i = 0; i < hrtf->max_num_ir - 1; i++ )
{ int generate_reverb_ivas_tables_from_sofa( const char *file_path )
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 ); char *sofa_file_path = NULL;
fprintf( fp, "," ); int i, indSR;
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 ); int32_t sofa_M, sofa_N, sofa_R, sofa_N_48k;
fprintf( fp, "}," ); const char *sofaDataBaseName = "";
const char *sofaListenerName = "";
double *data_IR_current = NULL;
double *sofa_data_IR_val = NULL;
double *sofa_data_IR_val_48k = NULL;
double *sofa_data_IR_val_32k = NULL;
double *sofa_data_IR_val_16k = NULL;
double *sofa_latencys = NULL;
double *sofa_delay_val = NULL;
double *sofa_src_pos_val = NULL;
double *sofa_src_pos_cart_val = NULL;
float mdft_scale_fact = 1.f;
long sofa_sample_rate = 0;
double a[3] = { 0 };
double t[3] = { 0 };
sofa_file_path = (char *) malloc( sizeof( char ) * ( strlen( file_path ) + 1 ) );
if ( sofa_file_path == NULL )
{
fprintf( stderr, "Cannot alloc sofa_file_path !\n\n" );
return -1;
}
strcpy( sofa_file_path, file_path );
MATFile *mat_fp = matOpen( sofa_file_path, "r" );
if ( mat_fp == NULL )
{
printf( "Error reading existing matrix LocalDouble\n" );
usage_gen_crend_tables();
free( sofa_file_path );
return -1;
}
mxArray *sofa = matGetVariable( mat_fp, "Sofa" );
if ( sofa == NULL )
{
printf( "Error reading existing matrix LocalDouble\n" );
usage_gen_crend_tables();
free( sofa_file_path );
matClose( mat_fp );
return -1;
}
matClose( mat_fp );
mwSize total_num_of_elements;
mwIndex index = 0;
int number_of_fields, field_index;
const char *field_name;
const mxArray *data;
const double *sampleRate;
// total_num_of_elements = mxGetNumberOfElements( sofa );
number_of_fields = mxGetNumberOfFields( sofa );
/* For the given index, walk through each field. */
for ( field_index = 0; field_index < number_of_fields; field_index++ )
{
// display_subscript( structure_array_ptr, index );
field_name = mxGetFieldNameByNumber( sofa,
field_index );
if ( strcmp( field_name, "DatabaseName" ) == 0 )
{
sofaDataBaseName = mxArrayToUTF8String( mxGetFieldByNumber( sofa,
index,
field_index ) );
if ( sofaDataBaseName == NULL )
{
printf( "\tEmpty Field for %s\n", field_name );
}
}
if ( strcmp( field_name, "ListenerShortName" ) == 0 )
{
sofaListenerName = mxArrayToUTF8String( mxGetFieldByNumber( sofa,
index,
field_index ) );
if ( sofaListenerName == NULL )
{
printf( "\tEmpty Field for %s\n", field_name );
}
}
if ( strcmp( field_name, "latencys" ) == 0 )
{
sofa_latencys = mxGetPr( mxGetFieldByNumber( sofa,
index,
field_index ) );
if ( sofa_latencys == NULL )
{
printf( "\tEmpty Field for %s\n", field_name );
}
}
if ( strcmp( field_name, "DataResampled" ) == 0 )
{
data = mxGetFieldByNumber( sofa,
index,
field_index );
if ( data == NULL )
{
mxDestroyArray( sofa );
printf( "\tEmpty Field for %s\n", field_name );
free( sofa_file_path );
return -1;
}
total_num_of_elements = mxGetNumberOfElements( data );
for ( indSR = 0; indSR < total_num_of_elements; indSR++ )
{
sampleRate = mxGetPr( mxGetFieldByNumber( data,
indSR,
1 ) );
if ( *sampleRate == 48000 )
{
const mwSize *dims = mxGetDimensions( mxGetFieldByNumber( data,
indSR,
0 ) );
sofa_N = sofa_N_48k = (int32_t) dims[0];
sofa_R = (int32_t) dims[1];
sofa_M = (int32_t) dims[2];
sofa_data_IR_val_48k = mxGetPr( mxGetFieldByNumber( data,
indSR,
0 ) );
}
if ( *sampleRate == 32000 )
{
sofa_data_IR_val_32k = mxGetPr( mxGetFieldByNumber( data,
indSR,
0 ) );
}
if ( *sampleRate == 16000 )
{
sofa_data_IR_val_16k = mxGetPr( mxGetFieldByNumber( data,
indSR,
0 ) );
}
}
}
if ( strcmp( field_name, "PosCartesian" ) == 0 )
{
sofa_src_pos_cart_val = mxGetPr( mxGetFieldByNumber( sofa,
index,
field_index ) );
if ( sofa_src_pos_cart_val == NULL )
{
mxDestroyArray( sofa );
printf( "\tEmpty Field for %s\n", field_name );
free( sofa_file_path );
matClose( mat_fp );
return -1;
}
}
if ( strcmp( field_name, "PosSpherical" ) == 0 )
{
sofa_src_pos_val = mxGetPr( mxGetFieldByNumber( sofa,
index,
field_index ) );
if ( sofa_src_pos_val == NULL )
{
mxDestroyArray( sofa );
printf( "\tEmpty Field for %s\n", field_name );
free( sofa_file_path );
matClose( mat_fp );
return -1;
}
}
}
/* general information about the loaded HRTF set */
fprintf( stderr, "Number of HRTFs: %d\n", sofa_M );
fprintf( stderr, "Filter length: %d samples\n", sofa_N );
fprintf( stderr, "Database: %s\n", sofaDataBaseName );
fprintf( stderr, "Listener: %s\n", sofaListenerName );
for ( indSR = 0; indSR < sizeof( sample_rates ) / sizeof( float ); indSR++ )
{
uint16_t frame_len = L_FRAME48k;
switch ( sample_rates[indSR] )
{
case 8000:
frame_len = L_FRAME8k;
mdft_scale_fact = 8.f;
break;
case 16000:
frame_len = L_FRAME16k;
mdft_scale_fact = 3.f;
break;
case 32000:
frame_len = L_FRAME32k;
mdft_scale_fact = 3.f / 2.f;
break;
case 48000:
default:
mdft_scale_fact = 1.f;
frame_len = L_FRAME48k;
break;
}
if ( frame_len_ms == 5 )
frame_len = frame_len >> 2;
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
frame_len = get_fft_size( frame_len );
#endif
data_IR_current = sofa_data_IR_val_48k;
sofa_N = sofa_N_48k;
switch ( sample_rates[indSR] )
{
case 32000:
data_IR_current = sofa_data_IR_val_32k;
sofa_N = (int32_t) ceil( 32000.f * sofa_N_48k / 48000.f );
break;
case 16000:
data_IR_current = sofa_data_IR_val_16k;
sofa_N = (int32_t) ceil( 16000.f * sofa_N_48k / 48000.f );
break;
default:
data_IR_current = sofa_data_IR_val_48k;
sofa_N = sofa_N_48k;
break;
}
if ( frame_len < sofa_N )
{
mxDestroyArray( sofa );
fprintf( stderr, "Wrong file unsupported format hrir size too long > 240 samples at 48 kHz %s!\n\n", sofa_file_path );
free( sofa_file_path );
return -1;
}
int32_t ind_max_ir = sofa_N;
uint32_t delL = 0, delR = 0;
uint32_t size = (uint32_t) sofa_N * sofa_R;
double max_ir_l = 0;
double max_ir_r = 0;
int32_t ind_max_l = sofa_N;
int32_t ind_max_r = sofa_N;
float **pHrtf_set_l_re = NULL;
float **pHrtf_set_l_im = NULL;
float **pHrtf_set_r_re = NULL;
float **pHrtf_set_r_im = NULL;
float *pTemp = NULL;
int16_t nr_fc_fft_filter = LR_IAC_LENGTH_NR_FC;
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
nr_fc_fft_filter = ( frame_len >> 1 ) + 1;
float *p_avg_lr = NULL;
float *pCoherence = NULL;
p_avg_lr = (float *) malloc( sizeof( float * ) * nr_fc_fft_filter * 2 );
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 );
#else
float p_avg_lr[LR_IAC_LENGTH_NR_FC * 2] = { 0 };
float pCoherence[LR_IAC_LENGTH_NR_FC] = { 0 };
#endif
pHrtf_set_l_re = (float **) malloc( sizeof( float * ) * sofa_M );
pHrtf_set_l_im = (float **) malloc( sizeof( float * ) * sofa_M );
pHrtf_set_r_re = (float **) malloc( sizeof( float * ) * sofa_M );
pHrtf_set_r_im = (float **) malloc( sizeof( float * ) * sofa_M );
pTemp = (float *) malloc( sizeof( float ) * frame_len );
for ( i = 0; i < sofa_M; i++ )
{
pHrtf_set_l_re[i] = (float *) malloc( sizeof( float ) * ( frame_len ) );
memset( pHrtf_set_l_re[i], 0, sizeof( float ) * frame_len );
pHrtf_set_l_im[i] = (float *) malloc( sizeof( float ) * ( frame_len ) );
memset( pHrtf_set_l_im[i], 0, sizeof( float ) * frame_len );
memset( pTemp, 0, sizeof( float ) * frame_len );
for ( int32_t n = 0; n < sofa_N; n++ )
{
pTemp[n] = (float) ( data_IR_current[size * i + n] * (double) mdft_scale_fact );
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
memcpy( pHrtf_set_l_re[i], pTemp, frame_len );
memset( pHrtf_set_l_im[i], 0, frame_len );
DoRTFTn( pHrtf_set_l_re[i], pHrtf_set_l_im[i], frame_len );
#else
ivas_mdft( pTemp, pHrtf_set_l_re[i], pHrtf_set_l_im[i], frame_len, frame_len );
#endif
pHrtf_set_r_re[i] = (float *) malloc( sizeof( float ) * ( frame_len ) );
memset( pHrtf_set_r_re[i], 0, sizeof( float ) * frame_len );
pHrtf_set_r_im[i] = (float *) malloc( sizeof( float ) * ( frame_len ) );
memset( pHrtf_set_r_im[i], 0, sizeof( float ) * frame_len );
memset( pTemp, 0, sizeof( float ) * frame_len );
for ( int32_t n = 0; n < sofa_N; n++ )
{
pTemp[n] = (float) ( data_IR_current[size * i + sofa_N + n] * (double) mdft_scale_fact );
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
memcpy( pHrtf_set_r_re[i], pTemp, frame_len );
memset( pHrtf_set_r_im[i], 0, frame_len );
DoRTFTn( pHrtf_set_r_re[i], pHrtf_set_r_im[i], frame_len );
#else
ivas_mdft( pTemp, pHrtf_set_r_re[i], pHrtf_set_r_im[i], frame_len, frame_len );
#endif
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
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 );
#else
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, frame_len, nr_fc_fft_filter, p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence );
#endif
update_h_file_with_reverb( sample_rates[indSR] );
update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], nr_fc_fft_filter );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
if ( binary_file_path != NULL )
{
write_reverb_to_binary_file( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR] );
}
#endif
for ( int i = 0; i < sofa_M; i++ )
{
if ( pHrtf_set_l_re[i] )
{
free( pHrtf_set_l_re[i] );
pHrtf_set_l_re[i] = NULL;
}
if ( pHrtf_set_l_im[i] )
{
free( pHrtf_set_l_im[i] );
pHrtf_set_l_im[i] = NULL;
}
if ( pHrtf_set_r_re[i] )
{
free( pHrtf_set_r_re[i] );
pHrtf_set_r_re[i] = NULL;
}
if ( pHrtf_set_r_im[i] )
{
free( pHrtf_set_r_im[i] );
pHrtf_set_r_im[i] = NULL;
}
}
if ( pTemp )
{
free( pTemp );
pTemp = NULL;
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
if ( pCoherence )
{
free( pCoherence );
pCoherence = NULL;
}
if ( p_avg_lr )
{
free( p_avg_lr );
p_avg_lr = NULL;
}
#endif
}
/* close the file */
if ( sofa_file_path )
free( sofa_file_path );
mxDestroyArray( sofa );
return 0;
}
#endif
/*---------------------------------------------------------------------*
*write_array_float_to_file();
*---------------------------------------------------------------------*/
void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t sample_per_ligne, const char *format, const int num_tab, const char *tab )
{
int32_t k, l, num_iter, remaining_samples;
int16_t i;
num_iter = size_vec / sample_per_ligne;
remaining_samples = size_vec % sample_per_ligne;
if ( remaining_samples == 0 )
{
num_iter--;
remaining_samples = sample_per_ligne;
}
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
fprintf( fp, "{" );
for ( k = 0; k < num_iter; k++ )
{
if ( k != 0 )
{
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
}
for ( l = 0; l < sample_per_ligne; l++ )
{
fprintf( fp, format, vec[k * sample_per_ligne + l] );
fprintf( fp, "f, " );
}
fprintf( fp, "\n" );
}
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
for ( l = 0; l < remaining_samples - 1; l++ )
{
fprintf( fp, format, vec[k * sample_per_ligne + l] );
fprintf( fp, "f, " );
}
fprintf( fp, format, vec[k * sample_per_ligne + l] );
fprintf( fp, "f}" );
}
/*---------------------------------------------------------------------*
*write_array_float_to_file();
*---------------------------------------------------------------------*/
void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int32_t sample_per_ligne, const int num_tab, const char *tab )
{
int32_t k, l, num_iter, remaining_samples;
int16_t i;
num_iter = size_vec / sample_per_ligne;
remaining_samples = size_vec % sample_per_ligne;
if ( remaining_samples == 0 )
{
num_iter--;
remaining_samples = sample_per_ligne;
}
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
fprintf( fp, "{" );
for ( k = 0; k < num_iter; k++ )
{
if ( k != 0 )
{
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
}
for ( l = 0; l < sample_per_ligne; l++ )
{
fprintf( fp, "%u", vec[k * sample_per_ligne + l] );
fprintf( fp, ", " );
}
fprintf( fp, "\n" );
}
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
for ( l = 0; l < remaining_samples - 1; l++ )
{
fprintf( fp, "%u", vec[k * sample_per_ligne + l] );
fprintf( fp, ", " );
}
fprintf( fp, "%u", vec[k * sample_per_ligne + l] );
for ( i = 0; i < num_tab; i++ )
{
fprintf( fp, "%s", tab );
}
fprintf( fp, "}" );
}
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
/*---------------------------------------------------------------------*
*update_c_file_with_reverb();
*---------------------------------------------------------------------*/
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len )
{
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
char len_str[26] = "LR_IAC_LENGTH_NR_FC";
if ( samplerate == 16000 )
{
strcpy( len_str, "LR_IAC_LENGTH_NR_FC_16KHZ" );
}
#endif
if ( c_file_path == NULL )
return;
if ( pEner_l == NULL )
return;
if ( pEner_r == NULL )
return;
if ( pCoherence == NULL )
return;
FILE *fp = fopen( c_file_path, "a" );
if ( fp == NULL )
return;
if ( samplerate == DEFAULT_SAMPLERATE )
{
fprintf( fp, "\n#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES\n" );
fprintf( fp, "\n/********************** default HRIR reverb rom tables **********************/\n" );
}
fprintf( fp, "\n/* Sample Rate = %ld */\n", (long) samplerate );
/* float *defaultHRIR_right_avg_power_[LR_IAC_LENGTH_NR_FC];*/
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
fprintf( fp, "\nconst float defaultHRIR_coherence_%dkHz[%s] = \n", samplerate / 1000, len_str );
#else
fprintf( fp, "\nconst float defaultHRIR_coherence_%dkHz[LR_IAC_LENGTH_NR_FC] = \n", samplerate / 1000 );
#endif
write_array_float_to_file( fp, pCoherence, len, NUM_SAMPLES_PER_LINES_REVERB, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, ";\n" );
/* float *defaultHRIR_left_avg_power_[LR_IAC_LENGTH_NR_FC];*/
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
fprintf( fp, "\nconst float defaultHRIR_left_avg_power_%dkHz[%s] = \n", samplerate / 1000, len_str );
#else
fprintf( fp, "\nconst float defaultHRIR_left_avg_power_%dkHz[LR_IAC_LENGTH_NR_FC] = \n", samplerate / 1000 );
#endif
write_array_float_to_file( fp, pEner_l, len, NUM_SAMPLES_PER_LINES_REVERB, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, ";\n" );
/* float *defaultHRIR_right_avg_power_[LR_IAC_LENGTH_NR_FC];*/
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
fprintf( fp, "\nconst float defaultHRIR_right_avg_power_%dkHz[%s] = \n", samplerate / 1000, len_str );
#else
fprintf( fp, "\nconst float defaultHRIR_right_avg_power_%dkHz[LR_IAC_LENGTH_NR_FC] = \n", samplerate / 1000 );
#endif
write_array_float_to_file( fp, pEner_r, len, NUM_SAMPLES_PER_LINES_REVERB, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, ";\n" );
if ( samplerate == LAST_SAMPLERATE )
{
fprintf( fp, "\n#endif\n" );
}
if ( fp )
fclose( fp );
return;
}
#endif
/*---------------------------------------------------------------------*
*update_c_file();
*---------------------------------------------------------------------*/
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
{
if ( c_file_path == NULL )
return;
FILE *fp = fopen( c_file_path, "a" );
int16_t i, j;
uint32_t *pTotalNumFreqSampPerIterations[2], maxTotalNumFreqSampPerIterations;
uint32_t pTotalNumFreqSampPerIterationsDiffuse[2], maxTotalNumFreqSampPerIterationsDiffuse;
pTotalNumFreqSampPerIterations[0] = malloc( sizeof( float ) * hrtf->max_num_ir );
pTotalNumFreqSampPerIterations[1] = malloc( sizeof( float ) * hrtf->max_num_ir );
if ( fp == NULL )
return;
if ( hrtf == NULL )
return;
if ( samplerate == DEFAULT_SAMPLERATE )
{
/* float latency_s; */
fprintf( fp, "\n\n/********************** %s_%s **********************/\n", DECLARATION_NAME, lscfg.name );
fprintf( fp, "\nconst float %s_%s_latency_s = %10.9ff;", DECLARATION_NAME, lscfg.name, hrtf->latency_s );
}
fprintf( fp, "\n\n/* Sample Rate = %ld */\n", (long) samplerate );
/* int16_t max_num_iterations; */
fprintf( fp, "\nconst int16_t %s_%s_max_num_iterations_%2dkHz = %d;", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_iterations );
/* uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
fprintf( fp, "\nconst uint16_t %s_%s_num_iterations_%2dkHz[%s][BINAURAL_CHANNELS]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name );
for ( i = 0; i < hrtf->max_num_ir - 1; i++ )
{
fprintf( fp, "{%u, %u}, ", hrtf->num_iterations[i][0], hrtf->num_iterations[i][1] );
}
fprintf( fp, "{%u, %u} ", hrtf->num_iterations[i][0], hrtf->num_iterations[i][1] );
fprintf( fp, "};" );
/* uint16_t num_iterations_diffuse[BINAURAL_CHANNELS];*/
fprintf( fp, "\nconst uint16_t %s_%s_num_iterations_diffuse_%2dkHz[BINAURAL_CHANNELS] = {%u, %u};", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->num_iterations_diffuse[0], hrtf->num_iterations_diffuse[1] );
maxTotalNumFreqSampPerIterations = 0;
for ( i = 0; i < hrtf->max_num_ir; i++ )
{
pTotalNumFreqSampPerIterations[0][i] = 0;
pTotalNumFreqSampPerIterations[1][i] = 0;
for ( j = 0; j < hrtf->num_iterations[i][0]; j++ )
{
pTotalNumFreqSampPerIterations[0][i] += hrtf->pIndex_frequency_max[i][0][j];
}
if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[0][i] )
{
maxTotalNumFreqSampPerIterations = pTotalNumFreqSampPerIterations[0][i];
}
for ( j = 0; j < hrtf->num_iterations[i][1]; j++ )
{
pTotalNumFreqSampPerIterations[1][i] += hrtf->pIndex_frequency_max[i][1][j];
}
if ( maxTotalNumFreqSampPerIterations < pTotalNumFreqSampPerIterations[1][i] )
{
maxTotalNumFreqSampPerIterations = pTotalNumFreqSampPerIterations[1][i];
}
}
pTotalNumFreqSampPerIterationsDiffuse[0] = 0;
pTotalNumFreqSampPerIterationsDiffuse[1] = 0;
maxTotalNumFreqSampPerIterationsDiffuse = 0;
for ( j = 0; j < hrtf->num_iterations_diffuse[0]; j++ )
{
pTotalNumFreqSampPerIterationsDiffuse[0] += hrtf->pIndex_frequency_max_diffuse[0][j];
}
if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[0] )
{
maxTotalNumFreqSampPerIterationsDiffuse = pTotalNumFreqSampPerIterationsDiffuse[0];
}
for ( j = 0; j < hrtf->num_iterations_diffuse[1]; j++ )
{
pTotalNumFreqSampPerIterationsDiffuse[1] += hrtf->pIndex_frequency_max_diffuse[1][j];
}
if ( maxTotalNumFreqSampPerIterationsDiffuse < pTotalNumFreqSampPerIterationsDiffuse[1] )
{
maxTotalNumFreqSampPerIterationsDiffuse = pTotalNumFreqSampPerIterationsDiffuse[1];
}
/*uint16_t *pIndex_frequency_max[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 );
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 );
fprintf( fp, "}," );
} }
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[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT );
...@@ -1498,10 +2248,27 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int ...@@ -1498,10 +2248,27 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
/* uint16_t index_frequency_max_diffuse; */ /* uint16_t index_frequency_max_diffuse; */
fprintf( fp, "\nconst uint16_t %s_%s_index_frequency_max_diffuse_%2dkHz = %d;", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->index_frequency_max_diffuse ); fprintf( fp, "\nconst uint16_t %s_%s_index_frequency_max_diffuse_%2dkHz = %d;", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->index_frequency_max_diffuse );
#ifdef FIX_INV_DIFFUSE_WEIGHT
/* float inv_diffuse_weight[BINAURAL_CHANNELS][MAX_INTERN_CHANNELS]; */
fprintf( fp, "\n#ifdef FIX_INV_DIFFUSE_WEIGHT" );
fprintf( fp, "\nconst float %s_%s_inv_diffuse_weight_%2dkHz[BINAURAL_CHANNELS][%s]=", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name );
fprintf( fp, "{" );
write_array_float_to_file( fp, hrtf->inv_diffuse_weight[0], hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, "," );
write_array_float_to_file( fp, hrtf->inv_diffuse_weight[1], hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, "}" );
fprintf( fp, ";" );
fprintf( fp, "\n#else" );
fprintf( fp, "\nconst float %s_%s_inv_diffuse_weight_%2dkHz[%s]=", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name );
write_array_float_to_file( fp, hrtf->inv_diffuse_weight[0], hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, ";" );
fprintf( fp, "\n#endif" );
#else
/* float inv_diffuse_weight[MAX_INTERN_CHANNELS]; */ /* float inv_diffuse_weight[MAX_INTERN_CHANNELS]; */
fprintf( fp, "\nconst float %s_%s_inv_diffuse_weight_%2dkHz[%u]=", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir ); fprintf( fp, "\nconst float %s_%s_inv_diffuse_weight_%2dkHz[%s]=", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name );
write_array_float_to_file( fp, hrtf->inv_diffuse_weight, hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0, TAB_WITH_SPACE_OR_NOT ); write_array_float_to_file( fp, hrtf->inv_diffuse_weight, hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0, TAB_WITH_SPACE_OR_NOT );
fprintf( fp, ";" ); fprintf( fp, ";" );
#endif
/* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/ /* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/
if ( hrtf->pIndex_frequency_max_diffuse[0] == NULL ) if ( hrtf->pIndex_frequency_max_diffuse[0] == NULL )
...@@ -1518,7 +2285,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int ...@@ -1518,7 +2285,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
} }
/* float *pOut_to_bin[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ /* float *pOut_to_bin[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
fprintf( fp, "\nconst float %s_%s_coeff_re_%2dkHz[%d][BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, maxTotalNumFreqSampPerIterations ); fprintf( fp, "\nconst float %s_%s_coeff_re_%2dkHz[%s][BINAURAL_CHANNELS][%d]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, maxTotalNumFreqSampPerIterations );
for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) for ( i = 0; i < hrtf->max_num_ir - 1; i++ )
{ {
fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT );
...@@ -1534,7 +2301,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int ...@@ -1534,7 +2301,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
fprintf( fp, "\n%s}", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s}", TAB_WITH_SPACE_OR_NOT );
fprintf( fp, "\n};" ); fprintf( fp, "\n};" );
fprintf( fp, "\nconst float %s_%s_coeff_im_%2dkHz[%d][BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, maxTotalNumFreqSampPerIterations ); fprintf( fp, "\nconst float %s_%s_coeff_im_%2dkHz[%s][BINAURAL_CHANNELS][%d]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name, maxTotalNumFreqSampPerIterations );
for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) for ( i = 0; i < hrtf->max_num_ir - 1; i++ )
{ {
fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT );
...@@ -1592,6 +2359,66 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int ...@@ -1592,6 +2359,66 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
return; return;
} }
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
/*---------------------------------------------------------------------*
*update_h_file_with_reverb
*---------------------------------------------------------------------*/
void update_h_file_with_reverb( int32_t samplerate )
{
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
char len_str[26] = "LR_IAC_LENGTH_NR_FC";
if ( samplerate == 16000 )
{
strcpy( len_str, "LR_IAC_LENGTH_NR_FC_16KHZ" );
}
#endif
if ( h_file_path == NULL )
return;
FILE *fp = fopen( h_file_path, "a" );
if ( fp == NULL )
return;
if ( samplerate == DEFAULT_SAMPLERATE )
{
fprintf( fp, "\n #ifdef FIX_638_ENERGIE_IAC_ROM_TABLES\n" );
fprintf( fp, "\n/********************** default HRIR reverb rom tables **********************/\n" );
}
fprintf( fp, "\n/* Sample Rate = %ld */\n", (long) samplerate );
/* float *defaultHRIR_coherence_[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
fprintf( fp, "\nextern float defaultHRIR_coherence_%dkHz[%s];", samplerate / 1000, len_str );
#else
fprintf( fp, "\nextern float defaultHRIR_coherence_%dkHz[LR_IAC_LENGTH_NR_FC];", samplerate / 1000 );
#endif
/* float *defaultHRIR_left_avg_power[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
fprintf( fp, "\nextern float defaultHRIR_left_avg_power_%dkHz[%s];", samplerate / 1000, len_str );
#else
fprintf( fp, "\nextern float defaultHRIR_left_avg_power_%dkHz[LR_IAC_LENGTH_NR_FC];", samplerate / 1000 );
#endif /* float *defaultHRIR_right_avg_power[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
fprintf( fp, "\nextern float defaultHRIR_right_avg_power_%dkHz[%s];", samplerate / 1000, len_str );
#else
fprintf( fp, "\nextern float defaultHRIR_right_avg_power_%dkHz[LR_IAC_LENGTH_NR_FC];", samplerate / 1000 );
#endif
if ( samplerate == LAST_SAMPLERATE )
{
fprintf( fp, "\n\n#endif\n" );
}
if ( fp )
fclose( fp );
return;
}
#endif
/*---------------------------------------------------------------------* /*---------------------------------------------------------------------*
*update_h_file(); *update_h_file();
*---------------------------------------------------------------------*/ *---------------------------------------------------------------------*/
...@@ -1668,19 +2495,28 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int ...@@ -1668,19 +2495,28 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
/* int16_t max_num_iterations; */ /* 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 int16_t %s_%s_max_num_iterations_%2dkHz;", DECLARATION_NAME, lscfg.name, samplerate / 1000 );
/* uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ /* uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
fprintf( fp, "\nextern uint16_t %s_%s_num_iterations_%2dkHz[%d][BINAURAL_CHANNELS];", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir ); 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 );
/* uint16_t num_iterations_diffuse[BINAURAL_CHANNELS];*/ /* 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 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]; */ /*uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; */
fprintf( fp, "\nextern uint16_t %s_%s_pIndex_frequency_max_%2dkHz[%d][BINAURAL_CHANNELS][%d];", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, hrtf->max_num_iterations ); 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 index_frequency_max_diffuse; */ /* 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 uint16_t %s_%s_index_frequency_max_diffuse_%2dkHz;", DECLARATION_NAME, lscfg.name, samplerate / 1000 );
#ifdef FIX_INV_DIFFUSE_WEIGHT
/* float inv_diffuse_weight[BINAURAL_CHANNELS][MAX_INTERN_CHANNELS]; */
fprintf( fp, "\n#ifdef FIX_INV_DIFFUSE_WEIGHT" );
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, "\n#else" );
fprintf( fp, "\nextern float %s_%s_inv_diffuse_weight_%2dkHz[%s];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name );
fprintf( fp, "\n#endif" );
#else
/* float inv_diffuse_weight[MAX_INTERN_CHANNELS]; */ /* float inv_diffuse_weight[MAX_INTERN_CHANNELS]; */
fprintf( fp, "\nextern float %s_%s_inv_diffuse_weight_%2dkHz[%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir ); fprintf( fp, "\nextern float %s_%s_inv_diffuse_weight_%2dkHz[%s];", DECLARATION_NAME, lscfg.name, samplerate / 1000, lscfg.output_config_num_channel_name );
#endif
/* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/ /* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/
if ( hrtf->pIndex_frequency_max_diffuse[0] == NULL ) if ( hrtf->pIndex_frequency_max_diffuse[0] == NULL )
{ {
...@@ -1692,8 +2528,8 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int ...@@ -1692,8 +2528,8 @@ void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int
} }
/* float *pOut_to_bin[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/ /* float *pOut_to_bin[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];*/
fprintf( fp, "\nextern float %s_%s_coeff_re_%2dkHz[%d][BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, maxTotalNumFreqSampPerIterations ); 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[%d][BINAURAL_CHANNELS][%u];", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, 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 );
/* float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS];*/ /* float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS];*/
if ( hrtf->pOut_to_bin_diffuse_re[0] == NULL ) if ( hrtf->pOut_to_bin_diffuse_re[0] == NULL )
...@@ -1815,7 +2651,11 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr ...@@ -1815,7 +2651,11 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr
} }
hrtf_data_size += sizeof( uint16_t ); // index_frequency_max_diffuse hrtf_data_size += sizeof( uint16_t ); // index_frequency_max_diffuse
#ifdef FIX_INV_DIFFUSE_WEIGHT
hrtf_data_size += hrtf->max_num_ir * sizeof( float ) * BINAURAL_CHANNELS; // inv_diffuse_weight
#else
hrtf_data_size += hrtf->max_num_ir * sizeof( float ); // inv_diffuse_weight hrtf_data_size += hrtf->max_num_ir * sizeof( float ); // inv_diffuse_weight
#endif
hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration
...@@ -1962,12 +2802,26 @@ void write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const ...@@ -1962,12 +2802,26 @@ void write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
memcpy( hrtf_bin_wptr, &( hrtf->index_frequency_max_diffuse ), sizeof( uint16_t ) ); // index_frequency_max_diffuse memcpy( hrtf_bin_wptr, &( hrtf->index_frequency_max_diffuse ), sizeof( uint16_t ) ); // index_frequency_max_diffuse
hrtf_bin_wptr += sizeof( uint16_t ); hrtf_bin_wptr += sizeof( uint16_t );
#ifdef FIX_INV_DIFFUSE_WEIGHT
for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
{
sprintf( tmpStr, FORMAT_FLOAT, hrtf->inv_diffuse_weight[0][iIR] );
sscanf( tmpStr, "%f", &( (float *) hrtf_bin_wptr )[iIR] );
}
for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
{
sprintf( tmpStr, FORMAT_FLOAT, hrtf->inv_diffuse_weight[1][iIR] );
sscanf( tmpStr, "%f", &( (float *) hrtf_bin_wptr )[hrtf->max_num_ir + iIR] );
}
data_size_tmp = hrtf->max_num_ir * sizeof( float ) * BINAURAL_CHANNELS;
#else
for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ ) for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
{ {
sprintf( tmpStr, FORMAT_FLOAT, hrtf->inv_diffuse_weight[iIR] ); sprintf( tmpStr, FORMAT_FLOAT, hrtf->inv_diffuse_weight[iIR] );
sscanf( tmpStr, "%f", &( (float *) hrtf_bin_wptr )[iIR] ); sscanf( tmpStr, "%f", &( (float *) hrtf_bin_wptr )[iIR] );
} }
data_size_tmp = hrtf->max_num_ir * sizeof( float ); data_size_tmp = hrtf->max_num_ir * sizeof( float );
#endif
hrtf_bin_wptr += data_size_tmp; hrtf_bin_wptr += data_size_tmp;
memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_total_num_fsamp_per_iteration ), sizeof( uint16_t ) ); // max_total_num_fsamp_per_iteration memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_total_num_fsamp_per_iteration ), sizeof( uint16_t ) ); // max_total_num_fsamp_per_iteration
...@@ -2077,6 +2931,108 @@ void write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const ...@@ -2077,6 +2931,108 @@ void write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
free( hrtf_bin ); free( hrtf_bin );
free( binary_file_full_path ); free( binary_file_full_path );
} }
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
/*---------------------------------------------------------------------*
* write_binary_file();
*---------------------------------------------------------------------*/
void write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate )
{
FILE *output_binary_file;
int16_t iTap;
char tmpStr[64];
uint32_t hrtf_data_size;
char *hrtf_bin = NULL, *hrtf_bin_wptr;
char *binary_file_full_path = NULL;
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
int16_t len = LR_IAC_LENGTH_NR_FC;
if ( samplerate == 16000 )
{
len = LR_IAC_LENGTH_NR_FC_16KHZ;
}
#endif
if ( pEner_l == NULL )
return;
if ( pEner_r == NULL )
return;
if ( pCoherence == NULL )
return;
if ( binary_file_path == NULL )
return;
hrtf_bin = NULL;
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
hrtf_data_size = sizeof( float ) * 3 * len;
#else
hrtf_data_size = sizeof( float ) * 3 * LR_IAC_LENGTH_NR_FC;
#endif
hrtf_bin = (char *) malloc( hrtf_data_size );
if ( hrtf_bin == NULL )
return;
memset( hrtf_bin, 0x00, hrtf_data_size );
hrtf_bin_wptr = hrtf_bin;
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
for ( iTap = 0; iTap < len; iTap++ )
#else
for ( iTap = 0; iTap < LR_IAC_LENGTH_NR_FC; iTap++ )
#endif
{
sprintf( tmpStr, FORMAT_FLOAT, pEner_l[iTap] );
sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
hrtf_bin_wptr += sizeof( float ) * len;
for ( iTap = 0; iTap < len; iTap++ )
#else
hrtf_bin_wptr += sizeof( float ) * LR_IAC_LENGTH_NR_FC;
for ( iTap = 0; iTap < LR_IAC_LENGTH_NR_FC; iTap++ )
#endif
{
sprintf( tmpStr, FORMAT_FLOAT, pEner_r[iTap] );
sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
hrtf_bin_wptr += sizeof( float ) * len;
for ( iTap = 0; iTap < len; iTap++ )
#else
hrtf_bin_wptr += sizeof( float ) * LR_IAC_LENGTH_NR_FC;
for ( iTap = 0; iTap < LR_IAC_LENGTH_NR_FC; iTap++ )
#endif
{
sprintf( tmpStr, FORMAT_FLOAT, pCoherence[iTap] );
sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
hrtf_bin_wptr += sizeof( float ) * len;
#else
hrtf_bin_wptr += sizeof( float ) * LR_IAC_LENGTH_NR_FC;
#endif
binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( "Reverb" ) + 1 + 5 + 3 + 4 ) );
sprintf( binary_file_full_path, "%s_%s_%ikHz.bin", binary_file_path, "Reverb", samplerate / 1000 );
fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path );
output_binary_file = fopen( binary_file_full_path, "wb" );
if ( output_binary_file == NULL )
{
free( hrtf_bin );
return;
}
fwrite( hrtf_bin, hrtf_data_size, 1, output_binary_file );
fclose( output_binary_file );
free( hrtf_bin );
free( binary_file_full_path );
}
#endif
/*---------------------------------------------------------------------* /*---------------------------------------------------------------------*
*get_ls_layout_config( AUDIO_CONFIG_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct ) *get_ls_layout_config( AUDIO_CONFIG_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct )
...@@ -2093,6 +3049,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2093,6 +3049,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
{ {
case IVAS_AUDIO_CONFIG_FOA: case IVAS_AUDIO_CONFIG_FOA:
strcpy( ls_struct->name, "FOA" ); strcpy( ls_struct->name, "FOA" );
strcpy( ls_struct->output_config_num_channel_name, "FOA_CHANNELS" );
ls_struct->nb_channel = 4; ls_struct->nb_channel = 4;
ls_struct->isloudspeaker = 0; ls_struct->isloudspeaker = 0;
ls_struct->sba_order = 1; ls_struct->sba_order = 1;
...@@ -2101,6 +3058,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2101,6 +3058,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_HOA2: case IVAS_AUDIO_CONFIG_HOA2:
strcpy( ls_struct->name, "HOA2" ); strcpy( ls_struct->name, "HOA2" );
strcpy( ls_struct->output_config_num_channel_name, "HOA2_CHANNELS" );
ls_struct->nb_channel = 9; ls_struct->nb_channel = 9;
ls_struct->isloudspeaker = 0; ls_struct->isloudspeaker = 0;
ls_struct->sba_order = 2; ls_struct->sba_order = 2;
...@@ -2109,6 +3067,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2109,6 +3067,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_HOA3: case IVAS_AUDIO_CONFIG_HOA3:
strcpy( ls_struct->name, "HOA3" ); strcpy( ls_struct->name, "HOA3" );
strcpy( ls_struct->output_config_num_channel_name, "HOA3_CHANNELS" );
ls_struct->nb_channel = 16; ls_struct->nb_channel = 16;
ls_struct->isloudspeaker = 0; ls_struct->isloudspeaker = 0;
ls_struct->sba_order = 3; ls_struct->sba_order = 3;
...@@ -2117,6 +3076,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2117,6 +3076,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_MONO: case IVAS_AUDIO_CONFIG_MONO:
strcpy( ls_struct->name, "MONO" ); strcpy( ls_struct->name, "MONO" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 1; ls_struct->nb_channel = 1;
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
ls_struct->sba_order = -1; ls_struct->sba_order = -1;
...@@ -2125,6 +3085,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2125,6 +3085,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_STEREO:
strcpy( ls_struct->name, "STEREO" ); strcpy( ls_struct->name, "STEREO" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 2; ls_struct->nb_channel = 2;
memcpy( ls_struct->azi, ls_azimuth_CICP2, sizeof( float ) * ls_struct->nb_channel ); memcpy( ls_struct->azi, ls_azimuth_CICP2, sizeof( float ) * ls_struct->nb_channel );
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
...@@ -2134,6 +3095,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2134,6 +3095,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_5_1: case IVAS_AUDIO_CONFIG_5_1:
strcpy( ls_struct->name, "5_1" ); strcpy( ls_struct->name, "5_1" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 5; ls_struct->nb_channel = 5;
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
ls_struct->sba_order = -1; ls_struct->sba_order = -1;
...@@ -2145,6 +3107,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2145,6 +3107,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_7_1: case IVAS_AUDIO_CONFIG_7_1:
strcpy( ls_struct->name, "7_1" ); strcpy( ls_struct->name, "7_1" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 7; ls_struct->nb_channel = 7;
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
ls_struct->sba_order = -1; ls_struct->sba_order = -1;
...@@ -2156,6 +3119,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2156,6 +3119,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_5_1_2: case IVAS_AUDIO_CONFIG_5_1_2:
strcpy( ls_struct->name, "5_1_2" ); strcpy( ls_struct->name, "5_1_2" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 7; ls_struct->nb_channel = 7;
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
ls_struct->sba_order = -1; ls_struct->sba_order = -1;
...@@ -2166,6 +3130,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2166,6 +3130,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_5_1_4: case IVAS_AUDIO_CONFIG_5_1_4:
strcpy( ls_struct->name, "5_1_4" ); strcpy( ls_struct->name, "5_1_4" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 9; ls_struct->nb_channel = 9;
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
ls_struct->sba_order = -1; ls_struct->sba_order = -1;
...@@ -2177,6 +3142,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2177,6 +3142,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
break; break;
case IVAS_AUDIO_CONFIG_7_1_4: case IVAS_AUDIO_CONFIG_7_1_4:
strcpy( ls_struct->name, "7_1_4" ); strcpy( ls_struct->name, "7_1_4" );
strcpy( ls_struct->output_config_num_channel_name, "" );
ls_struct->nb_channel = 11; ls_struct->nb_channel = 11;
ls_struct->isloudspeaker = 1; ls_struct->isloudspeaker = 1;
ls_struct->sba_order = -1; ls_struct->sba_order = -1;
...@@ -2192,6 +3158,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con ...@@ -2192,6 +3158,7 @@ void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_con
const float tmp_azi[15] = { 30, -30, 0, 135, -135, 110, -110, 90, -90, 30, -30, 110, -110, 135, -135 }; const float tmp_azi[15] = { 30, -30, 0, 135, -135, 110, -110, 90, -90, 30, -30, 110, -110, 135, -135 };
const float tmp_ele[15] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 35, 35, 35, 35, 35 }; const float tmp_ele[15] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 35, 35, 35, 35, 35 };
strcpy( ls_struct->name, "Combined" ); strcpy( ls_struct->name, "Combined" );
strcpy( ls_struct->output_config_num_channel_name, "HRTF_LS_CHANNELS" );
ls_struct->nb_channel = 15; ls_struct->nb_channel = 15;
memcpy( ls_struct->azi, tmp_azi, sizeof( float ) * ls_struct->nb_channel ); memcpy( ls_struct->azi, tmp_azi, sizeof( float ) * ls_struct->nb_channel );
memcpy( ls_struct->ele, tmp_ele, sizeof( float ) * ls_struct->nb_channel ); memcpy( ls_struct->ele, tmp_ele, sizeof( float ) * ls_struct->nb_channel );
......
...@@ -46,7 +46,7 @@ addpath(genpath('../td_object_renderer/modeling_tool/')); ...@@ -46,7 +46,7 @@ addpath(genpath('../td_object_renderer/modeling_tool/'));
%% Set arguments %% Set arguments
writeRomFileOutput = true; %% generation of rom files if true writeRomFileOutput = true; %% generation of rom files if true
writeBinaryOutput = false; %% generation of binary files if true. Always true for TD renderer writeBinaryOutput = true; %% generation of binary files if true. Always true for TD renderer
writeEachRendererBinaryOutput = true; %% generation of binary split files each containing binary data for individual renderer writeEachRendererBinaryOutput = true; %% generation of binary split files each containing binary data for individual renderer
%% Set ivas root path %% Set ivas root path
...@@ -101,6 +101,8 @@ if writeBinaryOutput == true ...@@ -101,6 +101,8 @@ if writeBinaryOutput == true
end end
command = [command ... command = [command ...
' -compute_reverb_rom ' ...
erase(hrir_file,'.sofa') '.mat ' ...
' 5 ' ... ' 5 ' ...
erase(hrir_file,'.sofa') '.mat ' ... erase(hrir_file,'.sofa') '.mat ' ...
erase(hrir_file,'.sofa') '_FOA.mat ' ... erase(hrir_file,'.sofa') '_FOA.mat ' ...
...@@ -173,6 +175,8 @@ if writeBinaryOutput == true ...@@ -173,6 +175,8 @@ if writeBinaryOutput == true
' -input_mixerconv_hrir_file_name ' binary_name ... ' -input_mixerconv_hrir_file_name ' binary_name ...
' -input_mixerconv_brir_file_path ' binary_path ... ' -input_mixerconv_brir_file_path ' binary_path ...
' -input_mixerconv_brir_file_name ' binary_name ... ' -input_mixerconv_brir_file_name ' binary_name ...
' -input_reverb_file_path ' binary_path ...
' -input_reverb_file_name ' binary_name ...
' -input_td_file_path ' fullfile(binary_path, 'IVAS_default') ... ' -input_td_file_path ' fullfile(binary_path, 'IVAS_default') ...
' -input_td_file_name ' td_binary_file ... ' -input_td_file_name ' td_binary_file ...
' -input_param_file_path ' binary_path ... ' -input_param_file_path ' binary_path ...
...@@ -198,6 +202,8 @@ if writeBinaryOutput == true && writeEachRendererBinaryOutput == true ...@@ -198,6 +202,8 @@ if writeBinaryOutput == true && writeEachRendererBinaryOutput == true
" -input_mixerconv_hrir_file_name " binary_name , ... " -input_mixerconv_hrir_file_name " binary_name , ...
" -input_mixerconv_brir_file_path " binary_path ... " -input_mixerconv_brir_file_path " binary_path ...
" -input_mixerconv_brir_file_name " binary_name ,... " -input_mixerconv_brir_file_name " binary_name ,...
" -input_reverb_file_path " binary_path ...
" -input_reverb_file_name " binary_name ,...
" -input_td_file_path " fullfile(binary_path, 'IVAS_default') ... " -input_td_file_path " fullfile(binary_path, 'IVAS_default') ...
" -input_td_file_name " td_binary_file ,... " -input_td_file_name " td_binary_file ,...
" -input_param_file_path " binary_path ... " -input_param_file_path " binary_path ...
......
...@@ -146,7 +146,12 @@ static void printfAudioBufferOutFilterParams( ...@@ -146,7 +146,12 @@ static void printfAudioBufferOutFilterParams(
printf( "\nmax Diffuse Fc : %u", pParam->index_frequency_max_diffuse ); printf( "\nmax Diffuse Fc : %u", pParam->index_frequency_max_diffuse );
printf( "\n" ); printf( "\n" );
printf( "\nInverse Diffuse Weights :" ); printf( "\nInverse Diffuse Weights :" );
#ifdef FIX_INV_DIFFUSE_WEIGHT
printBuf_float32( pParam->inv_diffuse_weight[0], pParam->max_num_ir );
printBuf_float32( pParam->inv_diffuse_weight[1], pParam->max_num_ir );
#else
printBuf_float32( pParam->inv_diffuse_weight, pParam->max_num_ir ); printBuf_float32( pParam->inv_diffuse_weight, pParam->max_num_ir );
#endif
printf( "\n" ); printf( "\n" );
/*if (pParam->numDiffuseBlock > 0) /*if (pParam->numDiffuseBlock > 0)
...@@ -558,11 +563,20 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params( ...@@ -558,11 +563,20 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
{ {
pParam->num_iterations[i_chan][0]++; pParam->num_iterations[i_chan][0]++;
} }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
/* max MAX_LENGTH_DIRECT_FILTER */
if ( pParam->num_iterations[i_chan][0] > cfgReader->maxNumDirectBlocks )
{
pParam->num_iterations[i_chan][0] = cfgReader->maxNumDirectBlocks;
}
pParam->num_iterations[i_chan][1] = pParam->num_iterations[i_chan][0];
#else
pParam->num_iterations[i_chan][1] = pParam->num_iterations[i_chan][0]; pParam->num_iterations[i_chan][1] = pParam->num_iterations[i_chan][0];
if ( pParam->num_iterations[i_chan][0] > IVAS_MAX_NUM_DIRECT_BLOCKS ) if ( pParam->num_iterations[i_chan][0] > IVAS_MAX_NUM_DIRECT_BLOCKS )
{ {
pParam->num_iterations[i_chan][0] = IVAS_MAX_NUM_DIRECT_BLOCKS; pParam->num_iterations[i_chan][0] = IVAS_MAX_NUM_DIRECT_BLOCKS;
} }
#endif
} }
pParam->max_num_iterations = 0; pParam->max_num_iterations = 0;
...@@ -652,10 +666,17 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params( ...@@ -652,10 +666,17 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
} }
/* max MAX_NUM_DIFFUSE_BLOCKS */ /* max MAX_NUM_DIFFUSE_BLOCKS */
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
if ( numDiffuseBlock > cfgReader->maxNumDiffuseBlocks )
{
numDiffuseBlock = cfgReader->maxNumDiffuseBlocks;
}
#else
if ( numDiffuseBlock > IVAS_MAX_NUM_DIFFUSE_BLOCKS ) if ( numDiffuseBlock > IVAS_MAX_NUM_DIFFUSE_BLOCKS )
{ {
numDiffuseBlock = IVAS_MAX_NUM_DIFFUSE_BLOCKS; numDiffuseBlock = IVAS_MAX_NUM_DIFFUSE_BLOCKS;
} }
#endif
for ( i_ear = 0; i_ear < 2; ++i_ear ) for ( i_ear = 0; i_ear < 2; ++i_ear )
{ {
...@@ -685,6 +706,9 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params( ...@@ -685,6 +706,9 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
ivas_hrtf_t *pFirData, ivas_hrtf_t *pFirData,
const int16_t frame_len, const int16_t frame_len,
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
float mdft_scale_fact,
#endif
HRTFS_DATA *pParam, HRTFS_DATA *pParam,
int32_t index_start, int32_t index_start,
int32_t index_end, int32_t index_end,
...@@ -712,7 +736,9 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( ...@@ -712,7 +736,9 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
float ppEnergyDiffuseFilter[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS] = { { 0 } }; /* diffuse filter energies ( ppEnergyDiffuseFilter[ear][channel] ) */ float ppEnergyDiffuseFilter[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS] = { { 0 } }; /* diffuse filter energies ( ppEnergyDiffuseFilter[ear][channel] ) */
float ppDiffuseWeight[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS] = { { 0 } }; /* diffuse weights ( ppDiffuseWeight[ear][channel] ) */ float ppDiffuseWeight[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS] = { { 0 } }; /* diffuse weights ( ppDiffuseWeight[ear][channel] ) */
float delayf; float delayf;
#ifndef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
float mdft_scale_fact = ( (float) L_FRAME48k * 0.25f ) / frame_len; float mdft_scale_fact = ( (float) L_FRAME48k * 0.25f ) / frame_len;
#endif
if ( cfgReader != NULL ) if ( cfgReader != NULL )
{ {
...@@ -1071,11 +1097,37 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( ...@@ -1071,11 +1097,37 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
{ {
if ( ppDiffuseWeight[i_chan][0] != -1 && ppDiffuseWeight[i_chan][1] != -1 ) if ( ppDiffuseWeight[i_chan][0] != -1 && ppDiffuseWeight[i_chan][1] != -1 )
{ {
#ifdef FIX_INV_DIFFUSE_WEIGHT
if ( cfgReader != NULL )
{
if ( cfgReader->harmonizeLateReverbBinauralGain )
{
pParam->inv_diffuse_weight[0][i_chan] = cfgReader->lateReverbCompensationGain[i_chan] * 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] );
pParam->inv_diffuse_weight[1][i_chan] = pParam->inv_diffuse_weight[0][i_chan];
}
else
{
pParam->inv_diffuse_weight[0][i_chan] = cfgReader->lateReverbCompensationGain[i_chan] * 1.f / ppDiffuseWeight[i_chan][0];
pParam->inv_diffuse_weight[1][i_chan] = cfgReader->lateReverbCompensationGain[i_chan] * 1.f / ppDiffuseWeight[i_chan][1];
}
}
else
{
pParam->inv_diffuse_weight[0][i_chan] = 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] );
pParam->inv_diffuse_weight[1][i_chan] = pParam->inv_diffuse_weight[0][i_chan];
}
#else
pParam->inv_diffuse_weight[i_chan] = 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] ); pParam->inv_diffuse_weight[i_chan] = 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] );
#endif
} }
else else
{ {
#ifdef FIX_INV_DIFFUSE_WEIGHT
pParam->inv_diffuse_weight[0][i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */
pParam->inv_diffuse_weight[1][i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */
#else
pParam->inv_diffuse_weight[i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */ pParam->inv_diffuse_weight[i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */
#endif
} }
} }
...@@ -1285,13 +1337,19 @@ ivas_error ivas_set_hrtf_fr( ...@@ -1285,13 +1337,19 @@ ivas_error ivas_set_hrtf_fr(
HRTFS_DATA *crend_hrtf, HRTFS_DATA *crend_hrtf,
ivas_hrtf_t *hrtf, ivas_hrtf_t *hrtf,
const int16_t output_frame const int16_t output_frame
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
,
float mdft_scale_fact
#endif
) )
{ {
int32_t i, j, m, n; int32_t i, j, m, n;
float data_ir_flt[L_FRAME48k] = { 0.0f }; float data_ir_flt[L_FRAME48k] = { 0.0f };
int32_t tmp_ir_len, in_len, k; int32_t tmp_ir_len, in_len, k;
#ifndef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
float mdft_scale_fact = ( (float) L_FRAME48k * 0.25f ) / output_frame; float mdft_scale_fact = ( (float) L_FRAME48k * 0.25f ) / output_frame;
#endif
crend_hrtf->max_num_ir = (int16_t) hrtf->m; crend_hrtf->max_num_ir = (int16_t) hrtf->m;
......
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#define IVAS_SOFA_MAX_VAL_R ( 2 ) #define IVAS_SOFA_MAX_VAL_R ( 2 )
#define IVAS_SOFA_MAX_VAL_N ( 48000 ) #define IVAS_SOFA_MAX_VAL_N ( 48000 )
#define IVAS_SOFA_MAX_VAL_I ( 1 ) #define IVAS_SOFA_MAX_VAL_I ( 1 )
#ifndef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
#define IVAS_MAX_NUM_DIRECT_BLOCKS ( 40 ) /* max number of direct blocks */ #define IVAS_MAX_NUM_DIRECT_BLOCKS ( 40 ) /* max number of direct blocks */
#define IVAS_MAX_NUM_DIFFUSE_BLOCKS ( 40 ) /* max number of diffuse blocks */ #define IVAS_MAX_NUM_DIFFUSE_BLOCKS ( 40 ) /* max number of diffuse blocks */
#endif
#define IVAS_MAX_HRTF_LATENCY_MS ( 0.1 ) /* max hrtf latency */ #define IVAS_MAX_HRTF_LATENCY_MS ( 0.1 ) /* max hrtf latency */
typedef struct ivas_hrtf_t typedef struct ivas_hrtf_t
...@@ -61,10 +63,17 @@ typedef struct ivas_hrtf_t ...@@ -61,10 +63,17 @@ typedef struct ivas_hrtf_t
ivas_error ivas_get_hrtf_lens( ivas_hrtf_t *hrtf, HRTFS_DATA *crend_hrtf, const int16_t frame_len ); 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 ivas_error ivas_set_hrtf_fr( HRTFS_DATA *crend_hrtf, ivas_hrtf_t *hrtf, const int16_t frame_len
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
,
float mdft_scale_fact
#endif
); );
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_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, ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_hrtf_t *pFirData, const int16_t frame_len,
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
float mdft_scale_fact,
#endif
HRTFS_DATA *pParam, HRTFS_DATA *pParam,
int32_t index_start, int32_t index_start,
int32_t index_end, int32_t index_end,
......
...@@ -97,7 +97,8 @@ if isfile(Lib_Name) ...@@ -97,7 +97,8 @@ if isfile(Lib_Name)
if sampleRates(ind) == Sofa.Data.SamplingRate if sampleRates(ind) == Sofa.Data.SamplingRate
Sofa.DataResampled(ind).IR = Sofa.Data.IR; Sofa.DataResampled(ind).IR = Sofa.Data.IR;
else else
Sofa.DataResampled(ind).IR = resample(Sofa.Data.IR, sampleRates(ind),Sofa.Data.SamplingRate, 'Dimension',1); Sofa.DataResampled(ind).IR(:,1,:) = resample(squeeze(Sofa.Data.IR(:,1,:)), sampleRates(ind),Sofa.Data.SamplingRate);
Sofa.DataResampled(ind).IR(:,2,:) = resample(squeeze(Sofa.Data.IR(:,2,:)), sampleRates(ind),Sofa.Data.SamplingRate);
end end
Sofa.DataResampled(ind).SamplingRate = sampleRates(ind); Sofa.DataResampled(ind).SamplingRate = sampleRates(ind);
end end
......
...@@ -69,7 +69,7 @@ Excess_Phase = squeeze(unwrap(diff(angle(FRs_hi_res), 1, 2) - ... ...@@ -69,7 +69,7 @@ Excess_Phase = squeeze(unwrap(diff(angle(FRs_hi_res), 1, 2) - ...
bin1200 = ceil( 1200/24000*N ); bin1200 = ceil( 1200/24000*N );
ITD_hi_res = Excess_Phase(bin1200,:)' / ((bin1200-0.5)/N*24000*2*pi); ITD_hi_res = Excess_Phase(bin1200,:)' / ((bin1200-0.5)/N*24000*2*pi);
MaxDel = max(ITD_hi_res, [], 'all'); MaxDel = max(ITD_hi_res);
% Create 2 ears % Create 2 ears
Ear_dels_hi_res = (repmat(ITD_hi_res, 1, 2) .* [0.5 -0.5]) + 0.5*MaxDel .* ... Ear_dels_hi_res = (repmat(ITD_hi_res, 1, 2) .* [0.5 -0.5]) + 0.5*MaxDel .* ...
...@@ -79,7 +79,7 @@ MRs_hi_res = abs(FRs_hi_res_minP); ...@@ -79,7 +79,7 @@ MRs_hi_res = abs(FRs_hi_res_minP);
% Generate permutation % Generate permutation
[~, perm] = ismembertol(... [~, perm] = ismembertol(...
Vs_hi_res', Vs_hi_res'.*[1,-1,1], ... Vs_hi_res', Vs_hi_res'.*[1,-1,1], ...
1e-4, "ByRows",true); 1e-4, 'ByRows',true);
MRs_hi_res(:,2,:) = MRs_hi_res(:,2,perm); MRs_hi_res(:,2,:) = MRs_hi_res(:,2,perm);
New_FreqResp_L = mag2min_phase(squeeze(mean(MRs_hi_res, 2))) .* ... New_FreqResp_L = mag2min_phase(squeeze(mean(MRs_hi_res, 2))) .* ...
...@@ -113,7 +113,6 @@ IR_HOA = permute(IR_HOA, [3, 1, 2]); ...@@ -113,7 +113,6 @@ IR_HOA = permute(IR_HOA, [3, 1, 2]);
IR_HOA = IR_HOA(:,1:ir_len,:) .* sin(interp1([0,150/192*ir_len,ir_len+1],[1,1,0]*pi/2, 1:ir_len)); IR_HOA = IR_HOA(:,1:ir_len,:) .* sin(interp1([0,150/192*ir_len,ir_len+1],[1,1,0]*pi/2, 1:ir_len));
IR = permute(IR_HOA, [2, 1, 3]); IR = permute(IR_HOA, [2, 1, 3]);
HOAformat_str = ['HOA',num2str(order),'S'];
IR_data = IR; IR_data = IR;
......
...@@ -295,7 +295,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -295,7 +295,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec BINAURAL 48 bit_error testv/stv48n.wav_1ISM_13200_48-48_DTX_FER5_BINAURAL.tst ../IVAS_dec BINAURAL 48 bit_error testv/stv48n.wav_1ISM_13200_48-48_DTX_FER5_BINAURAL.tst
// 1 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out // 1 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out
../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit ../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1ISM48s.wav_16400_48-48_binaural_room.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1ISM48s.wav_16400_48-48_binaural_room.tst
...@@ -303,7 +303,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -303,7 +303,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 32000 32 testv/stv32n.wav bit ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 32000 32 testv/stv32n.wav bit
../IVAS_dec MONO 32 bit testv/stv32n.wav_1ISM_32000_32-32_DTX_MONO.tst ../IVAS_dec MONO 32 bit testv/stv32n.wav_1ISM_32000_32-32_DTX_MONO.tst
// 1 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FER at 5% // 1 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out, head rotation, random FER at 5%
../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit ../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 48 bit_error testv/stv1ISM48s.wav_64000_48-48_binaural_room_HR.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 48 bit_error testv/stv1ISM48s.wav_64000_48-48_binaural_room_HR.tst
...@@ -313,7 +313,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -313,7 +313,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL 48 bit_error testv/stv1ISM48s.wav_64000_48-48_FER5_binaural_HR.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL 48 bit_error testv/stv1ISM48s.wav_64000_48-48_FER5_binaural_HR.tst
// 1 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, external orientation, random FER at 5% // 1 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out, head rotation, external orientation, random FER at 5%
../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit ../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit_error testv/stv1ISM48s.wav_64000_48-48_FER5_binaural_room_HR_EXOF.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit_error testv/stv1ISM48s.wav_64000_48-48_FER5_binaural_room_HR_EXOF.tst
...@@ -358,7 +358,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -358,7 +358,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec EXT 48 bit_error testv/stv2ISM48s.wav_48000_48-48_EXT_FER5.tst ../IVAS_dec EXT 48 bit_error testv/stv2ISM48s.wav_48000_48-48_EXT_FER5.tst
// 2 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out // 2 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out
../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv2ISM48s.wav_64000_48-48_binaural_room.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv2ISM48s.wav_64000_48-48_binaural_room.tst
...@@ -402,7 +402,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -402,7 +402,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
// 3 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, EXT out // 3 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, EXT out
../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit ../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit
../IVAS_dec MONO 48 bit testv/stv3ISM48s.48000_48-48_MONO.tst ../IVAS_dec EXT 48 bit testv/stv3ISM48s.48000_48-48_MONO.tst
// 3 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, EXT out // 3 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, EXT out
../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 64000 48 testv/stv3ISM48s.wav bit ../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 64000 48 testv/stv3ISM48s.wav bit
...@@ -451,17 +451,17 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -451,17 +451,17 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit
../IVAS_dec -t testv/headrot_case03_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural_file_TDHR_EXOF.tst ../IVAS_dec -t testv/headrot_case03_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural_file_TDHR_EXOF.tst
// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FER at 5% // 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out, random FER at 5%
../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec BINAURAL_ROOM_IR 48 bit_error testv/stv4ISM48s.wav_32000_48-48_binaural_room_FER5.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit_error testv/stv4ISM48s.wav_32000_48-48_binaural_room_FER5.tst
// 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM out, random FER at 5% // 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM IR out, random FER at 5%
../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv4ISM48n.wav bit ../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv4ISM48n.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec BINAURAL_ROOM_IR 48 bit_error testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FER5.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit_error testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FER5.tst
// 4 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out // 4 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out
../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst
...@@ -624,43 +624,43 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -624,43 +624,43 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_stereo.tst ../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_stereo.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom.tst ../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Subframe.tst ../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Subframe.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, external orientation
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot_EXOF.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, Orientation tracking
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, Orientation tracking, external orientation
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrAvg.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, reference vector tracking
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst ../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking, external orientation // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, reference vector tracking, external orientation
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPos.tst ../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPos.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, reference vector tracking in level mode
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst ../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode, external orientation // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, reference vector tracking in level mode, external orientation
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPosLev.tst ../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPosLev.tst
...@@ -681,6 +681,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -681,6 +681,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit ../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit
../IVAS_dec 5_1_2 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_5_1_2.tst ../IVAS_dec 5_1_2 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_5_1_2.tst
// SBA at 48 kbps, 48kHz in, 48kHz out, BINAURAL out, fr 5ms
../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit
../IVAS_dec -fr 5 -t testv/headrot.csv BINAURAL 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_binaural_ht_fr5.tst
// SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX, random FER at 5% // SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX, random FER at 5%
../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit ../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
...@@ -727,19 +731,19 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -727,19 +731,19 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit ../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit
../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_96000_48-48_FOA.tst ../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_96000_48-48_FOA.tst
// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation
../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst
// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, external orientation
../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot_EXOF.tst
// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, Orientation tracking
../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst
// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, Orientation tracking, external orientation
../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_EXOF_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_EXOF_OtrAvg.tst
...@@ -777,7 +781,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -777,7 +781,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.wav bit ../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_BINAURAL_ROOM.tst ../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_BINAURAL_ROOM.tst
// SBA at 256 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation // SBA at 256 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, Headrotation, external orientation
../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.wav bit ../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_BinauralRoom_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_BinauralRoom_Headrot_EXOF.tst
...@@ -798,6 +802,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -798,6 +802,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit ../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv3OA48c.wav_SBA_512000_48-48_Binaural_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv3OA48c.wav_SBA_512000_48-48_Binaural_Headrot_EXOF.tst
// SBA at 512 kbps, 48kHz in, 48kHz out, BINAURAL out, fr 5ms
../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit
../IVAS_dec -fr 5 -t testv/headrot.csv BINAURAL 48 bit testv/stv3OA48c.wav_SBA_512000_48-48_binaural_ht_fr5.tst
// SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out
../IVAS_cod -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 48 testv/stvFOA48c.wav bit ../IVAS_cod -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 48 testv/stvFOA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_sw_48-48_BINAURAL.tst ../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_sw_48-48_BINAURAL.tst
...@@ -842,6 +850,38 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -842,6 +850,38 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -sba 1 -max_band fb ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stvFOA48c.wav bit ../IVAS_cod -sba 1 -max_band fb ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stvFOA48c.wav bit
../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_sw_48-48_FOA.tst ../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_sw_48-48_FOA.tst
// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, Headrotation
../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_REVERB 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoomReverb_Headrot.tst
// Planar SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, Config renderer, Headrotation
../IVAS_cod -sba -2 48000 32 testv/stv2OA32c.wav bit
../IVAS_dec -t testv/headrot.csv -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 32 bit testv/stv2OA32c.pcm_planarSBA_48000_32-32_BinauralRoomReverb_Config_renderer_Headrot.tst
// SBA at 48 kbps, 32kHz in, 48kHz out, BINAURAL_ROOM_REVERB out (Model from file), Headrotation
../IVAS_cod -sba 1 48000 32 testv/stvFOA32c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin -t testv/headrot.csv BINAURAL_ROOM_REVERB 48 bit testv/stvFOA32c.pcm_SBA_48000_32-48_BinauralRoomReverb_Headrot_BinauralFile.tst
// Planar SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM_REVERB out (Model from file), Config renderer, Headrotation
../IVAS_cod -sba -3 48000 32 testv/stv3OA32c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin -t testv/headrot.csv -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 32 bit testv/stv3OA32c.pcm_planarSBA_48000_32-32_BinauralRoomReverb_Config_renderer_Headrot_BinauralFile.tst
// SBA at 128 kbps, 32kHZ in, 32kHz out, BINAURAL_ROOM_REVERB out Headrotation
../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_REVERB 32 bit testv/stv3OA32c.pcm_SBA_12800032-32_BinauralRoomReverb_Headrot.tst
// SBA at 128 kbps, 32kHZ in, 32kHz out, BINAURAL_ROOM_REVERB out, Config renderer, Headrotation
../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 32 bit testv/stv3OA32c.pcm_SBA_12800032-32_BinauralRoomReverb_Config_renderer_Headrot.tst
// SBA at 128 kbps, 32kHZ in, 16kHz out, BINAURAL_ROOM_REVERB out (Model from file), Headrotation
../IVAS_cod -sba 2 128000 32 testv/stv2OA32c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_REVERB 16 bit testv/stv2OA32c.pcm_SBA_12800032-16_BinauralRoomReverb_Headrot_BinauralFile.tst
// Planar SBA at 128 kbps, 48kHZ in, 32kHz out, BINAURAL_ROOM_REVERB out (Model from file), Config renderer, Headrotation
../IVAS_cod -sba -1 128000 48 testv/stvFOA48c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin -t testv/headrot_case00_3000_q.csv -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 32 bit testv/stvFOA48c.pcm_planarSBA_12800032-32_BinauralRoomReverb_Config_renderer_Headrot_BinauralFile.tst
// MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out
../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 13200 48 testv/stv1MASA1TC48c.wav bit ../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 13200 48 testv/stv1MASA1TC48c.wav bit
...@@ -852,19 +892,19 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -852,19 +892,19 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec HOA3 48 bit_error testv/stv1MASA1TC48c.wav_16400_48-48_HOA3_FER5.tst ../IVAS_dec HOA3 48 bit_error testv/stv1MASA1TC48c.wav_16400_48-48_HOA3_FER5.tst
// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out
../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit ../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom.tst
// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out
../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit ../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Subframe.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Subframe.tst
// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation
../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit ../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit
../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Headrot.tst ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Headrot.tst
// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, external orientation // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation, external orientation
../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit ../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Headrot_EXOF.tst
...@@ -911,23 +951,23 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -911,23 +951,23 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 24400 48 testv/stv1MASA2TC48c.wav bit ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 24400 48 testv/stv1MASA2TC48c.wav bit
../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_24400_48-48_STEREO.tst ../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_24400_48-48_STEREO.tst
// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out
../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom.tst
// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation
../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit
../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst
// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, external orientation // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation, external orientation
../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot_EXOF.tst
// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation, Orientation tracking
../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit
../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst
// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation, Orientation tracking, external orientation
../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_EXOF_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_EXOF_OtrAvg.tst
...@@ -1088,11 +1128,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1088,11 +1128,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_Headrot_EXOF.tst
// Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation
../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_room_Headrot.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_room_Headrot.tst
// Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, external orientation // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, Headrotation, external orientation
../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_room_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_room_Headrot_EXOF.tst
...@@ -1118,7 +1158,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1118,7 +1158,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
../IVAS_dec STEREO 48 bit_error testv/stv51MC48c.wav_MC51_256000_48-48_stereo_FER5.tst ../IVAS_dec STEREO 48 bit_error testv/stv51MC48c.wav_MC51_256000_48-48_stereo_FER5.tst
// Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out
../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_192000_48-48_BinauralRoom.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_192000_48-48_BinauralRoom.tst
...@@ -1126,19 +1166,19 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1126,19 +1166,19 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit
../IVAS_dec MONO 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_mono.tst ../IVAS_dec MONO 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_mono.tst
// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, head rotation
../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot.tst
// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, external orientation // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, head rotation, external orientation
../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot_EXOF.tst ../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot_EXOF.tst
// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, head rotation, Orientation tracking
../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst
// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking, external orientation // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, head rotation, Orientation tracking, external orientation
../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit
../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_EXOF_OtrAvg.tst ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_EXOF_OtrAvg.tst
...@@ -1192,6 +1232,18 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1192,6 +1232,18 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -mc 7_1_4 160000 48 testv/stv714MC48c.wav bit ../IVAS_cod -mc 7_1_4 160000 48 testv/stv714MC48c.wav bit
../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_160000_48-48_MC714.tst ../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_160000_48-48_MC714.tst
// Multi-channel 7_1_4 at 160 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out, fr 5ms
../IVAS_cod -mc 7_1_4 160000 48 testv/stv714MC48c.wav bit
../IVAS_dec -fr 5 BINAURAL_ROOM_IR 48 bit testv/stv714MC48c.wav_MC714_160000_48-48_MC_binaural_room_fr5.tst
// Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, with headtracking, BINAURAL out, fr 5ms
../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit
../IVAS_dec -fr 5 -t testv/headrot.csv BINAURAL 48 bit testv/stv714MC48c.wav_MC714_512000_48-48_MC_binaural_ht_fr5.tst
// Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL out, fr 5ms
../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit
../IVAS_dec -fr 5 -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_binaural_ht_fr5.tst
// Multi-channel 5_1_2 at 32 kbps, 48kHz in, 48kHz out, STEREO out, random FER at 5% // Multi-channel 5_1_2 at 32 kbps, 48kHz in, 48kHz out, STEREO out, random FER at 5%
../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.wav bit ../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.wav bit
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error
...@@ -1548,6 +1600,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1548,6 +1600,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -ism_sba 1 1 testv/stvISM1.csv 32000 48 testv/stvOSBA_1ISM_FOA48c.wav bit ../IVAS_cod -ism_sba 1 1 testv/stvISM1.csv 32000 48 testv/stvOSBA_1ISM_FOA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_1ISM_FOA48c.wav_BINAURAL_32000_48-48.tst ../IVAS_dec BINAURAL 48 bit testv/stvOSBA_1ISM_FOA48c.wav_BINAURAL_32000_48-48.tst
// OSBA FOA 1ISM at 48 kbps, 16kHz in, 16kHz out, BINAURAL_ROOM_REVERB (Model from file) out
../IVAS_cod -ism_sba 1 1 testv/stvISM1.csv 32000 16 testv/stvOSBA_1ISM_FOA16c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL_ROOM_REVERB 16 bit testv/stvOSBA_1ISM_FOA16c.wav_BINAURAL_ROOM_REVERB_32000_16-16.tst
// OSBA FOA 2ISM at 64 kbps, 48kHz in, 48kHz out, HOA3 out // OSBA FOA 2ISM at 64 kbps, 48kHz in, 48kHz out, HOA3 out
../IVAS_cod -ism_sba 2 1 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stvOSBA_2ISM_FOA48c.wav bit ../IVAS_cod -ism_sba 2 1 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stvOSBA_2ISM_FOA48c.wav bit
../IVAS_dec HOA3 48 bit testv/stvOSBA_2ISM_FOA48c.wav_HOA3_64000_48-48.tst ../IVAS_dec HOA3 48 bit testv/stvOSBA_2ISM_FOA48c.wav_HOA3_64000_48-48.tst
...@@ -1560,9 +1616,13 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1560,9 +1616,13 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -ism_sba 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stvOSBA_4ISM_FOA48c.wav bit ../IVAS_cod -ism_sba 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stvOSBA_4ISM_FOA48c.wav bit
../IVAS_dec EXT 48 bit testv/stvOSBA_4ISM_FOA48c.wav_EXT_256000_48-48.tst ../IVAS_dec EXT 48 bit testv/stvOSBA_4ISM_FOA48c.wav_EXT_256000_48-48.tst
// OSBA FOA 4ISM at 512 kbps, 48kHz in, 48kHz out, BINAURAL out // OSBA FOA 4ISM at 512 kbps, 48kHz in, 48kHz out, BINAURAL (Model from file) out
../IVAS_cod -ism_sba 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_FOA48c.wav bit ../IVAS_cod -ism_sba 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_FOA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_4ISM_FOA48c.wav_BINAURAL_512000_48-48.tst ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stvOSBA_4ISM_FOA48c.wav_BINAURAL_512000_48-48.tst
// OSBA FOA 4ISM at 384 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR (Model from file) out
../IVAS_cod -ism_sba 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 384000 32 testv/stvOSBA_4ISM_FOA32c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL_ROOM_IR 32 bit testv/stvOSBA_4ISM_FOA32c.wav_BINAURAL_384000_32-32.tst
// OSBA 2OA 1ISM at 24.4 kbps, 48kHz in, 48kHz out, FOA out // OSBA 2OA 1ISM at 24.4 kbps, 48kHz in, 48kHz out, FOA out
../IVAS_cod -ism_sba 1 2 testv/stvISM1.csv 24400 48 testv/stvOSBA_1ISM_2OA48c.wav bit ../IVAS_cod -ism_sba 1 2 testv/stvISM1.csv 24400 48 testv/stvOSBA_1ISM_2OA48c.wav bit
...@@ -1572,6 +1632,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1572,6 +1632,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv 48000 48 testv/stvOSBA_2ISM_2OA48c.wav bit ../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv 48000 48 testv/stvOSBA_2ISM_2OA48c.wav bit
../IVAS_dec MONO 48 bit testv/stvOSBA_2ISM_2OA48c.wav_MONO_48000_48-48.tst ../IVAS_dec MONO 48 bit testv/stvOSBA_2ISM_2OA48c.wav_MONO_48000_48-48.tst
// OSBA 2OA 2ISM at 64 kbps, 32kHz in, 16kHz out, BINAURAL ROOM REVERB out
../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv 48000 32 testv/stvOSBA_2ISM_2OA32c.wav bit
../IVAS_dec BINAURAL_ROOM_REVERB 16 bit testv/stvOSBA_2ISM_2OA32c.wav_MONO_64000_32-16.tst
// OSBA 2OA 3ISM at 96 kbps, 48kHz in, 48kHz out, STEREO out // OSBA 2OA 3ISM at 96 kbps, 48kHz in, 48kHz out, STEREO out
../IVAS_cod -ism_sba 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 96000 48 testv/stvOSBA_3ISM_2OA48c.wav bit ../IVAS_cod -ism_sba 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 96000 48 testv/stvOSBA_3ISM_2OA48c.wav bit
../IVAS_dec STEREO 48 bit testv/stvOSBA_3ISM_2OA48c.wav_STEREO_96000_48-48.tst ../IVAS_dec STEREO 48 bit testv/stvOSBA_3ISM_2OA48c.wav_STEREO_96000_48-48.tst
...@@ -1592,11 +1656,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1592,11 +1656,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
../IVAS_cod -ism_sba 3 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stvOSBA_3ISM_3OA48c.wav bit ../IVAS_cod -ism_sba 3 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stvOSBA_3ISM_3OA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_3ISM_3OA48c.wav_BINAURAL_128000_48-48.tst ../IVAS_dec BINAURAL 48 bit testv/stvOSBA_3ISM_3OA48c.wav_BINAURAL_128000_48-48.tst
// OSBA 3OA 3ISM at 160 kbps, 16kHz in, 48kHz out, BINAURAL ROOM IR out
../IVAS_cod -ism_sba 3 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 160000 16 testv/stvOSBA_3ISM_3OA16c.wav bit
../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stvOSBA_3ISM_3OA416c.wav_BINAURAL_ROOM_IR_160000_16-48.tst
// OSBA 3OA 4ISM at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out // OSBA 3OA 4ISM at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out
../IVAS_cod -ism_sba 4 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 16400 48 testv/stvOSBA_4ISM_3OA48c.wav bit ../IVAS_cod -ism_sba 4 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 16400 48 testv/stvOSBA_4ISM_3OA48c.wav bit
../IVAS_dec 5_1 48 bit testv/stvOSBA_4ISM_3OA48c.wav_5_1_16400_48-48.tst ../IVAS_dec 5_1 48 bit testv/stvOSBA_4ISM_3OA48c.wav_5_1_16400_48-48.tst
// OSBA 3OA 4ISM bitrate switching 13.2 to 512, 48kHz in, 48kHz out, BIN out // OSBA 3OA 4ISM bitrate switching 13.2 to 512, 48kHz in, 48kHz out, BINAURAL out
../IVAS_cod -ism_sba 4 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stvOSBA_4ISM_3OA48c.wav bit ../IVAS_cod -ism_sba 4 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stvOSBA_4ISM_3OA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_4ISM_3OA48c.wav_BINAURAL_sw_13k2_512k_48-48.tst ../IVAS_dec BINAURAL 48 bit testv/stvOSBA_4ISM_3OA48c.wav_BINAURAL_sw_13k2_512k_48-48.tst
...@@ -1626,6 +1694,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -1626,6 +1694,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g192 bit_error eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g192 bit_error
../IVAS_dec STEREO 32 bit_error testv/stvOSBA_3ISM_2OA48c.wav_STEREO_sw_48-32_FER10.tst ../IVAS_dec STEREO 32 bit_error testv/stvOSBA_3ISM_2OA48c.wav_STEREO_sw_48-32_FER10.tst
// OSBA 3ISM 3OA at bitrate switching 13.2 to 512 kbps, 48kHz in, 32kHz out, BINAURAL ROOM REVERB out
../IVAS_cod -ism_sba 3 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stvOSBA_3ISM_3OA48c.wav bit
../IVAS_dec BINAURAL_ROOM_REVERB 32 bit testv/stvOSBA_3ISM_2OA48c.wav_BINAURAL_ROOM_REVERB_sw_48-32.tst
// OSBA planar FOA 1ISM at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out // OSBA planar FOA 1ISM at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out
../IVAS_cod -ism_sba 1 -1 testv/stvISM1.csv 256000 48 testv/stvOSBA_1ISM_FOA48c.wav bit ../IVAS_cod -ism_sba 1 -1 testv/stvISM1.csv 256000 48 testv/stvOSBA_1ISM_FOA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_1ISM_pFOA48c.wav_BINAURAL_256000_48-48.tst ../IVAS_dec BINAURAL 48 bit testv/stvOSBA_1ISM_pFOA48c.wav_BINAURAL_256000_48-48.tst
...@@ -1634,6 +1706,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g ...@@ -1634,6 +1706,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g
../IVAS_cod -ism_sba 2 -1 testv/stvISM1.csv testv/stvISM2.csv 512000 48 testv/stvOSBA_2ISM_FOA48c.wav bit ../IVAS_cod -ism_sba 2 -1 testv/stvISM1.csv testv/stvISM2.csv 512000 48 testv/stvOSBA_2ISM_FOA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_2ISM_pFOA48c.wav_BINAURAL_512000_48-48.tst ../IVAS_dec BINAURAL 48 bit testv/stvOSBA_2ISM_pFOA48c.wav_BINAURAL_512000_48-48.tst
// OSBA planar 3OA 4ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL out // OSBA planar 3OA 4ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM IR out
../IVAS_cod -ism_sba 4 -3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_3OA48c.wav bit ../IVAS_cod -ism_sba 4 -3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_3OA48c.wav bit
../IVAS_dec BINAURAL 48 bit testv/stvOSBA_4ISM_p3OA48c.wav_BINAURAL_512000_48-48.tst ../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stvOSBA_4ISM_p3OA48c.wav_BINAURAL_ROOM_IR_512000_48-48.tst
// OSBA planar 2OA 4ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM REVERB (Model from file) out
../IVAS_cod -ism_sba 4 -2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_2OA48c.wav bit
../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL_ROOM_REVERB 48 bit testv/stvOSBA_4ISM_p3OA48c.wav_BINAURAL_ROOM_REVERB_512000_48-48.tst
...@@ -401,7 +401,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ...@@ -401,7 +401,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1
// 3 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, EXT out // 3 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, EXT out
../IVAS_cod -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv 48000 48 testv/ltv48_3ISM.wav bit ../IVAS_cod -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv 48000 48 testv/ltv48_3ISM.wav bit
../IVAS_dec MONO 48 bit testv/ltv48_3ISM.48000_48-48_MONO.tst ../IVAS_dec EXT 48 bit testv/ltv48_3ISM.48000_48-48_MONO.tst
// 3 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, EXT out // 3 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, EXT out
../IVAS_cod -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv 64000 48 testv/ltv48_3ISM.wav bit ../IVAS_cod -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv 64000 48 testv/ltv48_3ISM.wav bit
......
#!/usr/bin/env python3
import argparse
from xml.etree import ElementTree
"""
Parse a junit report and create a MLD summary report.
"""
# Main routine
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Parse a junit report and create a MLD summary report.')
parser.add_argument('xml_report',type=str,help='XML junit report input file, e.g. report-junit.xml')
parser.add_argument('csv_file',type=str,help='Output CSV file, e.g. mld.csv')
args = parser.parse_args()
xml_report = args.xml_report
csv_file = args.csv_file
tree = ElementTree.parse(xml_report)
testsuite = tree.find(".//testsuite")
print(f"Found testsuite with {testsuite.get('tests')} tests and {testsuite.get('failures')} failures.")
testcases = tree.findall(".//testcase")
with open(csv_file,'w') as outfile:
for testcase in testcases:
fulltestname = testcase.get('file') + "::" + testcase.get('name')
system_out = testcase.find(".//system-out")
mld_val = None
if system_out is not None:
for line in system_out.text.split('\n'):
if line.startswith('MLD:'):
mld_val = float(line.split()[1])
outfile.write(fulltestname + ';' + str(mld_val)+'\n')
...@@ -38,12 +38,10 @@ import numpy as np ...@@ -38,12 +38,10 @@ import numpy as np
from pyaudio3dtools import audiofile, audioarray from pyaudio3dtools import audiofile, audioarray
FS = [48, 32, 16]
# scripts/testv/ path # scripts/testv/ path
input_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv') input_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv')
if 'TESTV_DIR' in os.environ:
output_dir = os.environ['TESTV_DIR']
else:
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv') output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv')
print(f'Writing new files into {output_dir}') print(f'Writing new files into {output_dir}')
...@@ -52,24 +50,24 @@ print(f'Writing new files into {output_dir}') ...@@ -52,24 +50,24 @@ print(f'Writing new files into {output_dir}')
force_overwrite = False # overwrite existing files force_overwrite = False # overwrite existing files
# define MASA test item files # define MASA test item files
masa_alts = ({'masa_meta_file': 'stv2MASA2TC48c.met', masa_alts = ({'masa_meta_file': 'stv2MASA2TC{}c.met',
'masa_audio_file': 'stv2MASA2TC48c.wav', 'masa_audio_file': 'stv2MASA2TC{}c.wav',
'masa_tag': '2MASA2TC'}, 'masa_tag': '2MASA2TC'},
{'masa_meta_file': 'stv2MASA1TC48c.met', {'masa_meta_file': 'stv2MASA1TC{}c.met',
'masa_audio_file': 'stv2MASA1TC48c.wav', 'masa_audio_file': 'stv2MASA1TC{}c.wav',
'masa_tag': '2MASA1TC'}, 'masa_tag': '2MASA1TC'},
{'masa_meta_file': 'stv1MASA2TC48c.met', {'masa_meta_file': 'stv1MASA2TC{}c.met',
'masa_audio_file': 'stv1MASA2TC48c.wav', 'masa_audio_file': 'stv1MASA2TC{}c.wav',
'masa_tag': '1MASA2TC'}, 'masa_tag': '1MASA2TC'},
{'masa_meta_file': 'stv1MASA1TC48c.met', {'masa_meta_file': 'stv1MASA1TC{}c.met',
'masa_audio_file': 'stv1MASA1TC48c.wav', 'masa_audio_file': 'stv1MASA1TC{}c.wav',
'masa_tag': '1MASA1TC'}) 'masa_tag': '1MASA1TC'})
sba_alts = ({'sba_audio_file': 'stvFOA48c.wav', sba_alts = ({'sba_audio_file': 'stvFOA{}c.wav',
'sba_tag': 'FOA'}, 'sba_tag': 'FOA'},
{'sba_audio_file': 'stv2OA48c.wav', {'sba_audio_file': 'stv2OA{}c.wav',
'sba_tag': '2OA'}, 'sba_tag': '2OA'},
{'sba_audio_file': 'stv3OA48c.wav', {'sba_audio_file': 'stv3OA{}c.wav',
'sba_tag': '3OA'}) 'sba_tag': '3OA'})
# files containing 1-4 ISMs as channels # files containing 1-4 ISMs as channels
...@@ -78,20 +76,26 @@ ism_files = ('stv1ISM48s.wav', 'stv2ISM48s.wav', 'stv3ISM48s.wav', 'stv4ISM48s.w ...@@ -78,20 +76,26 @@ ism_files = ('stv1ISM48s.wav', 'stv2ISM48s.wav', 'stv3ISM48s.wav', 'stv4ISM48s.w
ism_meta_files = ('stvISM1.csv', 'stvISM2.csv', 'stvISM3.csv', 'stvISM4.csv') ism_meta_files = ('stvISM1.csv', 'stvISM2.csv', 'stvISM3.csv', 'stvISM4.csv')
wrote_files = [] wrote_files = []
for fs in FS:
for enum_idx, (ism_audio_file, ism_meta_file) in enumerate(zip(ism_files, ism_meta_files)): for enum_idx, (ism_audio_file, ism_meta_file) in enumerate(zip(ism_files, ism_meta_files)):
n_isms = enum_idx + 1 n_isms = enum_idx + 1
ism_audio, ism_fs = audiofile.readfile(filename=os.path.join(input_dir, ism_audio_file)) ism_audio, ism_fs = audiofile.readfile(filename=os.path.join(input_dir, ism_audio_file))
# no stv MASA files in other sampling rates available currently
if fs == 48:
for masa_item in masa_alts: for masa_item in masa_alts:
masa_tag = masa_item['masa_tag'] masa_tag = masa_item['masa_tag']
masa_audio_file = masa_item['masa_audio_file'].format(fs)
meta_file = masa_item['masa_meta_file'].format(fs)
omasa_file_body = f'stvOMASA_{n_isms}ISM_{masa_tag}48c' omasa_file_body = f'stvOMASA_{n_isms}ISM_{masa_tag}{fs}c'
omasa_file = os.path.join(output_dir, f'{omasa_file_body}.wav') omasa_file = os.path.join(output_dir, f'{omasa_file_body}.wav')
if not os.path.exists(omasa_file) or force_overwrite: if not os.path.exists(omasa_file) or force_overwrite:
audiofile.combinefiles(in_filenames=[os.path.join(input_dir, ism_audio_file), audiofile.combinefiles(in_filenames=[os.path.join(input_dir, ism_audio_file),
os.path.join(input_dir, masa_item['masa_audio_file'])], os.path.join(input_dir, masa_audio_file)],
out_file=omasa_file) out_file=omasa_file,
in_fs=fs * 1000)
wrote_files.append(omasa_file) wrote_files.append(omasa_file)
# copy ISM metadata files under names matching the combined file # copy ISM metadata files under names matching the combined file
...@@ -102,21 +106,24 @@ for enum_idx, (ism_audio_file, ism_meta_file) in enumerate(zip(ism_files, ism_me ...@@ -102,21 +106,24 @@ for enum_idx, (ism_audio_file, ism_meta_file) in enumerate(zip(ism_files, ism_me
wrote_files.append(ism_file_name) wrote_files.append(ism_file_name)
# copy MASA metadata file under a matching name # copy MASA metadata file under a matching name
masa_meta_name = os.path.join(output_dir, f'{omasa_file_body}{os.path.splitext(masa_item["masa_meta_file"])[1]}') masa_meta_name = os.path.join(output_dir, f'{omasa_file_body}{os.path.splitext(meta_file)[1]}')
if not os.path.exists(masa_meta_name) or force_overwrite: if not os.path.exists(masa_meta_name) or force_overwrite:
shutil.copyfile(os.path.join(input_dir, masa_item['masa_meta_file']), masa_meta_name) shutil.copyfile(os.path.join(input_dir, meta_file), masa_meta_name)
wrote_files.append(masa_meta_name) wrote_files.append(masa_meta_name)
for sba_item in sba_alts: for sba_item in sba_alts:
sba_tag = sba_item['sba_tag'] sba_tag = sba_item['sba_tag']
sba_audio_file = sba_item['sba_audio_file'].format(fs)
osba_file_body = f'stvOSBA_{n_isms}ISM_{sba_tag}48c' osba_file_body = f'stvOSBA_{n_isms}ISM_{sba_tag}{fs}c'
osba_file = os.path.join(output_dir, f'{osba_file_body}.wav') osba_file = os.path.join(output_dir, f'{osba_file_body}.wav')
if not os.path.exists(osba_file) or force_overwrite: if not os.path.exists(osba_file) or force_overwrite:
audiofile.combinefiles(in_filenames=[os.path.join(input_dir, ism_audio_file), audiofile.combinefiles(in_filenames=[os.path.join(input_dir, ism_audio_file),
os.path.join(input_dir, sba_item['sba_audio_file'])], os.path.join(input_dir, sba_audio_file)],
out_file=osba_file) out_file=osba_file,
in_fs=fs * 1000)
wrote_files.append(osba_file) wrote_files.append(osba_file)
# copy ISM metadata files under names matching the combined file # copy ISM metadata files under names matching the combined file
......
...@@ -759,6 +759,8 @@ class IvasModeAnalyzer(IvasModeCollector): ...@@ -759,6 +759,8 @@ class IvasModeAnalyzer(IvasModeCollector):
if num_total_errors == 0: if num_total_errors == 0:
self.logger.console("{} reports no errors".format(self.check), logging.INFO) self.logger.console("{} reports no errors".format(self.check), logging.INFO)
return num_total_errors
def get_valgrind_errors(self): def get_valgrind_errors(self):
total_vg_errors = 0 total_vg_errors = 0
...@@ -799,12 +801,16 @@ class IvasModeAnalyzer(IvasModeCollector): ...@@ -799,12 +801,16 @@ class IvasModeAnalyzer(IvasModeCollector):
), ),
logging.ERROR, logging.ERROR,
) )
return build_errors
def get_errors(self, failed_modes): def get_errors(self, failed_modes):
""" """ """ """
self.get_build_errors() n_build_err = self.get_build_errors()
n_run_err = 0
if self.check in ["CLANG1", "CLANG2", "CLANG3", "VALGRIND"]: if self.check in ["CLANG1", "CLANG2", "CLANG3", "VALGRIND"]:
self.get_run_errors(failed_modes) n_run_err = self.get_run_errors(failed_modes)
return n_build_err, n_run_err
def set_select_list(self, select_list): def set_select_list(self, select_list):
self.log_select_list = select_list self.log_select_list = select_list
......
...@@ -50,6 +50,8 @@ import pyaudio3dtools.audiofile as af ...@@ -50,6 +50,8 @@ import pyaudio3dtools.audiofile as af
import pyaudio3dtools.audioarray as ar import pyaudio3dtools.audioarray as ar
BW_TO_SR = {"nb": 8, "wb": 16, "swb": 32, "fb": 48} BW_TO_SR = {"nb": 8, "wb": 16, "swb": 32, "fb": 48}
RET_CODE_TIMEOUT_EXP = 9999
class Error(Exception): class Error(Exception):
pass pass
...@@ -68,6 +70,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -68,6 +70,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
dir_name=".", dir_name=".",
bin_suffix="", bin_suffix="",
test_tool="", test_tool="",
run_env={},
silent=False, silent=False,
site_config="", site_config="",
sample_rate_enc_in=None, sample_rate_enc_in=None,
...@@ -84,6 +87,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -84,6 +87,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
console_logger_level="", console_logger_level="",
logger_name="IvasBaseClass", logger_name="IvasBaseClass",
log_level=logging.DEBUG, log_level=logging.DEBUG,
timeout=None,
): ):
super().__init__( super().__init__(
...@@ -96,6 +100,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -96,6 +100,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
logger_name=logger_name, logger_name=logger_name,
log_level=log_level, log_level=log_level,
) )
self.timeout = timeout
self.lock = threading.Lock() self.lock = threading.Lock()
self.dec_queue = None self.dec_queue = None
self.enc_queue = None self.enc_queue = None
...@@ -115,6 +120,8 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -115,6 +120,8 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
self.decoder = "" self.decoder = ""
self.bin_suffix = bin_suffix self.bin_suffix = bin_suffix
self.test_tool = test_tool self.test_tool = test_tool
self.run_env = os.environ.copy()
self.run_env.update(run_env)
self.silent = silent self.silent = silent
self.failed_threads = None self.failed_threads = None
self.max_workers = max_workers self.max_workers = max_workers
...@@ -314,13 +321,22 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -314,13 +321,22 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
+ [enc_file_name, dec_file_name] + [enc_file_name, dec_file_name]
) )
cur_dec_result = subprocess.run(dec_cmd, capture_output=True, text=True)
dec_log.write(" ".join(dec_cmd)) dec_log.write(" ".join(dec_cmd))
try:
cur_dec_result = subprocess.run(dec_cmd, capture_output=True, text=True, env=self.run_env, timeout=self.timeout)
returncode = cur_dec_result.returncode
dec_log.write(cur_dec_result.stderr) dec_log.write(cur_dec_result.stderr)
dec_log.write(cur_dec_result.stdout) dec_log.write(cur_dec_result.stdout)
if cur_dec_result.returncode != 0: except subprocess.TimeoutExpired:
returncode = RET_CODE_TIMEOUT_EXP
if returncode != 0:
fail_string = "Decoding {} to {} failed!"
if returncode == RET_CODE_TIMEOUT_EXP:
fail_string = fail_string[:-1] + f" due to timeout after {self.timeout} seconds!"
self.logger.error( self.logger.error(
"Decoding {} to {} failed!".format(enc_file_name, dec_file_name) fail_string.format(enc_file_name, dec_file_name)
) )
self.lock.acquire() self.lock.acquire()
if self.stats: if self.stats:
...@@ -328,9 +344,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -328,9 +344,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
self.show_progress() self.show_progress()
self.results.append( self.results.append(
[ [
"Decoding failed to {} for {}".format( fail_string.format(output_config, enc_file_name),
output_config, enc_file_name
),
config["ivas_format"], config["ivas_format"],
enc_dec_cmd["table_name"], enc_dec_cmd["table_name"],
dec_log_name, dec_log_name,
...@@ -703,10 +717,13 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -703,10 +717,13 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
enc_log = open(enc_log_name, "w") enc_log = open(enc_log_name, "w")
enc_log.write(" ".join(enc_cmd)) enc_log.write(" ".join(enc_cmd))
enc_result = subprocess.run(enc_cmd, capture_output=True, text=True) try:
enc_result = subprocess.run(enc_cmd, capture_output=True, text=True, env=self.run_env, timeout=self.timeout)
error = enc_result.returncode error = enc_result.returncode
enc_log.write(enc_result.stderr) enc_log.write(enc_result.stderr)
enc_log.write(enc_result.stdout) enc_log.write(enc_result.stdout)
except subprocess.TimeoutExpired:
error = RET_CODE_TIMEOUT_EXP
if error == 0 and "bitstream_processing" in enc_dec_cmd: if error == 0 and "bitstream_processing" in enc_dec_cmd:
bs_in_file = enc_file_name bs_in_file = enc_file_name
...@@ -794,13 +811,17 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -794,13 +811,17 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
self.lock.release() self.lock.release()
if error != 0: if error != 0:
fail_string = "Encoding failed for {}"
if error == RET_CODE_TIMEOUT_EXP:
fail_string = fail_string + f" due to timeout after {self.timeout} seconds"
self.lock.acquire() self.lock.acquire()
if self.stats: if self.stats:
self.stats["num_enc_errors"] += 1 self.stats["num_enc_errors"] += 1
self.show_progress() self.show_progress()
self.results.append( self.results.append(
[ [
"Encoding failed for {}".format(enc_file_name), fail_string.format(enc_file_name),
mode, mode,
enc_dec_cmd["table_name"], enc_dec_cmd["table_name"],
enc_log_name, enc_log_name,
...@@ -808,7 +829,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): ...@@ -808,7 +829,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
) )
self.failed_modes["enc"].append(mode) self.failed_modes["enc"].append(mode)
self.lock.release() self.lock.release()
self.logger.error("Encoding failed for {}".format(enc_file_name)) self.logger.error(fail_string.format(enc_file_name))
else: else:
self.logger.info("Encoding successful for {}".format(enc_file_name)) self.logger.info("Encoding successful for {}".format(enc_file_name))
......