Commit d5c3095a authored by vaclav's avatar vaclav
Browse files

output number of clipped samples in downmixed channels; under DEBUGGING

parent 5f12f841
Loading
Loading
Loading
Loading
Loading
+5 −1
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,11 +793,14 @@ int main(
    }

#ifdef DEBUGGING
    int32_t cnt_frames_limited;
    if ( ( cnt_frames_limited = IVAS_ENC_GetCntFramesLimited( hIvasEnc ) ) > 0 )
    {
        fprintf( stdout, "\nLimiter applied in %d frames.\n\n", cnt_frames_limited );
    }
    if ( ( noClipping = IVAS_ENC_GetNoCLipping( hIvasEnc ) ) > 0 )
    {
        fprintf( stdout, "Clipping (saturation) detected: %d samples clipped!!!\n\n", noClipping );
    }

    print_snr();
#endif
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
/* ################### Start DEBUGGING switches ########################### */

#ifndef RELEASE
#define DEBUGGING                           /* Activate debugging part of the code */
/*#define DEBUGGING*/                           /* Activate debugging part of the code */
#endif
/*#define WMOPS*/                               /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
@@ -200,7 +200,7 @@


#define NONBE_FIX_1165_STATIC_SCAL_PARAMMC              /* FhG: add static scaling to ParamMC DMX */
#define NONBE_FIX_1165_APPLY_LIMITER_ON_ENCODER_DMX     /* FhG: apply the limiter before the core encoder for formats with downmixing where the signal could exceed the 16-bit value range */
/*#define NONBE_FIX_1165_APPLY_LIMITER_ON_ENCODER_DMX*/     /* FhG: apply the limiter before the core encoder for formats with downmixing where the signal could exceed the 16-bit value range */
#define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR            /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */

/* ##################### End NON-BE switches ########################### */
+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],
Loading