Commit 249fe901 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

add macro and code for HARMONIZE_2567_init_acelp

parent 7e3f3315
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@
#define HARMONIZE_2537_SetTCXModeInfo                   /* FhG: Harmonize SetTCXModeInfo  - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */
#define HARMONIZE_2537_GetTCXMaxenergyChange            /* FhG: Harmonize GetTCXMaxenergyChange */
#define HARMONIZE_2508_InitTransientDetection           /* FhG: harmonize GetAttackForTCXDecision derivates for evs/ivas  */
#define HARMONIZE_2567_init_acelp                       /* FhG: harmonize init_acelp derivates for evs/ivas  */
#define FIX_BASOP_2555_FRAMELEN_CALC                    /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */
#define FIX_BASOP_2095_REMOVE_TABLES_PT01               /* FhG: BASOP issue 2095: remove unused tables, part 01 */
#define FIX_2346_DUPLICATED_IGF_FUNCTIONS_2             /* FhG: part 2 of basop issue 2346: Review potentially duplicated IGF functions */
+95 −17
Original line number Diff line number Diff line
@@ -21,14 +21,20 @@

static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag );
static void init_core_sig_ana_fx( Encoder_State *st );
#ifdef HARMONIZE_2567_init_acelp
static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate );
#else
static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift );
#endif
static void init_modes_fx( Encoder_State *st, const Word32 Last_total_brate );
static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr );
static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag );
static void init_core_sig_ana_ivas_fx( Encoder_State *st );
static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate );
static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate );
#ifndef HARMONIZE_2567_init_acelp
static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate );
#endif

/*-----------------------------------------------------------------------*
 * init_coder_ace_plus_fx()
@@ -174,7 +180,11 @@ void init_coder_ace_plus_fx(
    init_sig_buffers_fx( st, L_frame_old, L_subfr );

    /* Initialize ACELP */
#ifdef HARMONIZE_2567_init_acelp
    init_acelp_fx( st, L_frame_old, shift, 0 );
#else
    init_acelp_fx( st, L_frame_old, shift);
#endif

    if ( st->ini_frame == 0 )
    {
@@ -585,6 +595,7 @@ static void init_core_sig_ana_fx( Encoder_State *st )
    return;
}

#ifndef HARMONIZE_2567_init_acelp
static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift )
{
    Word16 mem_syn_r_size_old;
@@ -829,6 +840,7 @@ static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 s

    return;
}
#endif

static void init_modes_fx(
    Encoder_State *st,
@@ -1085,7 +1097,11 @@ void init_coder_ace_plus_ivas_fx(

    /* Initialize ACELP */

#ifdef HARMONIZE_2567_init_acelp
    init_acelp_fx( st, L_frame_old, 0, last_total_brate );
#else
    init_acelp_ivas_fx( st, L_frame_old, 0, last_total_brate );
#endif

    if ( st->ini_frame == 0 )
    {
@@ -1538,7 +1554,11 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st )
 *
 *
 *-----------------------------------------------------------------------*/
#ifdef HARMONIZE_2567_init_acelp
static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate )
#else
static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate )
#endif
{
    Word16 mem_syn_r_size_old;
    Word16 mem_syn_r_size_new;
@@ -1565,10 +1585,17 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
        {
            set16_fx( hLPDmem->syn, 0, 1 + M );
            set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM );
#ifdef HARMONIZE_2567_init_acelp
            IF( GT_16( st->element_mode, EVS_MONO ) )
            {
#endif
                hLPDmem->q_lpd_syn = Q15;
                hLPDmem->q_mem_syn = Q15;
                move16();
                move16();
#ifdef HARMONIZE_2567_init_acelp
            }
#endif
        }

        IF( st->hTcxEnc != NULL )
@@ -1598,10 +1625,12 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
            {
                Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M );
                set16_fx( hLPDmem->syn, 0, M );
#ifndef HARMONIZE_2567_init_acelp
                hLPDmem->q_lpd_syn = Q15;
                hLPDmem->q_mem_syn = Q15;
                move16();
                move16();
#endif
            }
            IF( st->hTcxEnc != NULL )
            {
@@ -1634,23 +1663,50 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
                move16();
                set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM );
                set16_fx( hLPDmem->syn, 0, 1 + M );
#ifdef HARMONIZE_2567_init_acelp
                IF( GT_16( st->element_mode, EVS_MONO ) )
                {
#endif
                    hLPDmem->q_lpd_syn = Q15;
                    move16();
                    hLPDmem->q_lpd_old_exc = Q15;
                    move16();
#ifdef HARMONIZE_2567_init_acelp
                }
#endif
                hLPDmem->mem_w0 = 0;
                move16();
                set16_fx( hLPDmem->mem_syn, 0, M );
                set16_fx( hLPDmem->mem_syn2, 0, M );
#ifdef HARMONIZE_2567_init_acelp
                IF( GT_16( st->element_mode, EVS_MONO ) )
                {
#endif
                    hLPDmem->q_mem_syn = Q15;
                    move16();
#ifdef HARMONIZE_2567_init_acelp
                }
#endif
            }

            /* unquantized LPC*/
            test();
            test();
            test();
#ifdef HARMONIZE_2567_init_acelp
            Word16 condition;
            IF( EQ_16( st->element_mode, EVS_MONO ) )
            {
                condition = !( ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) );
            }
            ELSE
            {
                condition = !( ( GE_32( st->total_brate, ACELP_16k40 ) && LE_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) );
            }
            IF( condition )
#else
            IF( !( ( GE_32( st->total_brate, ACELP_16k40 ) && LE_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) )
#endif
            {
                Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/
                IF( EQ_16( st->L_frame, L_FRAME16k ) )
@@ -1741,8 +1797,15 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
                    move16();
                    set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM );
                    move16();
#ifdef HARMONIZE_2567_init_acelp
                    IF( GT_16( st->element_mode, EVS_MONO ) )
                    {
#endif
                        hLPDmem->q_lpd_old_exc = Q15;
                        move16();
#ifdef HARMONIZE_2567_init_acelp
                    }
#endif
                    /*Resamp others memories*/
                    /*Size of LPC syn memory*/
                    /* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */
@@ -1830,19 +1893,34 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
    {
        st->mem_bpf_fx.lp_error_ener = L_deposit_l( 0 );
        move32();
#ifdef HARMONIZE_2567_init_acelp
        if ( GT_16( st->element_mode, EVS_MONO ) )
        {
#endif
            st->pst_lp_ener_fx = 0;
            move16();
#ifdef HARMONIZE_2567_init_acelp
        }
#endif
        IF( EQ_16( st->last_codec_mode, MODE1 ) )
        {
            st->mem_bpf_fx.lp_error = 0;
            move32();
#ifdef HARMONIZE_2567_init_acelp
            if ( GT_16( st->element_mode, EVS_MONO ) )
            {
#endif
                st->pst_mem_deemp_err_fx = 0;
                move16();
#ifdef HARMONIZE_2567_init_acelp
            }
#endif
        }
    }

    return;
}

/*-----------------------------------------------------------------------*
 * init_modes()
 *