www.pudn.com > SMV_Code.rar > glb_var.h
/*=========================================================================*/
/* Each of the companies; Ericsson, Lucent, Mindspeed, Motorola, Nokia, */
/* Nortel Networks, and Qualcomm (hereinafter referred to individually as */
/* “Source” or collectively as “Sources”) do hereby state: */
/* */
/* To the extent to which the Source(s) may legally and freely do so, */
/* the Source(s), upon submission of a Contribution, grant(s) a free, */
/* irrevocable, non-exclusive, license to the Third Generation Partnership */
/* Project 2 (3GPP2) and its Organizational Partners: ARIB, CCSA, TIA, */
/* TTA, and TTC, under the Source’s copyright or copyright license rights */
/* in the Contribution, to, in whole or in part, copy, make derivative */
/* works, perform, display and distribute the Contribution and derivative */
/* works thereof consistent with 3GPP2’s and each Organizational Partner’s */
/* policies and procedures, with the right to (i) sublicense the foregoing */
/* rights consistent with 3GPP2’s and each Organizational Partner’s */
/* policies and procedures and (ii) copyright and sell, if applicable) in */
/* 3GPP2's name or each Organizational Partner’s name any 3GPP2 or */
/* transposed Publication even though this Publication may contain the */
/* Contribution or a derivative work thereof. The Contribution shall */
/* disclose any known limitations on the Source’s rights to license as */
/* herein provided. */
/* */
/* When a Contribution is submitted by the Source(s) to assist the */
/* formulating groups of 3GPP2 or any of its Organizational Partners, */
/* it is proposed to the Committee as a basis for discussion and is not */
/* to be construed as a binding proposal on the Source(s). The Source(s) */
/* specifically reserve(s) the right to amend or modify the material */
/* contained in the Contribution. Nothing contained in the Contribution */
/* shall, except as herein expressly provided, be construed as conferring */
/* by implication, estoppel or otherwise, any license or right under */
/* (i) any existing or later issuing patent, whether or not the use of */
/* information in the document necessarily employs an invention of any */
/* existing or later issued patent, (ii) any copyright, (iii) any */
/* trademark, or (iv) any other intellectual property right. */
/* */
/* With respect to the Software necessary for the practice of any or all */
/* Normative portions of the Selectable Mode Vocoder (SMV) as it exists on */
/* the date of submittal of this form, should the SMV be approved as a */
/* Specification or Report by 3GPP2, or as a transposed Standard by any of */
/* the 3GPP2’s Organizational Partners, the Source(s) state(s) that a */
/* worldwide license to reproduce, use and distribute the Software, the */
/* license rights to which are held by the Source(s), will be made */
/* available to applicants under terms and conditions that are reasonable */
/* and non-discriminatory, which may include monetary compensation, */
/* and only to the extent necessary for the practice of any or all of the */
/* Normative portions of the SMV or the field of use of practice of the */
/* SMV Specification, Report, or Standard. The statement contained above */
/* is irrevocable and shall be binding upon the Source(s). In the event */
/* the rights of the Source(s) in and to copyright or copyright license */
/* rights subject to such commitment are assigned or transferred, */
/* the Source(s) shall notify the assignee or transferee of the existence */
/* of such commitments. */
/*=========================================================================*/
/* */
/*-------------------------------------------------------------------*/
/*===================================================================*/
/* FILE: gbl_var.h */
/*-------------------------------------------------------------------*/
/* PURPOSE : Global variables definitions for SMVocoder */
/*===================================================================*/
/*============================================================================*/
/*================================ FRAME COUNTERS ============================*/
/*============================================================================*/
INT64 frm_count = 0;
#ifdef DEC_CMP
INT64 frm_erasure = 0;
#endif
/*============================================================================*/
/*================================= SMV CONTROL ==============================*/
/*============================================================================*/
#ifdef ENC_CMP
INT16 smv_mode;
INT16 fix_rate, fix_rate_mem2;
#endif
INT16 fix_rate_enc_mem;
INT16 fix_rate_dec_mem;
#ifdef DEC_CMP
INT16 fix_rate_dec_mem2;
#endif
/*============================================================================*/
/*=============================== NOISE SUPRESSION ===========================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 MIN_GAIN = -13.0;
FLOAT64 *curr_ns_snr;
#endif
/*============================================================================*/
/*============================ PRE AND POST PROCESSING =======================*/
/*============================================================================*/
#include "lib_ppr.tab"
#ifdef ENC_CMP
INT16 *zeroed;
FLOAT64 *zero_rate;
FLOAT64 *low_rate;
FLOAT64 *high_rate;
FLOAT64 *low_neg;
FLOAT64 *low_pos;
INT32 min_delta;
FLOAT64 zero_level;
FLOAT64 l1_neg, l2_neg, l1_pos, l2_pos;
#endif
/*----------------------------------------------------------------------------*/
#ifdef DEC_CMP
FLOAT64 *buff_LTpost;
FLOAT64 *PF_mem_syn;
FLOAT64 r_zero, r_pole;
FLOAT64 pst_scale;
FLOAT64 pst_hp_mem;
/*----------------------------------------------------------------------------*/
FLOAT64 *pst_flt_buf;
#endif
#ifdef ENC_CMP
FLOAT64 *pre_flt_buf;
FLOAT64 *lp_flt_num;
FLOAT64 *lp_flt_buf;
#endif
/*============================================================================*/
/*================================ LPC ANALYSIS ==============================*/
/*============================================================================*/
#include "lib_lpc.tab"
#ifdef ENC_CMP
/*----------------------------------------------------------------------------*/
/* LPC parameters */
/*----------------------------------------------------------------------------*/
FLOAT64 pderr;
FLOAT64 *refl_mem;
FLOAT64 *lsf_new, *lsf_old;
FLOAT64 *lsf_mem;
/*----------------------------------------------------------------------------*/
FLOAT64 erg, lpcgain;
FLOAT64 *sub_refl;
#endif
#ifdef DEC_CMP
FLOAT64 sub_lpcg;
#endif
/*============================================================================*/
/*============================== Weighted Speech =============================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 *wspeech_mem, *ws_syn_buf;
FLOAT64 Z1_ws_1, Z1_ws_2;
FLOAT64 *ms_syn_buf, *tmp_ws_m;
#endif
/*============================================================================*/
/*=========================== Fixed codebook search ==========================*/
/*============================================================================*/
#ifdef DEC_CMP
FLOAT64 **qua_unfcod;
#endif
/*============================================================================*/
/*================================= Gain VQ ==================================*/
/*============================================================================*/
#include "lib_geq.tab"
#ifdef ENC_CMP
INT16 GainNormDeci;
FLOAT64 pgain_past;
FLOAT64 *past_energyq_4d_enc;
FLOAT64 *past_energyq_3d_enc;
FLOAT64 *past_energyq_2d_enc;
#endif
FLOAT64 *past_energyq_4d;
FLOAT64 *past_energyq_3d;
FLOAT64 *past_energyq_2d;
#ifdef DEC_CMP
FLOAT64 past_fixed_energy;
FLOAT64 *past_energyq_4d_dec;
FLOAT64 *past_energyq_3d_dec;
FLOAT64 *past_energyq_2d_dec;
FLOAT64 pgain_past_dec;
FLOAT64 **qua_gainQ;
FLOAT64 *gp_buf;
FLOAT64 *Prev_Beta_Pitch;
FLOAT64 *pred_energy_d38;
FLOAT64 *pred_energy_d410;
FLOAT64 *gain_code_vector;
FLOAT64 gp_mean;
FLOAT64 gp_fec;
#endif
/*============================================================================*/
/*================================ LSF quantizers ============================*/
/*============================================================================*/
#include "lib_qlsf.tab"
#ifdef ENC_CMP
FLOAT64 **qes;
FLOAT64 *lsfq_old;
#endif
#ifdef DEC_CMP
FLOAT64 **qes_dec;
FLOAT64 *lsfq_old_dec;
#endif
/*============================================================================*/
/*=============================== PITCH OPEN LOOP ============================*/
/*============================================================================*/
#include "lib_ltp.tab"
/*----------------------------------------------------------------------------*/
#ifdef ENC_CMP
INT16 *ol_lag;
FLOAT64 Rp_mem;
INT16 *lag_enc;
FLOAT64 *pitch_f_enc_mem;
FLOAT64 pitchf_enc;
#endif
/*----------------------------------------------------------------------------*/
INT16 *lag;
FLOAT64 *pitch_f_mem;
/*----------------------------------------------------------------------------*/
#ifdef DEC_CMP
INT16 *lag_dec;
FLOAT64 *pitch_f_dec_mem;
FLOAT64 pitchf_dec;
#endif
#ifdef ENC_CMP
INT16 VUVmm, pitch_m, pitch_mm, Iopt0;
INT16 *PITmax0;
INT16 LagCount, VadCount, Av_lag;
FLOAT64 Rp_m;
FLOAT64 Rp_m1;
FLOAT64 *Rmax0;
#endif
/*============================================================================*/
/*============================ CLOSED PITCH PROCESSING =======================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 *ext;
FLOAT64 *NewTg_mem;
FLOAT64 *lag_f_enc;
INT16 pitch_index;
#endif
FLOAT64 *lag_f;
#ifdef DEC_CMP
FLOAT64 *lag_f_dec;
#endif
/*============================================================================*/
/*============================= PITCH PRE-PROCESSING =========================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 Delay_pp, Last_Rp;
INT16 frame_class_pp_m;
FLOAT64 *targ_mem;
#endif
/*============================================================================*/
/*============================ PRC LIBRARY PROCESSING ========================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 cl_Eg, ol_Eg;
FLOAT64 m_lpc_gain;
#endif
/*============================================================================*/
/*============================ GCB LIBRARY PROCESSING ========================*/
/*============================================================================*/
#include "lib_gcb.tab"
#ifdef ENC_CMP
FLOAT64 ref_eng_gcb;
INT16 rate_mem;
INT16 seed_enc;
#endif
#ifdef DEC_CMP
INT16 seed_exc;
INT16 seed_dec;
#endif
/*============================================================================*/
/*============================ CLA LIBRARY PROCESSING ========================*/
/*============================================================================*/
#include "lib_cla.tab"
#ifdef ENC_CMP
INT16 frame_class, frame_class_m;
enum frame_class {SILENCE, NOISE_LIKE, UNVOICED, ONSET, PLOSIVE,
NON_STATIONARY_VOICED, STATIONARY_VOICED};
INT16 VUV, VUVm;
INT16 frame_class_pp;
FLOAT64 energy, energy_m;
INT16 frame_onset;
INT16 frame_pit_tab;
INT16 frame_class_mem, onstplsv_mem, *voiced_mem;
INT16 *cond_mem;
FLOAT64 *sig_ppr_mem;
FLOAT64 *Lp_buffer;
FLOAT64 *buffer_wtilt, *buffer_wmax;
FLOAT64 E_noi, T_noi, M_noi, R_noi;
FLOAT64 AR_avg_wRp, AR_min_wtilt;
#endif
/*----------------------------------------------------------------------------*/
#ifdef ENC_CMP
INT16 FlatSp_Flag_enc;
INT16 SVS_Count_enc, Vad_0_Count_enc;
FLOAT64 Av_value_enc;
#endif
#ifdef DEC_CMP
INT16 FlatSp_Flag_dec;
INT16 SVS_Count_dec, Vad_0_Count_dec;
FLOAT64 Av_value_dec;
#endif
/*----------------------------------------------------------------------------*/
#ifdef ENC_CMP
FLOAT64 Rp_m_cla;
/*----------------------------------------------------------------------------*/
FLOAT64 av_pit_lag, av_pit_g;
INT16 PP_mode1_m, PP_frm_count;
/*----------------------------------------------------------------------------*/
INT16 OnSet;
INT16 frame_class_mm;
/*----------------------------------------------------------------------------*/
#endif
#ifdef DEC_CMP
INT16 SVS_deci_mem;
#endif
/*============================================================================*/
/*============================ VAD LIBRARY PROCESSING ========================*/
/*============================================================================*/
#ifdef ENC_CMP
INT16 *lag_buf;
FLOAT64 *pgain_buf;
INT16 Vad, *flag_vad_mem;
INT16 flag;
INT16 count_sil;
INT16 count_ext;
INT16 count_noise;
INT16 dec3_flg_mem;
INT16 count_onset;
FLOAT64 pitch_gain_mean;
FLOAT64 **vad_lsf_mem;
FLOAT64 min_energy;
FLOAT64 mean_energy;
FLOAT64 *prev_cml_lsf_diff;
FLOAT64 *prev_energy;
FLOAT64 snr;
FLOAT64 mean_max;
FLOAT64 mean_s_energy;
FLOAT64 prev_min_energy;
FLOAT64 *min_energy_mem;
FLOAT64 next_min_energy;
FLOAT64 *mean_lsf;
FLOAT64 *norm_mean_lsf;
FLOAT64 cml_lsf_diff_filt;
FLOAT64 onset_trhsd;
INT16 onset_flg_enc;
#endif
#ifdef DEC_CMP
INT16 onset_flg_dec;
#endif
/*============================================================================*/
/*========================== MUSIC LIBRARY PROCESSING ========================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 *pcorr_buf;
FLOAT64 mlsf0;
FLOAT64 MeanPgain ;
FLOAT64 Mcount_pflag;
FLOAT64 *mrc;
FLOAT64 MeanSE ;
FLOAT64 NMeanPgain ;
FLOAT64 mean_mus_update;
FLOAT64 MLLenergy;
INT16 count_consc_nflag;
INT16 count_pflag;
INT16 count_consc_pflag;
INT16 count_consc_rflag;
INT16 mus_update;
#endif
/*============================================================================*/
/*============================ SNR LIBRARY PROCESSING ========================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 NoiseGainFactor;
INT16 n_nois_ext_enc;
FLOAT64 NoisEng_enc, eng_old_enc, diff_lsf_m_enc, diff_eng_m_enc;
INT16 snr_frm_count, snr_count_vad;
FLOAT64 eng_m_enc;
#endif
#ifdef DEC_CMP
INT16 n_nois_ext_dec;
FLOAT64 noise_nrg_dec;
FLOAT64 sig_nrg_dec;
FLOAT64 SNR_dec_mem;
#endif
/*============================================================================*/
/*============================ SMO LIBRARY PROCESSING ========================*/
/*============================================================================*/
#ifdef ENC_CMP
#include "lib_smo.tab"
FLOAT64 *lsf_smooth;
INT16 noise_stationarity, N_noise_spect_stationarity;
INT16 N_mode_sub_est, N_mode_frm;
FLOAT64 *ma_lsf, *dSP_buf;
INT16 consec_low, consec_high, consec_vad_0;
INT16 updates_noise, updates_speech, calls, lev_reset;
FLOAT64 ma_max_noise, ma_max_speech;
FLOAT64 *buffer_smo, *buffer_p, ma_cp;
FLOAT64 *buffer_sum_smo, *buffer_max_smo;
INT16 N_noise_energy_stationarity, consec;
INT16 updates;
FLOAT64 ma_max;
#endif
/*============================================================================*/
/*============================ FCS LIBRARY PROCESSING ========================*/
/*============================================================================*/
#include "lib_fcs.tab"
#ifdef ENC_CMP
INT16 **dyn_track_enc;
INT16 *MaxIdx_enc;
INT16 **track_enc;
FLOAT64 *wsp_m_enc;
FLOAT64 lpcg_m_enc, alpha_enc;
INT16 SVS_flag_m_enc;
FLOAT64 **PHI;
#endif
INT16 **dyn_track;
INT16 *MaxIdx;
INT16 **track;
#ifdef DEC_CMP
INT16 **dyn_track_dec;
INT16 *MaxIdx_dec;
INT16 **track_dec;
FLOAT64 *wsp_m_dec;
FLOAT64 lpcg_m_dec, alpha_dec;
INT16 SVS_flag_m_dec;
#endif
/*----------------------------------------------------------------------------*/
/* 13 bits & 15 bits Encoder */
/*----------------------------------------------------------------------------*/
#ifdef ENC_CMP
FLOAT64 Stab_enc;
#endif
/*----------------------------------------------------------------------------*/
/* 13 bits & 15 bits Decoder */
/*----------------------------------------------------------------------------*/
#ifdef DEC_CMP
FLOAT64 Stab_dec;
INT16 seed_bfi_exc;
#endif
/*============================================================================*/
/*========================= FRAME ERASURE CONCEALEMENT =======================*/
/*============================================================================*/
#ifdef DEC_CMP
INT16 N_bfi, bfh_oh;
INT16 past_bfi, ppast_bfi;
INT16 bfi_caution, nbfi_count;
FLOAT64 *enrg_buff;
FLOAT64 *ext_dec_fec;
#endif
/*============================================================================*/
/*============================== SIGNAL SYNTHESIS ============================*/
/*============================================================================*/
#ifdef ENC_CMP
FLOAT64 *synth_mem, *dif_mem, *target_mem;
#endif
#ifdef DEC_CMP
FLOAT64 *ext_dec, *synth_mem_dec;
FLOAT64 *sigsyn_dec_mem;
#endif
/*============================================================================*/
/*============================== BAD RATE DETECTION ==========================*/
/*============================================================================*/
#ifdef DEC_CMP
INT16 arrayindex, type0count, *type1en;
FLOAT64 maxenergy;
#endif
/*============================================================================*/
/*=============================== BIT-STREAM =================================*/
/*============================================================================*/
#include "lib_bit.tab"
#ifdef DATA
/*============================================================================*/
/*================================= DATA(TTY,DTMF) ===========================*/
/*============================================================================*/
INT16 dtmf_option;
INT16 dtmf_enc_flag;
INT16 dtmf_digit;
INT16 dtmf_digit_last;
INT16 data_mode; /* 0=no data [default],1= 1/2 rate,2=full rate
date+speech,3=full rate data */
INT16 num_data;
INT16 data_buf[DATA_SIZE+5];
#endif
#ifdef WMOPS
/*============================================================================*/
/*============================= WMOPS ESTIMATION =============================*/
/*============================================================================*/
BASIC_OP counter;
BASIC_OP op_weight =
{
1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 18, 25, 25
};
char wc_fn [NB_FUNC_MAX][255];
INT64 wc_frame;
INT64 nbframe;
INT64 glob_wc, wc[NB_FUNC_MAX], fnc_comp [NB_FUNC_MAX];
INT64 LastWOper;
FLOAT64 total_wmops;
#endif
/*============================================================================*/
/*============================= DRAM AND ROM ESTIMATION ======================*/
/*============================================================================*/
#ifdef DRAM_ROM_TEST
INT16 flag_RAM;
INT16 ROM_FLOAT64_counter;
INT16 ROM_INT16_counter;
INT16 RAM_FLOAT64_counter;
INT16 RAM_INT16_counter;
INT16 SP_RAM_FLOAT64_counter;
INT16 SP_RAM_INT16_counter;
INT16 SP_RAM_FLOAT64_max;
INT16 SP_RAM_INT16_max;
#endif
/*============================================================================*/
/*------------------------------------ END -----------------------------------*/
/*============================================================================*/