Commit a3b9d782 authored by vaclav's avatar vaclav
Browse files

harmonize LPDmem_enc_init_fx()

parent 735c8188
Loading
Loading
Loading
Loading
+20 −53
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ ivas_error init_encoder_fx(
)
{
    Word16 i;
    Word32 L_tmp;
    Word16 idchan = 0;
    Word16 vad_only_flag = 0;
    move16();
@@ -683,16 +682,9 @@ ivas_error init_encoder_fx(
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LPDmem\n" ) );
        }

        IF( st->element_mode == EVS_MONO )
        {
        LPDmem_enc_init_fx( st->hLPDmem );
    }
    ELSE
        {
            LPDmem_enc_init_ivas_fx( st->hLPDmem );
        }
    }
    ELSE
    {
        st->hLPDmem = NULL;
    }
@@ -1144,6 +1136,9 @@ ivas_error init_encoder_fx(

    set32_fx( st_fx->mem_hp20_in_fx, 0, 5 );

    /*-----------------------------------------------------------------*
     * IVAS parameters
     *-----------------------------------------------------------------*/

    st_fx->Q_syn2 = 0;
    move16();
@@ -1191,39 +1186,6 @@ void LPDmem_enc_init_fx(
    set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM );
    set16_fx( hLPDmem->mem_syn3, 0, M );

    hLPDmem->mem_w0 = 0;
    move16();
    hLPDmem->tilt_code = 0;
    move16();
    hLPDmem->gc_threshold = 0;
    move32();
    hLPDmem->dm_fx.prev_state = 0;
    move16(); /* This corresponds to st_fx->dispMem in FLP */
    hLPDmem->dm_fx.prev_gain_code = 0;
    move32();

    FOR( i = 2; i < 8; i++ )
    {
        hLPDmem->dm_fx.prev_gain_pit[i - 2] = 0;
        move16();
    }
    return;
}

void LPDmem_enc_init_ivas_fx(
    LPD_state_HANDLE hLPDmem /* i/o: LP memories     */
)
{
    Word16 i;

    set16_fx( hLPDmem->syn, 0, 1 + M );
    set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM );
    set16_fx( hLPDmem->mem_syn, 0, M );
    set16_fx( hLPDmem->mem_syn1_fx, 0, M );
    set16_fx( hLPDmem->mem_syn2, 0, M );
    set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM );
    set16_fx( hLPDmem->mem_syn3, 0, M );

    hLPDmem->q_lpd_old_exc = Q15;
    move16();
    hLPDmem->q_lpd_syn = Q15;
@@ -1383,8 +1345,13 @@ ivas_error init_encoder_ivas_fx(
    move16();
    set16_fx( st->mem_MA_fx, 0, M );

    st->mCb1_fx = 0;
    move16();

    init_gp_clip_fx( st->clip_var_fx );

    pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit, &st->old_corr_fx );

    set16_fx( st->old_wsp_fx, 0, L_WSP_MEM );
    st->exp_old_wsp = 0;
    move16();
@@ -1429,6 +1396,7 @@ ivas_error init_encoder_ivas_fx(
    set32_fx( st->Bin_E_fx, 0, L_FFT );
    st->q_Bin_E = Q31;
    move16();
    set16_fx( st->lgBin_E_fx, 0, L_FFT / 2 );

    st->ee_old_fx = 640; /* 10.0f in Q6 */
    move16();
@@ -1440,6 +1408,8 @@ ivas_error init_encoder_ivas_fx(
    /* adaptive lag window memory */
    st->old_pitch_la = 0;
    move16();
    st->old_voicing_la = 0;
    move16();

    st->prev_Q_new = 0;
    move16();
@@ -1569,6 +1539,8 @@ ivas_error init_encoder_ivas_fx(
    set16_fx( st->pitch, L_SUBFR, 3 );
    set16_fx( st->voicing_fx, 0, 3 );

    set32_fx( st->mem_hp20_in_fx, 0, 5 ); ////////////////////////////

    /*-----------------------------------------------------------------*
     * General signal buffers
     *-----------------------------------------------------------------*/
@@ -1629,18 +1601,20 @@ ivas_error init_encoder_ivas_fx(
        move16();
        st->q_old_inp32 = Q31;
        move16();
        st->old_input_signal_fx = st->input_buff_fx;
        st->old_input_signal32_fx = st->input_buff32_fx;

        IF( st->element_mode == EVS_MONO )
        {
            st->input32_fx = st->input_buff32_fx + add( frame_length, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ) );
            st->input_fx = st->input_buff_fx + add( frame_length, NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ) );
            st->input_fx = st->input_buff_fx + add( L_FRAME48k, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ); ///////////////////// input_Fs
            st->old_input_signal_fx = st->input_fx - add( NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), frame_length );
            st->old_input_signal32_fx = st->input_buff32_fx;
        }
        ELSE
        {
            st->input32_fx = st->input_buff32_fx + frame_length;
            st->input_fx = st->input_buff_fx + frame_length;
            st->old_input_signal_fx = st->input_buff_fx;
            st->old_input_signal32_fx = st->input_buff32_fx;
        }
    }
    ELSE
@@ -1992,16 +1966,9 @@ ivas_error init_encoder_ivas_fx(
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LPDmem\n" ) );
        }

        IF( st->element_mode == EVS_MONO )
        {
        LPDmem_enc_init_fx( st->hLPDmem );
    }
    ELSE
        {
            LPDmem_enc_init_ivas_fx( st->hLPDmem );
        }
    }
    ELSE
    {
        st->hLPDmem = NULL;
    }
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ static ivas_error allocate_CoreCoder_enc_fx(
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LPDmem\n" ) );
        }
        LPDmem_enc_init_ivas_fx( st->hLPDmem );
        LPDmem_enc_init_fx( st->hLPDmem );
    }

    IF( st->hGSCEnc == NULL && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
+0 −4
Original line number Diff line number Diff line
@@ -863,10 +863,6 @@ void LPDmem_enc_init_fx(
    LPD_state_HANDLE hLPDmem /* i/o: LP memories     */
);

void LPDmem_enc_init_ivas_fx(
    LPD_state_HANDLE hLPDmem /* i/o: LP memories     */
);

void lsf_end_enc_fx(
    Encoder_State *st,           /* i/o: encoder state structure                                */
    const Word16 *lsf,           /* i  : LSF in the frequency domain (0..6400)                  */