Commit 46d3f18d authored by vaclav's avatar vaclav
Browse files

HARM_CORE_SW, decoder step 6 (core_switching_post_enc)

parent 02394042
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -829,7 +829,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx(
     *----------------------------------------------------------------*/

#ifdef HARM_CORE_SW
    IF( NE_16( st_fx->element_mode, EVS_MONO ) )
    IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
    {
        CLDFB_SCALE_FACTOR scaleFactor;
        Word32 workBuffer[128 * 3];
+27 −4
Original line number Diff line number Diff line
@@ -386,13 +386,14 @@ void core_switching_pre_enc_fx(
 *
 * Postprocessing for ACELP/HQ core switching
 *---------------------------------------------------------------------*/

void core_switching_post_enc_fx(
    Encoder_State *st_fx,        /* i/o: encoder state structure             */
    const Word16 old_inp_12k8[], /* i  : input signal @12.8 kHz  Qinp        */
    const Word16 old_inp_16k[],  /* i  : input signal @16 kHz    Qinp        */
    const Word16 A[],            /* i  : unquant. LP filter coefs. (Q12)     */
    Word16 Qshift,
    Word16 Q_new,
    const Word16 Qshift,
    const Word16 Q_new,
    const Word16 Qsp, /* i/o  : Q from acelp synthsis */
    Word16 *Qmus      /* i/o  : Q from mdct synthsis / Q of output synthesis  */
)
@@ -418,9 +419,15 @@ void core_switching_post_enc_fx(
        move16();
    }
    ELSE
    {
#ifdef HARM_CORE_SW
        IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
#endif
        {
            *Qmus = Qsp; /* Write Qout */
            move16();
        }

        IF( hBWE_TD == NULL )
        {
            return;
@@ -483,6 +490,7 @@ void core_switching_post_enc_fx(
        {
            TBEreset_enc_fx( st_fx->hBWE_TD, st_fx->last_core, st_fx->bwidth );
        }

        test();
        test();
        test();
@@ -493,6 +501,18 @@ void core_switching_post_enc_fx(
            hBWE_TD->fb_tbe_demph_fx = 0;
            fb_tbe_reset_enc_fx( hBWE_TD->elliptic_bpf_2_48k_mem_fx, &hBWE_TD->prev_fb_energy_fx, hBWE_TD->elliptic_bpf_2_48k_mem_fx_Q, &hBWE_TD->prev_fb_energy_fx_Q );
        }

#ifdef HARM_CORE_SW
        /* Fade towards init value for non HQ_CORE */
        test();
        IF( NE_16( st_fx->element_mode, EVS_MONO ) && st_fx->hHQ_core != NULL )
        {
            st_fx->hHQ_core->crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, st_fx->hHQ_core->crest_lp_fx ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, st_fx->hHQ_core->crest_lp_q ) ) ) ); /*crest_lp_q*/
            move32();
            st_fx->hHQ_core->crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, st_fx->hHQ_core->crest_mod_lp_fx ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, st_fx->hHQ_core->crest_mod_lp_q ) ) ) ); /*crest_mod_lp_q*/
            move32();
        }
#endif
    }

    return;
@@ -1016,9 +1036,11 @@ void core_switching_pre_enc_ivas_fx(
        st_fx->EnergyLT_fx_exp = 30;
        move16(); /* Set to a High Exponent so it is 1^-30 */
    }

    /*---------------------------------------------------------------------*
     * band-width switching from WB -> SWB/FB
     *---------------------------------------------------------------------*/

    IF( st_fx->element_mode > EVS_MONO )
    {
        IF( st_fx->bwidth_sw_cnt == 0 )
@@ -1045,6 +1067,7 @@ void core_switching_pre_enc_ivas_fx(
    return;
}


/*---------------------------------------------------------------------*
 * core_switching_post_enc()
 *
+4 −0
Original line number Diff line number Diff line
@@ -648,7 +648,11 @@ ivas_error ivas_core_enc_fx(
         *---------------------------------------------------------------------*/

#ifdef CLEANUP_ACELP_ENC
#ifdef HARM_CORE_SWaaa
        core_switching_post_enc_fx( st, NULL, NULL, NULL, 0, 0, 0, NULL );
#else
        core_switching_post_enc_ivas_fx( st );
#endif
#else
        core_switching_post_enc_ivas_fx( st, old_inp_12k8_fx[n], old_inp_16k_fx[n], A_fx[n], Q_new[n] );
#endif
+2 −2
Original line number Diff line number Diff line
@@ -118,8 +118,8 @@ void core_switching_post_enc_fx(
    const Word16 inp12k8[], /* i  : i   signal @12.8 kHz              Qinp*/
    const Word16 inp16k[],  /* i  : i   signal @16 kHz                Qinp*/
    const Word16 A[],       /* i  : unquant. LP filter coefs. (Q12)     */
    Word16 Qshift,
    Word16 Q_new,
    const Word16 Qshift,
    const Word16 Q_new,
    const Word16 Qsp, /* i/o  : Q from acelp synthsis                         */
    Word16 *Qmus      /* i/o  : Q from mdct synthsis / Q of output synthesis  */
);