Commit 270bf966 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

More clean up changes.

parent 2183f309
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -609,6 +609,8 @@ ivas_error config_acelp1(
    const Word16 GSC_IVAS_mode         /* i  : GSC IVAS mode                   */
)
{
	UNUSED_PARAM(active_cnt);

    Word16 i, bits, nb_subfr;
    Word16 flag_hardcoded, coder_type_sw, fix_first;
    Word32 core_brate;
+4 −0
Original line number Diff line number Diff line
@@ -223,7 +223,11 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
    float acousticPreDelay;                           /* Time elapsed between input signal and late reverberation start, float, range [0.001..10]           */
    float inputPreDelay;                              /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10]  */
#ifdef IVAS_FLOAT_FIXED
    Word32 pFc_input_fx[IVAS_CLDFB_NO_CHANNELS_MAX];      /* Center frequencies for which following values are provided:                                        */
    Word32 pAcoustic_rt60_fx[IVAS_CLDFB_NO_CHANNELS_MAX]; /*  - The room's T60 per center frequency                                                             */
    Word32 pAcoustic_dsr_fx[IVAS_CLDFB_NO_CHANNELS_MAX];  /*  - The room's Diffuse to Source Ratio per center frequency                                         */
    Word32 acousticPreDelay_fx; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10]           *//*Assumed Q-27*/
    Word32 inputPreDelay_fx; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10]  *//* Assumed Q-27*/
#endif // IVAS_FLOAT_FIXED

    /* early reflections */
+15 −16
Original line number Diff line number Diff line
@@ -267,17 +267,17 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
        IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData;
        hPrivateData = &st->hIGFDec->igfData;
        H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo;
        ACELP_config *pConfigAcelp = &( st->acelp_cfg );
        //ACELP_config *pConfigAcelp = &( st->acelp_cfg );
        Word16 i = 0,
            Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, Q_fer_samples = 0,
            Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, /*Q_fer_samples = 0,*/
            Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0,
            Q_pst_old_syn = 0,
            //Q_pst_old_syn = 0,
            delay_comp = 0;

        Word16 Q_lsf_cng = Q_factor( 6400 );
        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;
        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 */;

        if ( tofix )
        {
@@ -376,7 +376,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                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 );
            }
            st->TcxBandwidth = (Word16) floatToFixed( st->TcxBandwidth_float, 15 );
            //st->TcxBandwidth = (Word16) floatToFixed( st->TcxBandwidth_float, 15 );
        }
        else
        {
@@ -401,7 +401,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed(
                st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0];
                st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0];
            }
            st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 );
            //st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 );

            IF( st->hBWE_TD != NULL )
            {
@@ -509,16 +509,16 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
        IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData;
        hPrivateData = &st->hIGFDec->igfData;
        H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo;
        ACELP_config *pConfigAcelp = &( st->acelp_cfg );
        //ACELP_config *pConfigAcelp = &( st->acelp_cfg );
        Word16 /*i = 0,*/
               Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, Q_old_exc = 0, Q_fer_samples = 0,
               Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, Q_old_exc = 0,/* Q_fer_samples = 0,*/
               Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0,
               Q_pst_old_syn = 0,
               //Q_pst_old_syn = 0,
               delay_comp = 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;
        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*/;

        if ( tofix )
        {
@@ -643,7 +643,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2(
                st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0];
                st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0];
            }
            st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 );
            //st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 );
            IF( st->hBWE_TD != NULL )
            {
                Q_state_lsyn_filt_shb = Q_factor_arr( hBWE_TD->state_lsyn_filt_shb, 6 );
@@ -810,10 +810,10 @@ 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 i = 0; i < FDNS_NPTS; i++)
          FOR(Word16 ii = 0; ii < FDNS_NPTS; ii++)
          {
            f2me_16(st->hTonalMDCTConc->secondLastBlockData.scaleFactors_float[i], &st->hTonalMDCTConc->secondLastBlockData.scaleFactors[i], &st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i]);
            st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e = s_max(st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i]);
            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]);
          }
        }

