From 1cf189c7388a713834f052126ed8debd2e8f128b Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 18 Oct 2022 15:51:43 +0200 Subject: [PATCH 1/4] fix compile errors with DEBUG_SBA and DEBUG_SBA_MD_DUMP --- lib_debug/sba_debug.c | 2 +- lib_debug/sba_debug.h | 2 +- lib_dec/ivas_spar_md_dec.c | 29 ++++++++++++++++------------- lib_enc/ivas_spar_encoder.c | 1 + 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index fb3b208f3f..68fd39f4c0 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -185,7 +185,7 @@ static void UpdateWave( void ivas_spar_dump_signal_wav( const int16_t input_frame, float **ppPcm, - float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], + float pcm_array[IVAS_SPAR_MAX_CH][L_FRAME48k], const int16_t no_channel, WAVEFILEOUT *wave_file, char *location ) diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 8153929286..86e07e5a41 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -50,7 +50,7 @@ extern WAVEFILEOUT *spar_foa_dec_wav[4]; void ivas_close_agc_debug_files( void ); void ivas_open_agc_debug_files( int16_t agc ); #endif -void ivas_spar_dump_signal_wav( const int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], const int16_t no_channel, WAVEFILEOUT *wave_file, char *location ); +void ivas_spar_dump_signal_wav( const int16_t input_frame, float **ppPcm, float pcm_array[IVAS_SPAR_MAX_CH][L_FRAME48k], const int16_t no_channel, WAVEFILEOUT *wave_file, char *location ); void ivas_close_sba_encoder_debug_files( void ); void ivas_open_sba_encoder_debug_files( const int32_t fs, const int16_t n_transport, const char *file_tag, const int32_t ivas_total_brate, const int16_t dtx_on ); void ivas_close_sba_decoder_debug_files( const int32_t fs, const int16_t n_ch, const int16_t n_transport, const int16_t pca_ingest_channels ); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 7f01f64c0f..d91b893733 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -645,7 +645,7 @@ void ivas_spar_md_dec_process( ( b == 0 && frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; for ( j = 0; j < ( hMdDec->spar_md_cfg.num_decorr_per_band[bw * b] - hMdDec->spar_md_cfg.num_dmx_chans_per_band[bw * b] ); j++ ) { - for ( int16_t k = 0; k < hMdDec->spar_md_cfg.num_dmx_chans_per_band[bw * b] - 1; k++ ) + for ( k = 0; k < hMdDec->spar_md_cfg.num_dmx_chans_per_band[bw * b] - 1; k++ ) { dbgwrite( &hMdDec->spar_md.band_coeffs[b].C_re[j][k], sizeof( float ), 1, 1, f_name ); } @@ -1397,21 +1397,24 @@ void ivas_spar_dec_gen_umx_mat( } } } -#ifdef SPAR_HOA_DBG - - /* for ( b = 0; b < 1; b++) +#ifdef DEBUG_SBA_MD_DUMP { - fprintf( stdout, "\n\nMixer Matrix band %d\n\n", b ); - for ( i = 0; i < num_out_ch; i++ ) + static FILE *f_mat = 0; + + if ( f_mat == 0 ) + f_mat = fopen( "mixer_mat_dec", "w" ); + + for ( i = 0; i < num_out_ch; i++ ) + { + for ( j = 0; j < num_out_ch; j++ ) { - for ( j = 0; j < num_out_ch; j++ ) - { - fprintf( stdout, "%.2f,\t", hMdDec->mixer_mat[i][j][0][b] ); - } - fprintf( stdout, "\n" ); + for ( b = 0; b < num_bands_out; b++ ) + { + fprintf( f_mat, "%f\n", hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ); + } } - fprintf( stdout, "\n" ); - }*/ + } + } #endif ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi ); diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 6c17a5711e..988a8fa013 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -788,6 +788,7 @@ static ivas_error ivas_spar_enc_process( #ifdef DEBUG_SBA_MD_DUMP { + int16_t k; static FILE *f_mat = 0; if ( f_mat == 0 ) -- GitLab From df85da53ea3e38673f313dd9ad7827d2235aa588 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 19 Oct 2022 09:47:58 +0200 Subject: [PATCH 2/4] fix compiler warning --- lib_com/options.h | 4 ++-- lib_enc/ivas_spar_md_enc.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5906991cdf..ce0fa4da5a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,10 +114,10 @@ /*#define TDREND_HRTF_TABLE_METHODS*/ /* Enable HRTF lookup from tables, for testing & evaluation. Supply file in table format to use. Note that a suitable HR filter lookup method should be written if the filters sample point grids are not in the formats. */ /*#define TDREND_STANDALONE*/ /* Used when renderer is built in standalone form, without IVAS encoding/decoding (see scripts/object_renderer_standalone). This is just here to ensure this is cleaned out by prepare_instrumentation.sh */ -/*#define DEBUG_SBA*/ /* debug DIRAC/SPAR in-out */ +#define DEBUG_SBA /* debug DIRAC/SPAR in-out */ #ifdef DEBUG_SBA /*#define DEBUG_SBA_AUDIO_DUMP*/ /* SBA intermediate audio wav file dumping */ -/*#define DEBUG_SBA_MD_DUMP*/ /* SBA metadata and variable file dumping */ +#define DEBUG_SBA_MD_DUMP /* SBA metadata and variable file dumping */ /*#define DEBUG_SPAR_MD_TARGET_TUNING*/ /* SPAR MD target bitrate tuning debug code */ /*#define DEBUG_SPAR_BYPASS_EVS_CODEC*/ /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ /*#define DEBUG_SPAR_WRITE_OUT_COV*/ /* write covariance per frame into a text file for verification */ diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 7ae45903d5..ce8a0e3bc1 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -1033,6 +1033,8 @@ ivas_error ivas_spar_md_enc_process( byte_size = sizeof( float ); for ( b = 0; b < nB; b++ ) { + ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[b * bands_bw]; + sprintf( f_name, "spar_band_pred_coeffs.bin" ); ( b == 0 && frame == 0 ) ? dbgwrite( &nB, sizeof( nB ), 1, 1, f_name ) : false; num_elements = num_ch - 1; -- GitLab From 15b5ddad49a75daf2244b6f5836350a261da1297 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 19 Oct 2022 10:09:52 +0200 Subject: [PATCH 3/4] disable debug switches DEBUG_SBA and DEBUG_SBA_MD_DUMP again --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ce0fa4da5a..5906991cdf 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,10 +114,10 @@ /*#define TDREND_HRTF_TABLE_METHODS*/ /* Enable HRTF lookup from tables, for testing & evaluation. Supply file in table format to use. Note that a suitable HR filter lookup method should be written if the filters sample point grids are not in the formats. */ /*#define TDREND_STANDALONE*/ /* Used when renderer is built in standalone form, without IVAS encoding/decoding (see scripts/object_renderer_standalone). This is just here to ensure this is cleaned out by prepare_instrumentation.sh */ -#define DEBUG_SBA /* debug DIRAC/SPAR in-out */ +/*#define DEBUG_SBA*/ /* debug DIRAC/SPAR in-out */ #ifdef DEBUG_SBA /*#define DEBUG_SBA_AUDIO_DUMP*/ /* SBA intermediate audio wav file dumping */ -#define DEBUG_SBA_MD_DUMP /* SBA metadata and variable file dumping */ +/*#define DEBUG_SBA_MD_DUMP*/ /* SBA metadata and variable file dumping */ /*#define DEBUG_SPAR_MD_TARGET_TUNING*/ /* SPAR MD target bitrate tuning debug code */ /*#define DEBUG_SPAR_BYPASS_EVS_CODEC*/ /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ /*#define DEBUG_SPAR_WRITE_OUT_COV*/ /* write covariance per frame into a text file for verification */ -- GitLab From 13387473b44de732c19e7e8b23533c5fb8979f0d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 19 Oct 2022 11:23:07 +0200 Subject: [PATCH 4/4] move debug-output block inside the time-slot loop in ivas_spar_dec_gen_umx_mat --- lib_dec/ivas_spar_md_dec.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index d91b893733..f192228e81 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1396,26 +1396,27 @@ void ivas_spar_dec_gen_umx_mat( } } } - } + #ifdef DEBUG_SBA_MD_DUMP - { - static FILE *f_mat = 0; + { + static FILE *f_mat = 0; - if ( f_mat == 0 ) - f_mat = fopen( "mixer_mat_dec", "w" ); + if ( f_mat == 0 ) + f_mat = fopen( "mixer_mat_dec", "w" ); - for ( i = 0; i < num_out_ch; i++ ) - { - for ( j = 0; j < num_out_ch; j++ ) + for ( i = 0; i < num_out_ch; i++ ) { - for ( b = 0; b < num_bands_out; b++ ) + for ( j = 0; j < num_out_ch; j++ ) { - fprintf( f_mat, "%f\n", hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ); + for ( b = 0; b < num_bands_out; b++ ) + { + fprintf( f_mat, "%f\n", hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ); + } } } } - } #endif + } ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi ); -- GitLab