Commit 3113ee25 authored by vaclav's avatar vaclav
Browse files

harmonize est_tilt_ivas_fx(), under CLEANUP_ACELP_ENC

parent 4342d7e9
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -120,8 +120,11 @@ Word16 est_tilt_ivas_fx(
    const Word32 gain_code, /* i  : algebraic code gain             Q16 */
    Word16 *voice_fac,      /* o  : voicing factor                  Q15 */
    const Word16 Q_exc,     /* i  : Scaling factor of excitation    Q0  */
    const Word16 L_subfr,   /* i  : Sub frame length                    */
    const Word16 L_subfr   /* i  : Sub frame length                    */
#ifndef CLEANUP_ACELP_ENC
    ,
    const Word16 flag_tilt  /* i  : flag for special tilt        */
#endif
)
{
    Word16 i, tmp, exp, ener1, exp1, ener2, exp2;
@@ -161,6 +164,9 @@ Word16 est_tilt_ivas_fx(
    *voice_fac = exp;
    move16();

#ifdef CLEANUP_ACELP_ENC
    tilt_code = mac_r( 8192L /*0.25.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 8192 /*0.25.Q15*/ ); /*Q15 */
#else
    IF( flag_tilt == 0 )
    {
        /* tilt of code for next subframe: 0.5=voiced, 0=unvoiced */
@@ -180,6 +186,7 @@ Word16 est_tilt_ivas_fx(
        // tilt_code = (float)(0.28f + (*voice_fac + 1.0f) * 0.14f);
        tilt_code = mac_r( 13763L /*0.42.Q15*/ * 65536 /*1.Q16*/ - 0x8000 /*1.Q15*/, *voice_fac, 4588 /*0.14.Q15*/ ); /*Q15 */
    }
#endif

    return tilt_code;
}
+5 −2
Original line number Diff line number Diff line
@@ -4851,8 +4851,11 @@ Word16 est_tilt_ivas_fx(
    const Word32 gain_code, /* i  : algebraic code gain             Q16 */
    Word16 *voice_fac,      /* o  : voicing factor                  Q15 */
    const Word16 Q_exc,     /* i  : Scaling factor of excitation    Q0  */
    const Word16 L_subfr,   /* i  : Sub frame length                    */
    const Word16 L_subfr    /* i  : Sub frame length                    */
#ifndef CLEANUP_ACELP_ENC
    ,
    const Word16 flag_tilt /* i  : flag for special tilt        */
#endif
);
/* o  : tilt of the code                    */
+8 −2
Original line number Diff line number Diff line
@@ -173,13 +173,14 @@ ivas_error decod_gen_voic_fx(
            pred_lt4( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
        }

        // tbe_celp_exc(L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx);
        tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag );

        /*--------------------------------------------------------------*
         * LP filtering of the adaptive excitation
         *--------------------------------------------------------------*/

        lp_filt_exc_dec_fx( st_fx, MODE1, i_subfr_fx, L_SUBFR, L_frame, st_fx->acelp_cfg.ltf_mode, exc_fx );
        
        /*-----------------------------------------------------------------*
         * Transform-domain contribution decoding (active frames)
         *-----------------------------------------------------------------*/
@@ -215,12 +216,18 @@ ivas_error decod_gen_voic_fx(
        {
            gain_dec_mless_fx( st_fx, L_frame, st_fx->coder_type, i_subfr_fx, -1, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx );
        }

#ifdef CLEANUP_ACELP_ENC
        st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR ); // Q15
#else
        st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0 ); // Q15
#endif
        move16();

        /*-----------------------------------------------------------------*
         * Transform domain contribution decoding
         *-----------------------------------------------------------------*/

        test();
        IF( !st_fx->inactive_coder_type_flag && st_fx->coder_type == INACTIVE )
        {
@@ -368,7 +375,6 @@ ivas_error decod_gen_voic_fx(
    }

    /* FEC fast recovery */

    IF( do_WI_fx )
    {
        /* shft_prev = L_EXC_MEM - rint_new_fx(st_fx->bfi_pitch_fx);*/
+9 −1
Original line number Diff line number Diff line
@@ -202,12 +202,15 @@ void dec_pit_exc_fx(

            gain_dec_mless_fx( st_fx, st_fx->L_frame, LOCAL_CT, i_subfr_fx, -1, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx );

#ifdef CLEANUP_ACELP_ENC
            st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx );
#else
            st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx, 0 );
#endif
            move16();
        }
        ELSE IF( EQ_16( use_fcb, 2 ) ) /* IVAS only */
        {
            /*inov_decode_fx(st_fx, Local_BR_fx, 0, st_fx->L_frame, 1, i_subfr_fx, p_Aq_fx, st_fx->tilt_code_fx, *pt_pitch_fx, code_fx, L_subfr_fx);*/
            inov_decode_fx( st_fx, st_fx->core_brate, 0, st_fx->L_frame, 0, i_subfr_fx, p_Aq_fx, st_fx->tilt_code_fx, *pt_pitch_fx, code_fx, L_subfr_fx );

            /*--------------------------------------------------------------*
@@ -217,7 +220,11 @@ void dec_pit_exc_fx(

            gain_dec_lbr_fx( st_fx, GENERIC, i_subfr_fx, code_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, gc_mem, gp_mem, L_subfr_fx );

#ifdef CLEANUP_ACELP_ENC
            st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx );
#else
            st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, 0, L_subfr_fx, 0 );
#endif
            move16();
        }
        ELSE
@@ -250,6 +257,7 @@ void dec_pit_exc_fx(
        /*----------------------------------------------------------------------*
         * Find the total excitation
         *----------------------------------------------------------------------*/

        Rescale_exc( hMusicPF->dct_post_old_exc_fx, &exc_fx[i_subfr_fx], &bwe_exc_fx[( i_subfr_fx * ( 2 * HIBND_ACB_L_FAC ) ) / 2], hGSCDec->last_exc_dct_in_fx,
                     L_subfr_fx, shr( imult1616( L_subfr_fx, 2 * HIBND_ACB_L_FAC ), 1 ), gain_code_fx, &( st_fx->Q_exc ), st_fx->Q_subfr, NULL, i_subfr_fx, coder_type );

+10 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ void decod_tran_fx(
    move16();

    set16_fx( code_preQ_fx, 0, L_SUBFR ); // Q10

    /*----------------------------------------------------------------*
     * ACELP subframe loop
     *----------------------------------------------------------------*/
@@ -118,9 +119,11 @@ void decod_tran_fx(

        transition_dec_fx( st_fx, 0, L_frame_fx, i_subfr, tc_subfr_fx, &Jopt_flag, exc_fx,
                           &T0, &T0_frac, &T0_min, &T0_max, &pt_pitch_fx, &position, bwe_exc_fx, &st_fx->Q_exc );
        
        /*-----------------------------------------------------------------*
         * Transform domain contribution decoding - active frames
         *-----------------------------------------------------------------*/

        IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
        {
            gain_code_fx = 0;
@@ -176,13 +179,18 @@ void decod_tran_fx(
        {
            lp_gain_updt_ivas_fx( i_subfr, gain_pit_fx, L_add( norm_gain_code_fx, norm_gain_preQ_fx ), &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_frame_fx );

#ifdef CLEANUP_ACELP_ENC
            st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR );
#else
            st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0 );
#endif
            move16();
        }

        /*----------------------------------------------------------------------*
         * Find the total excitation
         *----------------------------------------------------------------------*/

        test();
        test();
        test();
@@ -219,6 +227,7 @@ void decod_tran_fx(
        /*-----------------------------------------------------------------*
         * Add the ACELP pre-quantizer contribution
         *-----------------------------------------------------------------*/

        IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
        {
            IF( ( st_fx->element_mode == EVS_MONO ) )
@@ -244,6 +253,7 @@ void decod_tran_fx(
        /*-----------------------------------------------------------------*
         * Prepare TBE excitation
         *-----------------------------------------------------------------*/

        Word16 tmp_idx_2;
        tmp_idx_2 = 0;
        move16();
Loading