Commit 5c4be483 authored by multrus's avatar multrus
Browse files

[cleanup] accept REUSE_EVS_BE_ACELP_4T64, REUSE_EVS_BE_ACELP_2t32, REUSE_EVS_BE_ACELP_1t64

parent 4c3b3037
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -78,9 +78,6 @@



#define REUSE_EVS_BE_ACELP_4T64
#define REUSE_EVS_BE_ACELP_2t32
#define REUSE_EVS_BE_ACELP_1t64
#define REUSE_EVS_BE_ACELP_AVQ
#define REUSE_EVS_BE_GAUSS          
#define REUSE_EVS_BE_GAINQ          
+0 −343
Original line number Diff line number Diff line
@@ -296,279 +296,6 @@ void acelp_2t32_fx(
    }
    return;
}
#ifndef REUSE_EVS_BE_ACELP_2t32
void acelp_2t32_ivas_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle                      */
    const Word16 dn[],     /* i  : corr. between target and h[].                 Qx*/
    const Word16 h[],      /* i  : impulse response of weighted synthesis filter Q12*/
    Word16 code[],         /* o  : algebraic (fixed) codebook excitation       Q9  */
    Word16 y[]             /* o  : filtered fixed codebook excitation          Q9  */
)
{
    Word16 i, j, k, i0, i1, ix, iy, pos, pos2, sign0, sign1, index;
    Word16 ps1, ps2, alpk, alp1, alp2;
    Word16 sq, psk;
    Word16 pol[L_SUBFR], dn_p[L_SUBFR];
    Word16 ii, jj;
    Word16 *p0, *p1, *p2;
    const Word16 *ptr_h1, *ptr_h2, *ptr_hf;

    Word32 s, L_cor;
    Word32 L_tmp;
    Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T];
    Word16 rrixiy[MSIZE];
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
    /*----------------------------------------------------------------*
     * Compute rrixix[][] needed for the codebook search.
     *----------------------------------------------------------------*/

    /* Init pointers to last position of rrixix[] */
    p0 = &rrixix[0][NB_POS_FCB_2T - 1];
    p1 = &rrixix[1][NB_POS_FCB_2T - 1];

    ptr_h1 = h;
    move16();
    L_cor = L_deposit_h( 1 );
    FOR( i = 0; i < NB_POS_FCB_2T; i++ )
    {
        L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
        ptr_h1++;
        *p1-- = extract_h( L_cor );
        move16(); /*Q9 Q7*/
        L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
        ptr_h1++;
        *p0-- = extract_h( L_cor );
        move16(); /*Q9 Q7*/
    }

    p0 = rrixix[0];
    p1 = rrixix[1];

    FOR( i = 0; i < NB_POS_FCB_2T; i++ )
    {
        *p0 = shr( *p0, 1 );
        move16();
        p0++;
        *p1 = shr( *p1, 1 );
        move16();
        p1++;
    }

    /*------------------------------------------------------------*
     * Compute rrixiy[][] needed for the codebook search.
     *------------------------------------------------------------*/

    pos = MSIZE - 1;
    move16();
    pos2 = MSIZE - 2;
    move16();
    ptr_hf = h + 1;

    FOR( k = 0; k < NB_POS_FCB_2T; k++ )
    {
        /* Init pointers to last position of diagonals */
        p1 = &rrixiy[pos];
        p0 = &rrixiy[pos2];

        ptr_h1 = h;
        ptr_h2 = ptr_hf;

        L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q25
        FOR( i = k; i < NB_POS_FCB_2T - 1; i++ )
        {
            *p1 = round_fx_o( L_cor, &Overflow ); // Q9
            L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
            *p0 = round_fx_o( L_cor, &Overflow ); // Q9
            L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
            move16();
            move16();
            p1 -= ( NB_POS_FCB_2T + 1 );
            p0 -= ( NB_POS_FCB_2T + 1 );
        }

        *p1 = round_fx_o( L_cor, &Overflow );
        pos -= NB_POS_FCB_2T;
        move16();
        pos2 = sub( pos2, 1 );
        ptr_hf += STEP;
        move16();
    }

    /*----------------------------------------------------------------*
     * computing reference vector and pre-selection of polarities
     *----------------------------------------------------------------*/

    L_tmp = L_deposit_h( dn[0] );
    FOR( i = 0; i < L_SUBFR; i++ )
    {
        /* FIR high-pass filtering */
        IF( i == 0 )
        {
            L_tmp = L_msu( L_tmp, dn[1], 11469 /*.3f Q15*/ );
        }
        ELSE IF( EQ_16( i, L_SUBFR - 1 ) )
        {
            L_tmp = L_deposit_h( dn[i] );
            L_tmp = L_msu( L_tmp, dn[i - 1], 11469 /*.3f Q15*/ );
        }
        ELSE
        {
            L_tmp = L_deposit_h( dn[i] );
            L_tmp = L_msu( L_tmp, dn[i - 1], 11469 /*.3f Q15*/ );
            L_tmp = L_msu( L_tmp, dn[i + 1], 11469 /*.3f Q15*/ );
        }

        /* pre-selection of polarities */
        IF( L_tmp >= 0 )
        {
            pol[i] = 1;
            move16();
            dn_p[i] = dn[i];
            move16();
        }
        ELSE
        {
            pol[i] = -1;
            move16();
            dn_p[i] = negate( dn[i] );
            move16();
        }
    }

    /*----------------------------------------------------------------*
     * compute denominator ( multiplied by polarity )
     *----------------------------------------------------------------*/

    k = 0;
    ii = 0;
    move16();
    move16();
    FOR( i = 0; i < NB_POS_FCB_2T; i++ )
    {
        jj = 1;
        move16();
        FOR( j = 0; j < NB_POS_FCB_2T; j++ )
        {
            test();
            if ( EQ_16( s_and( pol[ii], pol[jj] ), 1 ) && EQ_16( s_or( pol[ii], pol[jj] ), -1 ) )
            {
                rrixiy[k + j] = negate( rrixiy[k + j] );
                move16();
            }
            jj = add( jj, 2 );
        }
        ii = add( ii, 2 );
        k = add( k, NB_POS_FCB_2T );
    }

    /*----------------------------------------------------------------*
     * search 2 pulses
     * All combinaisons are tested:
     * 32 pos x 32 pos x 2 signs = 2048 tests
     *----------------------------------------------------------------*/

    p0 = rrixix[0];
    p1 = rrixix[1];
    p2 = rrixiy;
    psk = -1;
    move16();
    alpk = 1;
    move16();
    ix = 0;
    move16();
    iy = 1;
    move16();

    FOR( i0 = 0; i0 < L_SUBFR; i0 += STEP )
    {
        ps1 = dn_p[i0];
        move16();
        alp1 = *p0++;
        move16();
        pos = -1;
        move16();
        FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP )
        {
            ps2 = add( ps1, dn_p[i1] );
            alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow );
            sq = mult( ps2, ps2 );
            s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow );
            IF( s > 0 )
            {
                psk = sq;
                move16();
                alpk = alp2;
                move16();
                pos = i1;
                move16();
            }
        }
        p1 -= NB_POS_FCB_2T;

        IF( pos >= 0 )
        {
            ix = i0;
            move16();
            iy = pos;
            move16();
        }
    }

    i0 = shr( ix, 1 );
    i1 = shr( iy, 1 );

    sign0 = shl( pol[ix], 9 ); // Q9
    sign1 = shl( pol[iy], 9 ); // Q9

    /*-------------------------------------------------------------------*
     * Build the codeword, the filtered codeword and index of codevector.
     *-------------------------------------------------------------------*/

    set16_fx( code, 0, L_SUBFR );

    code[ix] = sign0;
    move16();
    code[iy] = sign1;
    move16();

    index = add( shl( i0, 6 ), i1 );


    if ( sign0 < 0 )
    {
        index = add( index, 0x800 );
    }
    if ( sign1 < 0 )
    {
        index = add( index, 0x20 ); /* move16();*/
    }

    set16_fx( y, 0, L_SUBFR );
    /* y_Q9 = sign_Q9<<3 * h_Q12 */

    sign0 = shl( sign0, 3 );
    sign1 = shl( sign1, 3 );

    FOR( i = ix; i < L_SUBFR; i++ )
    {
        y[i] = mult_r( sign0, h[i - ix] ); // Q9
        move16();
    }
    FOR( i = iy; i < L_SUBFR; i++ )
    {
        y[i] = round_fx( L_mac( L_deposit_h( y[i] ), sign1, h[i - iy] ) ); // Q9
        move16();
    }
    {
        /* write index to array of indices */
        push_indice( hBstr, IND_ALG_CDBK_2T32, index, 12 );
    }
    return;
}
#endif
/*----------------------------------------------------------------------------------
 * Function  acelp_1t64()
 *
@@ -646,73 +373,3 @@ void acelp_1t64_fx(

    return;
}
#ifndef REUSE_EVS_BE_ACELP_1t64
void acelp_1t64_ivas_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle                      */
    const Word16 dn[],     /* i  : corr. between target and h[].                Qx */
    const Word16 h[],      /* i  : impulse response of weighted synthesis filter Q12*/
    Word16 code[],         /* o  : algebraic (fixed) codebook excitation         Q9*/
    Word16 y[],            /* o  : filtered fixed codebook excitation            Q9*/
    const Word16 L_subfr   /* i  : subframe length                               */
)
{
    Word16 i, pos, sgn, index;
    Word32 L_tmp;
    /*-------------------------------------------------------------------*
     * Find position and sign of maximum impulse.
     *-------------------------------------------------------------------*/
    pos = emaximum_fx( 0, dn, L_subfr, &L_tmp );

    IF( dn[pos] < 0 )
    {
        sgn = -512; //-1 in Q9
        move16();
    }
    ELSE
    {
        sgn = 512; // 1 in Q9
        move16();
    }

    /*-------------------------------------------------------------------*
     * Build the codeword, the filtered codeword and index of codevector.
     *-------------------------------------------------------------------*/

    set16_fx( code, 0, L_subfr );
    code[pos] = sgn;
    move16();

    set16_fx( y, 0, L_subfr );

    FOR( i = pos; i < L_subfr; i++ )
    {
        IF( sgn > 0 )
        {
            y[i] = shr_r( h[i - pos], 3 ); // Q9
            move16();
        }
        ELSE
        {
            y[i] = negate( shr_r( h[i - pos], 3 ) ); // Q9
            move16();
        }
    }

    index = pos;
    move16();
    if ( sgn > 0 )
    {
        index = add( index, L_subfr );
    }
    IF( EQ_16( L_subfr, L_SUBFR ) )
    {
        push_indice( hBstr, IND_ALG_CDBK_1T64, index, 7 );
    }
    ELSE /* L_subfr == 2*L_SUBFR */
    {
        push_indice( hBstr, IND_ALG_CDBK_1T64, index, 8 );
    }

    return;
}
#endif
+0 −425

