Commit 29861d76 authored by vaillancour's avatar vaillancour
Browse files

Move debug code into debug.c and some cleaning

parent b45ffd79
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -63,9 +63,7 @@ void reset_preecho_dec_fx(
    }
#endif
/*End of IVAS_CNST_AND_ROM*/
#ifdef MY_DEBUG
void dbgwrite_indices(Encoder_State_fx* st);
#endif
void preecho_sb_fx(
    const Word32  brate,                /* i   Q0  : core bit-rate                                           */
    Word32 *wtda_audio_fx,              /* i   q_sig32  : imdct signal                                       */
+38 −0
Original line number Diff line number Diff line
@@ -107,6 +107,44 @@ static void setvalue(

static int16_t make_dirs( const char *const pathname );

#ifdef MY_DEBUG
void dbgwrite_indices(Encoder_State_fx* st)
{
    Word16 i;
    FILE* outputFile = NULL;
    static Word32 loc_frame = 1;
    float ft = (float)st->core_brate_fx;
    dbgwrite(&ft, 4, 1, 320, "res/core_rate");
    dbgwrite(&st->codec_mode, 2, 1, 320, "res/c_mode");
    dbgwrite(&st->coder_type, 2, 1, 320, "res/c_type");
    ft = (float)loc_frame;
    dbgwrite(&ft, 4, 1, 320, "res/loc_frame");
    if (outputFile == NULL) {
        if (loc_frame == 1)
        {
            outputFile = fopen("indice_test.txt", "w+");
            fprintf(outputFile, "Number\tvalue\tbits\n");
            printf("creating debugging file for writing indices.\n");
        }
        else
        {
            outputFile = fopen("indice_test.txt", "a+");
        }
    }
    if (outputFile != NULL) {
        fprintf(outputFile, "~~~~~~~~~~~frame: %d @ %d kbps\n", loc_frame, st->last_total_brate_fx);
        for (i = 0; i < MAX_NUM_INDICES - 1; i++)
        {
            if (st->hBstr->ind_list_fx[i].nb_bits > -1)
            {
                fprintf(outputFile, "%d\t%d\t%d\n", i, st->hBstr->ind_list_fx[i].value, st->hBstr->ind_list_fx[i].nb_bits);
            }
        }
        loc_frame++;
        fclose(outputFile);
    }
}
#endif
/*-------------------------------------------------------------------*
 * dbgwrite()
 *
+3 −1
Original line number Diff line number Diff line
@@ -76,7 +76,9 @@ char *fname( char *dir, char *file, const int16_t n, const int16_t id, const int
/*------------------------------------------------------------------------------------------*
 * Read/write I/O tool
 *------------------------------------------------------------------------------------------*/

#ifdef MY_DEBUG
void dbgwrite_indices(Encoder_State_fx * st);
#endif
#ifdef DEBUGGING

int16_t lookup(
+0 −1
Original line number Diff line number Diff line
@@ -1349,7 +1349,6 @@ ivas_error acelp_core_dec_fx(
    /* Update old synthesis buffer - needed for ACELP internal sampling rate switching */
    Copy( syn_fx + st_fx->L_frame_fx - L_SYN_MEM, st_fx->mem_syn_r, L_SYN_MEM );
    deemph_fx( syn_fx, st_fx->preemph_fac, st_fx->L_frame_fx, &(st_fx->mem_deemph_fx) );

    unscale_AGC( syn_fx, st_fx->Q_syn, syn_fx_tmp2, st_fx->agc_mem_fx, st_fx->L_frame_fx );
    Copy(syn_fx_tmp2, syn_fx, st_fx->L_frame_fx);

+12 −1
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ int main(int argc, char *argv[])
#ifdef BASOP_IGNORE_WARNINGS_IN_EVS
                    BASOP_SATURATE_WARNING_ON
#endif

                }
            }
            ELSE
@@ -207,7 +208,17 @@ int main(int argc, char *argv[])
#endif
                }
            }

#ifdef MY_DEBUG
            dbgwrite(&st_fx->codec_mode, 2, 1, st_fx->output_frame_fx, "res/codec_mode.dec");
            dbgwrite(&st_fx->coder_type_fx, 2, 1, st_fx->output_frame_fx, "res/coder_type.dec");
            dbgwrite(&st_fx->bfi_fx, 2, 1, st_fx->output_frame_fx, "res/bfi.dec");
            {
                float ftmp = st_fx->total_brate_fx;
                dbgwrite(&ftmp, 4, 1, st_fx->output_frame_fx, "res/tot_bitrate.dec");
                ftmp = st_fx->core_brate_fx;
                dbgwrite(&ftmp, 4, 1, st_fx->output_frame_fx, "res/core_bitrate.dec");
            }
#endif
            END_SUB_WMOPS;


Loading