Commit 08c5b51b authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Integration of fixed point sub-functions 17

[x] Few sub-funcs of ivas_dirac_dec_render converted to fixed point
[x] Few float structure elements and buffers clean up
[x] Fix for issue#726
[x] Removal of some of the intermediate conversions
[x] Integrated TDREND_GetMix function in external Renderer
[x] stereo_dtf_cng fixed point implemented
[x] Integration of ivas_mdct_core_reconstruct function inside mct_dec path.
parent 4010db07
Loading
Loading
Loading
Loading
Loading
+107 −51
Original line number Diff line number Diff line
@@ -76,6 +76,76 @@ void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l )
        i[j] = float_to_fix( f[j], Q );
    }
}

float fixedToFloat_32( Word32 number, Word16 Q )
{
    float val = 0.0f;
    assert( fabs( Q ) <= 63 );
    if ( fabs( Q ) > 31 )
    {
        if ( Q > 0 )
        {
            val = (float) ( ( number / ( 1 << ( Q - 31 ) ) ) / ( (unsigned int) MAX_32 + 1 ) );
        }
        else
        {
            val = (float) ( number * ( 1 << ( -Q - 31 ) ) * (unsigned int)MIN_32 );
        }
    }
    else
    {
        val = fixedToFloat( number, Q );
    }
    return val;
}

Word32 floatToFixed_32( float number, Word16 Q )
{
    float val = 0.0f;
    assert( fabs( Q ) <= 63 );
    if ( fabs( Q ) > 31 )
    {
        if ( Q > 0 )
        {
            val = ( number * ( (unsigned int) MAX_32 + 1 ) ) * ( 1 << ( Q - 31 ) );
        }
        else
        {
            val = ( number / ( 1 << ( -Q - 31 ) ) ) / (unsigned int)MIN_32;
        }
        if ( val >= 0.0f )
        {
            assert( (Word32) val <= MAX_32 );
        }
        else
        {
            assert( (Word32) val >= MIN_32 );
        }
    }
    else
    {
        return floatToFixed( number, Q );
    }

    return (Word32) val;
}

void floatToFixed_arrL32( float *f, Word32 *i, Word16 Q, Word16 l )
{
    for ( int j = 0; j < l; j++ )
    {
        i[j] = floatToFixed_32( f[j], Q );
    }
}

void fixedToFloat_arrL32( Word32 *i, float *f, Word16 Q, Word16 l )
{
    for ( int j = 0; j < l; j++ )
    {
        f[j] = fixedToFloat_32( i[j], Q );
    }
}

void floatToFixed_arr(float *f, Word16 *i, Word16 Q, Word16 l)
{
	for (int j = 0; j < l; j++)
@@ -205,7 +275,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
               delay_comp = 0, Q_loBuffer = 0;

        Word16 Q_lsf_cng = Q_factor( 6400 );
        Word16 Q_tcxltp_mem_in = 0, Q_tcxltp_mem_out = 0, Q_tcxltp_gain_post_prev = 0;
        Word16 Q_tcxltp_mem_in = 0, Q_tcxltp_mem_out = 0;
        TD_BWE_DEC_HANDLE hBWE_TD = st->hBWE_TD;
        Word16 Q_state_lsyn_filt_shb = 0, Q_state_lsyn_filt_dwn_shb = 0, Q_mem_resamp_HB = 0, Q_syn_overlap = 0, Q_int_3_over_2_tbemem_dec = 0, Q_mem_resamp_HB_32k = 0, Q_prev_fb_ener_adjust = 0, Q_fb_state_lpc_syn = 0, 
               Q_genSHBsynth_Hilbert_Mem = 0, Q_genSHBsynth_state_lsyn_filt_shb_local = 0;
@@ -300,16 +370,18 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                st->hTcxDec->LastFrameLevel_bfi_fx = (Word16) floatToFixed( st->hTcxDec->LastFrameLevel_bfi, 15 );
                FOR( i = 0; i < PLC_MIN_STAT_BUFF_SIZE; i++ )
                {
                    st->hTcxDec->NoiseLevelMemory_bfi_fx[i] = (Word16) floatToFixed( st->hTcxDec->NoiseLevelMemory_bfi[i], 15 );
                    //f2me_16(st->hTcxDec->NoiseLevelMemory_bfi[i], &st->hTcxDec->conNoiseLevelMemory[i], &st->hTcxDec->conNoiseLevelMemory_e[i]);
                    //st->hTcxDec->NoiseLevelMemory_bfi_fx[i] = (Word16) floatToFixed( st->hTcxDec->NoiseLevelMemory_bfi[i], 15 );
                }
                st->hTcxDec->cummulative_damping_tcx = (Word16) floatToFixed( st->hTcxDec->cummulative_damping_tcx_float, 15 );
            }
            IF( st->hHQ_core )
            {
                st->hHQ_core->Q_fer_samples = Q_factor_arr( st->hHQ_core->fer_samples + delay_comp, shr( st->hTcxDec->L_frameTCX, 1 ) ) - 1;
                //st->hHQ_core->Q_fer_samples = Q_factor_arr( st->hHQ_core->fer_samples + delay_comp, shr( st->hTcxDec->L_frameTCX, 1 ) ) - 1;
                st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k );
                st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k );
                floatToFixed_arr( st->hHQ_core->fer_samples + delay_comp, st->hHQ_core->fer_samples_fx + delay_comp, Q_fer_samples, shr( st->hTcxDec->L_frameTCX, 1 ) );
				st->hHQ_core->Q_fer_samples = 0;
                //floatToFixed_arr( st->hHQ_core->fer_samples + delay_comp, st->hHQ_core->fer_samples_fx + delay_comp, Q_fer_samples, shr( st->hTcxDec->L_frameTCX, 1 ) );
                floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k );
                floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k );
            }
