From 6b6d1c455b3a46907ce15a7c312fb4972310ec52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Thu, 21 Jul 2022 15:28:14 +0200 Subject: [PATCH 01/13] renamed spar_debug.[ch] to sba_debug.[ch] --- Workspace_msvc/lib_debug.vcxproj | 4 ++-- apps/decoder.c | 2 +- apps/encoder.c | 2 +- lib_debug/{spar_debug.c => sba_debug.c} | 2 +- lib_debug/{spar_debug.h => sba_debug.h} | 6 +++--- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_spar_decoder.c | 2 +- lib_enc/ivas_spar_encoder.c | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) rename lib_debug/{spar_debug.c => sba_debug.c} (99%) rename lib_debug/{spar_debug.h => sba_debug.h} (98%) diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 58dbb6aab7..2d55c30f20 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -147,7 +147,7 @@ - + @@ -155,7 +155,7 @@ - + diff --git a/apps/decoder.c b/apps/decoder.c index 14b0c19f3b..bfc81c9f5b 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -59,7 +59,7 @@ #include "render_config_reader.h" #ifdef DEBUG_SBA #include "ivas_cnst.h" -#include "spar_debug.h" +#include "sba_debug.h" int16_t numTransportChannels = 1; int16_t numOutChannels = 1; int16_t pca_ingest_channels = 1; diff --git a/apps/encoder.c b/apps/encoder.c index 8f82f3d0d6..4f063e03c0 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -53,7 +53,7 @@ #include "debug.h" #ifdef DEBUG_SBA #include "ivas_cnst.h" -#include "spar_debug.h" +#include "sba_debug.h" #endif #endif diff --git a/lib_debug/spar_debug.c b/lib_debug/sba_debug.c similarity index 99% rename from lib_debug/spar_debug.c rename to lib_debug/sba_debug.c index 619365735b..8f8bc6ce2a 100644 --- a/lib_debug/spar_debug.c +++ b/lib_debug/sba_debug.c @@ -38,7 +38,7 @@ #include "options.h" #include "ivas_cnst.h" #include "prot.h" -#include "spar_debug.h" +#include "sba_debug.h" #include #include "wmops.h" #ifdef DEBUG_SBA diff --git a/lib_debug/spar_debug.h b/lib_debug/sba_debug.h similarity index 98% rename from lib_debug/spar_debug.h rename to lib_debug/sba_debug.h index 8e8457e16a..43179e7f14 100644 --- a/lib_debug/spar_debug.h +++ b/lib_debug/sba_debug.h @@ -30,8 +30,8 @@ *******************************************************************************************************/ -#ifndef SPAR_DEBUG_H -#define SPAR_DEBUG_H +#ifndef SBA_DEBUG_H +#define SBA_DEBUG_H #include "options.h" #include @@ -67,4 +67,4 @@ void ivas_open_decoder_debug_files( spar_debug_t *dbg_params ); void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const uint32_t bps, WAVEFILEOUT *spar_wav ); #endif -#endif /* SPAR_DEBUG_H */ +#endif /* SBA_DEBUG_H */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 9acc451ea0..72a5d98f92 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -44,7 +44,7 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP #include "tinywaveout_c.h" -#include "spar_debug.h" +#include "sba_debug.h" float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_dec_wav[4]; extern int16_t numTransportChannels; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7dbb546760..643de0ddc2 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -46,7 +46,7 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP #include "tinywaveout_c.h" -#include "spar_debug.h" +#include "sba_debug.h" extern WAVEFILEOUT *spar_foa_dec_wav[4]; float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern int16_t numTransportChannels; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index ae95d02d24..0bd28634f7 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -45,7 +45,7 @@ #ifdef DEBUG_SBA_AUDIO_DUMP #include "tinywaveout_c.h" -#include "spar_debug.h" +#include "sba_debug.h" float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_enc_wav[3]; #endif -- GitLab From 6ba2131c414f62d6e0e85267833eb6b0927e0f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Thu, 21 Jul 2022 16:12:16 +0200 Subject: [PATCH 02/13] include sba_debug.h in debug.h --- apps/decoder.c | 3 +-- apps/encoder.c | 4 ---- lib_debug/debug.h | 3 +++ lib_debug/sba_debug.h | 1 + lib_dec/ivas_dec.c | 3 +-- lib_dec/ivas_spar_decoder.c | 3 +-- lib_enc/ivas_spar_encoder.c | 2 -- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index bfc81c9f5b..006907a6b1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -57,9 +57,8 @@ #include "debug.h" #endif #include "render_config_reader.h" + #ifdef DEBUG_SBA -#include "ivas_cnst.h" -#include "sba_debug.h" int16_t numTransportChannels = 1; int16_t numOutChannels = 1; int16_t pca_ingest_channels = 1; diff --git a/apps/encoder.c b/apps/encoder.c index 4f063e03c0..5c427cb542 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -51,10 +51,6 @@ #endif #ifdef DEBUGGING #include "debug.h" -#ifdef DEBUG_SBA -#include "ivas_cnst.h" -#include "sba_debug.h" -#endif #endif diff --git a/lib_debug/debug.h b/lib_debug/debug.h index 9b38b16b66..abf246674a 100644 --- a/lib_debug/debug.h +++ b/lib_debug/debug.h @@ -36,6 +36,9 @@ #include "options.h" #include #include +#ifdef DEBUG_SBA +#include "sba_debug.h" +#endif /*------------------------------------------------------------------------------------------* * Global variables used for debugging diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 43179e7f14..39b82de0d9 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -37,6 +37,7 @@ #include #include #ifdef DEBUG_SBA +#include "cnst.h" #include "tinywaveout_c.h" /*------------------------------------------------------------------------------------------* diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 72a5d98f92..70edf264d2 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -42,9 +42,8 @@ #include "debug.h" #endif #include "wmops.h" + #ifdef DEBUG_SBA_AUDIO_DUMP -#include "tinywaveout_c.h" -#include "sba_debug.h" float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_dec_wav[4]; extern int16_t numTransportChannels; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 643de0ddc2..7f21ef2a8b 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -44,9 +44,8 @@ #include #include #include "wmops.h" + #ifdef DEBUG_SBA_AUDIO_DUMP -#include "tinywaveout_c.h" -#include "sba_debug.h" extern WAVEFILEOUT *spar_foa_dec_wav[4]; float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern int16_t numTransportChannels; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 0bd28634f7..b65674dc52 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -44,8 +44,6 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP -#include "tinywaveout_c.h" -#include "sba_debug.h" float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_enc_wav[3]; #endif -- GitLab From cbdfaf966cf73a040d708bc6e2ef9f13876d9c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Thu, 21 Jul 2022 16:41:51 +0200 Subject: [PATCH 03/13] removed superfluous "extern int32_t frame;" --- lib_dec/ivas_spar_md_dec.c | 3 --- lib_enc/ivas_dirac_enc.c | 3 --- lib_enc/ivas_spar_md_enc.c | 3 --- 3 files changed, 9 deletions(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 412da7d5db..63fe83dfbe 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -42,9 +42,6 @@ #include #include "wmops.h" #include "ivas_stat_dec.h" -#ifdef DEBUG_SBA_MD_DUMP -extern int32_t frame; -#endif /*#define ENABLE_DITHER */ /* IVAS_fmToDo: development switch */ diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 05a8f83e7f..73789414d4 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -43,9 +43,6 @@ #include "debug.h" #endif #include "wmops.h" -#ifdef DEBUG_SBA_MD_DUMP -extern int32_t frame; -#endif /*------------------------------------------------------------------------- * Local function prototypes diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index f8fdc96edb..d3cce8ff03 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -41,9 +41,6 @@ #include "ivas_rom_com.h" #include #include "wmops.h" -#ifdef DEBUG_SBA_MD_DUMP -extern int32_t frame; -#endif /*------------------------------------------------------------------------------------------* -- GitLab From 936956b84b301162d68d0ed59e3c7e8b7608be40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Fri, 22 Jul 2022 10:37:15 +0200 Subject: [PATCH 04/13] tinywaveout_c.h: made const values static to allow for multiple inclusion --- lib_util/tinywaveout_c.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index bfa69199a8..39cde0d338 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -241,13 +241,8 @@ static WAVEFILEOUT *CreateWav( return CreateBWF( fileName, sampleRate, numChannels, bps ); } -#ifdef DEBUG_SBA -#define MAX_PCM16 ( 32767 ) -#define MIN_PCM16 ( -32768 ) -#else -const int16_t MAX_PCM16 = 32767; -const int16_t MIN_PCM16 = -32768; -#endif +static const int16_t MAX_PCM16 = 32767; +static const int16_t MIN_PCM16 = -32768; static __inline int32_t CLIP_PCM16( int32_t sample, uint32_t *clipcount ) @@ -271,13 +266,8 @@ static __inline int32_t CLIP_PCM16( return tmp; } -#ifdef DEBUG_SBA -#define MAX_PCM24 ( 8388607 ) -#define MIN_PCM24 ( -8388608 ) -#else -const int32_t MAX_PCM24 = 8388607; -const int32_t MIN_PCM24 = -8388608; -#endif +static const int32_t MAX_PCM24 = 8388607; +static const int32_t MIN_PCM24 = -8388608; static __inline int32_t CLIP_PCM24( int32_t sample, uint32_t *clipcount ) -- GitLab From e3af3a7da60e6d8dafd8b859e46517ebd6def0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Fri, 22 Jul 2022 11:59:16 +0200 Subject: [PATCH 05/13] decoder: simplified _debug_files() calls --- apps/decoder.c | 13 ++----------- lib_debug/sba_debug.c | 28 ++++++++++++++-------------- lib_debug/sba_debug.h | 4 ++-- lib_dec/ivas_dec.c | 1 - 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 006907a6b1..5f75ff66a1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -396,12 +396,7 @@ int main( } #ifdef DEBUG_SBA - spar_debug_t dbg_params; - dbg_params.fs = arg.output_Fs; - dbg_params.n_ch = numOutChannels; - dbg_params.n_transport = numTransportChannels; - dbg_params.pca_ingest_channels = pca_ingest_channels; - ivas_open_decoder_debug_files( &dbg_params ); + ivas_open_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels ); #endif /*-----------------------------------------------------------------* @@ -586,11 +581,7 @@ cleanup: } #ifdef DEBUG_SBA - dbg_params.fs = arg.output_Fs; - dbg_params.n_ch = numOutChannels; - dbg_params.n_transport = numTransportChannels; - dbg_params.pca_ingest_channels = pca_ingest_channels; - ivas_close_decoder_debug_files( &dbg_params ); + ivas_close_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels, pca_ingest_channels ); #endif #ifdef DEBUGGING dbgclose(); diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index 8f8bc6ce2a..21c02f6a33 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -219,26 +219,26 @@ float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k return ( db_value ); } -void ivas_close_decoder_debug_files( spar_debug_t *pDebug_params ) +void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ) { if ( spar_foa_dec_wav[0] != NULL ) { - UpdateWave( pDebug_params->fs, pDebug_params->n_transport, 32, spar_foa_dec_wav[0] ); + UpdateWave( fs, n_transport, 32, spar_foa_dec_wav[0] ); CloseWav( spar_foa_dec_wav[0] ); } if ( spar_foa_dec_wav[1] != NULL ) { - UpdateWave( pDebug_params->fs, pDebug_params->n_transport, 16, spar_foa_dec_wav[1] ); + UpdateWave( fs, n_transport, 16, spar_foa_dec_wav[1] ); CloseWav( spar_foa_dec_wav[1] ); } if ( spar_foa_dec_wav[2] != NULL ) { - UpdateWave( pDebug_params->fs, pDebug_params->pca_ingest_channels, 16, spar_foa_dec_wav[2] ); + UpdateWave( fs, pca_ingest_channels, 16, spar_foa_dec_wav[2] ); CloseWav( spar_foa_dec_wav[2] ); } if ( spar_foa_dec_wav[3] != NULL ) { - UpdateWave( pDebug_params->fs, pDebug_params->n_ch, 16, spar_foa_dec_wav[3] ); + UpdateWave( fs, n_ch, 16, spar_foa_dec_wav[3] ); CloseWav( spar_foa_dec_wav[3] ); } } @@ -274,38 +274,38 @@ void ivas_close_remove_debug_files( void ) fclose(fp); */ } -void ivas_open_decoder_debug_files( spar_debug_t *pDebug_params ) +void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport ) { int8_t fb_wav_dump_path[4][MAX_PLUG_IN_FILE_LEN] = { "", "", "", "" }; cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "dec_out.wav" ); spar_foa_dec_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], - pDebug_params->fs, - pDebug_params->n_ch, + fs, + n_ch, 32 /* const uint32_t writeWaveExt */ ); cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), "agc_dec_out.wav" ); spar_foa_dec_wav[1] = CreateWav( (const char *) fb_wav_dump_path[1], - pDebug_params->fs, - pDebug_params->n_transport, + fs, + n_transport, 16 /* const uint32_t writeWaveExt */ ); cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), "pca_dec.wav" ); spar_foa_dec_wav[2] = CreateWav( (const char *) fb_wav_dump_path[2], - pDebug_params->fs, - pDebug_params->n_transport, + fs, + n_transport, 16 /* const uint32_t writeWaveExt */ ); cstrcat( (char *) fb_wav_dump_path[3], sizeof( fb_wav_dump_path[3] ), "cldfbSynthesis.wav" ); spar_foa_dec_wav[3] = CreateWav( (const char *) fb_wav_dump_path[3], - pDebug_params->fs, - pDebug_params->n_transport, + fs, + n_transport, 16 /* const uint32_t writeWaveExt */ ); diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 39b82de0d9..42f299b39e 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -63,8 +63,8 @@ void ivas_open_agc_debug_files( spar_debug_t *pDebug_params ); float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k * 2], int16_t no_channel, WAVEFILEOUT *wave_file ); void ivas_close_remove_debug_files( void ); void ivas_open_debug_files( spar_debug_t *pDebug_params ); -void ivas_close_decoder_debug_files( spar_debug_t *pDebug_params ); -void ivas_open_decoder_debug_files( spar_debug_t *dbg_params ); +void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ); +void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport ); void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const uint32_t bps, WAVEFILEOUT *spar_wav ); #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 70edf264d2..516eaaee1b 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -47,7 +47,6 @@ float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_dec_wav[4]; extern int16_t numTransportChannels; -extern int16_t numOutChannels; #endif /*--------------------------------------------------------------------------* -- GitLab From ad9ca4c3740f18589dafacda819cb2bf995d6729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Fri, 22 Jul 2022 17:22:22 +0200 Subject: [PATCH 06/13] encoder: simplified _debug_files() calls --- apps/encoder.c | 33 ++++++------------------- lib_debug/sba_debug.c | 38 ++++++++++++++--------------- lib_debug/sba_debug.h | 22 +++-------------- lib_enc/ivas_agc_enc.c | 22 +++-------------- lib_enc/lib_enc.c | 55 ++++++++---------------------------------- lib_enc/lib_enc.h | 14 ----------- 6 files changed, 43 insertions(+), 141 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 5c427cb542..261f096822 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -56,6 +56,11 @@ #define WMC_TOOL_MAN +#ifdef DEBUG_SBA +int16_t numTransportChannelsEnc = 1; +int16_t numInputChannels = 1; +#endif + /*------------------------------------------------------------------------------------------* * Local constants, enums, structures *------------------------------------------------------------------------------------------*/ @@ -214,9 +219,6 @@ int main( FILE *f_forcedModeProfile = NULL; #endif -#ifdef DEBUG_SBA - spar_debug_t dbg_params; -#endif #ifdef WMOPS size_t SRAM_size = 0; #endif @@ -555,29 +557,10 @@ int main( uint16_t numBits = 0; #ifdef DEBUG_SBA - int16_t numInputChannels; - if ( ( error = IVAS_ENC_GetNumInputChannels( hIvasEnc, &numInputChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nGetNumInputChannels failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); - goto cleanup; - } - dbg_params.agc = (int16_t) arg.agc; - dbg_params.dtx_on = (int16_t) arg.dtxConfig.enabled; - dbg_params.file_tag = arg.dbg_file_tag; - dbg_params.ivas_total_brate = arg.initBitrate; - dbg_params.fs = arg.inputFs; - dbg_params.n_ch = numInputChannels; - int16_t numTransportChannels; - if ( ( error = getTransportChannel( hIvasEnc, &numTransportChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nGetNumInputChannels failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); - goto cleanup; - } - dbg_params.n_transport = numTransportChannels; #ifdef DEBUG_AGC - ivas_open_agc_debug_files( &dbg_params ); + ivas_open_agc_debug_files( (int16_t) arg.agc ); #endif - ivas_open_debug_files( &dbg_params ); + ivas_open_encoder_debug_files( arg.inputFs, numInputChannels, numTransportChannelsEnc, arg.dbg_file_tag, arg.initBitrate, (int16_t) arg.dtxConfig.enabled ); #endif if ( !arg.quietModeEnabled ) @@ -845,7 +828,7 @@ cleanup: #ifdef DEBUG_SBA ivas_close_remove_debug_files(); #ifdef DEBUG_AGC - ivas_close_agc_debug_files( &io_params ); + ivas_close_agc_debug_files(); #endif #endif diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index 21c02f6a33..bafd94428c 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -67,7 +67,7 @@ int8_t file_names[NUM_DEBUG_FILES][MAX_TAG_LEN + MAX_DEBUG_TAG_LEN]; #ifdef DEBUG_AGC -FILE *agcOut; /* temporary AGC bitstream */ +FILE *agcOut = NULL; /* temporary AGC bitstream */ #endif /*-----------------------------------------------------------------------------------------* @@ -128,21 +128,19 @@ static void cstrcat( char *_Destination, size_t _SizeInBytes, const char *_Sourc #ifdef DEBUG_AGC -void ivas_close_agc_debug_files( spar_debug_t *pDebug_params ) +void ivas_close_agc_debug_files( void ) { - if ( pDebug_params->agc > 0 ) /* temporary */ + if ( agcOut != NULL ) { - if ( agcOut != NULL ) - { - fclose( agcOut ); - } + fclose( agcOut ); + agcOut = NULL; } } -void ivas_open_agc_debug_files( spar_debug_t *pDebug_params ) +void ivas_open_agc_debug_files( int16_t agc ) { /* Temporary AGC file */ - if ( pDebug_params->agc > 0 ) + if ( agc > 0 ) { char agcFilename[50] = "agcBitstream.bin"; if ( ( agcOut = fopen( agcFilename, "wb" ) ) == NULL ) @@ -311,16 +309,16 @@ void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transpor ); } -void ivas_open_debug_files( spar_debug_t *pDebug_params ) +void ivas_open_encoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ) { int8_t fb_wav_dump_path[3][MAX_PLUG_IN_FILE_LEN] = { "spar_foa_enc", "spar_foa_enc", "spar_foa_enc" }; - if ( pDebug_params->file_tag != NULL ) + if ( file_tag != NULL ) { - cstrcpy( (char *) file_names[0], sizeof( file_names[0] ), (const char *) pDebug_params->file_tag ); + cstrcpy( (char *) file_names[0], sizeof( file_names[0] ), (const char *) file_tag ); } /* ivas_total_brate */ - switch ( pDebug_params->ivas_total_brate ) + switch ( ivas_total_brate ) { case 24400: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr24k" ); @@ -361,7 +359,7 @@ void ivas_open_debug_files( spar_debug_t *pDebug_params ) } /* DTX */ - if ( pDebug_params->dtx_on ) + if ( dtx_on ) { cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_DTX1" ); } @@ -379,8 +377,8 @@ void ivas_open_debug_files( spar_debug_t *pDebug_params ) cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "_pca_enc.wav" ); spar_foa_enc_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], - pDebug_params->fs, - pDebug_params->n_ch, + fs, + n_ch, 16 /* const uint32_t writeWaveExt */ ); @@ -388,8 +386,8 @@ void ivas_open_debug_files( spar_debug_t *pDebug_params ) cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), "_fb_mixer_enc.wav" ); spar_foa_enc_wav[1] = CreateWav( (const char *) fb_wav_dump_path[1], - pDebug_params->fs, - pDebug_params->n_transport, + fs, + n_transport, 16 /* const uint32_t writeWaveExt */ ); @@ -397,8 +395,8 @@ void ivas_open_debug_files( spar_debug_t *pDebug_params ) cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), "_agc_enc.wav" ); spar_foa_enc_wav[2] = CreateWav( (const char *) fb_wav_dump_path[2], - pDebug_params->fs, - pDebug_params->n_transport, + fs, + n_transport, 16 /* const uint32_t writeWaveExt */ ); diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 42f299b39e..211e8ecd6d 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -40,29 +40,13 @@ #include "cnst.h" #include "tinywaveout_c.h" -/*------------------------------------------------------------------------------------------* - * Global variables used for debugging - *------------------------------------------------------------------------------------------*/ - -typedef struct spar_debug_t -{ - const char *file_tag; - int32_t ivas_total_brate; - int16_t dtx_on; - int16_t agc; - int32_t fs; - int16_t n_ch; - int16_t n_transport; - int16_t pca_ingest_channels; -} spar_debug_t; - #ifdef DEBUG_AGC -void ivas_close_agc_debug_files( spar_debug_t *pDebug_params ); -void ivas_open_agc_debug_files( spar_debug_t *pDebug_params ); +void ivas_close_agc_debug_files( void ); +void ivas_open_agc_debug_files( int16_t agc ); #endif float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k * 2], int16_t no_channel, WAVEFILEOUT *wave_file ); void ivas_close_remove_debug_files( void ); -void ivas_open_debug_files( spar_debug_t *pDebug_params ); +void ivas_open_encoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ); void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ); void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport ); void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const uint32_t bps, WAVEFILEOUT *spar_wav ); diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index 45326ce8a7..493d1ac071 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -56,7 +56,7 @@ #ifdef DEBUG_AGC extern FILE *agcOut; -static int16_t ivas_agc_writeBits( FILE *stream, ivas_agc_enc_in_buf_t *in_buf, ivas_agc_enc_state_t *pState ); +static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_agc_enc_state_t *pState ); #endif @@ -472,7 +472,7 @@ void ivas_agc_enc_process( #ifdef DEBUG_AGC /* writing to a temporary bitstream file */ - if ( ivas_agc_writeBits( agcOut, pIn_buf, pState ) ) + if ( ivas_agc_writeBits( agcOut, n_channels, pState ) ) { /* TODO: return error once error codes are harmonized */ IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "SPAR ENC AGC Failed to open agcOut\n " ); @@ -483,21 +483,7 @@ void ivas_agc_enc_process( } #ifdef DEBUG_AGC - -/*-----------------------------------------------------------------------------------------* - * Function description - - * Get a window function - * - * Inputs - - * float* winFunc - * unsigned integer frameLen - * - * Outputs - - * returns status - * - * - *-----------------------------------------------------------------------------------------*/ -static int16_t ivas_agc_writeBits( FILE *stream, ivas_agc_enc_in_buf_t *pIn_buf, ivas_agc_enc_state_t *pState ) +static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_agc_enc_state_t *pState ) { if ( stream == NULL ) { @@ -505,7 +491,7 @@ static int16_t ivas_agc_writeBits( FILE *stream, ivas_agc_enc_in_buf_t *pIn_buf, } int16_t num_bits = 0, num_dmx_bits[4] = { 0 }; - for ( int16_t i = 0; i < pIn_buf->n_channels; i++ ) + for ( int16_t i = 0; i < n_channels; i++ ) { if ( pState->gain_data[i].absGainExpCurr < 0 || pState->gain_data[i].absGainExpCurr >= (int16_t) pow( 2, pState->agc_com.betaE ) ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 369670e47c..af4bd513c0 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -43,6 +43,11 @@ #include "wmops.h" #endif +#ifdef DEBUG_SBA_AUDIO_DUMP +extern int16_t numTransportChannelsEnc; +extern int16_t numInputChannels; +#endif + /*---------------------------------------------------------------------* * Local struct *---------------------------------------------------------------------*/ @@ -466,6 +471,11 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); +#ifdef DEBUG_SBA_AUDIO_DUMP + numInputChannels = hEncoderConfig->nchan_inp; + numTransportChannelsEnc = hIvasEnc->st_ivas->nchan_transport; +#endif + return error; } @@ -946,51 +956,6 @@ ivas_error IVAS_ENC_GetDelay( } -#ifdef DEBUG_SBA -/*---------------------------------------------------------------------* - * IVAS_ENC_GetNumInputChannels() - * - * - *---------------------------------------------------------------------*/ - -ivas_error IVAS_ENC_GetNumInputChannels( - const IVAS_ENC_HANDLE hIvasEnc, /* i : IVAS encoder handle */ - int16_t *numInChannels /* o : number of input channels with current */ -) -{ - if ( !hIvasEnc->isConfigured ) - { - return IVAS_ERR_NOT_CONFIGURED; - } - - if ( numInChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - *numInChannels = hIvasEnc->st_ivas->hEncoderConfig->nchan_inp; - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * getTransportChannel() - * - * - *---------------------------------------------------------------------*/ - -ivas_error getTransportChannel( - const IVAS_ENC_HANDLE hIvasEnc, /* i : IVAS encoder handle */ - int16_t *no_channels_Transport /* o : number of transport channels */ -) -{ - *no_channels_Transport = hIvasEnc->st_ivas->nchan_transport; - return IVAS_ERR_OK; -} -#endif - - /*---------------------------------------------------------------------* * getInputBufferSize() * diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index f6f32d9baa..dce4d6a010 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -288,20 +288,6 @@ ivas_error IVAS_ENC_GetDelay( int16_t *delay /* o : encoder delay */ ); -#ifdef DEBUG_SBA -/*! r: encoder error code */ -ivas_error IVAS_ENC_GetNumInputChannels( - const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - int16_t *numInChannels /* o : number of input channels with current configuration */ -); - -/*! r: encoder error code */ -ivas_error getTransportChannel( - const IVAS_ENC_HANDLE hIvasEnc, /* i : IVAS encoder handle */ - int16_t *no_channels_Transport /* o : number of transport channels */ -); -#endif - /*! r: encoder error code */ ivas_error IVAS_ENC_GetInputBufferSize( const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ -- GitLab From 39e7ff0f88af9d6781dfd9555b8c8d67381a526c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Fri, 22 Jul 2022 20:00:59 +0200 Subject: [PATCH 07/13] improved ivas_spar_dump_signal_wav() --- lib_debug/sba_debug.c | 18 ++++++++++++---- lib_debug/sba_debug.h | 3 ++- lib_dec/ivas_dec.c | 16 +------------- lib_dec/ivas_spar_decoder.c | 42 +++---------------------------------- lib_enc/ivas_spar_encoder.c | 41 +++--------------------------------- 5 files changed, 23 insertions(+), 97 deletions(-) diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index bafd94428c..771db40525 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -171,12 +171,12 @@ void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const ui fwrite( &writeValue16, sizeof( writeValue16 ), 1, spar_wav->theFile ); } -float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k * 2], int16_t no_channel, WAVEFILEOUT *wave_file ) +void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], int16_t no_channel, WAVEFILEOUT *wave_file, char *location ) { float tmp_value; int16_t pcm_value, i, j, k; int16_t debug_tmp[IVAS_SPAR_MAX_CH * L_FRAME48k * 2]; - /* Dump audio signal after pca_enc */ + k = 0; int16_t Clipping = 0; float largest_value = 0; @@ -185,7 +185,14 @@ float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k { for ( i = 0; i < no_channel; i++, k++ ) { - tmp_value = roundf( data_f[i][j] * PCM16_TO_FLT_FAC ); + if ( ppPcm ) + { + tmp_value = roundf( ppPcm[i][j] * PCM16_TO_FLT_FAC ); + } + else + { + tmp_value = roundf( pcm_array[i][j] * PCM16_TO_FLT_FAC ); + } if ( tmp_value > MAX16B_FLT ) { largest_value = (float) fabs( tmp_value ) > largest_value ? (float) fabs( tmp_value ) : largest_value; @@ -214,7 +221,10 @@ float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k debug_tmp, ( no_channel * input_frame ) ); - return ( db_value ); + if ( db_value ) + { + fprintf( stderr, "\t In %s largest clipped sample in dB %f \n", location, db_value ); + } } void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ) diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 211e8ecd6d..cac9f19de1 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -38,13 +38,14 @@ #include #ifdef DEBUG_SBA #include "cnst.h" +#include "ivas_cnst.h" #include "tinywaveout_c.h" #ifdef DEBUG_AGC void ivas_close_agc_debug_files( void ); void ivas_open_agc_debug_files( int16_t agc ); #endif -float ivas_spar_dump_signal_wav( int16_t input_frame, float data_f[][L_FRAME48k * 2], int16_t no_channel, WAVEFILEOUT *wave_file ); +void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], int16_t no_channel, WAVEFILEOUT *wave_file, char *location ); void ivas_close_remove_debug_files( void ); void ivas_open_encoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ); void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 516eaaee1b..2b3a00df35 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -44,7 +44,6 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP -float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_dec_wav[4]; extern int16_t numTransportChannels; #endif @@ -284,22 +283,9 @@ ivas_error ivas_dec( } } #ifdef DEBUG_SBA_AUDIO_DUMP - float largest_value; - int16_t i, j; numTransportChannels = st_ivas->nchan_transport; /* Dump audio signal after core-decoding */ - for ( i = 0; i < numTransportChannels; i++ ) - { - for ( j = 0; j < output_frame; j++ ) - { - data_array[i][j] = output[i][j]; - } - } - largest_value = ivas_spar_dump_signal_wav( output_frame, data_array, numTransportChannels, spar_foa_dec_wav[0] ); - if ( largest_value ) - { - fprintf( stderr, "\t In core-decoding largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( output_frame, NULL, output, numTransportChannels, spar_foa_dec_wav[0], "core-decoding" ); #endif /* TCs remapping */ nchan_remapped = st_ivas->nchan_transport; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7f21ef2a8b..8076d05040 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -47,7 +47,6 @@ #ifdef DEBUG_SBA_AUDIO_DUMP extern WAVEFILEOUT *spar_foa_dec_wav[4]; -float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern int16_t numTransportChannels; extern int16_t pca_ingest_channels; extern int16_t numOutChannels; @@ -959,22 +958,9 @@ void ivas_spar_dec_upmixer( ivas_agc_dec_process( pState->hAgcDec, output, output, nchan_transport, output_frame ); #ifdef DEBUG_SBA_AUDIO_DUMP - int16_t l; - float largest_value; numTransportChannels = st_ivas->nchan_transport; /* Dump audio signal after ivas_agc_dec_process */ - for ( i = 0; i < numTransportChannels; i++ ) - { - for ( l = 0; l < output_frame; l++ ) - { - data_array[i][l] = output[i][l]; - } - } - largest_value = ivas_spar_dump_signal_wav( output_frame, data_array, numTransportChannels, spar_foa_dec_wav[1] ); - if ( largest_value ) - { - fprintf( stderr, "\t In ivas_agc_dec_process() largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( output_frame, NULL, output, numTransportChannels, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); #endif /*---------------------------------------------------------------------* @@ -1007,18 +993,7 @@ void ivas_spar_dec_upmixer( #ifdef DEBUG_SBA_AUDIO_DUMP pca_ingest_channels = num_in_ingest; /* Dump audio signal after ivas_pca_dec */ - for ( i = 0; i < pca_ingest_channels; i++ ) - { - for ( l = 0; l < output_frame; l++ ) - { - data_array[i][l] = output[i][l]; - } - } - largest_value = ivas_spar_dump_signal_wav( output_frame, data_array, pca_ingest_channels, spar_foa_dec_wav[2] ); - if ( largest_value ) - { - fprintf( stderr, "\t In ivas_pca_dec() largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( output_frame, NULL, output, pca_ingest_channels, spar_foa_dec_wav[2], "ivas_pca_dec()" ); #endif } @@ -1232,18 +1207,7 @@ void ivas_spar_dec_upmixer( } #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after cldfbSynthesis */ - for ( i = 0; i < numOutChannels; i++ ) - { - for ( l = 0; l < output_frame; l++ ) - { - data_array[i][l] = output[i][l]; - } - } - largest_value = ivas_spar_dump_signal_wav( output_frame, data_array, numOutChannels, spar_foa_dec_wav[3] ); - if ( largest_value ) - { - fprintf( stderr, "\t In cldfbSynthesis() largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( output_frame, NULL, output, numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); #endif split_band = SPAR_DIRAC_SPLIT_START_BAND; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index b65674dc52..65c24c6a45 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -44,7 +44,6 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP -float data_array[IVAS_MAX_NUM_CH][L_FRAME48k * 2]; extern WAVEFILEOUT *spar_foa_enc_wav[3]; #endif @@ -777,19 +776,7 @@ static ivas_error ivas_spar_enc_process( ivas_fb_mixer_process( pState->hFbMixer, pState->hMdEnc->mixer_mat, p_pcm_tmp, input_frame, in_out_mixer_map ); #ifdef DEBUG_SBA_AUDIO_DUMP - float largest_value; - for ( i = 0; i < nchan_transport; i++ ) - { - for ( j = 0; j < input_frame; j++ ) - { - data_array[i][j] = p_pcm_tmp[i][j]; - } - } - largest_value = ivas_spar_dump_signal_wav( input_frame, data_array, nchan_transport, spar_foa_enc_wav[1] ); - if ( largest_value ) - { - fprintf( stderr, "\t In ivas_fb_mixer_process() largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[1], "ivas_fb_mixer_process()" ); #endif /* move delayed W into output buffer unless activeW operation*/ @@ -816,18 +803,7 @@ static ivas_error ivas_spar_enc_process( } } #ifdef DEBUG_SBA_AUDIO_DUMP - for ( i = 0; i < nchan_inp; i++ ) - { - for ( j = 0; j < input_frame; j++ ) - { - data_array[i][j] = data_f[i][j]; - } - } - largest_value = ivas_spar_dump_signal_wav( input_frame, data_array, nchan_inp, spar_foa_enc_wav[0] ); - if ( largest_value ) - { - fprintf( stderr, "\t In ivas_pca_enc() largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( input_frame, NULL, data_f, nchan_inp, spar_foa_enc_wav[0], "ivas_pca_enc()" ); #endif @@ -862,18 +838,7 @@ static ivas_error ivas_spar_enc_process( } #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after ivas_agc_enc_process */ - for ( i = 0; i < nchan_transport; i++ ) - { - for ( j = 0; j < input_frame; j++ ) - { - data_array[i][j] = p_pcm_tmp[i][j]; - } - } - largest_value = ivas_spar_dump_signal_wav( input_frame, data_array, nchan_transport, spar_foa_enc_wav[2] ); - if ( largest_value ) - { - fprintf( stderr, "\t In ivas_agc_enc_process() largest clipped sample in dB %f \n", largest_value ); - } + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[2], "ivas_agc_enc_process()" ); #endif #ifdef DEBUG_SPAR_BYPASS_EVS_CODEC -- GitLab From ca676b917d1872328fa9226db82a63d3d9e2cb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Fri, 22 Jul 2022 21:20:48 +0200 Subject: [PATCH 08/13] fix MSVC compilation with DEBUG_SBA enabled --- Workspace_msvc/lib_debug.vcxproj | 6 +++--- Workspace_msvc/lib_enc.vcxproj | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 2d55c30f20..d8efa0879d 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) false @@ -97,7 +97,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) false @@ -124,7 +124,7 @@ AnySuitable false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index 0e21d3f4a3..40302c56cd 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -129,7 +129,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -176,7 +176,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true -- GitLab From 6cfd72d33289f95bb79290bf0b5562ca407b6a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Wed, 27 Jul 2022 13:36:15 +0200 Subject: [PATCH 09/13] fix MSVC compilation with DEBUG_SBA enabled --- Workspace_msvc/lib_com.vcxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 144ceed2da..ed091573fc 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -78,7 +78,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -109,7 +109,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -147,7 +147,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true -- GitLab From 993a334e2dcb7f175ca3d5c02aa6e0ab06e5a352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Wed, 27 Jul 2022 14:50:31 +0200 Subject: [PATCH 10/13] fixed signal to be dumped after ivas_pca_enc() --- lib_enc/ivas_spar_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 65c24c6a45..b7cd181001 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -803,7 +803,7 @@ static ivas_error ivas_spar_enc_process( } } #ifdef DEBUG_SBA_AUDIO_DUMP - ivas_spar_dump_signal_wav( input_frame, NULL, data_f, nchan_inp, spar_foa_enc_wav[0], "ivas_pca_enc()" ); + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_inp, spar_foa_enc_wav[0], "ivas_pca_enc()" ); #endif -- GitLab From ce3764e5c95d45a27ca2a177568cb2876adc957f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Fri, 29 Jul 2022 10:44:08 +0200 Subject: [PATCH 11/13] fixed number of channels in _pca_enc.wav dump signal --- apps/encoder.c | 3 +-- lib_debug/sba_debug.c | 4 ++-- lib_debug/sba_debug.h | 2 +- lib_enc/ivas_spar_encoder.c | 2 +- lib_enc/lib_enc.c | 2 -- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 261f096822..a85fac4b78 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -58,7 +58,6 @@ #ifdef DEBUG_SBA int16_t numTransportChannelsEnc = 1; -int16_t numInputChannels = 1; #endif /*------------------------------------------------------------------------------------------* @@ -560,7 +559,7 @@ int main( #ifdef DEBUG_AGC ivas_open_agc_debug_files( (int16_t) arg.agc ); #endif - ivas_open_encoder_debug_files( arg.inputFs, numInputChannels, numTransportChannelsEnc, arg.dbg_file_tag, arg.initBitrate, (int16_t) arg.dtxConfig.enabled ); + ivas_open_encoder_debug_files( arg.inputFs, numTransportChannelsEnc, arg.dbg_file_tag, arg.initBitrate, (int16_t) arg.dtxConfig.enabled ); #endif if ( !arg.quietModeEnabled ) diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index 771db40525..4c4294dd8a 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -319,7 +319,7 @@ void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transpor ); } -void ivas_open_encoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ) +void ivas_open_encoder_debug_files( int32_t fs, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ) { int8_t fb_wav_dump_path[3][MAX_PLUG_IN_FILE_LEN] = { "spar_foa_enc", "spar_foa_enc", "spar_foa_enc" }; if ( file_tag != NULL ) @@ -388,7 +388,7 @@ void ivas_open_encoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transpor spar_foa_enc_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], fs, - n_ch, + n_transport, 16 /* const uint32_t writeWaveExt */ ); diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index cac9f19de1..779cbef373 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -47,7 +47,7 @@ void ivas_open_agc_debug_files( int16_t agc ); #endif void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], int16_t no_channel, WAVEFILEOUT *wave_file, char *location ); void ivas_close_remove_debug_files( void ); -void ivas_open_encoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ); +void ivas_open_encoder_debug_files( int32_t fs, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ); void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ); void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport ); void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const uint32_t bps, WAVEFILEOUT *spar_wav ); diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index b7cd181001..9df416e2e4 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -803,7 +803,7 @@ static ivas_error ivas_spar_enc_process( } } #ifdef DEBUG_SBA_AUDIO_DUMP - ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_inp, spar_foa_enc_wav[0], "ivas_pca_enc()" ); + ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[0], "ivas_pca_enc()" ); #endif diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index af4bd513c0..b1769b7772 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -45,7 +45,6 @@ #ifdef DEBUG_SBA_AUDIO_DUMP extern int16_t numTransportChannelsEnc; -extern int16_t numInputChannels; #endif /*---------------------------------------------------------------------* @@ -472,7 +471,6 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); #ifdef DEBUG_SBA_AUDIO_DUMP - numInputChannels = hEncoderConfig->nchan_inp; numTransportChannelsEnc = hIvasEnc->st_ivas->nchan_transport; #endif -- GitLab From 553699bbe52d2289aa449fcc800072cca7fd3f55 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 1 Aug 2022 10:37:54 +0200 Subject: [PATCH 12/13] - fix compilation warnings within SPAR_HOA_DBG and DEBUG_SBA_MD_DUMP - define 'extern WAVEFILEOUT *spar_foa_dec_wav[4]' in sba_debug.h --- lib_com/ivas_spar_com.c | 14 ++++++++------ lib_com/options.h | 8 ++++---- lib_debug/sba_debug.h | 2 ++ lib_dec/ivas_dec.c | 5 ++--- lib_dec/ivas_spar_decoder.c | 1 - lib_enc/ivas_spar_md_enc.c | 5 ++++- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index baf63f6e35..88f39f713b 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1551,9 +1551,9 @@ void ivas_compute_spar_params( { float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; int16_t b, i, ndm; - ivas_get_pred_coeffs( pppCov_mat_re, pred_coeffs_re, dm_fv_re, num_ch, - start_band, end_band, active_w, dtx_vad, - from_dirac ); + + ivas_get_pred_coeffs( pppCov_mat_re, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, dtx_vad, from_dirac ); + #ifdef SPAR_HOA_DBG /*fprintf(stderr, "\n\n Prediction Coefficients:\n"); @@ -1613,15 +1613,17 @@ void ivas_compute_spar_params( { fprintf( stdout, "\n\nUnquantised C, P coeffs -- band %d:\n", b ); - for ( ii = 0; ii < num_ch; ii++ ) + for ( int16_t ii = 0; ii < num_ch; ii++ ) { fprintf( stdout, "%f |", hSparMd->band_coeffs[b].pred_re[ii] ); if ( ii < num_ch - ndm ) { - for ( jj = 0; jj < ndm - 1; jj++ ) + for ( int16_t jj = 0; jj < ndm - 1; jj++ ) + { fprintf( stdout, "%f,\t", hSparMd->band_coeffs[b].C_re[ii][jj] ); - fprintf( stdout, "| %f", hSparMd->band_coeffs[b].P_re[ii][ii] ); + } + fprintf( stdout, "| %f", hSparMd->band_coeffs[b].P_re[ii] ); } fprintf( stdout, "\n" ); } diff --git a/lib_com/options.h b/lib_com/options.h index 5a3e09fe60..31618f57f6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,17 +114,17 @@ /*#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_AUDIO_DUMP /* SBA intermediate audio wav 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 */ /*#define DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS*/ /*#define DEBUG_AGC*/ /* debug SPAR AGC in-out */ #endif -/*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */ +#define SPAR_HOA_DBG /* SPAR HOA debug statements */ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ #endif diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 779cbef373..48ed7736da 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -41,6 +41,8 @@ #include "ivas_cnst.h" #include "tinywaveout_c.h" +extern WAVEFILEOUT *spar_foa_dec_wav[4]; + #ifdef DEBUG_AGC void ivas_close_agc_debug_files( void ); void ivas_open_agc_debug_files( int16_t agc ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 2b3a00df35..33462800e4 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -44,7 +44,7 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP -extern WAVEFILEOUT *spar_foa_dec_wav[4]; + extern int16_t numTransportChannels; #endif @@ -283,9 +283,8 @@ ivas_error ivas_dec( } } #ifdef DEBUG_SBA_AUDIO_DUMP - numTransportChannels = st_ivas->nchan_transport; /* Dump audio signal after core-decoding */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, numTransportChannels, spar_foa_dec_wav[0], "core-decoding" ); + ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[0], "core-decoding" ); #endif /* TCs remapping */ nchan_remapped = st_ivas->nchan_transport; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 8076d05040..7c633d0031 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -46,7 +46,6 @@ #include "wmops.h" #ifdef DEBUG_SBA_AUDIO_DUMP -extern WAVEFILEOUT *spar_foa_dec_wav[4]; extern int16_t numTransportChannels; extern int16_t pca_ingest_channels; extern int16_t numOutChannels; diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index d3cce8ff03..39f8746004 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -633,6 +633,9 @@ ivas_error ivas_spar_md_enc_process( planarCP = 0; code_strat = 0; +#ifdef DEBUG_SBA_MD_DUMP + ndec = -1; +#endif #ifdef DEBUG_SPAR_MD_TARGET_TUNING for ( qsi = 0; qsi < 1; qsi++ ) #else @@ -953,7 +956,7 @@ ivas_error ivas_spar_md_enc_process( fprintf( stdout, "|\t" ); for ( j = 0; j < num_ch - ndm; j++ ) { - fprintf( stdout, "%.2f\t", pState->spar_md.band_coeffs[b].P_quant_re[i][j] ); + fprintf( stdout, "%.2f\t", pState->spar_md.band_coeffs[b].P_quant_re[j] ); } } fprintf( stdout, "\n" ); -- GitLab From 24530a20408e4e0fa0c2d1ae558466a7462923a3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 1 Aug 2022 12:58:17 +0200 Subject: [PATCH 13/13] improvements within DEBUG_SBA_AUDIO_DUMP: - get rid of global variables - unify SPAR debug function names - formal improvements (add 'const', 'return', ...) --- apps/decoder.c | 20 ++--- apps/encoder.c | 16 ++-- lib_com/options.h | 8 +- lib_debug/sba_debug.c | 149 +++++++++++++++++++----------------- lib_debug/sba_debug.h | 14 ++-- lib_dec/ivas_dec.c | 5 +- lib_dec/ivas_spar_decoder.c | 21 +++-- lib_dec/ivas_stat_dec.h | 5 ++ lib_dec/lib_dec.c | 43 +++++++++++ lib_dec/lib_dec.h | 9 +++ lib_enc/ivas_spar_encoder.c | 5 +- lib_enc/lib_enc.c | 9 ++- lib_enc/lib_enc.h | 4 + 13 files changed, 188 insertions(+), 120 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 5f75ff66a1..cb81edc24b 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -58,11 +58,6 @@ #endif #include "render_config_reader.h" -#ifdef DEBUG_SBA -int16_t numTransportChannels = 1; -int16_t numOutChannels = 1; -int16_t pca_ingest_channels = 1; -#endif #define WMC_TOOL_MAN @@ -201,6 +196,9 @@ int main( #ifdef DEBUGGING int32_t noClipping; int32_t cnt_frames_limited; +#ifdef DEBUG_SBA_AUDIO_DUMP + int16_t numOutChannels, numTransportChannels, pca_ingest_channels; +#endif #endif #ifdef WMOPS @@ -395,8 +393,8 @@ int main( } } -#ifdef DEBUG_SBA - ivas_open_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels ); +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_open_sba_decoder_debug_files( arg.output_Fs, 1, 1 ); #endif /*-----------------------------------------------------------------* @@ -552,6 +550,10 @@ int main( cleanup: +#ifdef DEBUG_SBA_AUDIO_DUMP + IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); +#endif + IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); @@ -580,8 +582,8 @@ cleanup: printf( "\n" ); } -#ifdef DEBUG_SBA - ivas_close_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels, pca_ingest_channels ); +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_close_sba_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels, pca_ingest_channels ); #endif #ifdef DEBUGGING dbgclose(); diff --git a/apps/encoder.c b/apps/encoder.c index a85fac4b78..e11b4465d3 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -53,12 +53,8 @@ #include "debug.h" #endif - #define WMC_TOOL_MAN -#ifdef DEBUG_SBA -int16_t numTransportChannelsEnc = 1; -#endif /*------------------------------------------------------------------------------------------* * Local constants, enums, structures @@ -218,6 +214,10 @@ int main( FILE *f_forcedModeProfile = NULL; #endif +#ifdef DEBUG_SBA + int16_t numTransportChannels = 1; +#endif + #ifdef WMOPS size_t SRAM_size = 0; #endif @@ -440,7 +440,11 @@ int main( } break; case IVAS_ENC_INPUT_SBA: +#ifdef DEBUG_SBA_AUDIO_DUMP + if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, arg.agc, arg.pca, &numTransportChannels ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, arg.agc, arg.pca ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; @@ -559,7 +563,7 @@ int main( #ifdef DEBUG_AGC ivas_open_agc_debug_files( (int16_t) arg.agc ); #endif - ivas_open_encoder_debug_files( arg.inputFs, numTransportChannelsEnc, arg.dbg_file_tag, arg.initBitrate, (int16_t) arg.dtxConfig.enabled ); + ivas_open_sba_encoder_debug_files( arg.inputFs, numTransportChannels, arg.dbg_file_tag, arg.initBitrate, (int16_t) arg.dtxConfig.enabled ); #endif if ( !arg.quietModeEnabled ) @@ -825,7 +829,7 @@ cleanup: #endif #ifdef DEBUG_SBA - ivas_close_remove_debug_files(); + ivas_close_sba_encoder_debug_files(); #ifdef DEBUG_AGC ivas_close_agc_debug_files(); #endif diff --git a/lib_com/options.h b/lib_com/options.h index 31618f57f6..5a3e09fe60 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,17 +114,17 @@ /*#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_AUDIO_DUMP*/ /* SBA intermediate audio wav 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 */ /*#define DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS*/ /*#define DEBUG_AGC*/ /* debug SPAR AGC in-out */ #endif -#define SPAR_HOA_DBG /* SPAR HOA debug statements */ +/*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ #endif diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index 4c4294dd8a..3526478e4d 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -135,6 +135,8 @@ void ivas_close_agc_debug_files( void ) fclose( agcOut ); agcOut = NULL; } + + return; } void ivas_open_agc_debug_files( int16_t agc ) @@ -150,10 +152,16 @@ void ivas_open_agc_debug_files( int16_t agc ) } fprintf( stdout, "Temporary gain control bitstream file %s is opened\n", agcFilename ); } + + return; } #endif -void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const uint32_t bps, WAVEFILEOUT *spar_wav ) +static void UpdateWave( + const uint32_t sampleRate, + const uint32_t numChannels, + const uint32_t bps, + WAVEFILEOUT *spar_wav ) { uint32_t blockAlignment = 0; uint16_t writeValue16; @@ -169,9 +177,18 @@ void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const ui writeValue32 = LittleEndian32( sampleRate * blockAlignment ); fwrite( &writeValue32, sizeof( writeValue32 ), 1, spar_wav->theFile ); fwrite( &writeValue16, sizeof( writeValue16 ), 1, spar_wav->theFile ); + + return; } -void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], 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_MAX_NUM_CH][L_FRAME48k], + const int16_t no_channel, + WAVEFILEOUT *wave_file, + char *location ) { float tmp_value; int16_t pcm_value, i, j, k; @@ -181,6 +198,7 @@ void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_ar int16_t Clipping = 0; float largest_value = 0; float db_value = 0; + for ( j = 0; j < input_frame; j++ ) { for ( i = 0; i < no_channel; i++, k++ ) @@ -216,18 +234,23 @@ void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_ar db_value = 20.f * (float) log( largest_value ); fprintf( stderr, "%d\t Clipping detected ", Clipping ); } - WriteWavShort( - wave_file, - debug_tmp, - ( no_channel * input_frame ) ); + + WriteWavShort( wave_file, debug_tmp, ( no_channel * input_frame ) ); if ( db_value ) { fprintf( stderr, "\t In %s largest clipped sample in dB %f \n", location, db_value ); } + + return; } -void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ) + +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 ) { if ( spar_foa_dec_wav[0] != NULL ) { @@ -249,9 +272,12 @@ void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transpo UpdateWave( fs, n_ch, 16, spar_foa_dec_wav[3] ); CloseWav( spar_foa_dec_wav[3] ); } + + return; } -void ivas_close_remove_debug_files( void ) + +void ivas_close_sba_encoder_debug_files( void ) { if ( spar_foa_enc_wav[0] != NULL ) @@ -280,48 +306,43 @@ void ivas_close_remove_debug_files( void ) fprintf(fp, "%s\n", file_names[0]); fprintf(fp, "%d\n", iter_max); fclose(fp); */ + + return; } -void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport ) + +void ivas_open_sba_decoder_debug_files( + const int32_t fs, + const int16_t n_ch, + const int16_t n_transport ) { int8_t fb_wav_dump_path[4][MAX_PLUG_IN_FILE_LEN] = { "", "", "", "" }; + cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "dec_out.wav" ); - spar_foa_dec_wav[0] = CreateWav( - (const char *) fb_wav_dump_path[0], - fs, - n_ch, - 32 - /* const uint32_t writeWaveExt */ - ); + spar_foa_dec_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], fs, n_ch, 32 /* const uint32_t writeWaveExt */ ); + cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), "agc_dec_out.wav" ); - spar_foa_dec_wav[1] = CreateWav( - (const char *) fb_wav_dump_path[1], - fs, - n_transport, - 16 - /* const uint32_t writeWaveExt */ - ); + spar_foa_dec_wav[1] = CreateWav( (const char *) fb_wav_dump_path[1], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), "pca_dec.wav" ); - spar_foa_dec_wav[2] = CreateWav( - (const char *) fb_wav_dump_path[2], - fs, - n_transport, - 16 - /* const uint32_t writeWaveExt */ - ); + spar_foa_dec_wav[2] = CreateWav( (const char *) fb_wav_dump_path[2], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + cstrcat( (char *) fb_wav_dump_path[3], sizeof( fb_wav_dump_path[3] ), "cldfbSynthesis.wav" ); - spar_foa_dec_wav[3] = CreateWav( - (const char *) fb_wav_dump_path[3], - fs, - n_transport, - 16 - /* const uint32_t writeWaveExt */ - ); + spar_foa_dec_wav[3] = CreateWav( (const char *) fb_wav_dump_path[3], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + return; } -void ivas_open_encoder_debug_files( int32_t fs, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ) + +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 ) { int8_t fb_wav_dump_path[3][MAX_PLUG_IN_FILE_LEN] = { "spar_foa_enc", "spar_foa_enc", "spar_foa_enc" }; + if ( file_tag != NULL ) { cstrcpy( (char *) file_names[0], sizeof( file_names[0] ), (const char *) file_tag ); @@ -330,40 +351,40 @@ void ivas_open_encoder_debug_files( int32_t fs, int16_t n_transport, const char /* ivas_total_brate */ switch ( ivas_total_brate ) { - case 24400: + case IVAS_24k4: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr24k" ); break; - case 32000: + case IVAS_32k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr32k" ); break; - case 48000: + case IVAS_48k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr48k" ); break; - case 64000: + case IVAS_64k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr64k" ); break; - case 80000: + case IVAS_80k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr80k" ); break; - case 96000: + case IVAS_96k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr96k" ); break; - case 128000: + case IVAS_128k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr128k" ); break; - case 160000: + case IVAS_160k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr160k" ); break; - case 192000: + case IVAS_192k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr192k" ); break; - case 256000: + case IVAS_256k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr256k" ); break; - case 384000: + case IVAS_384k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr384k" ); break; - case 512000: + case IVAS_512k: cstrcat( (char *) file_names[0], sizeof( file_names[0] ), "_ivasbr512k" ); break; } @@ -385,31 +406,17 @@ void ivas_open_encoder_debug_files( int32_t fs, int16_t n_transport, const char cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), (const char *) file_names[2] ); cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "_pca_enc.wav" ); - spar_foa_enc_wav[0] = CreateWav( - (const char *) fb_wav_dump_path[0], - fs, - n_transport, - 16 - /* const uint32_t writeWaveExt */ - ); + spar_foa_enc_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), (const char *) file_names[2] ); cstrcat( (char *) fb_wav_dump_path[1], sizeof( fb_wav_dump_path[1] ), "_fb_mixer_enc.wav" ); - spar_foa_enc_wav[1] = CreateWav( - (const char *) fb_wav_dump_path[1], - fs, - n_transport, - 16 - /* const uint32_t writeWaveExt */ - ); + spar_foa_enc_wav[1] = CreateWav( (const char *) fb_wav_dump_path[1], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), (const char *) file_names[2] ); cstrcat( (char *) fb_wav_dump_path[2], sizeof( fb_wav_dump_path[2] ), "_agc_enc.wav" ); - spar_foa_enc_wav[2] = CreateWav( - (const char *) fb_wav_dump_path[2], - fs, - n_transport, - 16 - /* const uint32_t writeWaveExt */ - ); + spar_foa_enc_wav[2] = CreateWav( (const char *) fb_wav_dump_path[2], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + + return; } #endif /* DEBUG_SBA */ diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index 48ed7736da..8153929286 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -41,18 +41,20 @@ #include "ivas_cnst.h" #include "tinywaveout_c.h" +#ifdef DEBUG_SBA_AUDIO_DUMP +extern WAVEFILEOUT *spar_foa_enc_wav[3]; extern WAVEFILEOUT *spar_foa_dec_wav[4]; +#endif #ifdef DEBUG_AGC void ivas_close_agc_debug_files( void ); void ivas_open_agc_debug_files( int16_t agc ); #endif -void ivas_spar_dump_signal_wav( int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], int16_t no_channel, WAVEFILEOUT *wave_file, char *location ); -void ivas_close_remove_debug_files( void ); -void ivas_open_encoder_debug_files( int32_t fs, int16_t n_transport, const char *file_tag, int32_t ivas_total_brate, int16_t dtx_on ); -void ivas_close_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport, int16_t pca_ingest_channels ); -void ivas_open_decoder_debug_files( int32_t fs, int16_t n_ch, int16_t n_transport ); -void UpdateWave( const uint32_t sampleRate, const uint32_t numChannels, const uint32_t bps, WAVEFILEOUT *spar_wav ); +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_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 ); +void ivas_open_sba_decoder_debug_files( const int32_t fs, const int16_t n_ch, const int16_t n_transport ); #endif #endif /* SBA_DEBUG_H */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 33462800e4..8e1392cf9d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -43,10 +43,6 @@ #endif #include "wmops.h" -#ifdef DEBUG_SBA_AUDIO_DUMP - -extern int16_t numTransportChannels; -#endif /*--------------------------------------------------------------------------* * ivas_dec() @@ -282,6 +278,7 @@ ivas_error ivas_dec( return error; } } + #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after core-decoding */ ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[0], "core-decoding" ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7c633d0031..fe8db4f0fd 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -45,11 +45,6 @@ #include #include "wmops.h" -#ifdef DEBUG_SBA_AUDIO_DUMP -extern int16_t numTransportChannels; -extern int16_t pca_ingest_channels; -extern int16_t numOutChannels; -#endif /*-------------------------------------------------------------------* * Local function prototypes @@ -957,9 +952,8 @@ void ivas_spar_dec_upmixer( ivas_agc_dec_process( pState->hAgcDec, output, output, nchan_transport, output_frame ); #ifdef DEBUG_SBA_AUDIO_DUMP - numTransportChannels = st_ivas->nchan_transport; /* Dump audio signal after ivas_agc_dec_process */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, numTransportChannels, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); + ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); #endif /*---------------------------------------------------------------------* @@ -984,15 +978,18 @@ void ivas_spar_dec_upmixer( * PCA decoder *---------------------------------------------------------------------*/ +#ifdef DEBUG_SBA_AUDIO_DUMP + pState->pca_ingest_channels = num_in_ingest; +#endif + #ifdef SBA_CLEANING if ( pState->hPCA != NULL ) #endif { ivas_pca_dec( pState->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); #ifdef DEBUG_SBA_AUDIO_DUMP - pca_ingest_channels = num_in_ingest; /* Dump audio signal after ivas_pca_dec */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, pca_ingest_channels, spar_foa_dec_wav[2], "ivas_pca_dec()" ); + ivas_spar_dump_signal_wav( output_frame, NULL, output, num_in_ingest, spar_foa_dec_wav[2], "ivas_pca_dec()" ); #endif } @@ -1180,7 +1177,7 @@ void ivas_spar_dec_upmixer( } } #ifdef DEBUG_SBA_AUDIO_DUMP - numOutChannels = outchannels; + pState->numOutChannels = outchannels; #endif } else @@ -1201,12 +1198,12 @@ void ivas_spar_dec_upmixer( } } #ifdef DEBUG_SBA_AUDIO_DUMP - numOutChannels = numch_out_dirac; + pState->numOutChannels = numch_out_dirac; #endif } #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after cldfbSynthesis */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); + ivas_spar_dump_signal_wav( output_frame, NULL, output, pState->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); #endif split_band = SPAR_DIRAC_SPLIT_START_BAND; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index b9218ecaaa..18fc4b4741 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -879,6 +879,11 @@ typedef struct ivas_spar_dec_lib_t int32_t core_nominal_brate; /* Nominal bitrate for core coding */ int32_t i_subframe; +#ifdef DEBUG_SBA_AUDIO_DUMP + int16_t numOutChannels; + int16_t pca_ingest_channels; +#endif + } SPAR_DEC_DATA, *SPAR_DEC_HANDLE; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 8f963664fb..87f754d4d3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1847,6 +1847,13 @@ void IVAS_DEC_PrintConfigWithBitstream( } #endif + +/*---------------------------------------------------------------------* + * IVAS_DEC_PrintDisclaimer( ) + * + * Print IVAS disclaimer to console + *---------------------------------------------------------------------*/ + void IVAS_DEC_PrintDisclaimer( void ) { print_disclaimer( stderr ); @@ -2047,6 +2054,42 @@ ivas_error IVAS_DEC_SetForcedRendMode( return IVAS_ERR_OK; } + +#ifdef DEBUG_SBA_AUDIO_DUMP +/*---------------------------------------------------------------------* + * IVAS_DEC_GetSbaDebugParams( ) + * + * Returns SBA debug parameters + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_GetSbaDebugParams( + const IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *numOutputChannels, + int16_t *numTransportChannels, + int16_t *pca_ingest_channels ) +{ + if ( hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( hIvasDec->st_ivas->ivas_format != SBA_FORMAT || hIvasDec->st_ivas->hSpar == NULL ) + { + *numOutputChannels = 1; + *numTransportChannels = 1; + *pca_ingest_channels = 1; + } + else + { + *numOutputChannels = hIvasDec->st_ivas->hSpar->numOutChannels; + *numTransportChannels = hIvasDec->st_ivas->nchan_transport; + *pca_ingest_channels = hIvasDec->st_ivas->hSpar->pca_ingest_channels; + } + + return IVAS_ERR_OK; +} +#endif /* DEBUG_SBA_AUDIO_DUMP */ + #endif /* DEBUGGING */ static ivas_error input_format_API_to_internal( diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index b4221c142c..f43034c885 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -235,6 +235,15 @@ ivas_error IVAS_DEC_SetForcedRendMode( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_DEC_FORCED_REND_MODE forcedRendMode /* i : forced renderer mode */ ); + +#ifdef DEBUG_SBA_AUDIO_DUMP +ivas_error IVAS_DEC_GetSbaDebugParams( + const IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *numOutputChannels, + int16_t *numTransportChannels, + int16_t *pca_ingest_channels +); +#endif #endif /* Getter functions - retrieve information from a decoder through a handle */ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 9df416e2e4..a7a72735e9 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -43,9 +43,6 @@ #include #include "wmops.h" -#ifdef DEBUG_SBA_AUDIO_DUMP -extern WAVEFILEOUT *spar_foa_enc_wav[3]; -#endif /*-------------------------------------------------------------------* * Local function prototypes @@ -802,11 +799,11 @@ static ivas_error ivas_spar_enc_process( push_next_indice( hMetaData, PCA_MODE_INACTIVE, 1 ); } } + #ifdef DEBUG_SBA_AUDIO_DUMP ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[0], "ivas_pca_enc()" ); #endif - #ifdef SPAR_HOA_DBG /*FILE *fp = fopen("int_enc_dmx.raw", "ab"); for (int16_t t = 0; t < 960; t++) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index b1769b7772..21b1bf5765 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -43,9 +43,6 @@ #include "wmops.h" #endif -#ifdef DEBUG_SBA_AUDIO_DUMP -extern int16_t numTransportChannelsEnc; -#endif /*---------------------------------------------------------------------* * Local struct @@ -443,6 +440,10 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ const bool Opt_AGC_ON, /* i : AGC on/off flag */ const bool Opt_PCA_ON /* i : PCA option flag */ +#ifdef DEBUG_SBA_AUDIO_DUMP + , + int16_t *numTransportChannels +#endif ) { ENCODER_CONFIG_HANDLE hEncoderConfig; @@ -471,7 +472,7 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); #ifdef DEBUG_SBA_AUDIO_DUMP - numTransportChannelsEnc = hIvasEnc->st_ivas->nchan_transport; + *numTransportChannels = hIvasEnc->st_ivas->nchan_transport; #endif return error; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index dce4d6a010..325c854f73 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -191,6 +191,10 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ const bool Opt_AGC_ON, /* i : AGC on/off flag */ const bool Opt_PCA_ON /* i : PCA option flag */ +#ifdef DEBUG_SBA_AUDIO_DUMP + , + int16_t *numTransportChannels +#endif ); /*! r: error code */ -- GitLab