⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ld8k.h

📁 ITU-T G.729 Source code(已经验证过的)
💻 H
📖 第 1 页 / 共 3 页
字号:

void Syn_filt(
  Word16 a[],       /* (i) Q12 : a[m+1] prediction coefficients   (m=10)    */
  Word16 x[],       /* (i)     : input signal                               */
  Word16 y[],       /* (o)     : output signal                              */
  Word16 lg,        /* (i)     : size of filtering                          */
  Word16 mem[],     /* (i/o)   : memory associated with this filtering.     */
  Word16 update     /* (i)     : 0=no update, 1=update of memory.           */
);

void Convolve(
  Word16 x[],       /* (i)     : input vector                               */
  Word16 h[],       /* (i) Q12 : impulse response                           */
  Word16 y[],       /* (o)     : output vector                              */
  Word16 L          /* (i)     : vector size                                */
);

/*--------------------------------------------------------------------------*
 *       LTP constant parameters                                            *
 *--------------------------------------------------------------------------*/

#define THRESHPIT   27853      /* Threshold to favor small pitch 0.85  Q15  */
#define UP_SAMP     3          /* upsampling factor for fractional pitch    */
#define L_INTER4    4          /* length/2 for interpolation filter         */
#define FIR_SIZE_ANA (UP_SAMP*L_INTER4+1)
#define L_INTER10   10         /* length/2 for interpolation filter         */
#define FIR_SIZE_SYN (UP_SAMP*L_INTER10+1)

/*--------------------------------------------------------------------------*
 * Pitch functions.                                                         *
 *--------------------------------------------------------------------------*/

  Word16 Pitch_ol(  /* (o)     : open loop pitch lag                        */
  Word16 signal[],  /* (i)     : signal used to compute the open loop pitch */
                    /*       signal[-pit_max] to signal[-1] should be known */
  Word16 pit_min,   /* (i)     : minimum pitch lag                          */
  Word16 pit_max,   /* (i)     : maximum pitch lag                          */
  Word16 L_frame    /* (i)     : length of frame to compute pitch           */
);

  Word16 Pitch_fr3( /* (o)     : pitch period.                              */
  Word16 exc[],     /* (i)     : excitation buffer                          */
  Word16 xn[],      /* (i)     : target vector                              */
  Word16 h[],       /* (i) Q12 : impulse response of filters.               */
  Word16 L_subfr,   /* (i)     : length of subframe                         */
  Word16 t0_min,    /* (i)     : minimum value in the searched range.       */
  Word16 t0_max,    /* (i)     : maximum value in the searched range.       */
  Word16 i_subfr,   /* (i)     : indicator for first subframe.              */
  Word16 *pit_frac  /* (o)     : chosen fraction.                           */
);

Word16 G_pitch(     /* (o) Q14 : Gain of pitch lag saturated to 1.2         */
  Word16 xn[],      /* (i)     : Pitch target.                              */
  Word16 y1[],      /* (i)     : Filtered adaptive codebook.                */
  Word16 g_coeff[], /* (i)     : Correlations need for gain quantization.   */
  Word16 L_subfr    /* (i)     : Length of subframe.                        */
);

Word16 Enc_lag3(    /* (o)     : Return index of encoding                   */
  Word16 T0,        /* (i)     : Pitch delay                                */
  Word16 T0_frac,   /* (i)     : Fractional pitch delay                     */
  Word16 *T0_min,   /* (i/o)   : Minimum search delay                       */
  Word16 *T0_max,   /* (i/o)   : Maximum search delay                       */
  Word16 pit_min,   /* (i)     : Minimum pitch delay                        */
  Word16 pit_max,   /* (i)     : Maximum pitch delay                        */
  Word16 pit_flag   /* (i)     : Flag for 1st subframe                      */
);

void Dec_lag3(      /* (o)     : return integer pitch lag                   */
  Word16 index,     /* (i)     : received pitch index                       */
  Word16 pit_min,   /* (i)     : minimum pitch lag                          */
  Word16 pit_max,   /* (i)     : maximum pitch lag                          */
  Word16 i_subfr,   /* (i)     : subframe flag                              */
  Word16 *T0,       /* (o)     : integer part of pitch lag                  */
  Word16 *T0_frac   /* (o)     : fractional part of pitch lag               */
);

Word16 Interpol_3(  /* (o)     : interpolated value                         */
  Word16 *x,        /* (i)     : input vector                               */
  Word16 frac       /* (i)     : fraction                                   */
);

void Pred_lt_3(
  Word16 exc[],     /* (i/o)   : excitation buffer                          */
  Word16 T0,        /* (i)     : integer pitch lag                          */
  Word16 frac,      /* (i)     : fraction of lag                            */
  Word16 L_subfr    /* (i)     : subframe size                              */
);

Word16 Parity_Pitch( /* (o)    : parity bit (XOR of 6 MSB bits)             */
  Word16 pitch_index /* (i)    : index for which parity to compute          */
);

Word16 Check_Parity_Pitch( /* (o) : 0 = no error, 1= error                  */
  Word16 pitch_index, /* (i)   : index of parameter                         */
  Word16 parity       /* (i)   : parity bit                                 */
);

