Commit 9eacdeb3 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

add code and macro for HARMONIZE_2567_init_coder_ace_plus

parent 49bc936e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@
#define HARMONIZE_2567_init_acelp                       /* FhG: harmonize init_acelp derivates for evs/ivas  */
#define HARMONIZE_2567_init_tcx_cfg                     /* FhG: harmonize init_tcx_cfg derivates for evs/ivas  */
#define HARMONIZE_2567_init_tcx                         /* FhG: harmonize init_tcx derivates for evs/ivas  */
#define HARMONIZE_2567_init_coder_ace_plus              /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas  */
/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
+10 −1
Original line number Diff line number Diff line
@@ -9587,11 +9587,20 @@ void writeTCXparam_fx(
    const Word16 target_bitsTCX10[2],
    const Word16 pre_past_flag );

#ifdef HARMONIZE_2567_init_coder_ace_plus
void init_coder_ace_plus_fx(
    Encoder_State *st,             /* i  : Encoder state                          */
    const Word32 last_total_brate, /* i  : last total bitrate                     */
    const Word32 igf_brate,        /* i  : IGF configuration bitrate           */
    const Word16 shift,
    const Word16 MCT_flag /* i  : hMCT handle allocated (1) or not (0)   */
#else
void init_coder_ace_plus_ivas_fx(
    Encoder_State *st,             /* i  : Encoder state                          */
    const Word32 last_total_brate, /* i  : last total bitrate                     */
    const Word32 igf_brate,        /* i  : IGF configuration bitrate           */
    const Word16 MCT_flag          /* i  : hMCT handle allocated (1) or not (0)   */
#endif
);

void core_coder_reconfig_ivas_fx(
+154 −19
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
#endif
#endif

#ifndef HARMONIZE_2567_init_coder_ace_plus
/*-----------------------------------------------------------------------*
 * init_coder_ace_plus_fx()
 *
@@ -293,6 +294,7 @@ void init_coder_ace_plus_fx(

    return;
}
#endif

#ifndef HARMONIZE_2567_init_tcx
static void init_tcx_fx(
@@ -948,12 +950,22 @@ static void init_modes_fx(
 *
 * Initialization of state variables
 *-----------------------------------------------------------------------*/
#ifdef HARMONIZE_2567_init_coder_ace_plus
void init_coder_ace_plus_fx(
    Encoder_State *st,             /* i  : Encoder state                          */
    const Word32 last_total_brate, /* i  : last total bitrate                     */
    const Word32 igf_brate,        /* i  : IGF configuration bitrate           */
    const Word16 shift,
    const Word16 MCT_flag /* i  : hMCT handle allocated (1) or not (0)   */
#else
void init_coder_ace_plus_ivas_fx(
    Encoder_State *st,             /* i  : Encoder state                          */
    const Word32 last_total_brate, /* i  : last total bitrate                     */
    const Word32 igf_brate,        /* i  : IGF configuration bitrate           */
    const Word16 MCT_flag          /* i  : hMCT handle allocated (1) or not (0)   */
#endif
)

{
    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
    Word16 L_frame_old; /*keep old frame size for switching */
@@ -1010,7 +1022,11 @@ void init_coder_ace_plus_ivas_fx(
    test();
    test();
    test();
#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) )
#else
    IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( st->element_mode > EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) )
#endif
    {
        st->nb_subfr = NB_SUBFR16k;
        move16();
@@ -1032,8 +1048,20 @@ void init_coder_ace_plus_ivas_fx(
    {
        st->acelpFramesCount = 0;
        move16();
#ifdef HARMONIZE_2567_init_coder_ace_plus
        IF( EQ_16( st->element_mode, EVS_MONO ) )
        {
            st->energyCoreLookahead_Fx = 0;
            move16();
        }
        ELSE
        {
#endif
            st->prevTempFlatness_32fx = ONE_IN_Q21 /*1.0f Q21*/;
            move32();
#ifdef HARMONIZE_2567_init_coder_ace_plus
        }
#endif
    }

    /* Initialize TBE */
@@ -1051,6 +1079,14 @@ void init_coder_ace_plus_ivas_fx(
    move32();
    st->currEnergyHF_e_fx = 0;
    move16();

#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        st->energyCoreLookahead_Fx = 0;
        move16();
    }
#endif
    test();
    /* Initialize LPC analysis/quantization */
    IF( LE_32( st->sr_core, INT_FS_16k ) && st->tcxonly == 0 )
@@ -1083,55 +1119,117 @@ void init_coder_ace_plus_ivas_fx(

    test();
    IF( st->igf && st->hIGFEnc != NULL )
    {
#ifdef HARMONIZE_2567_init_coder_ace_plus
        IF( EQ_16( st->element_mode, EVS_MONO ) )
        {
            IGFEncSetMode_fx( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode );
        }
        ELSE
        {
            IGFEncSetMode_fx( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode );
        }
#else
        IGFEncSetMode_fx( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode );
#endif
    }
    ELSE IF( st->hIGFEnc != NULL )
    {
        st->hIGFEnc->infoTotalBitsWritten = 0;
        move16();
#ifdef HARMONIZE_2567_init_coder_ace_plus
        if ( ( GT_16( st->element_mode, EVS_MONO ) ) || ( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( MCT_flag, -10 ) ) )
        {
#endif
            st->hIGFEnc->infoTotalBitsPerFrameWritten = 0;
            move16();
#ifdef HARMONIZE_2567_init_coder_ace_plus
        }
#endif
    }

#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( GT_16( st->element_mode, EVS_MONO ) )
    {
#endif
        /* Initialize Core Signal Analysis Module */
        init_core_sig_ana_ivas_fx( st );

#ifdef HARMONIZE_2567_init_coder_ace_plus
    }
#endif

    /* Initialize TCX */
    IF( hTcxEnc != NULL )
    {
#ifdef HARMONIZE_2567_init_tcx
        init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag );
#else
#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( GT_16( st->element_mode, EVS_MONO ) )
    {
        init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag );
    }
    ELSE
    {
        init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag );
    }
#else
    init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag );
#endif

#endif
    }

#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        /* Initialize Core Signal Analysis Module */
        init_core_sig_ana_fx( st );
    }
#endif

    /* Initialize Signal Buffers */
#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        init_sig_buffers_fx( st, L_frame_old, L_subfr );
    }
    ELSE
    {
        init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate );
    }
#else
init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate );
#endif

    /* Initialize ACELP */
#ifdef HARMONIZE_2567_init_acelp
#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        init_acelp_fx( st, L_frame_old, shift, 0 );
    }
    ELSE
    {
#ifdef NONBE_FIX_ISSUE_2518
        init_acelp_fx( st, L_frame_old, 0, last_total_brate );
#else
        init_acelp_fx( st, L_frame_old, 0, last_total_brate );
#endif
    }
#else
#ifdef NONBE_FIX_ISSUE_2518
    init_acelp_ivas_fx( st, L_frame_old, last_total_brate );
init_acelp_fx( st, L_frame_old, 0, last_total_brate );
#else
    init_acelp_ivas_fx( st, L_frame_old, 0, last_total_brate );
init_acelp_fx( st, L_frame_old, 0, last_total_brate );
#endif
#endif


    if ( st->ini_frame == 0 )
    {
        st->tec_tfa = 0;
        move16();
    }

    IF( st->hTECEnc != NULL )
    {
        resetTecEnc_Fx( st->hTECEnc, st->tec_tfa );
@@ -1150,7 +1248,6 @@ void init_coder_ace_plus_ivas_fx(
        st->tec_tfa = 0;
        move16();
    }

    st->tec_flag = 0;
    move16();
    st->tfa_flag = 0;
@@ -1159,7 +1256,13 @@ void init_coder_ace_plus_ivas_fx(
    test();
    test();
    test();
#ifdef HARMONIZE_2567_init_coder_ace_plus
    test();
    if ( EQ_16( st->element_mode, EVS_MONO ) && ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) ||
                                                  EQ_32( st->total_brate, ACELP_24k40 ) || EQ_32( st->total_brate, ACELP_32k ) ) )
#else
IF( ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && st->element_mode == EVS_MONO )
#endif
    {
        st->glr = 1;
        move16();
@@ -1174,11 +1277,43 @@ void init_coder_ace_plus_ivas_fx(
    move16();

    /* Initialize ACELP/TCX Modes */
#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        init_modes_fx( st, last_total_brate );
    }
    ELSE
    {
        init_modes_ivas_fx( st, last_total_brate );
    }
#else
init_modes_ivas_fx( st, last_total_brate );
#endif

    /* Adaptive BPF */
#ifdef HARMONIZE_2567_init_coder_ace_plus
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        set16_fx( st->mem_bpf_fx.noise_buf, 0, 2 * L_FILT16k );
        set16_fx( st->mem_bpf_fx.error_buf, 0, L_FILT16k );
        set16_fx( st->bpf_gainT, 0, NB_SUBFR16k );

        set16_fx( st->bpf_T, PIT_MIN_12k8, NB_SUBFR16k );

        st->mem_bpf_fx.lp_error = 0;
        move16();
        st->mem_bpf_fx.noise_shift_old = 0;
        move16();
    }
    ELSE
    {
        set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k );
        set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k );
    }
#else
set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k );
set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k );
#endif

    IF( st->ini_frame == 0 )
    {
+10 −0
Original line number Diff line number Diff line
@@ -157,7 +157,11 @@ void core_coder_mode_switch_fx(
    {
        st->igf = getIgfPresent_fx( st->element_mode, st->total_brate, st->bwidth, st->rf_mode );
        move16();
#ifdef HARMONIZE_2567_init_coder_ace_plus
        init_coder_ace_plus_fx( st, last_total_bitrate, 0, shift, MCT_flag );
#else
        init_coder_ace_plus_fx( st, last_total_bitrate, shift, MCT_flag );
#endif
    }

    test();
@@ -396,7 +400,13 @@ void core_coder_mode_switch_ivas_fx(
        st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift );
        move16();
#endif

#ifdef HARMONIZE_2567_init_coder_ace_plus
        init_coder_ace_plus_fx( st, last_total_brate, st->total_brate, 0, MCT_flag );
#else
        init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag );
#endif

#ifndef NONBE_FIX_ISSUE_2518
        if ( st->hLPDmem != NULL )
        {
+9 −0
Original line number Diff line number Diff line
@@ -1134,7 +1134,11 @@ ivas_error init_encoder_fx(

    IF( st->element_mode == EVS_MONO )
    {
#ifdef HARMONIZE_2567_init_coder_ace_plus
        init_coder_ace_plus_fx( st, st->last_total_brate, 0, 0, -10 /*hack*/ );
#else
        init_coder_ace_plus_fx( st, st->last_total_brate, 0, -10 /*hack*/ );
#endif
    }
    ELSE
    {
@@ -1148,7 +1152,12 @@ ivas_error init_encoder_fx(
        st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift );
        move16();


#ifdef HARMONIZE_2567_init_coder_ace_plus
        init_coder_ace_plus_fx( st, st->last_total_brate, igf_brate, 0, 0 );
#else
        init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 );
#endif
    }

#ifndef NONBE_FIX_ISSUE_2518
Loading