Commit 0d74cb1c authored by vaclav's avatar vaclav
Browse files

removal of duplicated code, under CLEANUP_ACELP_ENC

parent 96ae0d1c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
#define FIX_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_2271_OOB_INDEXING_IN_PIT_OL2                /* VA: Fix for issue 2271, to silence clang18 */
#define FIX_2273_OOB_INDEXING_IN_PIT_FR4                /* VA: Fix to silence clang on ptr init */
#define CLEANUP_ACELP_ENC                               /* VA: basop issue 2304: Remove duplicated code in excitation encoding in the ACELP core */

/* #################### End BE switches ################################## */

+7 −3
Original line number Diff line number Diff line
@@ -10898,11 +10898,15 @@ ivas_error IGF_Reconfig_fx(
);
void core_switching_post_enc_ivas_fx(
    Encoder_State *st,       /* i/o: encoder state structure             */
    Encoder_State *st /* i/o: encoder state structure             */
#ifndef CLEANUP_ACELP_ENC
    ,
    Word16 *old_inp_12k8_fx, /* i  : old input signal @12.8kHz           */
    Word16 *old_inp_16k_fx,  /* i  : old input signal @16kHz             */
    Word16 A_fx[],           /* i  : unquant. LP filter coefs.           */
    Word16 Q_new );
    Word16 Q_new
#endif
);
void residu_ivas_fx(
    const Word16 *a, /* i  : LP filter coefficients           Q31-a_exp*/
@@ -11194,7 +11198,7 @@ ivas_error acelp_core_enc_ivas_fx(
    Word16 *unbits,                      /* o  : number of unused bits                  Q0*/
    STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle               */
    Word16 tdm_lsfQ_PCh[M],              /* i  : Q LSFs for primary channel              X2.56*/
    Word16 Q_new );
    const Word16 Q_new );
void flip_and_downmix_generic_fx32(
    Word32 input[],                      /* i : input spectrum Qx*/
+2 −1
Original line number Diff line number Diff line
@@ -699,6 +699,7 @@ ivas_error acelp_core_enc_fx(
 *
 * ACELP core encoder
 *--------------------------------------------------------------------*/

ivas_error acelp_core_enc_ivas_fx(
    Encoder_State *st,                  /* i/o: encoder state structure                 */
    const Word16 inp[],                 /* i  : input signal of the current frame       Q_new*/
@@ -717,7 +718,7 @@ ivas_error acelp_core_enc_ivas_fx(
    Word16 *unbits,                      /* o  : number of unused bits                  Q0*/
    STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle            */
    Word16 tdm_lsfQ_PCh[M],              /* i  : Q LSFs for primary channel             X2.56*/
    Word16 Q_new )
    const Word16 Q_new )
{
    Word16 i, nBits;          /* reserved bits                        */
    LPD_state_HANDLE hLPDmem; /* i/o: acelp memories                  */
+28 −18
Original line number Diff line number Diff line
@@ -15,15 +15,18 @@
 * Local function prototypes
 *---------------------------------------------------------------------*/

static void encod_gen_voic_core_switch_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, Word16 shift, Word16 Q_new );

static void encod_gen_voic_core_switch_ivas_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, Word16 shift, Word16 Q_new );
static void encod_gen_voic_core_switch_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, const Word16 shift, const Word16 Q_new );

#ifndef CLEANUP_ACELP_ENC
static void encod_gen_voic_core_switch_ivas_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, const Word16 shift, const Word16 Q_new );
#endif
static void bwe_switch_enc_fx( Encoder_State *st_fx, const Word16 *new_speech );

#ifndef CLEANUP_ACELP_ENC
static void bwe_switch_enc_ivas_fx( Encoder_State *st_fx, const Word16 *new_speech );
#endif
static Word16 dotprod_satcont( const Word16 *x, const Word16 *y, const Word16 qx, const Word16 qy, Word16 *qo, const Word16 len, const Word16 delta );

static Word16 dotprod_satcont( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy, Word16 *qo, Word16 len, Word16 delta );

