Commit 01232dd2 authored by multrus's avatar multrus
Browse files

[cleanup] accept REMOVE_CAM_FROM_IVAS

parent 98c5071a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@
#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_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_1478_UNINIT_ON_BFI                          /* VA: Fix issue 1478 where a vector is partly un-initialized during bfi */
#define REMOVE_CAM_FROM_IVAS                            /* VA: basop issue 210: remove obsoelte CAM code from IVAS */
#define FIX_2318_CLANG_DECODER                          /* VA: basop issue 2318: Initialize command-line parameter arg.non_diegetic_pan_gain_fx */
#define OPT_BE_2311_HARM_GSC_GAIN                       /* VA: issue 2311: BE part of the GSC gain harmonization pipeline #70380 shows the BE */
#define HARM_CORECODER_UPDT                             /* VA: basop issue 2342: Remove duplicated code in core-coder common update functions */
+0 −76
Original line number Diff line number Diff line
@@ -760,82 +760,6 @@ void signalling_enc_fx(
void signaling_enc_rf_fx(
    Encoder_State *st /* i  : encoder state structure   */
)
#ifndef REMOVE_CAM_FROM_IVAS
{
    Word16 i;
    Word16 sfr;
    RF_ENC_HANDLE hRF = st->hRF;

    /* write partial copy into bitstream */
    IF( EQ_16( st->rf_mode, 1 ) )
    {
        enc_prm_rf_ivas_fx( st, hRF->rf_indx_frametype[st->rf_fec_offset], st->rf_fec_offset );
        hRF->rf_indx_tbeGainFr[0] = hRF->RF_bwe_gainFr_ind; /*Q0*/
        move16();
    }

    /* Shift the RF indices such that the partial copy associated with
       (n-fec_offset)th frame is included in the bitstream in nth frame. */
    IF( hRF != NULL )
    {
        FOR( i = st->rf_fec_offset; i >= 0; i-- )
        {
            /* rf frame type */
            hRF->rf_indx_frametype[i + 1] = hRF->rf_indx_frametype[i];
            move16();
            /* rf target bits buffer */
            hRF->rf_targetbits_buff[i + 1] = hRF->rf_targetbits_buff[i];
            move16();
            /* lsf indx */
            hRF->rf_indx_lsf[i + 1][0] = hRF->rf_indx_lsf[i][0];
            hRF->rf_indx_lsf[i + 1][1] = hRF->rf_indx_lsf[i][1];
            hRF->rf_indx_lsf[i + 1][2] = hRF->rf_indx_lsf[i][2];
            move16();
            move16();
            move16();
            /* ES pred energy */
            hRF->rf_indx_EsPred[i + 1] = hRF->rf_indx_EsPred[i];
            move16();
            /* LTF mode, sfr params: pitch, fcb and gain */
            FOR( sfr = 0; sfr < st->nb_subfr; sfr++ )
            {
                hRF->rf_indx_ltfMode[i + 1][sfr] = hRF->rf_indx_ltfMode[i][sfr];
                hRF->rf_indx_pitch[i + 1][sfr] = hRF->rf_indx_pitch[i][sfr];
                hRF->rf_indx_fcb[i + 1][sfr] = hRF->rf_indx_fcb[i][sfr];
                hRF->rf_indx_gain[i + 1][sfr] = hRF->rf_indx_gain[i][sfr];
                move16();
                move16();
                move16();
                move16();
            }

            /* shift the nelp indices */
            hRF->rf_indx_nelp_iG1[i + 1] = hRF->rf_indx_nelp_iG1[i];
            hRF->rf_indx_nelp_iG2[i + 1][0] = hRF->rf_indx_nelp_iG2[i][0];
            hRF->rf_indx_nelp_iG2[i + 1][1] = hRF->rf_indx_nelp_iG2[i][1];
            hRF->rf_indx_nelp_fid[i + 1] = hRF->rf_indx_nelp_fid[i];
            move16();
            move16();
            move16();
            move16();
            /* tbe gain Fr shift */
            hRF->rf_indx_tbeGainFr[i + 1] = hRF->rf_indx_tbeGainFr[i];
            hRF->rf_clas[i + 1] = hRF->rf_clas[i];
            hRF->rf_gain_tcx[i + 1] = hRF->rf_gain_tcx[i];
            hRF->rf_tcxltp_param[i + 1] = hRF->rf_tcxltp_param[i];
            move16();
            move16();
            move16();
            move16();
        }
    }
    return;
}

void signalling_enc_rf_fx(
    Encoder_State *st /* i  : encoder state structure   */
)
#endif
{
    Word16 i;
    Word16 sfr;
+0 −173
Original line number Diff line number Diff line
@@ -99,179 +99,6 @@ static void enc_prm_hm_ivas_fx(
 *                                                                 *
 * encode RF parameters for ACELP and TCX partial copy             *
 *-----------------------------------------------------------------*/
#ifndef REMOVE_CAM_FROM_IVAS
void enc_prm_rf_ivas_fx(
    Encoder_State *st,
    const Word16 rf_frame_type, /* Q0 */
    const Word16 fec_offset     /* Q0 */
)
{
    Word16 sfr, nb_subfr, n, index;
    Word16 ltp_mode, ltf_mode, gains_mode;
    RF_ENC_HANDLE hRF = st->hRF;
    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
    BSTR_ENC_HANDLE hBstr = st->hBstr;


    nb_subfr = st->nb_subfr; /* Q0 */
    move16();
    /* partial copy bitstream writing */
    test();
    IF( GE_16( rf_frame_type, RF_TCXFD ) && LE_16( rf_frame_type, RF_TCXTD2 ) )
    {
        /* TCX frames partial copy write */

        /* LSF indices */
        IF( EQ_16( rf_frame_type, RF_TCXFD ) )
        {
            push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], lsf_numbits[0] ); /* VQ 1 */
            push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], lsf_numbits[1] ); /* VQ 2 */
            push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][2], lsf_numbits[2] ); /* VQ 3 */
        }

        /* classification */
        test();
        IF( EQ_16( hRF->rf_clas[fec_offset], UNVOICED_CLAS ) )
        {
            index = 0;
            move16();
        }
        ELSE IF( ( EQ_16( hRF->rf_clas[fec_offset], VOICED_TRANSITION ) ) || ( EQ_16( hRF->rf_clas[fec_offset], UNVOICED_TRANSITION ) ) )
        {
            index = 1;
            move16();
        }
        ELSE IF( EQ_16( hRF->rf_clas[fec_offset], VOICED_CLAS ) )
        {
            index = 2;
            move16();
        }
        ELSE
        {
            index = 3;
            move16();
        }
        push_next_indice( hBstr, index, 2 );

        IF( EQ_16( rf_frame_type, RF_TCXFD ) )
        {
            /* TCX global gain  = 7 bits */
            push_next_indice( hBstr, hRF->rf_gain_tcx[fec_offset], 7 );
            /*window info
            1 bit for long overlap
            2 if minimum or half overlap*/
        }
        ELSE
        {
            /*gains adapt
            gains inov*/

            /*LPC on full rate -> excitation */
            /* pitch and gain */
            /* LTP data */
            test();
            test();
            IF( ( EQ_16( rf_frame_type, RF_TCXTD1 ) || EQ_16( rf_frame_type, RF_TCXTD2 ) ) && hTcxEnc->tcxltp != 0 )
            {
                push_next_indice( hBstr, hRF->rf_tcxltp_param[fec_offset], 9 );
            }
        }
    }
    ELSE IF( EQ_16( rf_frame_type, 7 ) ) /* NELP bitstream writing */
    {
        /* LSF indices */
        push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */
        push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */

        /* NELP gain indices */
        push_next_indice( hBstr, hRF->rf_indx_nelp_iG1[fec_offset], 5 );
        push_next_indice( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][0], 6 );
        push_next_indice( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][1], 6 );

        /* NELP filter selection index */
        push_next_indice( hBstr, hRF->rf_indx_nelp_fid[fec_offset], 2 );

        /* tbe gainFr */
        push_next_indice( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 5 );
    }
    ELSE IF( GE_16( rf_frame_type, 4 ) ) /* rf_frame_type ALL_PRED: 4, NO_PRED: 5, GEN_PRED: 6 */
    {
        /* LSF indices */
        push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */
        push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */

        /* ES pred */
        push_next_indice( hBstr, hRF->rf_indx_EsPred[fec_offset], 3 );

        ltp_mode = ACELP_LTP_MODE[1][1][rf_frame_type];
        ltf_mode = ACELP_LTF_MODE[1][1][rf_frame_type];
        gains_mode = ACELP_GAINS_MODE[1][1][rf_frame_type];
        move16();
        move16();
        move16();
        /* Subframe parameters */
        FOR( sfr = 0; sfr < nb_subfr; sfr++ )
        {
            /* Pitch lag (5, or 8 bits) */
            n = ACELP_LTP_BITS_SFR[ltp_mode][sfr];
            move16();
            IF( n != 0 )
            {
                push_next_indice( hBstr, hRF->rf_indx_pitch[fec_offset][sfr], n );
            }

            /* Adaptive codebook filtering (1 bit) */
            IF( EQ_16( ltf_mode, 2 ) )
            {
                push_next_indice( hBstr, hRF->rf_indx_ltfMode[fec_offset][sfr], 1 );
            }

            /*Innovative codebook*/
            test();
            test();
            test();
            IF( ( EQ_16( rf_frame_type, RF_NOPRED ) ) ||
                ( EQ_16( rf_frame_type, RF_GENPRED ) &&
                  ( sfr == 0 || EQ_16( sfr, 2 ) ) ) )
            {
                push_next_indice( hBstr, hRF->rf_indx_fcb[fec_offset][sfr], 7 );
            }

            /* Gains (5b, 6b or 7b / subfr) */
            test();
            IF( sfr == 0 || EQ_16( sfr, 2 ) )
            {
                n = ACELP_GAINS_BITS[gains_mode];
                move16();
                push_next_indice( hBstr, hRF->rf_indx_gain[fec_offset][sfr], n );
            }
        }
        /* tbe gainFr */
        push_next_indice( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 2 );
    }

    /***************/
    /*IMPORTANT: The last three bits are always the rf_frame_type in the bitstream (for both acelp and tcx partial copy);
                 the rf_frame_type indicates the length of the partial copy payload at the decoder.
                 The 2 bits before the rf_frame_type contains the fec_offset */

    /***************/
    /* write FEC offset just before the rf_frame_type */
    test();
    test();
    IF( EQ_16( fec_offset, 2 ) )
    {
        push_next_indice( hBstr, 0, 2 );
    }
    ELSE IF( EQ_16( fec_offset, 3 ) || EQ_16( fec_offset, 5 ) || EQ_16( fec_offset, 7 ) )
    {
        push_next_indice( hBstr, shr( sub( fec_offset, 1 ), 1 ), 2 );
    }

    /* write RF frame type last in the bitstream */
    push_next_indice( hBstr, rf_frame_type, 3 );
}
#endif

void enc_prm_rf_fx(
    Encoder_State *st,
+0 −4
Original line number Diff line number Diff line
@@ -535,15 +535,11 @@ ivas_error evs_enc_fx(
     * Channel-aware mode - write signaling information into the bitstream
     *---------------------------------------------------------------------*/

#ifdef REMOVE_CAM_FROM_IVAS
    signaling_enc_rf_fx( st );

    /*---------------------------------------------------------------------*
     * Updates
     *---------------------------------------------------------------------*/
#else
    signalling_enc_rf_fx( st );
#endif

#ifdef HARM_CORECODER_UPDT
    updt_enc_common_fx( st, Q_new );
+0 −7
Original line number Diff line number Diff line
@@ -866,13 +866,6 @@ ivas_error ivas_core_enc_fx(
        st->q_inp = q_inp[1];
        move16();

#ifndef REMOVE_CAM_FROM_IVAS
        /*---------------------------------------------------------------------*
         * Channel-aware mode - write signaling information into the bitstream
         *---------------------------------------------------------------------*/

        signaling_enc_rf_fx( st );
#endif
        /*---------------------------------------------------------------------*
         * Common updates
         *---------------------------------------------------------------------*/
Loading