Commit d4d8576c authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'float_dependencies_cleanup_2' into 'main'

Floating point code clean up.

See merge request !263
parents bdc0c97b 109ea0b1
Loading
Loading
Loading
Loading
Loading
+59 −67
Original line number Diff line number Diff line
@@ -306,18 +306,18 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                st->hTcxDec->Q_syn_Overl_TDAC = Q_factor_arr( st->hTcxDec->syn_Overl_TDAC_float, L_FRAME32k / 2 ) - 1;
                st->hTcxDec->Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, L_FRAME32k / 2 ) - 1;
                st->hTcxDec->Q_syn_Overl_TDACFB = Q_factor_arr( st->hTcxDec->syn_Overl_TDACFB_float, L_FRAME32k / 2 );
                st->hTcxDec->Q_syn_OverlFB = Q_factor_arr( st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2 );
                //st->hTcxDec->Q_syn_OverlFB = Q_factor_arr( st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2 );
                Q_old_synth = Q_syn;
                Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX );
                //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX );
                floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 );
                floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 );
                floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 );
                floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 );
                floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 );
                floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 );
                //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
                st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 );
                //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 );
                st->output_frame_fx = st->hTcxDec->L_frameTCX;
                st->hTcxDec->CngLevelBackgroundTrace_bfi_fx = floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, 15 );
                //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, 14 );
@@ -353,10 +353,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(

            IF( st->hTcxLtpDec )
            {
                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 );
                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 );
                //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 );
                //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 );
            }


@@ -406,10 +406,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 );
                fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 );
                fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 );
                fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 );
                fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                st->hTcxDec->q_synth_history_fx = Q_synth_history;
                //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 );
                //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                //st->hTcxDec->q_synth_history_fx = Q_synth_history;
                //st->hTcxDec->conceal_eof_gain_float = fixedToFloat( st->hTcxDec->conceal_eof_gain, 14 );
                st->hTcxDec->CngLevelBackgroundTrace_bfi = fixedToFloat( st->hTcxDec->CngLevelBackgroundTrace_bfi_fx, 15 );
            }
@@ -443,16 +443,16 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
            Q_lsf_cng = Q_factor( 6400 );
            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 );
                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 );
                //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 );
                //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 );
            }
            IF( st->hTonalMDCTConc )
            {
                FOR( i = 0; i < FDNS_NPTS; i++ )
                {
                    st->hTonalMDCTConc->scaleFactorsBackground_flt[i] = fixedToFloat( st->hTonalMDCTConc->scaleFactorsBackground[i], 15 );
                    //st->hTonalMDCTConc->scaleFactorsBackground_flt[i] = fixedToFloat( st->hTonalMDCTConc->scaleFactorsBackground[i], 15 );
                }
            }
        }
@@ -527,18 +527,18 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                st->hTcxDec->Q_syn_Overl_TDAC = 0;
                st->hTcxDec->Q_syn_Overl = 0;
                st->hTcxDec->Q_syn_Overl_TDACFB = 0;
                st->hTcxDec->Q_syn_OverlFB = 0;
                //st->hTcxDec->Q_syn_OverlFB = 0;
                Q_old_synth = 0;
                Q_synth_history = 0;
                floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 );
                floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 );
                floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 );
                floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 );
                floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 );
                floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 );
                //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
                st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 );
                //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 );
                st->output_frame_fx = st->hTcxDec->L_frameTCX;
                st->hTcxDec->CngLevelBackgroundTrace_bfi_fx = floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, 15 );
                //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, 14 );
@@ -573,10 +573,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            }
            IF( st->hTcxLtpDec )
            {
                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 );
                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 );
                //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 );
                //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 );
            }


