Commit 9e71a50c authored by vaillancour's avatar vaillancour
Browse files

moving some debugging code and fixing another cng issue for encoder io

parent 46da7b09
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -63,7 +63,9 @@ 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                                       */
+3 −1
Original line number Diff line number Diff line
@@ -584,7 +584,9 @@ void amr_wb_enc_fx(

    /* update main codec parameters */
    updt_enc_common(st, Etot, Q_new);

#ifdef MY_DEBUG
    dbgwrite_indices(st);
#endif
    return;
}
/*---------------------------------------------------------------------*
+38 −1
Original line number Diff line number Diff line
@@ -27,7 +27,44 @@ long frame = 0; /* Counter of frames */
 * Local constants
 *------------------------------------------------------------------------------------------*/


#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


int main( int argc, char** argv )
+0 −32
Original line number Diff line number Diff line
@@ -16,39 +16,7 @@
static void initFrameHeader_loc( Encoder_State_fx *st );
static void writeFrameHeader_loc( Encoder_State_fx *st );
static void configure_core_coder_loc( Encoder_State_fx *st);
#ifdef MY_DEBUG
static void dbgwrite_indices(Encoder_State_fx* st)
{
    Word16 i;
    FILE* outputFile = NULL;
    static Word32 loc_frame = 1;

    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
/*-------------------------------------------------------------------*
 * evs_enc()
 *
+1 −1
Original line number Diff line number Diff line
@@ -414,7 +414,7 @@ void updt_enc_common(
        }
        
        test(); test(); test();
        if ((EQ_32(st->core_brate_fx, SID_2k40) || EQ_32(st->core_brate_fx, FRAME_NO_DATA) || (GT_32(st->core_brate_fx, SID_1k75) && EQ_16(st->core_fx, AMR_WB_CORE))) && st->hDtxEnc->first_CNG_fx == 0 && EQ_16(st->cng_type_fx, LP_CNG))
        if( (EQ_32(st->core_brate_fx, SID_2k40) || EQ_32(st->core_brate_fx, FRAME_NO_DATA)) && st->hDtxEnc->first_CNG_fx == 0 && EQ_16(st->cng_type_fx, LP_CNG))
        {
            st->hDtxEnc->first_CNG_fx = 1;
            move16();