@@ -347,8 +419,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
            {
                Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY );
                Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k );
                Q_tcxltp_gain_post_prev = Q_factor( st->hTcxLtpDec->tcxltp_gain_post_prev_float );
                st->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) floatToFixed( st->hTcxLtpDec->tcxltp_gain_post_prev_float, Q_tcxltp_gain_post_prev );
                floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_in_float, st->hTcxLtpDec->tcxltp_mem_in, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY );
                floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_out_float, st->hTcxLtpDec->tcxltp_mem_out, Q_tcxltp_mem_out, L_FRAME48k );
            }
@@ -367,9 +437,9 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                floatToFixed_arr( hBWE_TD->syn_overlap, hBWE_TD->syn_overlap_fx, Q_syn_overlap, 20 );
                Q_int_3_over_2_tbemem_dec = Q_factor_arr( hBWE_TD->int_3_over_2_tbemem_dec, 15 );
                Q_mem_resamp_HB_32k = Q_factor_arr( hBWE_TD->mem_resamp_HB_32k, 7 );
                Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                //Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                Q_fb_state_lpc_syn = Q_factor_arr( hBWE_TD->fb_state_lpc_syn, 10 );
                st->prev_fb_ener_adjust_fx = (Word16) floatToFixed( st->hBWE_FD->prev_fb_ener_adjust, Q_prev_fb_ener_adjust );
                //st->prev_fb_ener_adjust_fx = (Word16) floatToFixed( st->hBWE_FD->prev_fb_ener_adjust, Q_prev_fb_ener_adjust );
                floatToFixed_arr( hBWE_TD->fb_state_lpc_syn, hBWE_TD->fb_state_lpc_syn_fx, Q_fb_state_lpc_syn, 10 );
                floatToFixed_arr( hBWE_TD->int_3_over_2_tbemem_dec, hBWE_TD->int_3_over_2_tbemem_dec_fx, Q_int_3_over_2_tbemem_dec, INTERP_3_2_MEM_LEN );
                floatToFixed_arr( hBWE_TD->mem_resamp_HB_32k, hBWE_TD->mem_resamp_HB_32k_fx, Q_mem_resamp_HB_32k, 7 );
@@ -420,7 +490,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                Q_syn_overlap = Q_factor_arr( hBWE_TD->syn_overlap, 20 );
                Q_int_3_over_2_tbemem_dec = Q_factor_arr( hBWE_TD->int_3_over_2_tbemem_dec, 15 );
                Q_mem_resamp_HB_32k = Q_factor_arr( hBWE_TD->mem_resamp_HB_32k, 7 );
                Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                //Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                Q_fb_state_lpc_syn = Q_factor_arr( hBWE_TD->fb_state_lpc_syn, 10 );
                Q_genSHBsynth_Hilbert_Mem = Q_factor_arrL( hBWE_TD->genSHBsynth_Hilbert_Mem, 21 );
                Q_genSHBsynth_state_lsyn_filt_shb_local = Q_factor_arr( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local, 6 );