/*-------------------------------------------------------------------*
 * acelp_core_switch_enc_fx()
@@ -36,8 +39,8 @@ void acelp_core_switch_enc_fx(
    const Word16 inp12k8[],                  /* i  : input signal @12.8 kHz  Q0             */
    const Word16 inp16k[],                   /* i  : input signal @16 kHz    Q0             */
    const Word16 A[NB_SUBFR16k * ( M + 1 )], /* i  : A(z) unquantized for the 4 subframes Q12*/
    Word16 shift,
    Word16 Q_new )
    const Word16 shift,
    const Word16 Q_new )
{
    Word16 i, j, T_op[2];
    Word16 old_exc[L_EXC], *exc; /* excitation signal buffer      Qexc           */
@@ -163,7 +166,7 @@ void acelp_core_switch_enc_fx(
    return;
}


#ifndef CLEANUP_ACELP_ENC
void acelp_core_switch_enc_ivas_fx(
    Encoder_State *st_fx,                    /* i/o: encoder state structure                */
    const Word16 inp12k8[],                  /* i  : input signal @12.8 kHz  Q0             */
@@ -273,7 +276,7 @@ void acelp_core_switch_enc_ivas_fx(

    return;
}

#endif

/*-------------------------------------------------------------------*
 * encod_gen_voic_core_switch()
@@ -290,8 +293,8 @@ static void encod_gen_voic_core_switch_fx(
    const Word16 T_op[],       /* i  : open loop pitch                  Q0*/
    Word16 *exc,               /* i/o: current non-enhanced excitation  Q_exc*/
    const Word32 core_bitrate, /* i  : switching frame bitrate          Q0*/
    Word16 shift,
    Word16 Q_new )
    const Word16 shift,
    const Word16 Q_new )
{
    Word16 res[L_SUBFR];            /* residual signal  Qexc                 */
    Word16 Ap[M + 1];               /* A(z) with spectral expansion  Q12     */
@@ -431,8 +434,13 @@ static void encod_gen_voic_core_switch_fx(
     * Innovation encoding
     *-----------------------------------------------------------------*/

#ifdef CLEANUP_ACELP_ENC
    inov_encode_ivas_fx( st_fx, core_bitrate, 0, L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, 0, -1, Aq, gain_pit, cn, exc,
                         h2, hLPDmem->tilt_code, pitch, xn2, code, y2, &unbits, L_SUBFR, shift, 0 );
#else
    inov_encode_fx( st_fx, core_bitrate, 0, L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, 0, -1, Aq, gain_pit, cn, exc,
                    h2, hLPDmem->tilt_code, pitch, xn2, code, y2, &unbits, L_SUBFR, shift );
#endif

    /*-----------------------------------------------------------------*
     * Gain encoding
@@ -489,6 +497,7 @@ static void encod_gen_voic_core_switch_fx(
    return;
}

#ifndef CLEANUP_ACELP_ENC
static void encod_gen_voic_core_switch_ivas_fx(
    Encoder_State *st_fx,      /* i/o: state structure                  */
    const Word16 L_frame,      /* i  : length of the frame              Q0*/
@@ -498,8 +507,8 @@ static void encod_gen_voic_core_switch_ivas_fx(
    const Word16 T_op[],       /* i  : open loop pitch                  Q0*/
    Word16 *exc,               /* i/o: current non-enhanced excitation  Q_exc*/
    const Word32 core_bitrate, /* i  : switching frame bitrate          Q0*/
    Word16 shift,
    Word16 Q_new )
    const Word16 shift,
    const Word16 Q_new )
{
    Word16 res[L_SUBFR];            /* residual signal  Qexc                 */
    Word16 Ap[M + 1];               /* A(z) with spectral expansion  Q12     */
@@ -699,6 +708,7 @@ static void encod_gen_voic_core_switch_ivas_fx(

    return;
}
#endif

/*-------------------------------------------------------------------*
 * bwe_switch_enc()
@@ -849,7 +859,7 @@ static void bwe_switch_enc_fx(
    return;
}


#ifndef CLEANUP_ACELP_ENC
static void bwe_switch_enc_ivas_fx(
    Encoder_State *st_fx,       /* i/o: encoder state structure   */
    const Word16 *new_speech_fx /* i  : original input signal  Q0 */
@@ -989,16 +999,16 @@ static void bwe_switch_enc_ivas_fx(

    return;
}

#endif

static Word16 dotprod_satcont(
    const Word16 *x, /* qx */
    const Word16 *y, /* qy */
    Word16 qx,
    Word16 qy,
    const Word16 qx,
    const Word16 qy,
    Word16 *qo,
    Word16 len,  /* Q0 */
    Word16 delta /* Q0 */
    const Word16 len,  /* Q0 */
    const Word16 delta /* Q0 */
)
{
    Word16 tmp_tabx[L_FRAME48k], tmp_taby[L_FRAME48k];
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ void analy_lp_fx(
    const Word32 Core_sr,           /* i  :(q0) Internal core sampling rate                                          */
    const Word16 element_mode,      /* i  : element mode                                                             */
    const Word16 sec_chan_low_rate, /* i  :(q0) flag to signal second channel                                        */
    Word16 Q_new,                   /* i  : stores Q for speech                                                      */
    const Word16 Q_new,             /* i  : stores Q for speech                                                      */
    Word16 *Q_r                     /*stores q for ener*/
)
{
@@ -152,7 +152,7 @@ void analy_lp_AMR_WB_fx(
    Word16 isf_new[],      /* o  : current frame ISPs                                      Q15*/
    Word16 Top,            /* i  : open loop pitch lag                                     Q0*/
    Word16 Tnc,            /* i  : open loop pitch gain                                    Qx*/
    Word16 Q_new,
    const Word16 Q_new,
    Word16 *Q_r )
{
    Word16 r_h[M + 1]; /* Autocorrelations of windowed speech MSB */
Loading