Commit ac0742ee authored by vaclav's avatar vaclav
Browse files

Merge branch 'basop-2400-remove-duplicated-code-acelp_core_enc_fx' into 'main'

Remove duplicated code: acelp_core_enc_fx()

Closes #2400

See merge request !2781
parents e0f7bb5b a408beb7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@
#define FIX_2280_REDUCTION_UNNECESSARY_SCALING          /* VA: reduction of unnecessary scaling */
#define FIX_2280_REDUCTION_UNNECESSARY_SCALING_NONBE    /* VA: reduction of unnecessary scaling, non-BE part */
#define FIX_2403_COMBINE_PITCH_OL                       /* VA : basop 2403, reusing common code between EVS and IVAS in pitch_ol */
#define HARMONIZE_ACELP_ENC                             /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */

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

+17 −5
Original line number Diff line number Diff line
@@ -10867,7 +10867,11 @@ ivas_error init_encoder_fx(
    const Word32 element_brate  /* i  : element bitrate                      */
);
#ifdef HARMONIZE_ACELP_ENC
ivas_error acelp_core_enc_fx(
#else
ivas_error acelp_core_enc_ivas_fx(
#endif
    Encoder_State *st,                  /* i/o: encoder state structure                 */
    const Word16 inp[],                 /* i  : input signal of the current frame       Q_new*/
    Word16 A[NB_SUBFR16k * ( M + 1 )],  /* i  : A(z) unquantized for the 4 subframes    Q12*/
@@ -10880,12 +10884,20 @@ ivas_error acelp_core_enc_ivas_fx(
    Word32 bwe_exc_extended_fx[],       /* i/o: bandwidth extended excitation           st->prev_Q_bwe_exc*/
    Word16 *voice_factors_fx,           /* o  : voicing factors                         Q15*/
    Word16 old_syn_12k8_16k[],          /* o  : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE        q_old_syn_12k8_16*/
    Word16 *q_old_syn_12k8_16,
#ifndef HARMONIZE_ACELP_ENC
    Word16 *q_old_syn_12k8_16, /* o  : Q factor of old_syn_12k8_16k[]          */
#endif
    Word16 pitch_buf[NB_SUBFR16k],       /* o  : floating pitch for each subframe        Q6*/
    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*/
    const Word16 Q_new );
#ifdef HARMONIZE_ACELP_ENC
    const Word16 Q_new, /* i  : Scaling factor                          */
    const Word16 shift  /* i  : Shift need to obtain 12 bits vectors    */
#else
    const Word16 Q_new
#endif
);
void flip_and_downmix_generic_fx32(
    Word32 input[],                      /* i : input spectrum Qx*/
+472 −153

File changed.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -174,6 +174,11 @@ void decision_matrix_enc_fx(
            }
        }

#ifdef HARMONIZE_ACELP_ENC
        /* set inactive coder_type flag in ACELP core to GSC */
        st_fx->inactive_coder_type_flag = 1;
#endif

        return;
    }

+24 −9
Original line number Diff line number Diff line
@@ -43,8 +43,10 @@ ivas_error evs_enc_fx(
    Word32 ener;                               /* residual energy from Levinson-Durbin     */
    Word16 A[NB_SUBFR16k * ( M + 1 )];         /* A(z) unquantized for subframes           */
    Word16 Aw[NB_SUBFR16k * ( M + 1 )];        /* weighted A(z) unquantized for subframes  */
#ifndef HARMONIZE_ACELP_ENC
    Word16 epsP_h[M + 1]; /* LP prediction errors                     */
    Word16 epsP_l[M + 1]; /* LP prediction errors                     */
#endif
    Word32 epsP[M + 1]; /* LP prediction errors                     */
    Word16 lsp_new[M];  /* LSPs at the end of the frame             */
    Word16 lsp_mid[M];  /* ISPs in the middle of the frame          */
@@ -174,13 +176,19 @@ ivas_error evs_enc_fx(
     *---------------------------------------------------------------------*/

#ifdef FIX_I4_OL_PITCH
#ifdef HARMONIZE_ACELP_ENC
    pre_proc_fx( st, input_frame, old_inp_12k8, old_inp_16k, &inp, fr_bands, &Etot, &ener, A, Aw, epsP, lsp_new, lsp_mid, &vad_hover_flag,
#else
    pre_proc_fx( st, input_frame, old_inp_12k8, old_inp_16k, &inp, fr_bands, &Etot, &ener, A, Aw, epsP_h, epsP_l, epsP, lsp_new, lsp_mid, &vad_hover_flag,
#endif
                 &attack_flag, new_inp_resamp16k, &Voicing_flag, realBuffer, imagBuffer, &cldfbScale, hLPDmem->old_exc, &hq_core_type, &Q_new, &shift, Q_r );
#else
    pre_proc_fx( st, input_frame, old_inp_12k8, old_inp_16k, &inp, fr_bands, &Etot, &ener,
                 pitch_orig, A, Aw, epsP_h, epsP_l, epsP, lsp_new, lsp_mid, &vad_hover_flag,
                 &attack_flag, new_inp_resamp16k, &Voicing_flag, realBuffer, imagBuffer, &cldfbScale, hLPDmem->old_exc,
                 &hq_core_type, &Q_new, &shift, Q_r );
#ifdef HARMONIZE_ACELP_ENC
    pre_proc_fx( st, input_frame, old_inp_12k8, old_inp_16k, &inp, fr_bands, &Etot, &ener, pitch_orig, A, Aw, epsP, lsp_new, lsp_mid, &vad_hover_flag,
#else
    pre_proc_fx( st, input_frame, old_inp_12k8, old_inp_16k, &inp, fr_bands, &Etot, &ener, pitch_orig, A, Aw, epsP_h, epsP_l, epsP, lsp_new, lsp_mid, &vad_hover_flag,
#endif
                 &attack_flag, new_inp_resamp16k, &Voicing_flag, realBuffer, imagBuffer, &cldfbScale, hLPDmem->old_exc, &hq_core_type, &Q_new, &shift, Q_r );
#endif

    IF( EQ_16( st->mdct_sw, MODE2 ) )
@@ -264,8 +272,15 @@ ivas_error evs_enc_fx(

        IF( EQ_16( st->core, ACELP_CORE ) )
        {
#ifdef HARMONIZE_ACELP_ENC
            IF( NE_32( ( error = acelp_core_enc_fx( st, inp, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, Q_new, shift ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
#else
            acelp_core_enc_fx( st, inp, ener, A, Aw, epsP_h, epsP_l, lsp_new, lsp_mid, vad_hover_flag,
                               attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, Q_new, shift );
#endif
        }

        /*---------------------------------------------------------------------*
Loading