File changed.

Preview size limit exceeded, changes collapsed.

+0 −411
Original line number Diff line number Diff line
@@ -1067,11 +1067,7 @@ void E_ACELP_corrmatrix_fx( Word16 h[] /*Q12*/, Word16 sign[] /*Q0*/, Word16 vec
    return;
}

#ifndef REUSE_EVS_BE_ACELP_4T64
void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ )
#else
void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/, const Word16 element_mode )
#endif
{
    Word16 sign[L_SUBFR], vec[L_SUBFR];
    Word16 cor_x[16], cor_y[16], h_buf[4 * L_SUBFR];
@@ -1147,14 +1143,12 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
        scale = -2;
        move16();
    }
#ifdef REUSE_EVS_BE_ACELP_4T64 /* To be verified if it affects BE on 26.444, if yes, just a condition for IVAS here*/
    test();
    if ( EQ_16( val, 32767 ) && element_mode > EVS_MONO )
    {
        scale = -3;
        move16();
    }
#endif
    Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/

    E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR );
@@ -1397,332 +1391,6 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
    }
    return;
}
#ifndef REUSE_EVS_BE_ACELP_4T64
void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ )
{
    Word16 sign[L_SUBFR], vec[L_SUBFR];
    Word16 cor_x[16], cor_y[16], h_buf[4 * L_SUBFR];
    Word16 rrixix[4][16];
    Word16 rrixiy[4][256];
    Word16 dn2[L_SUBFR];
    Word16 psk, ps, alpk, alp = 0;
    Word16 codvec[NB_PULSE_MAX];
    Word16 pos_max[4];
    Word16 dn2_pos[8 * 4];
    UWord8 ipos[NB_PULSE_MAX];
    Word16 *p0, *p1, *p2, *p3;
    Word16 *h, *h_inv;
    Word16 i, j, k, l, st, pos;
    Word16 val, tmp, scale;
    Word32 s, L_tmp;
    Word16 nb_pulse, nb_pulse_m2;
    Word16 check = 0; /* debug code not instrumented */
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif


    alp = config->alp; /* Q13 */ /* initial value for energy of all fixed pulses */
    move16();
    nb_pulse = config->nb_pulse;
    move16();
    nb_pulse_m2 = sub( nb_pulse, 2 );

    set16_fx( codvec, 0, nb_pulse );

    /*
     * Find sign for each pulse position.
     */

    E_ACELP_pulsesign( cn, dn, dn2, sign, vec, alp, 0x7fff, L_SUBFR );

    /*
     * Select the most important 8 position per track according to dn2[].
     */
    E_ACELP_findcandidates( dn2, dn2_pos, pos_max );

    /*
     * Compute h_inv[i].
     */
    set16_fx( h_buf, 0, L_SUBFR );

    set16_fx( h_buf + ( 2 * L_SUBFR ), 0, L_SUBFR );

    h = h_buf + L_SUBFR;
    h_inv = h_buf + ( 3 * L_SUBFR );

    /*Check the energy if it is too high then scale to prevent an overflow*/
    scale = 0;
    move16();
    L_tmp = L_deposit_l( 0 );
    BASOP_SATURATE_WARNING_OFF_EVS
    FOR( i = 0; i < L_SUBFR; i++ )
    {
        L_tmp = L_mac_o( L_tmp, H[i], H[i], &Overflow ); /*Q25*/
    }
    val = extract_h( L_tmp ); /*Q9*/
    BASOP_SATURATE_WARNING_ON_EVS

    if ( GT_16( val, 0x2000 ) )
    {
        scale = -1;
        move16();
    }
    if ( GT_16( val, 0x7000 ) )
    {
        scale = -2;
        move16();
    }
    if ( EQ_16( val, 32767 ) )
    {
        scale = -3;
        move16();
    }

    Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/

    E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR );


    /*
     * Compute correlation matrices needed for the codebook search.
     */
    E_ACELP_corrmatrix_fx( h, sign, vec, rrixix, rrixiy );


    /*
     * Deep first search:
     * ------------------
     * 20 bits (4p):  4 iter x ((4x16)+(8x16))              = 768 tests
     * 36 bits (8p):  4 iter x ((1x1)+(4x16)+(8x16)+(8x16)) = 1280 tests
     * 52 bits (12p): 3 iter x ((1x1)+(1x1)+(4x16)+(6x16)
     *                                      +(8x16)+(8x16)) = 1248 tests
     * 64 bits (16p): 2 iter x ((1x1)+(1x1)+(4x16)+(6x16)
     *                        +(6x16)+(8x16)+(8x16)+(8x16)) = 1280 tests
     */
    psk = -1;
    move16();
    alpk = 1;
    move16();

    /*Number of iterations*/
    FOR( k = 0; k < config->nbiter; k++ )
    {
        E_ACELP_setup_pulse_search_pos( config, k, ipos );

        /* format of alp changes to Q(15-ALP2_E) */

        pos = config->fixedpulses;
        move16();

        IF( config->fixedpulses == 0 ) /* 1100, 11, 1110, 1111, 2211 */
        {
            ps = 0;
            move16();
            alp = 0;
            move16();
            set16_fx( vec, 0, L_SUBFR );
        }
        ELSE IF( EQ_16( config->fixedpulses, 2 ) ) /* 2222 and 3322 */
        {
            /* first stage: fix 2 pulses */
            ind[0] = pos_max[ipos[0]];
            move16();
            ind[1] = pos_max[ipos[1]];
            move16();
            ps = add( dn[ind[0]], dn[ind[1]] );

            /*alp = rrixix[ipos[0]][ind[0] >> 2] + rrixix[ipos[1]][ind[1] >> 2] +
                    rrixiy[ipos[0]][((ind[0] >> 2) << 4) + (ind[1] >> 2)];*/

            i = shr( ind[0], 2 );
            j = shr( ind[1], 2 );
            l = add( shl( i, 4 ), j );
            s = L_mult( rrixix[ipos[0]][i], _1_ );     /* Q9+Q12+1 */
            s = L_mac( s, rrixix[ipos[1]][j], _1_ );   /* Q9+Q12+1 */
            alp = mac_r( s, rrixiy[ipos[0]][l], _1_ ); /* Q9+Q12+1-16 */

            p0 = h - ind[0]; /*Q12+scale*/
            IF( sign[ind[0]] < 0 )
            {
                p0 = h_inv - ind[0]; /*Q12+scale*/
            }

            p1 = h - ind[1]; /*Q12+scale*/
            IF( sign[ind[1]] < 0 )
            {
                p1 = h_inv - ind[1]; /*Q12+scale*/
            }

            FOR( i = 0; i < L_SUBFR; i++ )
            {
                vec[i] = add( *p0++, *p1++ ); /*Q12+scale*/
                move16();
            }
        }
        ELSE /* 3333 and above */
        {
            /* first stage: fix 4 pulses */

            ind[0] = pos_max[ipos[0]]; /*Q0*/
            move16();
            ind[1] = pos_max[ipos[1]]; /*Q0*/
            move16();
            ind[2] = pos_max[ipos[2]]; /*Q0*/
            move16();
            ind[3] = pos_max[ipos[3]]; /*Q0*/
            move16();

            /*ps = dn[ind[0]] + dn[ind[1]] + dn[ind[2]] + dn[ind[3]];*/
            ps = add( add( add( dn[ind[0]], dn[ind[1]] ), dn[ind[2]] ), dn[ind[3]] );

            p0 = h - ind[0]; /*Q12+scale*/
            IF( sign[ind[0]] < 0 )
            {
                p0 = h_inv - ind[0]; /*Q12+scale*/
            }

            p1 = h - ind[1]; /*Q12+scale*/
            IF( sign[ind[1]] < 0 )
            {
                p1 = h_inv - ind[1]; /*Q12+scale*/
            }

            p2 = h - ind[2]; /*Q12+scale*/
            IF( sign[ind[2]] < 0 )
            {
                p2 = h_inv - ind[2]; /*Q12+scale*/
            }

            p3 = h - ind[3]; /*Q12+scale*/
            IF( sign[ind[3]] < 0 )
            {
                p3 = h_inv - ind[3]; /*Q12+scale*/
            }

            FOR( i = 0; i < L_SUBFR; i++ )
            {
                vec[i] = add( add( add( *p0++, *p1++ ), *p2++ ), *p3++ ); /*Q12+scale*/
                move16();
            }

            L_tmp = L_mult( vec[0], vec[0] ); /*Q25+2*scale*/
            FOR( i = 1; i < L_SUBFR; i++ )
            L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q25+2*scale*/

            alp = round_fx( L_shr( L_tmp, 3 ) ); /*Q6+2*scale*/

            /*alp *= 0.5F;      */
        }

        /* other stages of 2 pulses */
        st = 0;
        move16();
        FOR( j = pos; j < nb_pulse; j += 2 )
        {
            IF( GE_16( nb_pulse_m2, j ) ) /* pair-wise search */
            {
                /*
                 * Calculate correlation of all possible positions
                 * of the next 2 pulses with previous fixed pulses.
                 * Each pulse can have 16 possible positions.
                 */
                E_ACELP_h_vec_corr1_fx( h, vec, ipos[j], sign, rrixix, cor_x, dn2_pos, config->nbpos[st] );

                E_ACELP_h_vec_corr2_fx( h, vec, ipos[j + 1], sign, rrixix, cor_y );

                /*
                 * Find best positions of 2 pulses.
                 */
                E_ACELP_2pulse_search( config->nbpos[st], ipos[j], ipos[j + 1], &ps, &alp,
                                       &ind[j], &ind[j + 1], dn, dn2_pos, cor_x, cor_y, rrixiy );
            }
            ELSE /* single pulse search */
            {
                E_ACELP_h_vec_corr2_fx( h, vec, ipos[j], sign, rrixix, cor_x );

                E_ACELP_h_vec_corr2_fx( h, vec, ipos[j + 1], sign, rrixix, cor_y );

                E_ACELP_1pulse_search( &ipos[j], &ps, &alp,
                                       &ind[j], dn, cor_x, cor_y );
            }

            IF( GT_16( nb_pulse_m2, j ) )
            {
                p0 = h - ind[j]; /*Q12+scale*/
                IF( sign[ind[j]] < 0 )
                {
                    p0 = h_inv - ind[j]; /*Q12+scale*/
                }

                p1 = h - ind[j + 1]; /*Q12+scale*/
                IF( sign[ind[j + 1]] < 0 )
                {
                    p1 = h_inv - ind[j + 1]; /*Q12+scale*/
                }


                FOR( i = 0; i < L_SUBFR; i++ )
                {
                    tmp = add( *p0++, *p1++ );
                    vec[i] = add_o( vec[i], tmp, &Overflow ); /* can saturate here. */
                    move16();
                }
            }
            st = add( st, 1 );
        }

        /* memorise the best codevector */

        /*ps = ps * ps;                                            MULT(1);*/
        ps = mult( ps, ps );
        /*s = (alpk * ps) - (psk * alp);                            MULT(2);ADD(1);*/
        s = L_msu( L_mult( alpk, ps ), psk, alp ); /*Q9+Q6+1=Q16*/

        if ( psk < 0 )
        {
            s = 1;
            move32();
        }
        IF( s > 0 )
        {
            psk = ps;
            move16();
            alpk = alp;
            move16();
            Copy( ind, codvec, nb_pulse ); /*Q0*/
            check = 1;                     /* debug code not instrumented */
        }
    }

    assert( check ); /* debug code not instrumented */

    /*
     * Build the codeword, the filtered codeword and index of codevector, as well as store weighted correlations.
     */

    E_ACELP_build_code( nb_pulse, codvec, sign, code, ind );

    set16_fx( y, 0, L_SUBFR );
    FOR( k = 0; k < nb_pulse; ++k )
    {
        i = codvec[k]; /*Q0*/
        move16();
        p0 = h_inv - i; /*Q12+scale*/
        IF( sign[i] > 0 )
        {
            p0 -= 2 * L_SUBFR;
        }
        FOR( i = 0; i < L_SUBFR; i++ )
        {
            y[i] = add_o( y[i], *p0++, &Overflow ); /*Q12+scale*/
            move16();
        }
    }
    return;
}
#endif
/*
 * E_ACELP_4t_fx
 *
@@ -1771,10 +1439,8 @@ void E_ACELP_4t_fx(
    const Word32 total_brate,  /*Q0*/
    const Word16 i_subfr,      /*Q0*/
    const Word16 cmpl_flag     /*Q0*/
