Commit 803c4d53 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2424_REMOVE_GAUSS_L2_ENC

parent 9e4b55ae
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@
#define FIX_1990_SANITIZER_IN_REVERB_LOAD               /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#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_2424_REMOVE_GAUSS_L2_ENC                    /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */
#define FIX_MDCT_STEREO_ENC_STACK                       /* VA: basop issue 2428: Move IGF temporary buffers out of the highest stack */
#define HARMONIZE_TBE3                                  /* VA: basop issue 2399: Remove duplicated code: TBE, step 3 */
#define FIX_2459_USAN_AMR_SIDSTART                      /* FhG: basop issue 2459: fix msan complaint */
+0 −5
Original line number Diff line number Diff line
@@ -290,12 +290,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision *

        IF( EQ_16( acelp_cfg->gains_mode[j_subfr], 7 ) )
        {
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
            gauss_L2_fx( st->element_mode, h1, code2, y2, y22, &gain_code2, &g_corr, gain_pit, hLPDmem->tilt_code, p_Aq, acelp_cfg->formant_enh_num, &( st->seed_acelp ), shift );
#else
            assert( gain_pit == 0 );
            gauss_L2_fx( h1, code2, y2, y22, &gain_code2, &g_corr, gain_pit, hLPDmem->tilt_code, p_Aq, acelp_cfg->formant_enh_num, &( st->seed_acelp ), shift );
#endif
        }
        ELSE
        {
+0 −92
Original line number Diff line number Diff line
@@ -20,9 +20,7 @@
 *-------------------------------------------------------------------*/

void gauss_L2_fx(
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    const Word16 element_mode, /* i  : element mode                                */
#endif
    const Word16 h[],             /* i  : weighted LP filter impulse response   Q14+s */
    Word16 code[],                /* o  : gaussian excitation                     Q9  */
    const Word16 y2[],            /* i  : zero-memory filtered code. excitation   Q9  */
@@ -38,7 +36,6 @@ void gauss_L2_fx(
{
    Word16 i, tmp16;
    Word32 tmp32, tmp32_2;
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    Word16 Q_fac;

    Q_fac = Q18;
@@ -48,7 +45,6 @@ void gauss_L2_fx(
        Q_fac = Q16;
        move16();
    }
#endif

    assert( gain_pit == 0 );

@@ -80,24 +76,16 @@ void gauss_L2_fx(
    move32();

    /*Update correlations for gains coding */
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - Q_fac );   /* Q_fac */
    tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - Q_fac ); /* Q_fac */
#else
    tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 );   /* Q18 */
    tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */
#endif

#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    IF( element_mode == EVS_MONO )
    {
#endif
        FOR( i = 0; i < L_SUBFR; i++ )
        {
            tmp32 = L_mac0_sat( tmp32, y11[i], y11[i] );    /* Q18 */
            tmp32_2 = L_mac0_sat( tmp32_2, y11[i], y2[i] ); /* Q18 */
        }
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    }
    ELSE
    {
@@ -108,98 +96,18 @@ void gauss_L2_fx(
            tmp32_2 = L_mac0( tmp32_2, tmp16, shr( y2[i], 1 ) ); /* Q16 */
        }
    }
#endif

    tmp16 = norm_l( tmp32 );
    g_corr->y1y1 = round_fx_sat( L_shl( tmp32, tmp16 ) );
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    g_corr->y1y1_e = sub( sub( 31, Q_fac ), tmp16 );
#else
    g_corr->y1y1_e = sub( 31 - 18, tmp16 );
#endif
    move16();
    move16();

    tmp16 = norm_l( tmp32_2 );
    g_corr->y1y2 = round_fx_sat( L_shl( tmp32_2, tmp16 ) );
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    g_corr->y1y2_e = sub( sub( 31, Q_fac ), tmp16 );
#else
    g_corr->y1y2_e = sub( 31 - 18, tmp16 );
#endif
    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  */
    const Word16 y2[],            /* i  : zero-memory filtered code. excitation   Q9  */
    Word16 y11[],                 /* o  : zero-memory filtered gauss. excitation  Q9  */
    Word32 *gain,                 /* o  : excitation gain                         Q16 */
    ACELP_CbkCorr *g_corr,        /*i/o : correlation structure for gain coding       */
    const Word16 gain_pit,        /* i  : unquantized gain of code                Q14 */
    const Word16 tilt_code,       /* i  : tilt of code                            Q15 */
    const Word16 *Aq,             /* i  : quantized LPCs                          Q12 */
    const Word16 formant_enh_num, /* i  : formant enhancement numerator factor              Q15 */
    Word16 *seed_acelp,           /*i/o : random seed                             Q0  */
    const Word16 shift )
{
    Word16 i, tmp16;
    Word32 tmp32, tmp32_2;


    assert( gain_pit == 0 );

    /*-----------------------------------------------------------------*
     * Find new target for the Gaussian codebook
     *-----------------------------------------------------------------*/

    /*Generate white gaussian noise using central limit theorem method (N only 4 as E_util_random is not purely uniform)*/
    FOR( i = 0; i < L_SUBFR; i++ )
    {
        Random( seed_acelp );
        tmp32 = L_mac( 0, *seed_acelp, 1 << 9 );

        Random( seed_acelp );
        tmp32 = L_mac( tmp32, *seed_acelp, 1 << 9 );

        Random( seed_acelp );
        code[i] = mac_r( tmp32, *seed_acelp, 1 << 9 );
        move16();
    }

    /*Shape the gaussian excitation*/
    cb_shape_fx( 1, 0, 0, 1, 0, formant_enh_num, FORMANT_SHARPENING_G2, Aq, code, tilt_code, 0, 1, L_SUBFR );

    /*compute 0s memory weighted synthesis contribution and find gain*/
    E_UTIL_f_convolve( code, h, y11, L_SUBFR ); /* y11: Q8+shift */
    Scale_sig( y11, L_SUBFR, sub( 1, shift ) ); /* Q9 */
    *gain = L_deposit_l( 0 );
    move32();
    /*Update correlations for gains coding */
    tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 16 );   /* Q16 */
    tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 16 ); /* Q16 */
    FOR( i = 0; i < L_SUBFR; i++ )
    {
        tmp16 = shr( y11[i], 1 );
        tmp32 = L_mac0( tmp32, tmp16, tmp16 );               /* Q16 */
        tmp32_2 = L_mac0( tmp32_2, tmp16, shr( y2[i], 1 ) ); /* Q16 */
    }

    tmp16 = norm_l( tmp32 );
    // To be checked
    g_corr->y1y1 = round_fx_sat( L_shl( tmp32, tmp16 ) );
    g_corr->y1y1_e = sub( 31 - 16, tmp16 );
    move16();
    move16();

    tmp16 = norm_l( tmp32_2 );
    g_corr->y1y2 = round_fx_sat( L_shl( tmp32_2, tmp16 ) );
    g_corr->y1y2_e = sub( 31 - 16, tmp16 );
    move16();
    move16();
}
#endif
+0 −12
Original line number Diff line number Diff line
@@ -180,19 +180,7 @@ void encod_unvoiced_fx(
            move16();
            move16();

#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
            gauss_L2_fx( st_fx->element_mode, 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 );
#else
            assert( gain_pit_fx == 0 );
            IF( st_fx->element_mode == EVS_MONO )
            {
                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 );
            }
            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                       *
