Commit 7fa3c751 authored by vaclav's avatar vaclav
Browse files

move DEBUG_VA to ivas_set_surplus_brate_enc()

parent ae50cf1e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5158,6 +5158,10 @@ void ivas_omasa_enc(
#ifdef OMASA_BRATE
void ivas_set_surplus_brate_enc(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
#ifdef DEBUG_VA
    ,
    const int16_t *nb_bits_metadata                             /* i  : number of metadata bits                 */
#endif
);

void ivas_set_surplus_brate_dec(
+4 −25
Original line number Diff line number Diff line
@@ -378,8 +378,11 @@ ivas_error ivas_enc(
                          st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa );

        /* Configuration of combined-format bit-budget distribution */
#ifdef DEBUG_VA
        ivas_set_surplus_brate_enc( st_ivas, nb_bits_metadata );
#else
        ivas_set_surplus_brate_enc( st_ivas );

#endif
#else
        if ( st_ivas->hQMetaData != NULL )
        {
@@ -438,30 +441,6 @@ ivas_error ivas_enc(
        {
            ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); // VE2Nokia: this condition is unnecessary
        }

#ifdef DEBUG_VA
        if ( st_ivas->hSCE[0] != NULL )
        {
            float tmpF = 0;
            if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ )
            {
                tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 );
            }
            else
            {
                for ( i = 0; i < st_ivas->nchan_ism; i++ )
                {
                    tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 );
                }
            }
            tmpF /= 1000.f;
            dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_ISM" );
            tmpF = ivas_total_brate / 1000.0f - tmpF;
            dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA" );
            tmpF = nb_bits_metadata[0] * 50 / 1000.0f;
            dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MD" );
        }
#endif
    }
#endif
    else if ( ivas_format == MC_FORMAT )
+29 −0
Original line number Diff line number Diff line
@@ -561,6 +561,10 @@ void set_ism_importance_interformat(

void ivas_set_surplus_brate_enc(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
#ifdef DEBUG_VA
    ,
    const int16_t *nb_bits_metadata /* i  : number of metadata bits         */
#endif
)
{
    if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ )
@@ -577,6 +581,31 @@ void ivas_set_surplus_brate_enc(
        st_ivas->hCPE[0]->brate_surplus = 0;
    }

#ifdef DEBUG_VA
    if ( st_ivas->hSCE[0] != NULL )
    {
        int16_t input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC );
        float tmpF = 0;
        if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ )
        {
            tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 );
        }
        else
        {
            for ( int16_t i = 0; i < st_ivas->nchan_ism; i++ )
            {
                tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 );
            }
        }
        tmpF /= 1000.f;
        dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_ISM" ); /* == ism_total_brate incl. ISM MD */
        tmpF = st_ivas->hEncoderConfig->ivas_total_brate / 1000.0f - tmpF;
        dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA" ); /* == masa_total_brate incl. MASA MD */
        tmpF = nb_bits_metadata[0] * FRAMES_PER_SEC / 1000.0f;
        dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA_MD" ); /* == MASA MD bitrate */
    }
#endif

    return;
}
#endif