Commit 5842ab2c authored by vaillancour's avatar vaillancour
Browse files

addition of REUSE_EVS_ACELP_corr_xh_fx, harmonizes corr_xh, more can be done is stage 3

parent 6d8c0490
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@
#define FIX_1822

#define FIX_ISSUE_1764                       /* NTT: update renorm and use abs */
//#define EVS_BE_REUSAGE
#define EVS_BE_REUSAGE
#ifdef EVS_BE_REUSAGE
#define REUSE_EVS_BE_ACELP_LP_FILT
#define REUSE_EVS_BE_ACELP_4T64
@@ -104,6 +104,10 @@
#define REUSE_EVS_BE_ACELP_PITCH_PIT_Q
#define REUSE_EVS_BE_GAINQ_LBR   // BE by adding one condition, but could be harmonized in a non-BE way. There is a small difference in how Etot is computed


#define REUSE_EVS_ACELP_corr_xh_fx    // this one could be non-bit-exact on very low level signal, as summation is initialized with 1 instead of 0


#endif
#define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW  /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */
#define FIX_1844_MISSING_FREE                                /* FhG: add missing free in ivas_binRenderer_convModuleClose_fx() */
+30 −1
Original line number Diff line number Diff line
@@ -23,14 +23,26 @@
 *
 *   y[i]=sum(j=i,l-1) x[j]*h[j-i], i=0,l-1
 *-------------------------------------------------------------------*/
#ifdef REUSE_EVS_ACELP_corr_xh_fx
Word16 corr_xh_fx(
#else
void corr_xh_fx(
#endif
    const Word16 x[], /* i  : target signal                                   Qx*/
    Word16 dn[],      /* o  : correlation between x[] and h[]                 Qdn = Qx+j-1*/
    const Word16 h[]  /* i  : impulse response (of weighted synthesis filter) Q14*/
#ifdef REUSE_EVS_ACELP_corr_xh_fx
    ,
    const Word16 L_subfr /* i  : sub-frame lenght Q0 */
#endif
)
{
    Word16 i, j, k;
#ifdef REUSE_EVS_ACELP_corr_xh_fx
    Word32 L_tmp, y32[2 * L_SUBFR], L_maxloc, L_tot;
#else
    Word32 L_tmp, y32[L_SUBFR], L_maxloc, L_tot;
#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
@@ -42,10 +54,18 @@ void corr_xh_fx(
    FOR( k = 0; k < NB_TRACK; k++ )
    {
        L_maxloc = L_deposit_l( 0 );
#ifdef REUSE_EVS_ACELP_corr_xh_fx
        FOR( i = k; i < L_subfr; i += STEP )
#else
        FOR( i = k; i < L_SUBFR; i += STEP )
#endif
        {
            L_tmp = L_mac( 1L, x[i], h[0] ); /* 1 -> to avoid null dn[] Qx+15*/
#ifdef REUSE_EVS_ACELP_corr_xh_fx
            FOR( j = i; j < L_subfr - 1; j++ )
#else
            FOR( j = i; j < L_SUBFR - 1; j++ )
#endif
            {
                L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); /*Qx+15*/
            }
@@ -66,11 +86,19 @@ void corr_xh_fx(

    j = sub( norm_l( L_tot ), 4 ); /* 4 -> 16 x tot */

#ifdef REUSE_EVS_ACELP_corr_xh_fx
    FOR( i = 0; i < L_subfr; i++ )
#else
    FOR( i = 0; i < L_SUBFR; i++ )
#endif
    {
        dn[i] = round_fx( L_shl( y32[i], j ) ); /*Qx+15+j-16*/
    }
#ifdef REUSE_EVS_ACELP_corr_xh_fx
    return j;               // TODO remove this, should not be needed, but won't be BE
#else
    return;
#endif
}

void corr_hh_ivas_fx(
@@ -127,7 +155,7 @@ void corr_hh_ivas_fx(
    move16();
    return;
}

#ifndef REUSE_EVS_ACELP_corr_xh_fx
void corr_xh_ivas_fx(
    const Word16 x[], /* i  : target signal                                   Qx*/
    const Word16 Qx,
@@ -184,3 +212,4 @@ void corr_xh_ivas_fx(
    move16();
    return;
}
#endif
 No newline at end of file
+8 −2
Original line number Diff line number Diff line
@@ -73,8 +73,11 @@ Word16 gaus_encode_fx(
     *----------------------------------------------------------------*/

    /* Correlation between target xn2[] and impulse response h1[] */
#ifdef REUSE_EVS_ACELP_corr_xh_fx
    corr_xh_fx( xn, dn, h1, L_SUBFR );
#else
    corr_xh_fx( xn, dn, h1 );

#endif
    tmp_idx = shr( i_subfr, 6 );
    nb_bits = st_fx->acelp_cfg.fixed_cdk_index[tmp_idx]; /* Q0 */
    move16();
@@ -171,8 +174,11 @@ Word16 gaus_encode_ivas_fx(
     *----------------------------------------------------------------*/

    /* Correlation between target xn2[] and impulse response h1[] */
#ifdef REUSE_EVS_ACELP_corr_xh_fx
    corr_xh_fx( xn, dn, h1, L_SUBFR );
#else
    corr_xh_fx( xn, dn, h1 );

#endif
    tmp_idx = shr( i_subfr, 6 );
    nb_bits = st_fx->acelp_cfg.fixed_cdk_index[tmp_idx]; /* Q0 */
    move16();
+9 −0
Original line number Diff line number Diff line
@@ -139,7 +139,11 @@ Word16 inov_encode_fx(
        Scale_sig( cn, L_subfr, shift );

        cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr );
#ifdef REUSE_EVS_ACELP_corr_xh_fx
        corr_xh_fx( xn2, dn, h2, L_subfr );
#else
        corr_xh_fx( xn2, dn, h2 );
#endif
    }

    /*-----------------------------------------------------------------*
@@ -479,7 +483,12 @@ Word16 inov_encode_ivas_fx(
        Word16 q_h1 = sub( 14, norm_s( h2[0] ) );
        Scale_sig( h2, L_SUBFR, sub( 11, q_h1 ) ); /* set h2[] in Q11*/
        cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr );
#ifndef REUSE_EVS_ACELP_corr_xh_fx
        corr_xh_ivas_fx( xn2, Qxn, dn, &Qdn, h2, L_subfr ); // Q(dn) = Q_new+1
#else
        k = corr_xh_fx( xn2, dn, h2, L_subfr ); // Q(dn) = Q_new+1
        Qdn = sub( add( add( Qxn, add( sub( 14, norm_s( h2[0] ) ), 1 ) ), k ), 16 );
#endif
        IF( LT_16( Qdn, Qcn ) )
        {
            scale_sig( cn, L_subfr, sub( Qdn, Qcn ) );
+8 −0
Original line number Diff line number Diff line
@@ -3012,10 +3012,18 @@ void core_coder_mode_switch_fx(
    const Word16 is_mct,
    const Word16 shift );

#ifdef REUSE_EVS_ACELP_corr_xh_fx
Word16 corr_xh_fx(
#else
void corr_xh_fx(
#endif
    const Word16 x[], /* i  : target signal                                   Qx*/
    Word16 dn[],      /* o  : correlation between x[] and h[]                 Qdn*/
    const Word16 h[]  /* i  : impulse response (of weighted synthesis filter) Q14*/
#ifdef REUSE_EVS_ACELP_corr_xh_fx
    ,
    const Word16 L_subfr /* i  : sub-frame lenght Q0 */
#endif
);

void corr_hh_ivas_fx(