@@ -626,10 +626,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 );
                fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 );
                fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 );
                fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 );
                fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                st->hTcxDec->q_synth_history_fx = Q_synth_history;
                //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 );
                //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC );
                //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX );
                //st->hTcxDec->q_synth_history_fx = Q_synth_history;
                //st->hTcxDec->conceal_eof_gain_float = fixedToFloat( st->hTcxDec->conceal_eof_gain, 14 );
                st->hTcxDec->CngLevelBackgroundTrace_bfi = fixedToFloat( st->hTcxDec->CngLevelBackgroundTrace_bfi_fx, 15 );
                st->hTcxDec->conCngLevelBackgroundTrace = (Word16) st->hTcxDec->CngLevelBackgroundTrace_bfi_fx;
@@ -668,16 +668,16 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(

            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 );
                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 );
                //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 );
                //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 );
            }
            IF( st->hTonalMDCTConc )
            {
                FOR( i = 0; i < FDNS_NPTS; i++ )
                {
                    st->hTonalMDCTConc->scaleFactorsBackground_flt[i] = fixedToFloat( st->hTonalMDCTConc->scaleFactorsBackground[i], 15 );
                    //st->hTonalMDCTConc->scaleFactorsBackground_flt[i] = fixedToFloat( st->hTonalMDCTConc->scaleFactorsBackground[i], 15 );
                }
            }
        }
@@ -688,14 +688,14 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
        /*==========*/
        for ( int p = 0; p < hTcxDec->old_synth_len; p++ )
        {
            hTcxDec->old_synth[p] = (Word16) ( hTcxDec->old_synth_float[p] );
            //hTcxDec->old_synth[p] = (Word16) ( hTcxDec->old_synth_float[p] );
        }
        for ( int p = 0; p < hTcxDec->old_synth_lenFB; p++ )
        {
            hTcxDec->old_synthFB_fx[p] = (Word16) ( hTcxDec->old_synthFB[p] );
        }

        st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 );
        //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 );
        if ( st->hTonalMDCTConc != NULL )
        {
            floatToFixed_arr( st->hTonalMDCTConc->secondLastPcmOut_float, st->hTonalMDCTConc->secondLastPcmOut, 0, st->hTonalMDCTConc->nSamples );
@@ -718,7 +718,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
        st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi;
        if ( hTcxLtpDec->tcxltp )
        {
            hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( hTcxDec->tcxltp_last_gain_unmodified_float, Q15 );
            //hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( hTcxDec->tcxltp_last_gain_unmodified_float, Q15 );
        }

        floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) );
@@ -736,10 +736,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            //{
            //    st->hFdCngDec->hFdCngCom->periodog[p] = (Word32) ( st->hFdCngDec->hFdCngCom->periodog_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->periodog_exp ) ) );
            //}
            for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ )
            {
                st->hFdCngDec->hFdCngCom->fftBuffer[p] = (Word32) ( st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) );
            }
            //for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ )
            //{
            //    st->hFdCngDec->hFdCngCom->fftBuffer[p] = (Word32) ( st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) );
            //}
            st->hFdCngDec->msNoiseEst_exp = 31 - Q4;
            for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ )
            {
@@ -766,15 +766,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
            //}
        }

        IF(bfi && st->tonal_mdct_plc_active && NE_16(st->element_mode, IVAS_CPE_MDCT))
        {
          FOR(Word16 ii = 0; ii < FDNS_NPTS; ii++)
          {
            f2me_16(st->hTonalMDCTConc->secondLastBlockData.scaleFactors_float[ii], &st->hTonalMDCTConc->secondLastBlockData.scaleFactors[ii], &st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[ii]);
            st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e = s_max(st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[ii]);
          }
        }

        // u8bit to 16bit
        FOR(int l = 0; l < IGF_START_MX; l++)
        {
@@ -787,7 +778,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
        floatToFixed_arr(st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->Q_syn, 320);
        floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn+1, 320);
        floatToFixed_arr(st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->Q_syn, 480);
        floatToFixed_arr(st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->Q_syn, 480);
        //floatToFixed_arr(st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->Q_syn, 480);
    }
}