@@ -434,7 +504,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                fixedToFloat_arr( hBWE_TD->int_3_over_2_tbemem_dec_fx, hBWE_TD->int_3_over_2_tbemem_dec, Q_int_3_over_2_tbemem_dec, 15 );
                fixedToFloat_arr( hBWE_TD->mem_resamp_HB_32k_fx, hBWE_TD->mem_resamp_HB_32k, Q_mem_resamp_HB_32k, 7 );
                //bool des = ( st->bwidth == WB && st->last_extl != WB_TBE ) || ( st->bwidth == SWB && st->last_extl != SWB_TBE ) || ( st->bwidth == FB && st->last_extl != FB_TBE );
                st->hBWE_FD->prev_fb_ener_adjust = fixedToFloat( st->prev_fb_ener_adjust_fx, Q_prev_fb_ener_adjust );
                //st->hBWE_FD->prev_fb_ener_adjust = fixedToFloat( st->prev_fb_ener_adjust_fx, Q_prev_fb_ener_adjust );
            }
            st->preemph_fac_float = fixedToFloat( st->preemph_fac, 15 );
            IF( st->hTECDec != NULL )
@@ -508,7 +578,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                st->hTcxDec->LastFrameLevel_bfi = fixedToFloat( st->hTcxDec->LastFrameLevel_bfi_fx, 15 );
                FOR( i = 0; i < PLC_MIN_STAT_BUFF_SIZE; i++ )
                {
                    st->hTcxDec->NoiseLevelMemory_bfi[i] = fixedToFloat( st->hTcxDec->NoiseLevelMemory_bfi_fx[i], 15 );
                    //st->hTcxDec->NoiseLevelMemory_bfi[i] = me2f_16(st->hTcxDec->conNoiseLevelMemory[i], st->hTcxDec->conNoiseLevelMemory_e[i]);
                    //st->hTcxDec->NoiseLevelMemory_bfi[i] = fixedToFloat( st->hTcxDec->NoiseLevelMemory_bfi_fx[i], 15 );
                }
                st->hTcxDec->cummulative_damping_tcx_float = fixedToFloat( st->hTcxDec->cummulative_damping_tcx, 15 );
            }
@@ -553,14 +624,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
            }

            Q_lsf_cng = Q_factor( 6400 );
            st->past_gpit_float = fixedToFloat( st->past_gpit, 0 );
            st->past_gcode_float = fixedToFloat( st->past_gcode, 0 );
            fixedToFloat_arr( st->Aq_cng, st->Aq_cng_float, 2, M );

            if ( st->last_gain_syn_deemph == 16384 )
            {
                st->last_gain_syn_deemph_float = 1;
            }
            //if ( st->last_gain_syn_deemph == 16384 )
            //{
            //    st->last_gain_syn_deemph_float = 1;
            //}
            st->last_concealed_gain_syn_deemph_float = fixedToFloat( st->last_concealed_gain_syn_deemph, 14 );
            st->enr_old = fixedToFloat( st->enr_old_fx, 0 );
            st->lp_gainc = fixedToFloat( st->lp_gainc_fx, 0 );
