Commit cb0dfc31 authored by norvell's avatar norvell
Browse files

Add max/min overload value

parent 5575ec8f
Loading
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -195,7 +195,8 @@ int main(
#ifdef DEBUG_SBA
    int16_t numTransportChannels = 1;
#endif
    int32_t cnt_frames_limited, noClipping;
    int32_t noClipping;
    float maxOverload, minOverload;
#endif

#ifdef DEBUGGING
@@ -793,9 +794,11 @@ int main(
    }

#ifdef DEBUGGING
    if ( ( noClipping = IVAS_ENC_GetNoCLipping( hIvasEnc ) ) > 0 )
    if ( ( noClipping = IVAS_ENC_GetNoCLipping( hIvasEnc, &maxOverload, &minOverload ) ) > 0 )
    {
        fprintf( stdout, "Clipping (saturation) detected: %d samples clipped!!!\n\n", noClipping );
        fprintf( stdout, "Core input overload detected: %d samples!!!\n", noClipping );
        fprintf( stdout, "Max overload value: %f \n", maxOverload );
        fprintf( stdout, "Min overload value: %f \n\n", minOverload );
    }
    print_snr();
#endif
+5 −3
Original line number Diff line number Diff line
@@ -223,10 +223,12 @@ void mvs2s(
);

#ifdef DEBUGGING
/*! r: number of clipped samples */
/*! r: number of overload samples */
uint32_t check_clipping(
    const float x[],    /* i  : input vector                                   */
    const int16_t n  /* i  : vector size                                     */
    const int16_t n,    /* i  : vector size                                    */
    float *maxOverload, /* i/o: max overload value                             */
    float *minOverload  /* i/o: max overload value                             */
);

#endif
+15 −8
Original line number Diff line number Diff line
@@ -374,10 +374,12 @@ void mvs2s(
}

#ifdef DEBUGGING
/*! r: number of clipped samples */
/*! r: number of overload samples */
uint32_t check_clipping(
    const float x[],    /* i  : input vector  */
    const int16_t n  /* i  : vector size   */
    const int16_t n,    /* i  : vector size   */
    float *maxOverload, /* i/o: max overload value */
    float *minOverload  /* i/o: max overload value */
)
{
    int16_t i;
@@ -387,17 +389,22 @@ uint32_t check_clipping(
    for ( i = 0; i < n; i++ )
    {
        temp = x[i];
        temp = (float) floor( temp + 0.5f );

        if ( temp > MAX16B_FLT )
        if ( temp >= ( MAX16B_FLT + 0.5f ) )
        {
            temp = MAX16B_FLT;
            noClipping++;
            if ( temp > *maxOverload )
            {
                *maxOverload = temp;
            }
        else if ( temp < MIN16B_FLT )
        }
        else if ( temp <= ( MIN16B_FLT - 0.5f ) )
        {
            temp = MIN16B_FLT;
            noClipping++;
            if ( temp < *minOverload )
            {
                *minOverload = temp;
            }
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ ivas_error ivas_cpe_enc(
    for ( n = 0; n < n_CoreChannels; n++ )
    {
#ifdef DEBUGGING
        st_ivas->noClipping += check_clipping( hCPE->hCoreCoder[n]->input, input_frame );
        st_ivas->noClipping += check_clipping( hCPE->hCoreCoder[n]->input, input_frame, &st_ivas->maxOverload, &st_ivas->minOverload );

#endif
        error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n],
+2 −0
Original line number Diff line number Diff line
@@ -412,6 +412,8 @@ ivas_error ivas_init_encoder(

#ifdef DEBUGGING
    st_ivas->noClipping = 0;
    st_ivas->maxOverload = 0;
    st_ivas->minOverload = 0;
#endif
    /*-----------------------------------------------------------------*
     * Allocate floating-point input audio buffers
Loading