/*--------------------------------------------------------------------------*
 * fixed codebook excitation.                                               *
 *--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------*
 *       FCB constant parameters                                            *
 *--------------------------------------------------------------------------*/

#define DIM_RR      616        /* size of correlation matrix                */
#define NB_POS      8          /*                                           */
#define STEP        5          /* spacing for individual pulse              */
#define MSIZE       64
#define THRESHFCB   13107      /* 0.4 in Q15                                */
#define MAX_TIME    75         /* maximum number of iterations              */

/*--------------------------------------------------------------------------*
 * FCB functions.                                                           *
 *--------------------------------------------------------------------------*/

Word16 ACELP_Codebook( /* (o)  : index of pulses positions                  */
  Word16 x[],       /* (i)     : Target vector                              */
  Word16 h[],       /* (i) Q12 : Impulse response of filters                */
  Word16 T0,        /* (i)     : Pitch lag                                  */
  Word16 pitch_sharp,/* (i) Q14: Last quantized pitch gain                  */
  Word16 i_subfr,   /* (i)     : Indicator of 1st subframe,                 */
  Word16 code[],    /* (o) Q13 : Innovative codebook                        */
  Word16 y[],       /* (o) Q12 : Filtered innovative codebook               */
  Word16 *sign      /* (o)     : Signs of 4 pulses                          */
);

void Decod_ACELP(
  Word16 sign,      /* (i)     : signs of 4 pulses.                         */
  Word16 index,     /* (i)     : Positions of the 4 pulses.                 */
  Word16 cod[]      /* (o) Q13 : algebraic (fixed) codebook excitation      */
);

/*--------------------------------------------------------------------------*
 *       LSP quantizer constant parameters                                  *
 *--------------------------------------------------------------------------*/

#define NC          5          /*  NC = M/2                                 */
#define MA_NP       4          /* MA prediction order for LSP               */
#define MODE        2          /* number of modes for MA prediction         */
#define NC0_B       7          /* number of first stage bits                */
#define NC1_B       5          /* number of second stage bits               */
#define NC0         (1<<NC0_B) /* number of entries in first stage          */
#define NC1         (1<<NC1_B) /* number of entries in second stage         */

#define L_LIMIT     40         /* minimum lsf value Q13:0.005               */
#define M_LIMIT     25681      /* maximum lsf value Q13:3.135               */

#define GAP1        10         /* bandwidth expansion factor Q13            */
#define GAP2        5          /* bandwidth expansion factor Q13            */
#define GAP3        321        /* bandwidth expansion factor Q13            */
#define GRID_POINTS 60         /* search grid                               */

#define PI04        ((Word16)1029)       /* Q13  pi*0.04                    */
#define PI92        ((Word16)23677)      /* Q13  pi*0.92                    */
#define CONST10     ((Word16)10*(1<<11)) /* Q11  10.0                       */
#define CONST12     ((Word16)19661)      /* Q14  1.2                        */

/*--------------------------------------------------------------------------*
 * LSP VQ functions.                                                        *
 *--------------------------------------------------------------------------*/

void Lsf_lsp2(
  Word16 lsf[],     /* (i) Q13 : lsf[m] (range: 0.0<=val<PI)                */
  Word16 lsp[],     /* (o) Q15 : lsp[m] (range: -1<=val<1)                  */
  Word16 m          /* (i)     : LPC order                                  */
);

void Lsp_lsf2(
  Word16 lsp[],     /* (i) Q15 : lsp[m] (range: -1<=val<1)                  */
  Word16 lsf[],     /* (o) Q13 : lsf[m] (range: 0.0<=val<PI)                */
  Word16 m          /* (i)     : LPC order                                  */
);

void Qua_lsp(
  Word16 lsp[],     /* (i) Q15 : Unquantized LSP                            */
  Word16 lsp_q[],   /* (o) Q15 : Quantized LSP                              */
  Word16 ana[]      /* (o)     : indexes                                    */
);

void Get_wegt(
  Word16 flsp[],    /* (i) Q13 :                                            */
  Word16 wegt[]     /* (o) Q11 :  normalized                                */
);

void Lsp_encw_reset( void);

void Lsp_qua_cs(
  Word16 flsp_in[M],  /* Q13 */
  Word16 lspq_out[M], /* Q13 */
  Word16 *code
);

void Lsp_expand_1(
  Word16 buf[],     /* Q13 */
  Word16 gap        /* Q13 */
);

void Lsp_expand_2(
  Word16 buf[],     /* Q13 */
  Word16 gap        /* Q13 */
);

void Lsp_expand_1_2(
  Word16 buf[],     /* Q13 */
  Word16 gap        /* Q13 */
);

void Lsp_get_quant(
  Word16 lspcb1[][M],    /* Q13 */
  Word16 lspcb2[][M],    /* Q13 */
  Word16 code0,
  Word16 code1,
  Word16 code2,
  Word16 fg[][M],        /* Q15 */
  Word16 freq_prev[][M], /* Q13 */
  Word16 lspq[],            /* Q13 */
  Word16 fg_sum[]           /* Q15 */
);

void Lsp_get_tdist(
  Word16 wegt[],    /* normalized */
  Word16 buf[],     /* Q13 */
  Word32 *L_tdist,  /* Q27 */
  Word16 rbuf[],    /* Q13 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -