Commit 82487175 authored by vaillancour's avatar vaillancour
Browse files

part 2 of Reusing EVS FCB

parent 32f66381
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#define USE_EVS_FCB_1
#define USE_EVS_FCB_2           /* replace E_ACELP_4tsearch_ivas_fx with EVS, BE except for maybe one scaling condition that has to be verified on 26.444*/
#define USE_EVS_FCB_3 /*  replace E_ACELP_4tsearchx_ivas_fx with EVS, BE except for maybe one scaling condition that has to be verified on 26.444*/ */
#define USE_EVS_FCB_4 /*  replace corr_xh_ivas_fx with EVS, BE except for maybe one scaling condition that has to be verified on 26.444*/ */

#endif

+16 −0
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ void corr_xh_fx(
    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 USE_EVS_FCB_4
    ,
    const Word16 L_subfr /* i  : sub-frame lenght Q0 */
#endif
)
{
    Word16 i, j, k;
@@ -42,10 +46,18 @@ void corr_xh_fx(
    FOR( k = 0; k < NB_TRACK; k++ )
    {
        L_maxloc = L_deposit_l( 0 );
#ifdef USE_EVS_FCB_4
        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 USE_EVS_FCB_4
            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,7 +78,11 @@ void corr_xh_fx(

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

#ifdef USE_EVS_FCB_4
    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*/
    }
+2 −1
Original line number Diff line number Diff line
@@ -1814,7 +1814,7 @@ void E_ACELP_4t_fx(
    E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index );
    return;
}

#ifndef USE_EVS_FCB_3
void E_ACELP_4t_ivas_fx(
    Word16 dn[], /*Qdn*/
    Word16 cn[] /* Q_xn */,
@@ -1886,6 +1886,7 @@ void E_ACELP_4t_ivas_fx(
    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*/
+14 −12
Original line number Diff line number Diff line
@@ -540,7 +540,9 @@ void encod_gen_voic_ivas_fx(
    /*------------------------------------------------------------------*
     * ACELP subframe loop
     *------------------------------------------------------------------*/

#ifdef USE_EVS_FUNC_LP
    shift_wsp = sub( shift_wsp, 1 );
#endif
    FOR( i_subfr_fx = 0; i_subfr_fx < L_frame; i_subfr_fx += L_SUBFR )
    {

@@ -636,17 +638,19 @@ void encod_gen_voic_ivas_fx(
        /*-----------------------------------------------------------------*
         * Innovation encoding
         *-----------------------------------------------------------------*/

#ifdef USE_EVS_FCB_4 // -> this might need ajsutement in acelp_fast
        inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame, st_fx->last_L_frame,
                             st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx,
                             gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn2_fx, code_fx, y2_fx, &unbits_PI_fx, L_SUBFR, shift );
#else
        inov_encode_ivas_fx( st_fx, st_fx->core_brate, 0, L_frame, st_fx->last_L_frame,
                             st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx,
                             gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn2_fx, code_fx, y2_fx, &unbits_PI_fx, L_SUBFR, shift, Q_new );

#endif
        /*-----------------------------------------------------------------*
         * Gain encoding
         *-----------------------------------------------------------------*/
#ifdef TRY_SHIFT_ACELP2
        shift_wsp += 1;
#endif


        IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
        {
@@ -654,7 +658,7 @@ void encod_gen_voic_ivas_fx(
            gain_enc_lbr_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, sub( shift_wsp, 1 ), y2_fx, code_fx,
                                  &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR );
#else
            gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp-1, y2_fx, code_fx,
            gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx,
                                  &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR );
#endif
        }
@@ -665,7 +669,7 @@ void encod_gen_voic_ivas_fx(
                                 &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, sub( shift_wsp, 1 ) );
#else
            gain_enc_SQ_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx,
                                 &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp-1 );
                                 &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp );
#endif
        }
        ELSE
@@ -674,13 +678,11 @@ void encod_gen_voic_ivas_fx(
            gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, sub( shift_wsp, 1 ), y2_fx, code_fx, Es_pred_fx,
                                    &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx );
#else
            gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp-1, y2_fx, code_fx, Es_pred_fx,
            gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx,
                                    &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx );
#endif
        }
#ifdef TRY_SHIFT_ACELP2
        shift_wsp -= 1;
#endif


        IF( st_fx->Opt_SC_VBR )
        {
+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[] */
#ifndef USE_EVS_FCB_4 
    corr_xh_fx( xn, dn, h1 );

#else
    corr_xh_fx( xn, dn, h1, L_SUBFR );
#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[] */
#ifndef USE_EVS_FCB_4
    corr_xh_fx( xn, dn, h1 );

#else
    corr_xh_fx( xn, dn, h1, L_SUBFR );
#endif
    tmp_idx = shr( i_subfr, 6 );
    nb_bits = st_fx->acelp_cfg.fixed_cdk_index[tmp_idx]; /* Q0 */
    move16();
Loading