Commit 06a195df authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_FLOAT_1535_ARI_RES_Q_CLEANUP

parent 9f19bcdc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_FLOAT_1535_ARI_RES_Q_CLEANUP                /* FhG: remove dead code from tcx_ari_res_Q_spec() */
#define FIX_FLOAT_1536_INIT_NO_PARAM_LPC                /* FhG: make sure no_param_lpc is initialized in core_encode_twodiv() */
#define FIX_1525_UNINIT_FORMAT_SWITCHING_DEC            /* VA: float issue 1525: fix reading of uninitialized memory in format switching at the decoder */

+0 −63
Original line number Diff line number Diff line
@@ -1106,70 +1106,7 @@ int16_t tcx_ari_res_Q_spec(
    fac_p = 0.5f - fac_m;
    num_zeros = 0;

#ifdef FIX_FLOAT_1535_ARI_RES_Q_CLEANUP
    assert( x_fac != NULL );
#else
    if ( x_fac == NULL )
    {
        for ( i = 0; i < L_frame; ++i )
        {
            if ( bits >= target_bits )
            {
                /* no bits left */
                break;
            }
            if ( x_Q[i] != 0 )
            {
                int16_t sign = ( 1 - 2 * signs[i] );

                x_Q_m = x_Q[i] - sign * fac_m;
                x_Q_p = x_Q[i] + sign * fac_p;
                if ( fabs( x_orig[i] - gain * x_Q_m ) < fabs( x_orig[i] - gain * x_Q_p ) ) /* Decrease magnitude */
                {
                    x_Q[i] = x_Q_m;
                    prm[bits++] = 0;
                }
                else /* Increase magnitude */
                {
                    x_Q[i] = x_Q_p;
                    prm[bits++] = 1;
                }
            }
            else
            {
                zeros[num_zeros++] = i;
            }
        }

        /* Requantize zeroed-lines of the spectrum */
        fac_p = ( 1.0f - deadzone ) * 0.33f;
        --target_bits; /* reserve 1 bit for the check below */
        for ( j = 0; j < num_zeros; ++j )
        {
            if ( bits >= target_bits )
            {
                /* 1 or 0 bits left */
                break;
            }

            i = zeros[j];

            thres = fac_p;
            if ( fabs( x_orig[i] ) > thres * gain )
            {
                prm[bits++] = 1;
                prm[bits++] = 1 - signs[i];
                x_Q[i] = ( 2 - 4 * signs[i] ) * thres;
            }
            else
            {
                prm[bits++] = 0;
            }
        }

        return bits;
    }
#endif

    for ( i = 0; i < L_frame; ++i )
    {