Commit 79b32de9 authored by malenov's avatar malenov
Browse files

add dbg output to encoder

parent ac11b94e
Loading
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -936,7 +936,19 @@ static bool parseCmdlIVAS_enc(
                return false;
            }
        }

#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
        /*-----------------------------------------------------------------*
         * Define additional subfolder for debug info output in ./res
         *-----------------------------------------------------------------*/
        else if ( strcmp( argv_to_upper, "-INFO" ) == 0 )
        {
            extern char infoFolder[FILENAME_MAX];
            strncpy( infoFolder, argv[i + 1], sizeof( infoFolder ) );
            i += 2;
        }
#endif /* #ifdef DEBUG_MODE_INFO_TWEAK */
#endif /* #ifdef DEBUG_MODE_INFO */

        /*-----------------------------------------------------------------*
         * deactivate delay compensation
@@ -1636,6 +1648,11 @@ static void usage_enc( void )
    fprintf( stdout, "-pca                : activate PCA in SBA format FOA at 256 kbps \n" );
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
    fprintf( stdout, "-info <folder>      : specify subfolder name for debug output\n" );
#endif
#endif
    fprintf( stdout, "-q                  : Quiet mode, no frame counters\n" );
    fprintf( stdout, "                      default is deactivated\n" );
    fprintf( stdout, "\n" );
+10 −11
Original line number Diff line number Diff line
@@ -493,7 +493,7 @@ static ivas_error acelp_FCB_allocator(
    }
    cdbk--;

#if defined DEBUGGING
#ifdef DEBUGGING
    if ( cdbk < 0 && coder_type != TRANSITION )
    {
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bit-budget for fixed innovation codebook (frame = %d). Exiting! \n" );
@@ -612,7 +612,6 @@ ivas_error config_acelp1(
    Word16 flag_hardcoded, coder_type_sw, fix_first;
    Word32 core_brate;
#ifdef DEBUGGING
    Word32 core_brate_inpI = core_brate_inp;
#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
    (void) active_cnt;
#endif
@@ -642,15 +641,15 @@ ivas_error config_acelp1(
    {
        nb_subfr = NB_SUBFR;

#if defined DEBUGGING
#ifdef DEBUGGING
        if ( ( ( core_brate_inp < 5900 && coder_type > UNVOICED ) && !( core_brate_inp < MIN_TC_BRATE && coder_type == TRANSITION ) ) && !( idchan > 0 && element_mode == IVAS_CPE_TD ) && !( element_mode == IVAS_SCE && tdm_low_rate_mode ) )
        {
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inpI );
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inp );
        }

        if ( core_brate_inp > ACELP_12k8_HIGH_LIMIT && core == ACELP_CORE )
        {
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too high bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inpI );
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too high bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inp );
        }
#endif
    }
@@ -658,10 +657,10 @@ ivas_error config_acelp1(
    {
        nb_subfr = NB_SUBFR16k;

#if defined DEBUGGING
#ifdef DEBUGGING
        if ( core_brate_inp < ACELP_16k_LOW_LIMIT && core == ACELP_CORE )
        {
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@16k in frame %d. Exiting!\n", core_brate_inpI );
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@16k in frame %d. Exiting!\n", core_brate_inp );
        }
#endif
    }
@@ -1220,7 +1219,7 @@ ivas_error config_acelp1(
                    }
                    else /* No FCB */
                    {
#if defined DEBUGGING
#ifdef DEBUGGING
                        IVAS_ERROR( IVAS_ERR_INTERNAL, "WARNING!!!, No bit allocated to FCB, check frame %d\n" );
#endif
                        acelp_cfg->fixed_cdk_index[0] = -1;
@@ -1376,7 +1375,7 @@ ivas_error config_acelp1(
        }
        else if ( flag_hardcoded && core == ACELP_CORE && bits != 0 )
        {
#if defined DEBUGGING
#ifdef DEBUGGING
            IVAS_ERROR( IVAS_ERR_INTERNAL, "ERROR: bit-budget incorrect (%d bits) in frame %d.\n", (Word32) bits );
#endif
        }
@@ -1440,7 +1439,7 @@ ivas_error config_acelp1(
                    bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits );
                }
#endif
#if defined DEBUGGING
#ifdef DEBUGGING
                if ( idchan > 0 && bits > 0 && ( coder_type > UNVOICED || tdm_low_rate_mode == 0 ) )
                {
                    IVAS_ERROR( IVAS_ERR_INTERNAL, "WARNING !! Unused bits in secondary channel at frame %d\n" );
@@ -1470,7 +1469,7 @@ ivas_error config_acelp1(
        }
        else if ( bits < 0 && !( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) )
        {
#if defined DEBUGGING
#ifdef DEBUGGING
            IVAS_ERROR( IVAS_ERR_INTERNAL, "ERROR: bit-budget incorrect (%d bits) in frame %d.\n", (Word32) bits );
#endif
        }
+4 −0
Original line number Diff line number Diff line
@@ -7298,6 +7298,10 @@ void ivas_omasa_enc(

void ivas_set_surplus_brate_enc(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
#ifdef DEBUG_MODE_INFO
    ,
    const int16_t *nb_bits_metadata                             /* i  : number of metadata bits                 */
#endif
);

void ivas_set_surplus_brate_dec(
+4 −1
Original line number Diff line number Diff line
@@ -36,13 +36,16 @@

#ifndef OPTIONS_H
#define OPTIONS_H
//#define DEBUGGING /*allows message printed out during run time */
#define DEBUGGING /*allows message printed out during run time */
#ifdef DEBUGGING
#define DEBUG_MODE_INFO /* define to output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO_TWEAK /* enable command line switch to specify subdirectory for debug info output inside "./res/" */
#include "debug.h"
#endif

#include "stl.h"


/* clang-format off */
  /* ################### Start compiler switches ######################## */

+15 −2
Original line number Diff line number Diff line
@@ -591,9 +591,22 @@ void amr_wb_enc_fx(

    /* update main codec parameters */
    updt_enc_common_fx( st, Etot, Q_new );
#ifdef MY_DEBUG
    dbgwrite_indices( st );

#ifdef DEBUG_MODE_INFO
    dbgwrite( &st->codec_mode, sizeof( short ), 1, input_frame, "res/codec" );
    dbgwrite( &st->core, sizeof( short ), 1, input_frame, "res/core" );
    dbgwrite( &st->extl, sizeof( short ), 1, input_frame, "res/extl" );
    dbgwrite( &st->bwidth, sizeof( short ), 1, input_frame, "res/bwidth" );
    float ener_flt = st->total_brate / 1000.0f;
    dbgwrite( &ener_flt, sizeof( float ), 1, input_frame, "res/total_brate" );
    ener_flt = st->core_brate / 1000.0f;
    dbgwrite( &ener_flt, sizeof( float ), 1, input_frame, "res/core_brate" );
    dbgwrite( &st->coder_type, sizeof( short ), 1, input_frame, "res/coder_type" );
    dbgwrite( &st->cng_type, sizeof( short ), 1, input_frame, "res/cng_type" );
    dbgwrite( &st->L_frame, sizeof( short ), 1, input_frame, "res/L_frame" );
    dbgwrite( &st->vad_flag, sizeof( short ), 1, input_frame, "res/vad_flag" );
#endif

    return;
}
/*---------------------------------------------------------------------*
Loading