diff --git a/apps/encoder.c b/apps/encoder.c index 55b36e93562d310a29393b63e4aa9e82ef3c6454..dfd3da593b6a265c932d4316e5cfc9dcc36e91fc 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -785,12 +785,7 @@ int main( } /* *** Encode one frame *** */ - if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits -#ifdef DBG_BITSTREAM_ANALYSIS - , - frame -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nencodeFrame failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 6b37cdae8c052180dc4c62c5229c6c058eea0533..7d10e51557b9b1b8190ea7e923ce4dd8b6e66824 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -37,9 +37,6 @@ #include #include #include "options.h" -#ifdef DEBUGGING -#include "debug.h" -#endif #include "cnst.h" #include "prot.h" #include "stat_enc.h" @@ -50,9 +47,12 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#ifdef DEBUGGING +#include "debug.h" #ifdef DBG_BITSTREAM_ANALYSIS #include #endif +#endif #ifdef DEBUGGING @@ -212,7 +212,7 @@ ivas_error ind_list_realloc( { new_ind_list[i].id = old_ind_list[i].id; new_ind_list[i].value = old_ind_list[i].value; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 ); #endif } @@ -223,7 +223,7 @@ ivas_error ind_list_realloc( for ( ; i < max_num_indices; i++ ) { new_ind_list[i].nb_bits = -1; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( new_ind_list[i].function_name, "RESET in ind_list_realloc" ); #endif } @@ -812,7 +812,7 @@ void move_indices( new_ind_list[i].value = old_ind_list[i].value; new_ind_list[i].nb_bits = old_ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 ); #endif old_ind_list[i].nb_bits = -1; @@ -825,12 +825,12 @@ void move_indices( new_ind_list[i].id = old_ind_list[i].id; new_ind_list[i].value = old_ind_list[i].value; new_ind_list[i].nb_bits = old_ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 ); #endif old_ind_list[i].nb_bits = -1; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( old_ind_list[i].function_name, "RESET in move_indices" ); #endif } @@ -909,7 +909,7 @@ ivas_error check_ind_list_limits( return error; } -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) const char *named_indices_table[] = { "IND_IVAS_FORMAT", "IND_SMODE_OMASA", @@ -2837,7 +2837,7 @@ ivas_error push_indice( hBstr->ind_list[j].id = hBstr->ind_list[j - 1].id; hBstr->ind_list[j].nb_bits = hBstr->ind_list[j - 1].nb_bits; hBstr->ind_list[j].value = hBstr->ind_list[j - 1].value; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( hBstr->ind_list[j].function_name, hBstr->ind_list[j - 1].function_name, 100 ); #endif } @@ -2848,7 +2848,7 @@ ivas_error push_indice( hBstr->ind_list[i].id = id; hBstr->ind_list[i].value = value; hBstr->ind_list[i].nb_bits = nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( hBstr->ind_list[i].function_name, named_indices_table[id], 100 ); #endif @@ -2865,7 +2865,7 @@ ivas_error push_indice( * Push a new indice into the buffer at the next position *-------------------------------------------------------------------*/ -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) ivas_error push_next_indice_( const char *caller, #else @@ -2915,7 +2915,7 @@ ivas_error push_next_indice( hBstr->ind_list[hBstr->nb_ind_tot].value = value; hBstr->ind_list[hBstr->nb_ind_tot].nb_bits = nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( hBstr->ind_list[hBstr->nb_ind_tot].function_name, caller, 100 ); #endif @@ -2932,7 +2932,7 @@ ivas_error push_next_indice( * Push a bit buffer into the buffer at the next position *-------------------------------------------------------------------*/ -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) ivas_error push_next_bits_( const char *caller, #else @@ -2978,7 +2978,7 @@ ivas_error push_next_bits( ptr->value = code; ptr->nb_bits = 16; ptr->id = prev_id; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( ptr->function_name, caller, 100 ); #endif hBstr->nb_ind_tot++; @@ -2997,7 +2997,7 @@ ivas_error push_next_bits( ptr->value = bits[i]; ptr->nb_bits = 1; ptr->id = prev_id; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( ptr->function_name, caller, 100 ); #endif hBstr->nb_ind_tot++; @@ -3069,7 +3069,7 @@ uint16_t delete_indice( hBstr->ind_list[j].id = hBstr->ind_list[i].id; hBstr->ind_list[j].value = hBstr->ind_list[i].value; hBstr->ind_list[j].nb_bits = hBstr->ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( hBstr->ind_list[j].function_name, hBstr->ind_list[i].function_name, 100 ); #endif } @@ -3083,7 +3083,7 @@ uint16_t delete_indice( { /* reset the shifted indices at the end of the list */ hBstr->ind_list[j].nb_bits = -1; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( hBstr->ind_list[j].function_name, "RESET in delete_indice" ); #endif } @@ -3388,10 +3388,6 @@ static ivas_error write_indices_element( uint16_t **pt_stream, /* i : pointer to bitstream buffer */ const int16_t is_SCE, /* i : flag to distingusih SCE and CPE */ const int16_t element_id /* i : id of the SCE or CPE */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ) { int16_t ch; @@ -3513,7 +3509,7 @@ static ivas_error write_indices_element( } -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) if ( is_SCE ) /* EVS and SCE */ { static FILE *f1 = 0; @@ -3625,10 +3621,6 @@ ivas_error write_indices_ivas( Encoder_Struct *st_ivas, /* i/o: encoder state structure */ uint16_t *bit_stream, /* i/o: output bitstream */ uint16_t *num_bits /* i : number of indices written to output */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ) { int16_t i, n; @@ -3694,22 +3686,12 @@ ivas_error write_indices_ivas( for ( n = 0; n < st_ivas->nSCE; n++ ) { - write_indices_element( st_ivas, &pt_stream, 1, n -#ifdef DBG_BITSTREAM_ANALYSIS - , - frame -#endif - ); + write_indices_element( st_ivas, &pt_stream, 1, n ); } for ( n = 0; n < st_ivas->nCPE; n++ ) { - write_indices_element( st_ivas, &pt_stream, 0, n -#ifdef DBG_BITSTREAM_ANALYSIS - , - frame -#endif - ); + write_indices_element( st_ivas, &pt_stream, 0, n ); } *num_bits = (uint16_t) ( pt_stream - bit_stream ); diff --git a/lib_com/prot.h b/lib_com/prot.h index c3acc73e86260b4ea7f907d6e60522bba3f31237..30e895ccdcbe8d6ee3dcb7b9aced582c402f5823 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -473,12 +473,12 @@ ivas_error push_indice( int16_t nb_bits /* i : number of bits used to quantize the indice */ ); -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) #define push_next_indice( ... ) push_next_indice_( __func__, __VA_ARGS__ ) #define push_next_bits( ... ) push_next_bits_( __func__, __VA_ARGS__ ); #endif -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) ivas_error push_next_indice_( const char *caller, #else @@ -489,7 +489,7 @@ ivas_error push_next_indice( int16_t nb_bits /* i : number of bits used to quantize the indice */ ); -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) ivas_error push_next_bits_( const char *caller, #else @@ -589,10 +589,6 @@ ivas_error write_indices_ivas( Encoder_Struct *st_ivas, /* i/o: encoder state structure */ uint16_t *bit_stream, /* i/o: output bitstream */ uint16_t *num_bits /* i/o: number of bits written to output */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ); Word16 rate2EVSmode( diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index f7b5a4dd76079a33e4d43b6d0f699317a2150544..b5339333d3156033315946605994d27c7b5d611a 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -40,7 +40,7 @@ #include #endif #include "wmc_auto.h" -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) #include #endif @@ -170,7 +170,7 @@ ivas_error ivas_corecoder_enc_reconfig( temp_ind_list[i].id = hBstr->ind_list[i].id; temp_ind_list[i].value = hBstr->ind_list[i].value; temp_ind_list[i].nb_bits = hBstr->ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( temp_ind_list[i].function_name, hBstr->ind_list[i].function_name, 100 ); #endif hBstr->ind_list[i].nb_bits = -1; @@ -376,7 +376,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list[i].id = temp_ind_list[i].id; st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list[i].value = temp_ind_list[i].value; st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list[i].nb_bits = temp_ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list[i].function_name, temp_ind_list[i].function_name, 100 ); #endif } @@ -396,7 +396,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list[i].id = temp_ind_list[i].id; st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list[i].value = temp_ind_list[i].value; st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list[i].nb_bits = temp_ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list[i].function_name, temp_ind_list[i].function_name, 100 ); #endif } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index cd6a43f2b4039a33a196067ee7c882c42d5d41c5..6f2672cfc8ef9fcb6e7a821ec00342b0986742f6 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -42,7 +42,7 @@ #include "debug.h" #endif #include "wmc_auto.h" -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) #include #endif diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 565b2642c5c532b15ed0f09880a6d6dde2002479..9508496e54d5de6d7997c9e005eb4913c2604a08 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -42,7 +42,7 @@ #include "wmc_auto.h" #include "prot.h" #include "basop_settings.h" -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) #include #endif @@ -1276,7 +1276,7 @@ void reset_metadata_spatial( for ( i = 0; i < next_ind_sid; i++ ) { hMetaData->ind_list[i].nb_bits = -1; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( hMetaData->ind_list[i].function_name, "RESET in reset_metadata_spatial" ); #endif } @@ -1285,12 +1285,12 @@ void reset_metadata_spatial( { hMetaData->ind_list[j].value = hMetaData->ind_list[i].value; hMetaData->ind_list[j].nb_bits = hMetaData->ind_list[i].nb_bits; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) strncpy( hMetaData->ind_list[j].function_name, hMetaData->ind_list[i].function_name, 100 ); #endif hMetaData->nb_bits_tot += hMetaData->ind_list[j].nb_bits; hMetaData->ind_list[i].nb_bits = -1; -#ifdef BISTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( hMetaData->ind_list[i].function_name, "RESET in reset_metadata_spatial" ); #endif } @@ -1317,7 +1317,7 @@ void reset_metadata_spatial( hMetaData->nb_ind_tot--; hMetaData->nb_bits_tot -= hMetaData->ind_list[hMetaData->nb_ind_tot].nb_bits; hMetaData->ind_list[hMetaData->nb_ind_tot].nb_bits = -1; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( hMetaData->ind_list[hMetaData->nb_ind_tot].function_name, "RESET in reset_metadata_spatial" ); #endif } @@ -1975,7 +1975,7 @@ void restore_metadata_buffer( for ( i = next_ind_start; i < hMetaData->nb_ind_tot; i++ ) { hMetaData->ind_list[i].nb_bits = -1; -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) sprintf( hMetaData->ind_list[i].function_name, "RESET in restore_metadata_buffer" ); #endif } diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 514b093f373232fdb52d9b815c482ef4293d61dc..f464de18275e5d95dd25481531b65c307232212f 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -450,7 +450,7 @@ static void write_metadata_buffer( for ( i = 0; i < hMetaData_tmp->nb_ind_tot; i++ ) { -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) push_next_indice_( hMetaData_tmp->ind_list[i].function_name, hMetaData, hMetaData_tmp->ind_list[i].value, hMetaData_tmp->ind_list[i].nb_bits ); #else push_next_indice( hMetaData, hMetaData_tmp->ind_list[i].value, hMetaData_tmp->ind_list[i].nb_bits ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 66331a3f63f0455349e7dee7437ccac72f698e2d..984dc90f71405c3f121085627aee0333324f1902 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1143,10 +1143,6 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( int16_t inputBufferSize, /* i : total number of samples in the input buffer. Related function: IVAS_ENC_GetInputBufferSize() */ uint16_t *outputBitStream, /* o : pointer to serial output bitstream. The array must already be allocated and be of size at least IVAS_MAX_BITS_PER_FRAME */ uint16_t *numOutBits /* o : number of bits written to output bitstream. Each bit is stored as a single uint16_t value */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ) { Encoder_Struct *st_ivas; @@ -1244,7 +1240,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( { st_ivas->ind_list[i].nb_bits = -1; } -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) for ( i = 0; i < st_ivas->ivas_max_num_indices; i++ ) { memset( st_ivas->ind_list[i].function_name, 'A', 100 * sizeof( char ) ); @@ -1352,12 +1348,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } /* write indices into bitstream buffer */ - write_indices_ivas( st_ivas, outputBitStream, numOutBits -#ifdef DBG_BITSTREAM_ANALYSIS - , - frame -#endif - ); + write_indices_ivas( st_ivas, outputBitStream, numOutBits ); /* Reset switching flag before next call - can be set to "true" by some setters */ hIvasEnc->switchingActive = false; @@ -1378,21 +1369,12 @@ ivas_error IVAS_ENC_EncodeFrameToCompact( const int16_t inputBufferSize, /* i : total number of samples in the input buffer. Related function: IVAS_ENC_GetInputBufferSize() */ uint8_t *outputBitStream, /* o : pointer to compact output bitstream. The array must already be allocated. */ uint16_t *numOutBits /* o : number of bits written to output bitstream */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ) { ivas_error error; uint16_t bitstream[IVAS_MAX_BITS_PER_FRAME]; - if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, inputBuffer, inputBufferSize, bitstream, numOutBits -#ifdef DBG_BITSTREAM_ANALYSIS - , - frame -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, inputBuffer, inputBufferSize, bitstream, numOutBits ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 043e4c2713670938bded27b64e6dfddf63d2a64b..5a42c3dad1ebe2eb7df9caa796d0422902b35177 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -298,10 +298,6 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( int16_t inputBufferSize, /* i : total number of samples in the input buffer. Related function: IVAS_ENC_GetInputBufferSize() */ uint16_t *outputBitStream, /* o : pointer to serial output bitstream. The array must already be allocated and be of size at least IVAS_MAX_BITS_PER_FRAME */ uint16_t *numOutBits /* o : number of bits written to output bitstream. Each bit is stored as a single uint16_t value */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ); /*! r: error code */ @@ -311,10 +307,6 @@ ivas_error IVAS_ENC_EncodeFrameToCompact( const int16_t inputBufferSize, /* i : total number of samples in the input buffer. Related function: IVAS_ENC_GetInputBufferSize() */ uint8_t *outputBitStream, /* o : pointer to compact output bitstream. The array must already be allocated. */ uint16_t *numOutBits /* o : number of bits written to output bitstream */ -#ifdef DBG_BITSTREAM_ANALYSIS - , - int32_t frame -#endif ); /* Setter functions - apply changes to encoder configuration */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index a2a4fd06e34b117720677f7dbf86561f7be9b996..05e56ef4a9a15a333e8aaa718810560190eeddd3 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -55,7 +55,7 @@ typedef struct int16_t id; /* id of the indice */ uint16_t value; /* value of the quantized indice */ int16_t nb_bits; /* number of bits used for the quantization of the indice */ -#ifdef DBG_BITSTREAM_ANALYSIS +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) char function_name[100]; #endif } Indice, *INDICE_HANDLE;