@@ -572,18 +641,13 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
            }

            st->old_fpitch_float = fixedToFloat( st->old_fpitch, 16 );
            FOR( i = 0; i < 8; i++ )
            {
                st->dispMem[i] = 0;
            }

            IF( st->hTcxLtpDec != NULL )
            {
                Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY );
                Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k );
                Q_tcxltp_gain_post_prev = Q_factor( st->hTcxLtpDec->tcxltp_gain_post_prev_float );
                fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_in, st->hTcxLtpDec->tcxltp_mem_in_float, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY );
                fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_out, st->hTcxLtpDec->tcxltp_mem_out_float, Q_tcxltp_mem_out, L_FRAME48k );
                st->hTcxLtpDec->tcxltp_gain_post_prev_float = fixedToFloat( st->hTcxLtpDec->tcxltp_gain_post_prev, Q_tcxltp_gain_post_prev );
            }
            IF( st->hTonalMDCTConc )
            {
@@ -648,7 +712,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
               Q_pst_old_syn = 0,
               delay_comp = 0, Q_loBuffer = 0;

        Word16 Q_tcxltp_mem_in = 0, Q_tcxltp_mem_out = 0, Q_tcxltp_gain_post_prev = 0;
        Word16 Q_tcxltp_mem_in = 0, Q_tcxltp_mem_out = 0;
        TD_BWE_DEC_HANDLE hBWE_TD = st->hBWE_TD;
        Word16 Q_state_lsyn_filt_shb = 0, Q_state_lsyn_filt_dwn_shb = 0, Q_mem_resamp_HB = 0, Q_syn_overlap = 0, Q_int_3_over_2_tbemem_dec = 0, Q_mem_resamp_HB_32k = 0, Q_prev_fb_ener_adjust = 0, Q_fb_state_lpc_syn = 0,
               Q_genSHBsynth_Hilbert_Mem = 0, Q_genSHBsynth_state_lsyn_filt_shb_local = 0;
@@ -743,16 +807,17 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                st->hTcxDec->LastFrameLevel_bfi_fx = (Word16) floatToFixed( st->hTcxDec->LastFrameLevel_bfi, 15 );
                FOR( i = 0; i < PLC_MIN_STAT_BUFF_SIZE; i++ )
                {
                    st->hTcxDec->NoiseLevelMemory_bfi_fx[i] = (Word16) floatToFixed( st->hTcxDec->NoiseLevelMemory_bfi[i], 15 );
                    //f2me_16(st->hTcxDec->NoiseLevelMemory_bfi[i], &st->hTcxDec->conNoiseLevelMemory[i], &st->hTcxDec->conNoiseLevelMemory_e[i]);
                }
                st->hTcxDec->cummulative_damping_tcx = (Word16) floatToFixed( st->hTcxDec->cummulative_damping_tcx_float, 15 );
            }
            IF( st->hHQ_core )
            {
                st->hHQ_core->Q_fer_samples = Q_factor_arr( st->hHQ_core->fer_samples + delay_comp, shr( st->hTcxDec->L_frameTCX, 1 ) ) - 1;
                //st->hHQ_core->Q_fer_samples = Q_factor_arr( st->hHQ_core->fer_samples + delay_comp, shr( st->hTcxDec->L_frameTCX, 1 ) ) - 1;
                st->hHQ_core->Q_old_out = 0;
                st->hHQ_core->Q_old_outLB = 0;
                floatToFixed_arr( st->hHQ_core->fer_samples + delay_comp, st->hHQ_core->fer_samples_fx + delay_comp, Q_fer_samples, shr( st->hTcxDec->L_frameTCX, 1 ) );
				st->hHQ_core->Q_fer_samples = 0;
                //floatToFixed_arr( st->hHQ_core->fer_samples + delay_comp, st->hHQ_core->fer_samples_fx + delay_comp, Q_fer_samples, shr( st->hTcxDec->L_frameTCX, 1 ) );
                floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k );
                floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k );
            }
@@ -790,8 +855,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            {
                Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY );
                Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k );
                Q_tcxltp_gain_post_prev = Q_factor( st->hTcxLtpDec->tcxltp_gain_post_prev_float );
                st->hTcxLtpDec->tcxltp_gain_post_prev = (Word16) floatToFixed( st->hTcxLtpDec->tcxltp_gain_post_prev_float, Q_tcxltp_gain_post_prev );
                floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_in_float, st->hTcxLtpDec->tcxltp_mem_in, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY );
                floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_out_float, st->hTcxLtpDec->tcxltp_mem_out, Q_tcxltp_mem_out, L_FRAME48k );
            }
@@ -810,9 +873,9 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                floatToFixed_arr( hBWE_TD->syn_overlap, hBWE_TD->syn_overlap_fx, Q_syn_overlap, 20 );
                Q_int_3_over_2_tbemem_dec = Q_factor_arr( hBWE_TD->int_3_over_2_tbemem_dec, 15 );
                Q_mem_resamp_HB_32k = Q_factor_arr( hBWE_TD->mem_resamp_HB_32k, 7 );
                Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                //Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                Q_fb_state_lpc_syn = Q_factor_arr( hBWE_TD->fb_state_lpc_syn, 10 );
                st->prev_fb_ener_adjust_fx = (Word16) floatToFixed( st->hBWE_FD->prev_fb_ener_adjust, Q_prev_fb_ener_adjust );
                //st->prev_fb_ener_adjust_fx = (Word16) floatToFixed( st->hBWE_FD->prev_fb_ener_adjust, Q_prev_fb_ener_adjust );
                floatToFixed_arr( hBWE_TD->fb_state_lpc_syn, hBWE_TD->fb_state_lpc_syn_fx, Q_fb_state_lpc_syn, 10 );
                floatToFixed_arr( hBWE_TD->int_3_over_2_tbemem_dec, hBWE_TD->int_3_over_2_tbemem_dec_fx, Q_int_3_over_2_tbemem_dec, INTERP_3_2_MEM_LEN );
                floatToFixed_arr( hBWE_TD->mem_resamp_HB_32k, hBWE_TD->mem_resamp_HB_32k_fx, Q_mem_resamp_HB_32k, 7 );
