📄 ntt_encode.h
字号:
/*****************************************************************************//* This software module was originally developed by *//* Naoki Iwakami (NTT) *//* Takeshi Norimatsu, *//* Mineo Tsushima, *//* and Tomokazu Ishikawa (Matsushita Electric Industrial Co Ltd.) *//* and edited by *//* Naoki Iwakami (NTT) on 1997-07-17, *//* Akio Jin (NTT), *//* Mineo Tsushima, (Matsushita Electric Industrial Co Ltd.) *//* and Tomokazu Ishikawa (Matsushita Electric Industrial Co Ltd.) *//* in the course of development of the *//* MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and 3. *//* This software module is an implementation of a part of one or more *//* MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4 Audio *//* standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio standards *//* free license to this software module or modifications thereof for use in *//* hardware or software products claiming conformance to the MPEG-2 NBC/ *//* MPEG-4 Audio standards. Those intending to use this software module in *//* hardware or software products are advised that this use may infringe *//* existing patents. The original developer of this software module and *//* his/her company, the subsequent editors and their companies, and ISO/IEC *//* have no liability for use of this software module or modifications *//* thereof in an implementation. Copyright is not released for non *//* MPEG-2 NBC/MPEG-4 Audio conforming products. The original developer *//* retains full right to use the code for his/her own purpose, assign or *//* donate the code to a third party and to inhibit third party from using *//* the code for non MPEG-2 NBC/MPEG-4 Audio conforming products. *//* This copyright notice must be included in all copies or derivative works. *//* Copyright (c)1997. *//*****************************************************************************/#ifndef __ntt_encode_h__#define __ntt_encode_h__#include "tns3.h"#include "bitmux.h"#include "ntt_enc_para.h"/*** MODULE FUNCTION PROTOTYPE(S) ***/#ifdef __cplusplusextern "C" {#endif void ntt_get_wty(int flag, /* Input : trigger for short block length */ int m_flag, /* Input : trigger for medium block length */ WINDOW_SEQUENCE *w_type, /* Output : code index for block type*/ int InitFlag ); /* Control : initialization flag */ void ntt_mchkat48(double in[], /* Input : input signal */ int numChannel, int block_size_samples, int isampf, int *flag,/* Output : trigger for short block length */ int *mflag,/* Output : trigger for medium block length*/ int InitFlag); /* Control : initialization flag */ void ntt_tf_pre_process(/* Input */ double sig[], /* input signal */ /* Output */ ntt_INDEX *indexp, /* code index for block type */ ntt_PARAM *param_ntt, /* encoding parameters */ /* Control */ int med_sw, /* enable/disable flag for medium block length */ int InitFlag); /* initialization flag */ void ntt_win_sw_init(/* Input */ int max_ch, int block_size_samples, int sampling_rate, int bit_rate, int short_win_in_long); void ntt_enc_bark_env(/* Parameters */ int nfr, /* block length */ int nsf, /* number of sub frames */ int n_ch, int n_crb, int *bark_tbl, double bandUpper, int ndiv, /* number of interleave division */ int cb_size, /* codebook size */ int length, double *codev, /* code book */ int len_max, /* codevector memory length */ double prcpt, int prev_fw_code[], /* double *env_memory, double *pdot, */ int *p_w_type, /* Input */ double spectrum[], /* spectrum */ double lpc_spectrum[], /* LPC spectrum */ double pitch_sequence[],/* periodic peak components */ int current_block, /* block length type */ /* Output */ double tc[ntt_T_FR_MAX], /* flattened spectrum */ double pwt[ntt_T_FR_MAX], /* perceptual weight */ int index_fw[], /* indices for Bark-scale envelope coding */ int ind_fw_alf[], double bark_env[]); /* Bark-scale envelope */ void ntt_enc_gaim(/* Input */ double power, /* power to be encoded */ /* Output */ int *index_pow, /* power code index */ double *gain, /* gain */ double *norm); /* power normalize factor */ void ntt_enc_gain(/* Input */ double power, /* power to be encoded */ /* Output */ int *index_pow, /* power code index */ double *gain, /* gain */ double *norm); /* power normalize factor */ void ntt_enc_gain_t(/* Parameters */ int nfr, /* block length */ int nsf, /* number of sub frames */ int n_ch, /* Input */ double bark_env[], /* Bark-scale envelope */ /* In/Out */ double tc[], /* flattened spectrum */ /* Output */ int index_pow[], /* gain code indices */ double gain[]); /* gain factor */ void ntt_enc_gair_p(int *index_pgain, /* Output: power code index */ double powG, /* Input : power of weighted target */ double gain2, /* Input : squared gain of target */ double *g_opt, /* In/Out: optimum gain */ double nume, /*Input: cross power or the orig. & quant. */ double denom); /* Input : power of the orig. regid */ void ntt_enc_pgain(/* Input */ double power, /* power to be encoded */ /* Output */ int *index, /* power code index */ double *pgain, double *norm) ; /* gain */ void ntt_enc_pitch(/* Input */ double spectrum[], /* spectrum */ double lpc_spectrum[], /* LPC spectrum */ int w_type, /* block type */ int numChannel, int block_size_samples, int isampf, double bandUpper, double *pcode, short *pleave0, short *pleave1, /* Output */ int index_pit[], /* indices for periodic peak components coding */ int index_pls[], int index_pgain[], double pitch_component[]); /* periodic peak components */ void ntt_extract_pitch(/* Input */ int index_pit, double pit_seq[], int block_size_samples, int isampf, double bandUpper, /* Output */ double pit_pack[]); void ntt_freq_domain_pre_process(/* Parameters */ int nfr, /* block length */ int nsf, /* number of sub frames */ double band_lower, double band_upper, /* Input */ double spectrum[], /* spectrum */ double lpc_spectrum[], /* LPC spectrum */ /* Output */ double spectrum_out[], /* spectrum */ double lpc_spectrum_out[]); /* LPC spectrum */ void ntt_fw_div(int ndiv, /* Param : number of interleave division */ int length, /* Param : codebook length */ double prcpt, /* Param : perceptual weight */ double env[], /* Input : envelope vector */ double denv[], /* Output : envelope subvector */ double wt[], /* Input : weighting factor vector */ double dwt[], /* Output : weighting factor subvector */ int idiv); /* Param. : division number */ void ntt_fw_sear(/* Parameters */ int cb_size, /* codebook size */ int length, /* codevector length */ double *codev, /* codebook */ int len_max, /* codevector memory length */ /* Input */ double denv[], /* envelope subvector */ double dwt[], /* weight subvector */ /* Output */ int *index, /* quantization index */ double *dmin); /* quant. weighted distortion */ void ntt_fwalfenc(/* Input */ double alf, /* AR prediction coefficients */ /* Output */ double *alfq, /* quantized AR pred. coefficients */ int *ind); /* the index */ void ntt_fwpred(int nfr, /* Param: block size */ int n_crb, /* Param: number of Bark-scale band */ int *bark_tbl, /* Param: Bark-scale table */ double bandUpper, int ndiv, /* Param: number of interleave division */ int cb_size, /* Param: codebook size */ int length, /* Param: codevector length */ double *codev, /* Param: codebook */ int len_max, /* Param: codevector memory length */ double prcpt, /* Param. */ int prev_fw_code[], /*double *penv_tmp,*//*Param:memory for Bark-scale envelope*/ /*double *pdot_tmp,*//*Param:memory for env. calculation */ double iwt[], /* Input: LPC envelope */ double pred[], /* Output : Prediction factor */ double tc[], /* Input: Residual signal */ int index_fw[], /* Output: Envelope VQ indices */ int *ind_fw_alf, /* Output: AR prediction coefficient index */ int i_sup, /* Input: Channel number */ int pred_sw); /* Input: prediction switch */ void ntt_fwvq(/* Parameters */ int ndiv, /* number of interleave division */ int cb_size, /* codebook size */ int length, /* codevector length */ double *codev, /* codebook */ int len_max, /* codevector memory length */ double prcpt, /* perceptual control factor */ /* Input */ double env[], /* the envelope */ double wt[], /* the weighting factor */ /* Output */ int index[]); /* indexes */ void ntt_get_wegt(/* Parameters */ int n_pr, /* Input */ double flsp[], /* Output */ double wegt[]); void ntt_getalf(/* Input */ double *in, /* input sound data */ /* Output */ double *alf, /* alpha parameter */ double *resid); /* power of the residual */ void ntt_lsp_encw(int n_pr, double code[][ntt_N_PR_MAX], double fgcode[][ntt_MA_NP][ntt_N_PR_MAX], int *csize, int prev_lsp_code[], /* double buf_prev[ntt_MA_NP][ntt_N_PR_MAX+1], */ int ma_np, double freq[], /* Input : LSP parameters */ double freqout[], /* Output : quantized LSP parameters */ int index[], /* Output : the optimum LSP code index */ int nsp); void ntt_lsptowt(/* Parameters */ int nfr, /* block length */ int n_pr, int block_size_samples, /* Input */ double lsp[], /* Output */ double wt[], double *cos_TT); double ntt_mulaw(/* Input */ double x, double xmax, double mu); void ntt_opt_gain_p(int i_div, /* Input : division number */ int cb_len, /* Param. : codebook length */ int numChannel, double gt[], /* Input : gain */ double d_targetv[], /* Input : target vector */ double sig_l[], /* Input : decoded residual */ double d_wt[], /* Input : weight */ double nume[], /* Output: cross power (total)*/ double gain[], /* Input : gain of the residual */ double denom[], /* Output: resid. power without gain */ double nume0[], /* Output: cross power (divided) */ double denom0[], /* Output: resid. power without gain */ short *pleave0, short *pleave1); void ntt_pre_dot_p(int cb_len, /* Param. : codebook length */ int i_div, /* Input : division number */ double targetv[], /* Input : target vector */ double d_targetv[], /* Output: target subvector (weighted) */ double wt[], /* Input : weighting vector */ double mwt[], /* Input : perceptual controlled weight */ double gt[], /* Input : gain */ double powG[], /* Output: power of the weighted target */ double d_wt[], /* Output: weighting subvector */ int numChannel, short *pleave0, short *pleave1);void ntt_relspwed(int n_pr, double lsp[ntt_N_PR_MAX+1], double wegt[ntt_N_PR_MAX+1], double lspq[ntt_N_PR_MAX+1], int nstage, int csize[], double code[][ntt_N_PR_MAX], double fg_sum[ntt_N_MODE_MAX][ntt_N_PR_MAX], double target_buf[ntt_N_MODE_MAX][ntt_N_PR_MAX], double out_vec[ntt_N_PR_MAX], int *vqword, int index_lsp[], int nsp); void ntt_sear_ch_p(/* Parameters */ int cb_len, /* codebook length */ int pol_bits0, /* number of polarity bits */ int cb_size0, /* codebook size */ int n_can, /* number of candidates */ /* Input */ double d_targetv[], /* target subvector (weighted) */ double *codevv, /* codebook */ double d_wt[], /* divided weight */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -