Commit 62aa4070 authored by malenovsky's avatar malenovsky
Browse files

Merge branch 'ci/add-logging-for-encoder' into 'main'

[CI] Add logging for encoder

See merge request !380
parents 1670c2bf 554cb439
Loading
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -937,7 +937,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
@@ -1637,6 +1649,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
@@ -514,7 +514,7 @@ static ivas_error acelp_FCB_allocator(
    }
    cdbk = sub( cdbk, 1 );

#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" );
@@ -641,7 +641,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;
    (void) core_brate_inpI;
@@ -681,15 +680,15 @@ ivas_error config_acelp1(
        nb_subfr = NB_SUBFR;
        move16();

#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
    }
@@ -698,10 +697,10 @@ ivas_error config_acelp1(
        nb_subfr = NB_SUBFR16k;
        move16();

#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
    }
@@ -1408,7 +1407,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;
@@ -1624,7 +1623,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
        }
@@ -1698,7 +1697,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" );
@@ -1735,7 +1734,7 @@ ivas_error config_acelp1(
        }
        ELSE IF( bits < 0 && !( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( 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
@@ -7813,6 +7813,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(
+3 −1
Original line number Diff line number Diff line
@@ -47,7 +47,9 @@

/*#define DEBUGGING*/                             /* Allows debugging message to be printed out during runtime */
#ifdef DEBUGGING
/*#define DBG_WAV_WRITER*/
#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/" */
/*#define DBG_WAV_WRITER*/ /* enable dbgwrite_wav() function for generating ".wav" files */
#endif

#define SUPPORT_JBM_TRACEFILE                   /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
+15 −2
Original line number Diff line number Diff line
@@ -590,9 +590,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