@@ -864,7 +927,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                Q_syn_overlap = Q_factor_arr( hBWE_TD->syn_overlap, 20 );
                Q_int_3_over_2_tbemem_dec = Q_factor_arr( hBWE_TD->int_3_over_2_tbemem_dec, 15 );
                Q_mem_resamp_HB_32k = Q_factor_arr( hBWE_TD->mem_resamp_HB_32k, 7 );
                Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                //Q_prev_fb_ener_adjust = Q_factor( (Word16) st->hBWE_FD->prev_fb_ener_adjust );
                Q_fb_state_lpc_syn = Q_factor_arr( hBWE_TD->fb_state_lpc_syn, 10 );
                Q_genSHBsynth_Hilbert_Mem = Q_factor_arrL( hBWE_TD->genSHBsynth_Hilbert_Mem, 21 );
                Q_genSHBsynth_state_lsyn_filt_shb_local = Q_factor_arr( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local, 6 );
@@ -878,7 +941,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                fixedToFloat_arr( hBWE_TD->int_3_over_2_tbemem_dec_fx, hBWE_TD->int_3_over_2_tbemem_dec, Q_int_3_over_2_tbemem_dec, 15 );
                fixedToFloat_arr( hBWE_TD->mem_resamp_HB_32k_fx, hBWE_TD->mem_resamp_HB_32k, Q_mem_resamp_HB_32k, 7 );
                // bool des = ( st->bwidth == WB && st->last_extl != WB_TBE ) || ( st->bwidth == SWB && st->last_extl != SWB_TBE ) || ( st->bwidth == FB && st->last_extl != FB_TBE );
                st->hBWE_FD->prev_fb_ener_adjust = fixedToFloat( st->prev_fb_ener_adjust_fx, Q_prev_fb_ener_adjust );
                //st->hBWE_FD->prev_fb_ener_adjust = fixedToFloat( st->prev_fb_ener_adjust_fx, Q_prev_fb_ener_adjust );
            }
            st->preemph_fac_float = fixedToFloat( st->preemph_fac, 15 );
            IF( st->hTECDec != NULL )
@@ -959,8 +1022,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                st->hTcxDec->conLastFrameLevel_e = 0;
                FOR( i = 0; i < PLC_MIN_STAT_BUFF_SIZE; i++ )
                {
                    st->hTcxDec->NoiseLevelMemory_bfi[i] = fixedToFloat( st->hTcxDec->NoiseLevelMemory_bfi_fx[i], 15 );
                    st->hTcxDec->conNoiseLevelMemory[i] = st->hTcxDec->NoiseLevelMemory_bfi_fx[i];
                    //st->hTcxDec->NoiseLevelMemory_bfi[i] = me2f_16(st->hTcxDec->conNoiseLevelMemory[i], st->hTcxDec->conNoiseLevelMemory_e[i]);
                    //st->hTcxDec->conNoiseLevelMemory[i] = st->hTcxDec->NoiseLevelMemory_bfi_fx[i];
                }
                st->hTcxDec->cummulative_damping_tcx_float = fixedToFloat( st->hTcxDec->cummulative_damping_tcx, 15 );
            }
@@ -1004,14 +1067,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                st->hBPF->pst_mem_deemp_err = 0;
            }

            st->past_gpit_float = fixedToFloat( st->past_gpit, 0 );
            st->past_gcode_float = fixedToFloat( st->past_gcode, 0 );
            fixedToFloat_arr( st->Aq_cng, st->Aq_cng_float, 2, M );

            if ( st->last_gain_syn_deemph == 16384 )
            {
                st->last_gain_syn_deemph_float = 1;
            }
            //if ( st->last_gain_syn_deemph == 16384 )
            //{
            //    st->last_gain_syn_deemph_float = 1;
            //}
            st->last_concealed_gain_syn_deemph_float = fixedToFloat( st->last_concealed_gain_syn_deemph, 14 );
            st->enr_old = fixedToFloat( st->enr_old_fx, 0 );
            st->lp_gainc = fixedToFloat( st->lp_gainc_fx, 3 );