@@ -797,14 +788,14 @@ void fixed_to_float_stereo_tcx_core_dec(
{
    TCX_DEC_HANDLE hTcxDec = st->hTcxDec;
    //Word16 q_Aq;
    st->hTcxDec->tcxltp_last_gain_unmodified_float = (Word16) fixedToFloat( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 );
    //st->hTcxDec->tcxltp_last_gain_unmodified_float = (Word16) fixedToFloat( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 );

    if ( EQ_16( st->core, ACELP_CORE ) )
    {

        for ( int p = 0; p < st->L_frame / 2; p++ )
        {
            st->hTcxDec->syn_OverlFB_float[p] = (float) st->hTcxDec->syn_OverlFB[p] / (float) pow( 2, st->Q_syn );
            //st->hTcxDec->syn_OverlFB_float[p] = (float) st->hTcxDec->syn_OverlFB[p] / (float) pow( 2, st->Q_syn );
            st->hTcxDec->syn_Overl_float[p] = (float) st->hTcxDec->syn_Overl[p] / (float) pow( 2, st->Q_syn );
            st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn );
            st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn );
@@ -827,15 +818,15 @@ void fixed_to_float_stereo_tcx_core_dec(
    //    st->mid_lsf_int = st->mid_lsf_int;
    //}

    hTcxDec->tcxltp_last_gain_unmodified_float = fixedToFloat( hTcxDec->tcxltp_last_gain_unmodified, Q15 );
    //hTcxDec->tcxltp_last_gain_unmodified_float = fixedToFloat( hTcxDec->tcxltp_last_gain_unmodified, Q15 );

    //st->hTcxDec->conceal_eof_gain_float = fixedToFloat( st->hTcxDec->conceal_eof_gain, Q14 );

    st->hTcxDec->CngLevelBackgroundTrace_bfi = fixedToFloat( st->hTcxDec->conCngLevelBackgroundTrace, 15 - st->hTcxDec->conCngLevelBackgroundTrace_e );

    fixedToFloat_arr( hTcxDec->old_synth, hTcxDec->old_synth_float, 0, hTcxDec->old_synth_len );
    fixedToFloat_arr( hTcxDec->synth_history_fx, hTcxDec->synth_history, 0, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) );
    st->hTcxDec->q_synth_history_fx = 0;
    //fixedToFloat_arr( hTcxDec->old_synth, hTcxDec->old_synth_float, 0, hTcxDec->old_synth_len );
    //fixedToFloat_arr( hTcxDec->synth_history_fx, hTcxDec->synth_history, 0, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) );
    //st->hTcxDec->q_synth_history_fx = 0;

    fixedToFloat_arr( hTcxDec->old_synthFB_fx, hTcxDec->old_synthFB, 0, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) + hTcxDec->old_synth_lenFB );

@@ -864,17 +855,17 @@ void fixed_to_float_stereo_tcx_core_dec(
            {
                st->hTcxDec->CngLevelBackgroundTrace_bfi = fix_to_float( st->hTcxDec->CngLevelBackgroundTrace_bfi_fx, ( 31 - st->hTcxDec->CngLevelBackgroundTrace_bfi_exp ) );
                //st->cngTDLevel_float = fixedToFloat( st->cngTDLevel, ( 15 - st->cngTDLevel_e ) );
                for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ )
                {
                    st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->fftBuffer[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) );
                }
                //for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ )
                //{
                //    st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->fftBuffer[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) );
                //}
                for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ )
                {
                    st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) );
                }
                for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ )
                {
                    st->hFdCngDec->bandNoiseShape_float[p] = ( (float) st->hFdCngDec->bandNoiseShape[p] / ( 1u << ( 31 - st->hFdCngDec->bandNoiseShape_exp ) ) );
                    //st->hFdCngDec->bandNoiseShape_float[p] = ( (float) st->hFdCngDec->bandNoiseShape[p] / ( 1u << ( 31 - st->hFdCngDec->bandNoiseShape_exp ) ) );
                }
                                
				                
@@ -887,8 +878,9 @@ void fixed_to_float_stereo_tcx_core_dec(
                {
                    for ( int p = 0; p < L_FRAME16k - st->hFdCngDec->hFdCngCom->startBand; p++ )
                    {
                        st->hFdCngDec->smoothed_psd[st->hFdCngDec->hFdCngCom->startBand + p] = ( (float) st->hFdCngDec->smoothed_psd_fx[st->hFdCngDec->hFdCngCom->startBand + p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ) );
                        //st->hFdCngDec->smoothed_psd[st->hFdCngDec->hFdCngCom->startBand + p] = ( (float) st->hFdCngDec->smoothed_psd_fx[st->hFdCngDec->hFdCngCom->startBand + p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ) );
                    }
                    st->hFdCngDec->q_smoothed_psd = sub( 31 , st->hFdCngDec->msNoiseEst_exp );
                }

                int A_cng_q = 14;
@@ -922,7 +914,7 @@ void fixed_to_float_stereo_tcx_core_dec(
        }
        FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ )
        {
            st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) );
            //st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) );
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -1586,7 +1586,7 @@ typedef enum
#define GAIN_LFE                                1.88364911f                 /* Gain applied to LFE during renderering */
#define GAIN_LFE_WORD32                         2022552831                 /* Gain applied to LFE during renderering */
#ifdef IVAS_FLOAT_FIXED
#define GAIN_LFE_FX                             30862                 /* Gain applied to LFE during renderering */
#define GAIN_LFE_FX                             30862                 /*Q.14 Gain applied to LFE during renderering */
#endif // IVAS_FLOAT_FIXED
#define LOW_BIT_RATE_BINAURAL_EQ_BINS           17                          /* Number of bins in an EQ applied at low bit rates in binauralization */
#define LOW_BIT_RATE_BINAURAL_EQ_OFFSET         14                          /* Offset of bins where the low-bit-rate EQ starts*/
+4 −27

File changed.

Preview size limit exceeded, changes collapsed.

+3 −7
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ ivas_error ivas_core_dec(
    MCT_DEC_HANDLE hMCT,                                        /* i/o: MCT decoder structure                   */
    const int16_t n_channels,                                   /* i  : number of channels to be decoded        */
    Word32 *output_fx[],                                            /* o  : output synthesis signal                 */
    float outputHB[][L_FRAME48k],                               /* o  : output HB synthesis signal              */
    Word32 outputHB[][L_FRAME48k],                               /* o  : output HB synthesis signal              */
    Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX],                /* o  : DFT buffers                             */
    const int16_t sba_dirac_stereo_flag                         /* i  : signal stereo output for SBA DirAC      */
);
@@ -1753,9 +1753,6 @@ void stereo_dft_dec_core_switching(
void init_basic_allpass(
    basic_allpass_t *ap,                                        /* i/o: basic allpass structure             */
    const float *gains,                                         /* i  : allpass filter gains                */
#ifdef IVAS_FLOAT_FIXED
    const Word32 *gains_fx,
#endif
    const int16_t *delays                                       /* i  : allpass filter delays               */
);

@@ -6737,7 +6734,7 @@ void ivas_lfe_enc_fx(
);
#endif // IVAS_FLOAT_FIXED


#ifndef IVAS_FLOAT_FIXED
ivas_error ivas_create_lfe_dec( 
    LFE_DEC_HANDLE *hLFE_out,                                   /* o  : IVAS LFE decoder structure              */
    const int32_t output_Fs,                                    /* i  : output sampling rate                    */
@@ -6755,7 +6752,7 @@ void ivas_lfe_dec(
    const int16_t bfi,                                          /* i  : BFI flag                                */
    float output_lfe_ch[]                                       /* o  : output LFE synthesis                    */
);

#endif
void ivas_lfe_tdplc( 
    LFE_DEC_HANDLE hLFE,                                        /* i/o: LFE decoder handle                      */
    const float *prevsynth,                                     /* i  : previous frame synthesis                */
@@ -6798,7 +6795,6 @@ void ivas_filters_init_fx(
);
#endif


void ivas_filter_process( 
    ivas_filters_process_state_t *filter_state,                 /* i/o: filter state handle                     */
    float *pIn_Out,                                             /* i  : signal subject to filtering             */
+23 −18

File changed.

Preview size limit exceeded, changes collapsed.

Loading