Commit 253ade99 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'enc_cleanup_core_enc_fixes' into 'main'

Updates to core encoder and float structure elements cleanup

See merge request !798
parents 2dd25dbc fae2f2e2
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1416,7 +1416,11 @@ void init_tcx_cfg(
    hTcxCfg->tcxRateLoopOpt = ( element_mode == IVAS_CPE_MDCT ) ? 3 : hTcxCfg->tcxRateLoopOpt;

    /* TCX bandwidth */
#ifndef IVAS_FLOAT_FIXED
    hTcxCfg->bandwidth_flt = getTcxBandwidth_flt( bwidth );
#else
    hTcxCfg->bandwidth = getTcxBandwidth( bwidth );
#endif

    /* set number of coded lines */
    hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );
+5 −2
Original line number Diff line number Diff line
@@ -325,9 +325,12 @@ typedef struct TCX_config_structure

    /*Bandwidth*/
    float preemph_fac_flt; /* preemphasis factor */
    float bandwidth_flt;
    Word16 preemph_fac;    /* preemphasis factor Q15 */
    Word16 bandwidth;
#ifndef IVAS_FLOAT_FIXED
    float bandwidth_flt;
#else
    Word16 bandwidth;                         /* Q15 */
#endif

    /* Context HM - Residual Quantization*/
    Word16 ctx_hm;     /* Flag for enabling Context HM */