@@ -1023,18 +1084,13 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            }

            st->old_fpitch_float = fixedToFloat( st->old_fpitch, 16 );
            FOR( i = 0; i < 8; i++ )
            {
                st->dispMem[i] = 0;
            }

            IF( st->hTcxLtpDec != NULL )
            {
                Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY );
                Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k );
                Q_tcxltp_gain_post_prev = Q_factor( st->hTcxLtpDec->tcxltp_gain_post_prev_float );
                fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_in, st->hTcxLtpDec->tcxltp_mem_in_float, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY );
                fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_out, st->hTcxLtpDec->tcxltp_mem_out_float, Q_tcxltp_mem_out, L_FRAME48k );
                st->hTcxLtpDec->tcxltp_gain_post_prev_float = fixedToFloat( st->hTcxLtpDec->tcxltp_gain_post_prev, Q_tcxltp_gain_post_prev );
            }
            IF( st->hTonalMDCTConc )
            {
@@ -1128,7 +1184,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            //st->hPlcInfo->recovery_gain = (Word16) floatToFixed( st->hPlcInfo->recovery_gain_float, Q14 );
            //st->hPlcInfo->step_concealgain_fx = (Word16) floatToFixed( st->hPlcInfo->step_concealgain, Q15 );
        }
        floatToFixed_arr( st->hTcxDec->NoiseLevelMemory_bfi, st->hTcxDec->conNoiseLevelMemory, Q15, PLC_MIN_STAT_BUFF_SIZE );
        //floatToFixed_arr( st->hTcxDec->NoiseLevelMemory_bfi, st->hTcxDec->conNoiseLevelMemory, Q15, PLC_MIN_STAT_BUFF_SIZE );
        st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi;
        st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi;
        floatToFixed_arrL( st->old_pitch_buf, st->old_pitch_buf_fx, Q16, 2 * NB_SUBFR16k + 2 );
@@ -1201,7 +1257,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
        st->hTcxDec->cummulative_damping_tcx = float_to_fix16( st->hTcxDec->cummulative_damping_tcx_float, Q15 );
        // st->Mode2_lp_gainp = float_to_fix(st->lp_gainp, Q16);
        st->Mode2_lp_gainp = float_to_fix( st->lp_gainp, Q29 );
        f2me_16( st->last_gain_syn_deemph_float, &st->last_gain_syn_deemph, &st->last_gain_syn_deemph_e );
        //f2me_16( st->last_gain_syn_deemph_float, &st->last_gain_syn_deemph, &st->last_gain_syn_deemph_e );
        f2me_16( st->last_concealed_gain_syn_deemph_float, &st->last_concealed_gain_syn_deemph, &st->last_concealed_gain_syn_deemph_e );
        //st->last_concealed_gain_syn_deemph = float_to_fix16( st->last_concealed_gain_syn_deemph_float, Q14 );
        //st->last_concealed_gain_syn_deemph_e = 1;
@@ -1313,7 +1369,7 @@ void fixed_to_float_stereo_tcx_core_dec(
    st->old_fpitch_float = fix_to_float( st->old_fpitch, Q16 );
    for ( int p = 0; p < PLC_MIN_STAT_BUFF_SIZE; p++ )
    {
        st->hTcxDec->NoiseLevelMemory_bfi[p] = fixedToFloat( st->hTcxDec->conNoiseLevelMemory[p], 15 - st->hTcxDec->conNoiseLevelMemory_e[p] );
        //st->hTcxDec->NoiseLevelMemory_bfi[p] = fixedToFloat( st->hTcxDec->conNoiseLevelMemory[p], 15 - st->hTcxDec->conNoiseLevelMemory_e[p] );
    }
    fixedToFloat_arrL( st->old_pitch_buf_fx, st->old_pitch_buf, Q16, 2 * NB_SUBFR16k + 2 );
    st->hTcxDec->CngLevelBackgroundTrace_bfi = fixedToFloat( st->hTcxDec->conCngLevelBackgroundTrace, 15 - st->hTcxDec->conCngLevelBackgroundTrace_e );
@@ -1449,7 +1505,7 @@ void fixed_to_float_stereo_tcx_core_dec(
        }
    }

    st->last_gain_syn_deemph_float = fixedToFloat(st->last_gain_syn_deemph, 15 - st->last_gain_syn_deemph_e);
    //st->last_gain_syn_deemph_float = fixedToFloat(st->last_gain_syn_deemph, 15 - st->last_gain_syn_deemph_e);
    st->hTcxDec->old_gaintcx_bfi_float = fixedToFloat(st->hTcxDec->old_gaintcx_bfi, 15 - st->hTcxDec->old_gaintcx_bfi_e);
    st->hTcxDec->cummulative_damping_tcx_float = fix16_to_float(st->hTcxDec->cummulative_damping_tcx, Q15);
    st->hTcxDec->damping_float = fix16_to_float(st->hTcxDec->damping, Q14);
