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

Restore float funcs, dirac dec and stat_dec struct cleanup

parent f2de97c0
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -612,11 +612,11 @@ ivas_error acelp_core_dec(
                    nb_bits = -1;
                }

                config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
                config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );

                if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME )
                {
                    config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
                    config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
                }
            }

+1 −1
Original line number Diff line number Diff line
@@ -2459,7 +2459,7 @@ void ivas_binRenderer_fx(
    /* memory reset for the binaural output */
    FOR(chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++)
    {
        FOR(k = 0; k < numTimeSlots; k++)
        FOR(k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++)
        {
            set32_fx(Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX);
            set32_fx(Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX);
+1 −14
Original line number Diff line number Diff line
@@ -1162,7 +1162,7 @@ ivas_error ivas_core_dec(

            if ( hCPE->hStereoDft != NULL )
            {
                floatToFixed_arrL( hCPE->hStereoDft->hb_stefi_sig, hCPE->hStereoDft->hb_stefi_sig_fx, q, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) );
                //floatToFixed_arrL( hCPE->hStereoDft->hb_stefi_sig, hCPE->hStereoDft->hb_stefi_sig_fx, q, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) );
                hCPE->hStereoDft->td_gain_fx[0] = 1;
            }
            Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc );
@@ -1171,19 +1171,6 @@ ivas_error ivas_core_dec(
			Scale_sig32(hb_synth_32_fx[0], L_FRAME48k, sub(Q11 , q));
			Scale_sig32(hb_synth_32_fx[1], L_FRAME48k, sub(Q11 , q));

            if ( hCPE->hStereoDft != NULL )
            {

                fixedToFloat_arrL( hCPE->hStereoDft->hb_stefi_sig_fx, hCPE->hStereoDft->hb_stefi_sig, 16, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) );
                hCPE->hStereoDft->hb_nrg_subr[0] = (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] / ( 1u << hCPE->hStereoDft->Q_nrg_subr );
                hCPE->hStereoDft->hb_nrg_subr[1] = (float) hCPE->hStereoDft->hb_nrg_subr_fx[1] / ( 1u << hCPE->hStereoDft->Q_nrg_subr );
                hCPE->hStereoDft->hb_nrg[0] = (float) hCPE->hStereoDft->hb_nrg_fx[0] / ( 1u << ( hCPE->hStereoDft->Q_nrg_subr + 9 ) );

                if ( hCPE->hStereoDft->td_gain_fx[0] == 0 )
                {
                    hCPE->hStereoDft->td_gain[0] = 0;
                }
            }
        }

        IF( EQ_16( st->element_mode, EVS_MONO ) )
+2 −2
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ ivas_error ivas_hp20_dec_reconfig_fx(

    return error;
}
#endif
#else
ivas_error ivas_hp20_dec_reconfig(
    Decoder_Struct *st_ivas,     /* i/o: IVAS decoder structure                     */
    const int16_t nchan_hp20_old /* i  : number of HP20 filters in previous frame   */
@@ -941,7 +941,7 @@ ivas_error ivas_hp20_dec_reconfig(

    return error;
}

#endif

/*-------------------------------------------------------------------*
 * ivas_cldfb_dec_reconfig()
+4 −98
Original line number Diff line number Diff line
@@ -704,60 +704,13 @@ ivas_error ivas_cpe_dec_fx(
            scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) );
            hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft;

            for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ )
            {
                if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] )
                {
                    l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii];
                }
            }
            hCPE->hStereoDft->q_hb_nrg_subr = 0;
            if ( l_hb_nrg_subr > (float) MAX_32 )
            {
                int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 );
                hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient );
            }
            for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ )
            {
                hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) );
            }


            for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ )
            {
                if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] )
                {
                    l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii];
                }
            }
            hCPE->hStereoDft->q_hb_nrg = 0;
            if ( l_hb_nrg > (float) MAX_32 )
            {
                int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 );
                hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient );
            }
            for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ )
            {
                hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) );
            }

            floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) );
#endif
            stereo_dft_unify_dmx_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata );
#if 1
            scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) );
            hCPE->hStereoDft->q_res_cod_mem_fx = Q16;

            for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ )
            {
                hCPE->hStereoDft->hb_nrg_subr[0] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) );
            }
            for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ )
            {
                hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) );
            }
            fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) );
            fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q15, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) );
#endif
        }
        ELSE
@@ -777,60 +730,13 @@ ivas_error ivas_cpe_dec_fx(

                scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) );
                hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft;

                for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ )
                {
                    if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] )
                    {
                        l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii];
                    }
                }
                hCPE->hStereoDft->q_hb_nrg_subr = 0;
                if ( l_hb_nrg_subr > (float) MAX_32 )
                {
                    int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 );
                    hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient );
                }
                for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ )
                {
                    hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) );
                }


                for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ )
                {
                    if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] )
                    {
                        l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii];
                    }
                }
                hCPE->hStereoDft->q_hb_nrg = 0;
                if ( l_hb_nrg > (float) MAX_32 )
                {
                    int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 );
                    hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient );
                }
                for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ )
                {
                    hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) );
                }

                floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) );
            }
#endif
            stereo_dft_dec_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES );
#if 1
            {
                for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ )
                {
                    hCPE->hStereoDft->hb_nrg_subr[0] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) );
                }
                for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ )
                {
                    hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) );
                }
                fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) );
                fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q15, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) );

                scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) );
                hCPE->hStereoDft->q_res_cod_mem_fx = Q16;
@@ -901,8 +807,8 @@ ivas_error ivas_cpe_dec_fx(
    // Delete below
    IF( hCPE->hStereoDft != NULL )
    {
        Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX );
        floatToFixed_arrL( hCPE->hStereoDft->td_gain, hCPE->hStereoDft->td_gain_fx, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this.
        //Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX );
        //floatToFixed_arrL( hCPE->hStereoDft->td_gain, hCPE->hStereoDft->td_gain_fx, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this.
    }
    //////Till here

@@ -965,8 +871,8 @@ ivas_error ivas_cpe_dec_fx(
    // delete below
    IF( hCPE->hStereoDft != NULL )
    {
        Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX );
        fixedToFloat_arrL( hCPE->hStereoDft->td_gain_fx, hCPE->hStereoDft->td_gain, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this.
        //Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX );
        //fixedToFloat_arrL( hCPE->hStereoDft->td_gain_fx, hCPE->hStereoDft->td_gain, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this.
    }

    /*----------------------------------------------------------------*
Loading