+28 −45
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ void init_coder_ace_plus_ivas_fx(
    {
        st->acelpFramesCount = 0;
        move16();
        st->prevTempFlatness_fx = 128 /*1.0f Q7*/;
        st->prevTempFlatness_fx = 16 /*1.0f Q4*/;
        move16();
    }

@@ -389,7 +389,7 @@ void init_coder_ace_plus(
#endif
#ifdef IVAS_FLOAT_FIXED
#ifdef MSAN_FIX
        st->prevTempFlatness_fx = 128; // Q7
        st->prevTempFlatness_fx = 16; // Q4
#endif
#endif
    }
@@ -476,11 +476,6 @@ void init_coder_ace_plus(
    /* Initialize ACELP */
    init_acelp( st, L_frame_old, st->total_brate, last_total_brate );
#ifdef IVAS_FLOAT_FIXED
    if ( st->lspold_enc != NULL )
    {
        floatToFixed_arr16( st->lspold_enc, &st->lspold_enc_fx[0], Q15, M );
    }

    init_acelp_ivas_fx( st, L_frame_old, 0 );
#endif

@@ -638,11 +633,7 @@ static void init_tcx_ivas_fx(
        hTcxEnc->kernel_switch_corr_past = 0;
        hTcxEnc->kernel_symmetry_past = 0; /* MDCT_IV & 1 */
        hTcxEnc->enc_ste_pre_corr_past = 0;
        // hTcxEnc->tfm_mem_fx = 12288 /*0.75 in Q14*/;
        hTcxEnc->tfm_mem_fx = 1610612736;
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
        hTcxEnc->tfm_mem = 0.75f;
#endif
        hTcxEnc->tfm_mem_fx = 1610612736; /* 0.75 in Q31 */
        hTcxEnc->tcxltp_on_mem = 0;
        move16();
        move16();
@@ -747,13 +738,11 @@ static void init_tcx(
    /* Init TCX target bits correction factor */
#ifndef IVAS_FLOAT_FIXED
    hTcxEnc->tcx_target_bits_fac_flt = 1.0f;
#else
    hTcxEnc->tcx_target_bits_fac = ONE_IN_Q14;
#endif
    hTcxEnc->measuredBwRatio_flt = 1.0f;
#ifndef IVAS_FLOAT_FIXED
    hTcxEnc->noiseTiltFactor_flt = 0.5625f;
#else
    hTcxEnc->tcx_target_bits_fac = ONE_IN_Q14;
    hTcxEnc->measuredBwRatio = ONE_IN_Q14;
    hTcxEnc->noiseTiltFactor = 9216; /*0.5625f in 1Q14*/
#endif
    hTcxEnc->noiseLevelMemory_cnt = 0;
@@ -774,18 +763,22 @@ static void init_tcx(
        hTcxEnc->tcxltp_pitch_fr_past = 0;
#ifndef IVAS_FLOAT_FIXED
        hTcxEnc->tcxltp_gain_past_flt = 0.f;
#else
        hTcxEnc->tcxltp_gain_past = 0;
#endif
        hTcxEnc->tcxltp_norm_corr_past_flt = 0.f;
        hTcxEnc->tcxltp_norm_corr_mem_flt = 0.f;
#ifndef IVAS_FLOAT_FIXED
        hTcxEnc->kernel_switch_corr_past_flt = 0.f;
#else
        hTcxEnc->tcxltp_gain_past = 0;
        hTcxEnc->tcxltp_norm_corr_past = 0;
        hTcxEnc->tcxltp_norm_corr_mem = 0;
        hTcxEnc->kernel_switch_corr_past = 0;
#endif
        hTcxEnc->kernel_symmetry_past = 0; /* MDCT_IV & 1 */
        hTcxEnc->enc_ste_pre_corr_past = 0;
#ifndef IVAS_FLOAT_FIXED
        hTcxEnc->tfm_mem = 0.75f;
#else
        hTcxEnc->tfm_mem_fx = 1610612736; /* 0.75 in Q31 */
#endif
        hTcxEnc->tcxltp_on_mem = 0;
    }
    else if ( st->L_frame != L_frame_old && !( ( total_brate >= ACELP_16k40 && total_brate <= ACELP_24k40 ) &&
@@ -1270,28 +1263,26 @@ static void init_acelp(
            }

            /* unquantized LPC*/
#ifndef IVAS_FLOAT_FIXED
            if ( !( ( total_brate >= ACELP_16k40 && total_brate <= ACELP_24k40 ) && total_brate == last_total_brate && st->last_bwidth == st->bwidth ) )
            {
#ifndef IVAS_FLOAT_FIXED
                mvr2r( st->lsp_old1, st->lspold_enc, M ); /*lsp old @12.8kHz*/
#else
                Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
                fixedToFloat_arr( st->lspold_enc_fx, st->lspold_enc, Q15, M );
#endif
#endif
                if ( st->L_frame == L_FRAME16k )
                {
                    lsp_convert_poly( st->lspold_enc, st->L_frame, 0 );
                }
            }
#ifndef IVAS_FLOAT_FIXED
            mvr2r( st->lspold_enc, st->lsp_old, M ); /*used unquantized values for mid-LSF Q*/
            lsp2lsf( st->lsp_old, st->lsf_old, M, st->sr_core );
#else
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
            floatToFixed_arr( st->lspold_enc, st->lspold_enc_fx, Q15, M );
#endif
            IF( !( ( GE_32( st->total_brate, ACELP_16k40 ) && LE_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( total_brate, last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) )
            {
                Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/
                IF( EQ_16( st->L_frame, L_FRAME16k ) )
                {
                    lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame, 0 );
                }
            }
            Copy( st->lspold_enc_fx, st->lsp_old_fx, M ); /*used unquantized values for mid-LSF Q*/
            IF( st->tcxonly == 0 )
            {
@@ -1355,9 +1346,6 @@ static void init_acelp(
                {
                    Copy( st->lsp_old1_fx, st->lspold_enc_fx, M );
                }
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
                fixedToFloat_arr( st->lspold_enc_fx, st->lspold_enc, Q15, M );
#endif
#endif

                /* Update wsyn */
@@ -1412,23 +1400,18 @@ static void init_acelp(
                /* unquantized LPC*/
#ifndef IVAS_FLOAT_FIXED
                mvr2r( st->lsp_old1, st->lspold_enc, M ); /*lsp old @12.8kHz*/
#else
                Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
                fixedToFloat_arr( st->lspold_enc_fx, st->lspold_enc, Q15, M );
#endif
#endif
                if ( st->L_frame == L_FRAME16k )
                {
                    lsp_convert_poly( st->lspold_enc, st->L_frame, 0 );
                }
#ifndef IVAS_FLOAT_FIXED
                mvr2r( st->lspold_enc, st->lsp_old, M ); /*used unquantized values for mid-LSF Q*/
                lsp2lsf( st->lsp_old, st->lsf_old, M, st->sr_core );
#else
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
                floatToFixed_arr( st->lspold_enc, st->lspold_enc_fx, Q15, M );
#endif
                Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/
                IF( EQ_16( st->L_frame, L_FRAME16k ) )
                {
                    lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame, 0 );
                }
                Copy( st->lspold_enc_fx, st->lsp_old_fx, M ); /*used unquantized values for mid-LSF Q*/
                IF( st->tcxonly == 0 )
                {
@@ -1607,7 +1590,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
            test();
            test();
            test();
            IF( !( ( 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 ) ) ) )
            IF( !( ( GE_32( st->total_brate, ACELP_16k40 ) && LE_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) )
            {
                Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/
                IF( EQ_16( st->L_frame, L_FRAME16k ) )
+0 −7
Original line number Diff line number Diff line
@@ -230,12 +230,6 @@ void core_coder_mode_switch_ivas_fx(
        f2me_buf_16( st->old_inp_16k, st->old_inp_16k_fx, &st->exp_old_inp_16k, L_INP_MEM );
        f2me_buf_16( st->buf_wspeech_enc_flt + st->L_frame + L_SUBFR - L_WSP_MEM, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, &st->exp_old_inp_16k, L_WSP_MEM );

        /* Initialize ACELP */
        if ( st->lspold_enc != NULL )
        {
            floatToFixed_arr16( st->lspold_enc, &st->lspold_enc_fx[0], Q15, M );
        }

        /* Adaptive BPF */
        set_zero( st->mem_bpf, 2 * L_FILT16k );
        set_zero( st->mem_error_bpf, 2 * L_FILT16k );
@@ -243,7 +237,6 @@ void core_coder_mode_switch_ivas_fx(
        init_coder_ace_plus_ivas_fx( st, last_total_brate, MCT_flag );
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
        st->preemph_fac_flt = fix16_to_float( st->preemph_fac, Q15 );
        fixedToFloat_arr( st->lspold_enc_fx, st->lspold_enc, Q15, M );
        IF( st->hLPDmem != NULL )
        {
            // me2f_buf_16( st->hLPDmem->old_exc, st->hLPDmem->e_old_exc, st->hLPDmem->old_exc_flt, L_EXC_MEM );
+1 −504

File changed.

Preview size limit exceeded, changes collapsed.

Loading