+5 −1
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@
#ifdef IVAS_FLOAT_FIXED
#define _180_OVER_PI_Q25                         1922527233
#define _180_OVER_PI_FX                          (Word32) (( 180.0f / EVS_PI ) *ONE_IN_Q10)
#define PI_OVER_180_Q15                          ( 572 )
#define _180_OVER_PI_Q9                          ( 29335 )
#define PI_OVER_4_Q29                            421657440
#define _180_OVER_PI_Q9                          ( 29335 )
#define PI_OVER_Q29                              1686629760
@@ -1337,7 +1339,9 @@ typedef enum
#define MCMASA_LFE_BETA                         0.09f
#define MCMASA_LFE_THETA                        1.3f
#define MCMASA_LFE_SYNTH_ALPHA                  0.95f                       /* Smoothing coefficient for LFE synthesis */

#ifdef IVAS_FLOAT_FIXED
#define MCMASA_LFE_SYNTH_ALPHA_Q15              (31129) 
#endif
#define MCMASA_LFE_ALPHA_Q15                    (21954)
#define MCMASA_LFE_BETA_Q15                     (2949)
#define MCMASA_LFE_BETA_Q14                     (1474)
+10 −0
Original line number Diff line number Diff line
@@ -6933,6 +6933,16 @@ void ivas_omasa_dirac_rend_jbm(
    float *output_f[]                                           /* o  : rendered time signal                    */
);

#ifdef IVAS_FLOAT_FIXED
void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx(
    Decoder_Struct *st_ivas,
    Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX],
    Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX],
    Word16 *cldfb_buf_q,
    const Word16 nBins,
    const Word16 subframe
);
#endif
void ivas_omasa_preProcessStereoTransportsForMovedObjects(
    Decoder_Struct *st_ivas,
    float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX],
+17 −3
Original line number Diff line number Diff line
@@ -1269,9 +1269,10 @@ void stereo_icBWE_decproc_fx(
  CPE_DEC_HANDLE hCPE,                      /* i/o: CPE decoder structure       */
  Word32 *output[CPE_CHANNELS],              /* i/o: output synthesis            */
  Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i  : HB synthesis                */
  const int16_t last_core,                  /* i  : last core, primary channel  */
  const int16_t last_bwidth,                /* i  : last bandwidth              */
  const int16_t output_frame                /* i  : frame length                */
  const Word16 last_core,                  /* i  : last core, primary channel  */
  const Word16 last_bwidth,                /* i  : last bandwidth              */
  const Word16 output_frame,               /* i  : frame length                */
  Word16 q_output                            /* i  : Q-fac of output             */  
);

void add_HB_to_mono_dmx_fx(
@@ -1972,6 +1973,19 @@ void ivas_mct_side_bits_fx(
    const Word16 nb_bits_metadata       /* i  : number of metadata bits */
);

void conv_fx_32(
    const Word16 x[],   /* i  : i   vector                              Q_new*/
    const Word16 h[],   /* i  : impulse response (or second i   vector) Q(15)*/
    Word32 y[],   /* o  : output vetor (result of convolution)      12 bits*/
    const Word16 L      /* i  : vector size                               */
);

void stereo_dtf_cng_fx(
    CPE_DEC_HANDLE hCPE,                         /* i/o: CPE decoder structure    */
    const Word32 ivas_total_brate,              /* i  : IVAS total bitrate       */
    Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers              */
    const Word16 output_frame                   /* i  : output frame size        */
);

#endif // IVAS_FLOAT_FIXED

+5 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading