Commit 6b28ec96 authored by vaillancour's avatar vaillancour
Browse files

Reuse EVS for GENERIC LR

parent c49005e3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -86,5 +86,6 @@
#define	MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of Cy calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Obsoletes IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE. */

#define TEST_HR
#define REUSE_EVS_ACELP

#endif
+11 −0
Original line number Diff line number Diff line
@@ -777,6 +777,9 @@ ivas_error acelp_core_enc_ivas_fx(

    Word16 att_fx;
    Word16 tmpF_fx;
#ifdef REUSE_EVS_ACELP 
    Word16 shift = 0;
#endif

    test();
    IF( !st->Opt_AMR_WB && st->hBWE_TD != NULL )
@@ -1379,7 +1382,11 @@ ivas_error acelp_core_enc_ivas_fx(
                st->hTdCngEnc->burst_ho_cnt = 0;
                move16();
                /* VOICED frames in SC-VBR */
#ifdef REUSE_EVS_ACELP
                encod_gen_voic_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, shift, Q_new );
#else
                encod_gen_voic_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new );
#endif
            }
        }
        ELSE IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) )
@@ -1390,7 +1397,11 @@ ivas_error acelp_core_enc_ivas_fx(
        ELSE
        {
            /* GENERIC, VOICED and INACTIVE frames (coded by AVQ technology) */
#ifdef REUSE_EVS_ACELP
            encod_gen_voic_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, shift, Q_new );
#else
            encod_gen_voic_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new );
#endif
        }

        /* update mem_syn1_flt for ACELP core switching */
+7 −1
Original line number Diff line number Diff line
@@ -1143,7 +1143,13 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
        scale = -2;
        move16();
    }

#ifdef REUSE_EVS_ACELP /* To be verified if it affects BE on 26.444, if yes, just a condition for IVAS here*/
    if ( EQ_16( val, 32767 ) )
    {
        scale = -3;
        move16();
    }
#endif
    Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/

    E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR );
+9 −1
Original line number Diff line number Diff line
@@ -553,7 +553,15 @@ void E_ACELP_4tsearchx_fx(
                                           &ind[j], dn, cor, sign, sign_val_1 );
            }


#ifdef REUSE_EVS_ACELP
            IF( GT_16( alp, ONE_IN_Q14 ) )
            {
                alp = shr( alp, 1 );
                Scale_sig( cor, L_SUBFR, -1 );           /*Q8*/
                Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/
                Scale_sig( dn, L_SUBFR, -1 );            /*Qdn-1*/
            }
#endif
            st = add( st, 1 );
        }

+32 −8
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ void encod_gen_voic_fx(
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#ifdef REUSE_EVS_ACELP
    Word16 q_h1;
#endif
    SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
    BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
@@ -165,7 +168,12 @@ void encod_gen_voic_fx(
    set16_fx( code_preQ_fx, 0, L_SUBFR );

    shift_wsp = add( Q_new, shift );

#ifdef REUSE_EVS_ACELP
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    /* set and write harmonicity flag */
    harm_flag_acelp = 0;
    move16();
@@ -196,19 +204,33 @@ void encod_gen_voic_fx(
         *----------------------------------------------------------------*/

        Copy( &res_fx[i_subfr_fx], &exc_fx[i_subfr_fx], L_SUBFR ); /*Q_new*/
#ifdef REUSE_EVS_ACELP
        IF( st_fx->element_mode > EVS_MONO )
        {
            find_targets_ivas_new_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx,
                                      res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );
            q_h1 = sub( 14, norm_s( h1_fx[0] ) );
            Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/
            Scale_sig( h1_fx, L_SUBFR, add( sub( 14, q_h1 ), shift ) );
        }
        ELSE
#endif
        {

            find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx,
                             res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );

            Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, -2 );  /*Q11*/
            Scale_sig( h1_fx, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution Q(14+shift)*/

        }
        /* scaling of xn[] to limit dynamic at 12 bits */
        Scale_sig( xn_fx, L_SUBFR, shift );

        *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx,
                                      L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf ); /* Q6 */

#ifdef REUSE_EVS_ACELP
        //tbe_celp_exc, can be use EVS version in a bit-exact manner, just to add one condition and change L_SUBFR to L_subfr in the EVS version
#endif
        tbe_celp_exc( L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx );

        /*-----------------------------------------------------------------*
@@ -400,7 +422,7 @@ void encod_gen_voic_fx(
    }
    return;
}

#ifndef REUSE_EVS_ACELP
void encod_gen_voic_ivas_fx(
    Encoder_State *st_fx,              /* i/o: state structure                                  */
    const Word16 speech_fx[],          /* i  : input speech                                     Qnew -1 */
@@ -790,3 +812,5 @@ void encod_gen_voic_ivas_fx(
    }
    return;
}

#endif
 No newline at end of file
Loading