+0 −17
Original line number Diff line number Diff line
@@ -2014,9 +2014,7 @@ void E_ACELP_xy2_corr(
    Word16 exp_xn );

void gauss_L2_fx(
#ifdef FIX_2424_REMOVE_GAUSS_L2_ENC
    const Word16 element_mode, /* i  : element mode                                */
#endif
    const Word16 h[],         /* i  : weighted LP filter impulse response   Q14+s */
    Word16 code2[],           /* o  : gaussian excitation                     Q9  */
    const Word16 y2[],        /* i  : zero-memory filtered code. excitation   Q9  */
@@ -2030,21 +2028,6 @@ void gauss_L2_fx(
    Word16 *seed_acelp,       /*i/o : random seed                             Q0  */
    const Word16 shift );

#ifndef FIX_2424_REMOVE_GAUSS_L2_ENC
void gauss_L2_ivas_fx(
    const Word16 h[],         /* i  : weighted LP filter impulse response   Q14+s */
    Word16 code2[],           /* o  : gaussian excitation                     Q9  */
    const Word16 y2[],        /* i  : zero-memory filtered code. excitation   Q9  */
    Word16 y11[],             /* o  : zero-memory filtered gauss. excitation  Q9  */
    Word32 *gain,             /* o  : excitation gain                             */
    ACELP_CbkCorr *g_corr,    /*i/o : correlation structure for gain coding       */
    const Word16 gain_pit,    /* i  : unquantized gain of code                    */
    const Word16 tilt_code,   /* i  : tilt of code                            Q15 */
    const Word16 *Aq,         /* i  : quantized LPCs                          Q12 */
    const Word16 formant_enh, /* i  : formant enhancement factor              Q15 */
    Word16 *seed_acelp,       /*i/o : random seed                             Q0  */
    const Word16 shift );
#endif
Word32 SFM_Cal_fx(
    Word32 magn[],
    Word16 n );