Commit 61176f36 authored by vaclav's avatar vaclav Committed by norvell
Browse files

output number of clipped samples in downmixed channels; under DEBUGGING

parent 0c363ed0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ int main(
#ifdef DEBUG_SBA
    int16_t numTransportChannels = 1;
#endif
    int32_t cnt_frames_limited, noClipping;
#endif

#ifdef DEBUGGING
@@ -792,6 +793,10 @@ int main(
    }

#ifdef DEBUGGING
    if ( ( noClipping = IVAS_ENC_GetNoCLipping( hIvasEnc ) ) > 0 )
    {
        fprintf( stdout, "Clipping (saturation) detected: %d samples clipped!!!\n\n", noClipping );
    }
    print_snr();
#endif
    /*------------------------------------------------------------------------------------------*
+9 −0
Original line number Diff line number Diff line
@@ -222,6 +222,15 @@ void mvs2s(
    const int16_t n    /* i  : vector size                                     */
);

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

#endif
/*! r: number of clipped samples */
uint32_t mvr2s(
    const float x[], /* i  : input vector                                    */
    int16_t y[],     /* o  : output vector                                   */
+33 −0
Original line number Diff line number Diff line
@@ -373,6 +373,39 @@ void mvs2s(
    return;
}

#ifdef DEBUGGING
/*! r: number of clipped samples */
uint32_t check_clipping(
    const float x[], /* i  : input vector  */
    const int16_t n  /* i  : vector size   */
)
{
    int16_t i;
    float temp;
    uint32_t noClipping = 0;

    for ( i = 0; i < n; i++ )
    {
        temp = x[i];
        temp = (float) floor( temp + 0.5f );

        if ( temp > MAX16B_FLT )
        {
            temp = MAX16B_FLT;
            noClipping++;
        }
        else if ( temp < MIN16B_FLT )
        {
            temp = MIN16B_FLT;
            noClipping++;
        }
    }

    return noClipping;
}

#endif
/*! r: number of clipped samples */
uint32_t mvr2s(
    const float x[], /* i  : input vector  */
    int16_t y[],     /* o  : output vector */
+4 −0
Original line number Diff line number Diff line
@@ -471,6 +471,10 @@ 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 );

#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],
                                     &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n],
                                     realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n],
+3 −0
Original line number Diff line number Diff line
@@ -410,6 +410,9 @@ ivas_error ivas_init_encoder(

    st_ivas->nchan_transport = -1;

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