Admin message

WARNING! Gitlab maintenance operation scheduled for Monday, 20 April between 12:00 and 14:00 (CET). During this time window, short service interruptions (less than 5 minutes) may occur. Thank you in advance for your understanding.

tcx_ari_res_Q_spec(): Remove dead code, possibly harmonize BASOP functions

In the function tcx_ari_res_Q_spec() there is some dead code, which can't be reached:

    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;
    }

This code is never reached (https://ivas-codec-pc.3gpp.org/ivas-codec/coverage-merged/lib_enc/tcx_utils_enc.c.gcov.html). The code was introduced for MDCT Stereo, but this function is only executed for the LPC shaped arithmetic coder, which itself is never called for MDCT Stereo.

Also, in BASOP we have the functions

  • tcx_ari_res_Q_spec_fx()
  • tcx_ari_res_Q_spec_ivas_fx()

which look identical at the first glance (apart from this obsolete code).

Assignee Loading
Time tracking Loading