Commit f4321d6c authored by vaclav's avatar vaclav
Browse files

FIX_2424_REMOVE_GAUSS_L2_ENC

parent f4896dcb
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@
#define FIX_2404_HARM_SIGNAL_CLAS                       /* VA: basop-2404, harmonize signal_clas and signa_ivas_clas */
#define HARMONIZE_ACELP_ENC                             /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */
#define FIX_2392_MSAN_DESTROY_DEC                       /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */
#define FIX_2424_REMOVE_GAUSS_L2_ENC                    /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */

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

+4 −3
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ void decod_unvoiced_fx(
                         &voice_fac_fx, &gain_pit_fx, pt_pitch_fx, exc_fx, &gain_code_fx, exc2_fx, bwe_exc_fx, &( st_fx->Q_exc ), st_fx->Q_subfr );
        }
        ELSE
        { /*----------------------------------------------------------------*
        {
            /*----------------------------------------------------------------*
             * Unvoiced subframe processing in two stages
             *----------------------------------------------------------------*/

+9 −5
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
 * Local function prototypes
 *---------------------------------------------------------------------*/

void gaus_dec2v_fx( Decoder_State *st_fx, Word16 *code, const Word16 lg, const Word16 nb_bits );
static void gaus_dec2v_fx( Decoder_State *st_fx, Word16 *code, const Word16 lg, const Word16 nb_bits );
static void dec_2pos_fx( Word16 index, Word16 *ind1, Word16 *ind2, Word16 *sign1, Word16 *sign2, Word16 log2_n );

/*---------------------------------------------------------------------*
@@ -22,6 +22,7 @@ static void dec_2pos_fx( Word16 index, Word16 *ind1, Word16 *ind2, Word16 *sign1
 * - decode the codebook indices,
 * - find the excitation
 *---------------------------------------------------------------------*/

void gaus_dec_fx(
    Decoder_State *st_fx,     /* i/o: decoder static memory                                   */
    const Word16 i_subfr,     /* i          : subframe index                                  */
@@ -53,6 +54,7 @@ void gaus_dec_fx(
    /*------------------------------------------------------------------------------------------*
     * Unvoiced : Gaussian codebook
     *------------------------------------------------------------------------------------------*/

    nb_bits = st_fx->acelp_cfg.fixed_cdk_index[( i_subfr / 64 )];
    move16();

@@ -61,6 +63,7 @@ void gaus_dec_fx(
    /*------------------------------------------------------------------------------------------*
     * - Gain of Gaussian excitation and normalized Gaussian excitation
     *------------------------------------------------------------------------------------------*/

    /* gain_inov = 1.0f / (float)sqrt((dot_product(code, code, L_SUBFR) + 0.01f) / L_SUBFR) */
    L_tmp = Dot_product12( code, code, L_SUBFR, &exp );
    exp = sub( exp, 18 /*24*/ + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
@@ -141,7 +144,7 @@ void gaus_dec_fx(
 * One Gaussian vector of 190 values
 *-----------------------------------------------------*/

void gaus_dec2v_fx(
static void gaus_dec2v_fx(
    Decoder_State *st_fx, /* i/o: decoder state structure           */
    Word16 *code,         /* o  : decoded gaussian vector   Q12-exp */
    const Word16 lg,      /* i  : codevector length         Q0      */
@@ -211,6 +214,7 @@ void gaus_dec2v_fx(
 *
 * Decode the codevectors positions and signs
 *-----------------------------------------------------*/

static void dec_2pos_fx(
    Word16 index,  /* i  : quantization index      Q0 */
    Word16 *ind1,  /* o  : 1st vector index        Q0 */
@@ -257,6 +261,7 @@ static void dec_2pos_fx(
 *
 * One Gaussian vector
 *-----------------------------------------------------*/

void gaus_L2_dec(
    Word16 *code,       /* o  : decoded gaussian codevector     Q9  */
    Word16 tilt_code,   /* i  : tilt of code                    Q15 */
@@ -289,6 +294,5 @@ void gaus_L2_dec(
    /*Shape the gaussian excitation*/
    cb_shape_fx( 1, 0, 0, 1, 0, formant_enh, FORMANT_SHARPENING_G2, A, code, tilt_code, 0, 1, L_SUBFR );


    return;
}
+5 −3
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
#include <stdint.h>
#include "options.h"
#include <assert.h>
//#include "prot_fx.h"
#include "rom_com.h"     /* Common constants                       */
#include "prot_fx.h"     /* Function prototypes                    */
#include "prot_fx_enc.h" /* Function prototypes                    */
@@ -19,6 +18,7 @@
 *
 * Gaussian excitation is generated by a white noise and shapes it with LPC-derived filter
 *-------------------------------------------------------------------*/

void gauss_L2_fx(
    const Word16 h[],             /* i  : weighted LP filter impulse response   Q14+s */
    Word16 code[],                /* o  : gaussian excitation                     Q9  */
@@ -36,7 +36,6 @@ void gauss_L2_fx(
    Word16 i, tmp16;
    Word32 tmp32, tmp32_2;


    assert( gain_pit == 0 );

    /*-----------------------------------------------------------------*
@@ -86,8 +85,10 @@ void gauss_L2_fx(
    g_corr->y1y2_e = sub( 31 - 18, tmp16 );
    move16();
    move16();
}

    return;
}
#ifndef FIX_2424_REMOVE_GAUSS_L2_ENC
void gauss_L2_ivas_fx(
    const Word16 h[],             /* i  : weighted LP filter impulse response   Q14+s */
    Word16 code[],                /* o  : gaussian excitation                     Q9  */
@@ -157,3 +158,4 @@ void gauss_L2_ivas_fx(
    move16();
    move16();
}
#endif
+4 −0
Original line number Diff line number Diff line
@@ -180,15 +180,19 @@ void encod_unvoiced_fx(
            move16();
            move16();

#ifndef FIX_2424_REMOVE_GAUSS_L2_ENC
            assert( gain_pit_fx == 0 );
            IF( st_fx->element_mode == EVS_MONO )
            {
#endif
                gauss_L2_fx( h1_fx, code2, y2_fx, y22, &gain_code2, &g_corr, gain_pit_fx, hLPDmem->tilt_code, p_Aq_fx, acelp_cfg->formant_enh_num, &( st_fx->seed_acelp ), shift );
#ifndef FIX_2424_REMOVE_GAUSS_L2_ENC
            }
            ELSE
            {
                gauss_L2_ivas_fx( h1_fx, code2, y2_fx, y22, &gain_code2, &g_corr, gain_pit_fx, hLPDmem->tilt_code, p_Aq_fx, acelp_cfg->formant_enh_num, &( st_fx->seed_acelp ), shift );
            }
#endif

            /*----------------------------------------------------------*
             *  - Compute the fixed codebook gain                       *
Loading