#ifdef REUSE_EVS_BE_ACELP_4T64
    ,
    const Word16 element_mode /*Q0*/
#endif
)
{
    PulseConfig config;
@@ -1815,88 +1481,15 @@ void E_ACELP_4t_fx(

    IF( acelpautoc )
    {
#ifndef REUSE_EVS_BE_ACELP_4T64
        E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind );
#else
        E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind, element_mode );
#endif
    }
    ELSE
    {
#ifndef REUSE_EVS_BE_ACELP_4T64
        E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y );
#else
        E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y, element_mode );
#endif
    }
    E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index );
    return;
}
#ifndef REUSE_EVS_BE_ACELP_4T64
void E_ACELP_4t_ivas_fx(
    Word16 dn[], /*Qdn*/
    Word16 cn[] /* Q_xn */,
    Word16 H[],                /*Q12*/
    Word16 R[],                /*Qx*/
    Word8 acelpautoc,          /*Q0*/
    Word16 code[],             /*Q9*/
    Word16 cdk_index,          /*Q0*/
    Word16 _index[],           /*Q0*/
    const Word16 L_frame,      /*Q0*/
    const Word16 last_L_frame, /*Q0*/
    const Word32 total_brate,  /*Q0*/
    const Word16 i_subfr,      /*Q0*/
    const Word16 cmpl_flag,    /*Q0*/
    Word16 element_mode /*Q0*/ )
{
    PulseConfig config;
    Word16 ind[NPMAXPT * 4];
    Word16 y[L_SUBFR];

    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    memcpy( &config, &PulseConfTable[cdk_index], sizeof( PulseConfTable[cdk_index] ) );


    if ( cmpl_flag > 0 )
    {
        config.nbiter = cmpl_flag;
        move16();
    }
    test();
    test();
    IF( NE_16( L_frame, last_L_frame ) && EQ_32( total_brate, ACELP_24k40 ) && LT_32( i_subfr, 5 * L_SUBFR ) )
    {
        config.nbiter = sub( config.nbiter, 1 );
        config.nbiter = s_max( config.nbiter, 1 );
    }

    IF( acelpautoc )
    {
        E_ACELP_4tsearchx_ivas_fx( dn, cn, R, code, &config, ind, element_mode );
    }
    ELSE
    {
        E_ACELP_4tsearch_ivas_fx( dn, cn, H, code, &config, ind, y );
    }
    E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index );
    return;
}
#endif
static void E_ACELP_indexing_shift(
    Word16 wordcnt,      /* i: 16-bit word count including the newly shifted-in bits Q0*/
    Word16 shift_bits,   /* i: number of bits to shift in from the lsb               Q0*/
@@ -2319,11 +1912,7 @@ void E_ACELP_innovative_codebook_fx(
    /* Innovative codebook search */
    assert( acelp_cfg->fixed_cdk_index[idx] < ACELP_FIXED_CDK_NB );

#ifdef REUSE_EVS_BE_ACELP_4T64
    E_ACELP_4t_fx( dn, cn2, h2, Rw2, acelpautoc, code, acelp_cfg->fixed_cdk_index[idx], *pt_indice, L_frame, last_L_frame, total_brate, i_subfr, 0, 0 );
#else
    E_ACELP_4t_fx( dn, cn2, h2, Rw2, acelpautoc, code, acelp_cfg->fixed_cdk_index[idx], *pt_indice, L_frame, last_L_frame, total_brate, i_subfr, 0 );
#endif
    *pt_indice += 8;

    /* Generate weighted code */
+0 −293

File changed.

Preview size limit exceeded, changes collapsed.

Loading