@@ -838,7 +838,7 @@ void fixed_to_float_stereo_tcx_core_dec(
    float *signal_out )
{
    TCX_DEC_HANDLE hTcxDec = st->hTcxDec;
    Word16 q_Aq;
    //Word16 q_Aq;
    st->hTcxDec->tcxltp_last_gain_unmodified_float = (Word16) fixedToFloat( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 );

    if ( EQ_16( st->core, ACELP_CORE ) )
@@ -870,7 +870,6 @@ void fixed_to_float_stereo_tcx_core_dec(
    }

    hTcxDec->tcxltp_last_gain_unmodified_float = fixedToFloat( hTcxDec->tcxltp_last_gain_unmodified, Q15 );
    st->hTcxLtpDec->tcxltp_gain_float = fixedToFloat( st->hTcxLtpDec->tcxltp_gain, 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 );
+9 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@

#define PI_OVER_2                               ( EVS_PI / 2.0f )
#define PI_OVER_180                             ( EVS_PI / 180.0f )
#define ONE_BY_PI_OVER_180_Q25                             ( 1922527360 )
#define _180_OVER_PI                            ( 180.0f / EVS_PI )
#ifdef IVAS_FLOAT_FIXED
#define _180_OVER_PI_Q25                         1922527233
@@ -1449,9 +1450,17 @@ typedef enum
#define PARAM_MC_ICC_ERROR_BIAS_FAC              (1.15f)                    /* factor for favouring past ICC maps in the adaptive ICC map decision */
#define PARAM_MC_TRANSIENT_BAND_STEP             2                          /* Number of parameter bands combined in case of a transient frame*/
#define PARAM_MC_MAX_DECORR_CLDFB_BANDS         20                          /* Maximum number of CLDFB bands with decorrelation */
#ifdef FIX_901_PARAMMC_DEAD_CODE
#define PARAM_MC_MAX_TRANSPORT_CHANS             3                          /* Number of down mix channels */
#else
#define PARAM_MC_MAX_TRANSPORT_CHANS             4                          /* Number of down mix channels */
#endif
#define PARAM_MC_MAX_ILD_REF_CHANNELS            2                          /* Maximum number of reference channels for a coded ILD */
#ifdef FIX_901_PARAMMC_DEAD_CODE
#define PARAM_MC_NUM_CONFIGS                    14                          /* Number of available Parametric MC configurations */
#else
#define PARAM_MC_NUM_CONFIGS                    15                          /* Number of available Parametric MC configurations */
#endif
#define PARAM_MC_MAX_BAND_LFE                    1                          /* Number of parameter bands for LFE coding */
#define PARAM_MC_SZ_ICC_MAP                     11                          /* Maximum number of transmitted ICCs per parameter band */
#define PARAM_MC_SZ_ILD_MAP                     12                          /* Maximum number of transmitted channel energies per band*/
+32 −6
Original line number Diff line number Diff line
@@ -103,16 +103,22 @@ uint16_t ivas_param_mc_get_configuration_index(
#ifdef IVAS_FLOAT_FIXED
void ivas_param_mc_metadata_open(
    const MC_LS_SETUP mc_ls_setup,             /* i  : MC ls setup                                         */
#ifndef FIX_901_PARAMMC_DEAD_CODE
    const Word16 lfe_index,                   /* i  : channel index of LFE                                */
#endif
    const Word32 ivas_total_brate,            /* i  : IVAS total bitrate                                  */
    HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o  : handle for the Parametric MC parameter coding state */
)
{
#ifndef FIX_901_PARAMMC_DEAD_CODE
    Word16 i;
#endif
    UWord16 config_index;
#ifndef FIX_901_PARAMMC_DEAD_CODE
    Word16 nchan_setup;

    nchan_setup = ivas_mc_ls_setup_get_num_channels( mc_ls_setup );
#endif

    /* get coding band mappings */
    set16_fx( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS );
@@ -144,25 +150,28 @@ void ivas_param_mc_metadata_open(
    {
        assert( 0 && "nbands must be 20 or 14!" );
    }

#ifndef FIX_901_PARAMMC_DEAD_CODE
    /* create map of all possible ICCs */
    ivas_param_mc_create_full_icc_mapping( nchan_setup, lfe_index, hMetadataPMC->icc_map_full, &hMetadataPMC->icc_map_size_full );
#endif
    hMetadataPMC->icc_mapping_conf = ivas_param_mc_conf[config_index].icc_mapping_conf;
    hMetadataPMC->ild_mapping_conf = ivas_param_mc_conf[config_index].ild_mapping_conf;
    hMetadataPMC->ild_factors = ivas_param_mc_conf[config_index].ild_factors; //float
    hMetadataPMC->ild_factors_fx = ivas_param_mc_conf[config_index].ild_factors_fx;

#ifndef FIX_901_PARAMMC_DEAD_CODE
    /* set default ICC maps */
    FOR ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ )
    {
        ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] );
    }

#endif
    /* init remaining flags and indices */
    hMetadataPMC->param_frame_idx = 0;
	move16();
#ifndef FIX_901_PARAMMC_DEAD_CODE
    hMetadataPMC->flag_use_adaptive_icc_map = 0;
	move16();
#endif
    hMetadataPMC->bAttackPresent = 0;
	move16();
    hMetadataPMC->attackIndex = 0;
@@ -183,16 +192,22 @@ void ivas_param_mc_metadata_open(
#else
void ivas_param_mc_metadata_open(
    const MC_LS_SETUP mc_ls_setup,             /* i  : MC ls setup                                         */
#ifndef FIX_901_PARAMMC_DEAD_CODE
    const int16_t lfe_index,                   /* i  : channel index of LFE                                */
#endif
    const int32_t ivas_total_brate,            /* i  : IVAS total bitrate                                  */
    HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o  : handle for the Parametric MC parameter coding state */
)
{
#ifndef FIX_901_PARAMMC_DEAD_CODE
    int16_t i;
#endif
    uint16_t config_index;
#ifndef FIX_901_PARAMMC_DEAD_CODE
    int16_t nchan_setup;

    nchan_setup = ivas_mc_ls_setup_get_num_channels( mc_ls_setup );
#endif

    /* get coding band mappings */
    set_s( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS );
@@ -225,21 +240,26 @@ void ivas_param_mc_metadata_open(
        assert( 0 && "nbands must be 20 or 14!" );
    }

#ifndef FIX_901_PARAMMC_DEAD_CODE
    /* create map of all possible ICCs */
    ivas_param_mc_create_full_icc_mapping( nchan_setup, lfe_index, hMetadataPMC->icc_map_full, &hMetadataPMC->icc_map_size_full );
#endif
    hMetadataPMC->icc_mapping_conf = ivas_param_mc_conf[config_index].icc_mapping_conf;
    hMetadataPMC->ild_mapping_conf = ivas_param_mc_conf[config_index].ild_mapping_conf;
    hMetadataPMC->ild_factors = ivas_param_mc_conf[config_index].ild_factors;

#ifndef FIX_901_PARAMMC_DEAD_CODE
    /* set default ICC maps */
    for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ )
    {
        ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] );
    }

#endif
    /* init remaining flags and indices */
    hMetadataPMC->param_frame_idx = 0;
#ifndef FIX_901_PARAMMC_DEAD_CODE
    hMetadataPMC->flag_use_adaptive_icc_map = 0;
#endif
    hMetadataPMC->bAttackPresent = 0;
    hMetadataPMC->attackIndex = 0;
    hMetadataPMC->lfe_on = 1;
@@ -333,6 +353,7 @@ void ivas_param_mc_set_coded_bands(
}
#endif

#ifndef FIX_901_PARAMMC_DEAD_CODE
/*-------------------------------------------------------------------------
 * ivas_param_mc_metadata_close()
 *
@@ -379,7 +400,7 @@ void ivas_param_mc_metadata_close(
}
#endif


#endif
/*-------------------------------------------------------------------------
 * ivas_param_mc_getNumTransportChannels()
 *
@@ -421,6 +442,7 @@ int16_t ivas_param_mc_getNumTransportChannels(
#endif


#ifndef FIX_901_PARAMMC_DEAD_CODE
/*-------------------------------------------------------------------------
 * ivas_param_mc_create_full_icc_mapping()
 *
@@ -574,7 +596,7 @@ void ivas_param_mc_default_icc_map(
    return;
}
#endif

#endif

/*-------------------------------------------------------------------------
 * ivas_param_mc_get_num_param_bands()
@@ -668,10 +690,12 @@ static Word16 ivas_param_mc_get_num_param_bands(
                    num_parameter_bands = 14;
                    move16();
                    BREAK;
#ifndef FIX_901_PARAMMC_DEAD_CODE
                case IVAS_160k:
                    num_parameter_bands = 20;
                    move16();
                    BREAK;
#endif
            }
            BREAK;
        default:
@@ -756,9 +780,11 @@ static int16_t ivas_param_mc_get_num_param_bands(
                case IVAS_128k:
                    num_parameter_bands = 14;
                    break;
#ifndef FIX_901_PARAMMC_DEAD_CODE
                case IVAS_160k:
                    num_parameter_bands = 20;
                    break;
#endif
            }
            break;
        default:
Loading