www.pudn.com > g729Decoder.rar > Const.h


;*--------------------------------------------------------------* 
;* const.h 
;* ~~~~~~ 
;* Constants use in G.729A 
;* 
;*--------------------------------------------------------------* 
 
;-------------------------------------------------------------------------- 
;  Maximum and minimum 
;-------------------------------------------------------------------------- 
MAX_16        .set    07fffh 
MIN_16        .set    08000h 
;*-------------------------------------------------------------------------- 
;*       Codec constant parameters (coder, decoder, and postfilter) 
;*-------------------------------------------------------------------------- 
 
L_TOTAL       .set    240        ;/* Total size of speech buffer.              */ 
L_WINDOW      .set    240        ;/* Window size in LP analysis.               */ 
L_NEXT        .set    40         ;/* Lookahead in LP analysis.                 */ 
L_FRAME       .set    80         ;/* Frame size.                               */ 
L_SUBFR       .set    40         ;/* Subframe size.                            */ 
M             .set    10         ;/* Order of LP filter.                       */ 
MP1           .set    (M+1)      ;/* Order of LP filter + 1                    */ 
MM1           .set    (M-1)      ;/* Order of LP filter - 1                    */ 
PIT_MIN       .set    20         ;/* Minimum pitch lag.                        */ 
PIT_MAX       .set    143        ;/* Maximum pitch lag.                        */ 
L_INTERPOL    .set    (10+1)     ;/* Length of filter for interpolation.       */ 
 
PRM_SIZE      .set   11         ;/* Size of vector of analysis parameters.    */ 
SERIAL_SIZE   .set   (80+2)     ;/* Bits/frame + bfi+ number of speech bits   */ 
 
SHARPMAX      .set   13017      ;/* Maximum value of pitch sharpening 0.8 Q14 */ 
SHARPMIN      .set   3277       ;/* Minimum value of pitch sharpening 0.2 Q14 */ 
 
L_SUBFRP1     .set   (L_SUBFR + 1) 
 
GPCLIP        .set   15564      ;/* Maximum pitch gain if taming is needed Q14*/ 
GPCLIP2       .set   481        ;/* Maximum pitch gain if taming is needed Q9 */ 
GP0999        .set   16383      ;/* Maximum pitch gain if taming is needed    */ 
;L_THRESH_ERR  .set   983040000L ;/* Error threshold taming 16384. * 60000.   */ 
THRESH_ERR    .set   30000      ; THRESH_ERR = L_THRESH_ERR >> 15 
 
;*-------------------------------------------------------------------------- 
;*       PWF constant parameters 
;*-------------------------------------------------------------------------- 
 
A1_Q11      .set   4567       ;/*  2.23   in Q11                            */ 
A2_Q11      .set   11776      ;/*  5.75   in Q11                             */ 
A3_Q11      .set   27443      ;/* 13.40   in Q11                            */ 
 
;L_B1        .set   3194L   ;/*  0.78   in Q22                            */ 
;L_B2        .set   15924L  ;/*  3.90   in Q22                            */ 
;L_B3        .set   54886L  ;/* 11.16   in Q22                            */ 
SEG1        .set   1299       ;/*  0.6341 in Q11                            */ 
SEG2        .set   1815       ;/*  0.8864 in Q11                            */ 
SEG3        .set   1944       ;/*  0.9490 in Q11                            */ 
 
B1_Q11      .set   1597 
B2_Q11      .set   7987 
B3_Q11      .set   22856 
;SEG1        .set   20778      ;/*  0.6341 in Q15                            */ 
;SEG2        .set   29046      ;/*  0.8864 in Q15                            */ 
;SEG3        .set   31097      ;/*  0.9490 in Q15                            */ 
 
THRESH_L1   .set   -3562      ;/* -1.74   in Q11                            */ 
THRESH_L2   .set   -3116      ;/* -1.52   in Q11                            */ 
THRESH_H1   .set   1336       ;/*  0.65   in Q11                            */ 
THRESH_H2   .set   890        ;/*  0.43   in Q11                            */ 
 
;GAMMA1_0    .set   32113      ;/*  0.98   in Q15                            */ 
;GAMMA1_1    .set   30802      ;/*  0.94   in Q15                            */ 
;GAMMA2_0_L  .set   13107      ;/*  0.40   in Q15                            */ 
;GAMMA2_0_H  .set   22938      ;/*  0.70   in Q15                            */ 
;GAMMA2_1    .set   19661      ;/*  0.60   in Q15                            */ 
 
ALPHA       .set   19302      ;/*  6*pi   in Q10                            */ 
BETA        .set   1024       ;/*     1   in Q10                            */ 
 
;*-------------------------------------------------------------------------- 
;*       LTP constant parameters 
;*-------------------------------------------------------------------------- 
 
THRESHPIT    .set   27853      ;/* Threshold to favor small pitch 0.85  Q15  */ 
UP_SAMP      .set   3          ;/* upsampling factor for fractional pitch    */ 
L_INTER4     .set   4          ;/* length/2 for interpolation filter         */ 
FIR_SIZE_ANA .set   (UP_SAMP*L_INTER4+1) 
L_INTER10    .set   10         ;/* length/2 for interpolation filter         */ 
FIR_SIZE_SYN .set   (UP_SAMP*L_INTER10+1) 
 
;*-------------------------------------------------------------------------- 
;* fixed codebook excitation. 
;*-------------------------------------------------------------------------- 
 
;*-------------------------------------------------------------------------- 
;*       FCB constant parameters 
;*-------------------------------------------------------------------------- 
 
DIM_RR      .set   616        ;/* size of correlation matrix                */ 
NB_POS      .set   8          ;/*                                           */ 
STEP        .set   5          ;/* spacing for individual pulse              */ 
MSIZE       .set   64 
THRESHFCB   .set   13107      ;/* 0.4 in Q15                                */ 
MAX_TIME    .set   75         ;/* maximum number of iterations              */ 
 
 
;*------------------------------------------------------------------------- 
;*       LSP quantizer constant parameters 
;*------------------------------------------------------------------------- 
 
NC          .set   5          ;/*  NC = M/2                                 */ 
MA_NP       .set   4          ;/* MA prediction order for LSP               */ 
MODE        .set   2          ;/* number of modes for MA prediction         */ 
NC0_B       .set   7          ;/* number of first stage bits                */ 
NC1_B       .set   5          ;/* number of second stage bits               */ 
NC0         .set   (1<0 (Q15)     */ 
GAMMA3_MINUS .set   29491      ;/* tilt weighting factor when k1<0 (Q15)     */ 
 
;/* long term pst parameters :                                               */ 
F_UP_PST     .set   8          ;/* resolution for fractional delay           */ 
LH2_S        .set   4          ;/* length of short interp. subfilters        */ 
L2_LH2_L     .set   4          ;/* log2(LH2_L)                               */ 
LH2_L        .set   (1 << L2_LH2_L) 
MIN_GPLT     .set   21845      ;/* LT gain minimum (Q15)                     */ 
 
LH_UP_S      .set   (LH2_S/2) 
LH_UP_SM1    .set   (LH_UP_S-1) 
LH_UP_L      .set   (LH2_L/2) 
LH2_L_P1     .set   (LH2_L + 1) 
 
;/* gain adjustment parameters                                               */ 
AGC_FAC      .set   32358     ;/* gain adjustment factor  0.9875 (Q15)       */ 
AGC_FAC1     .set   32768 - AGC_FAC 
 
;/* Array sizes */ 
MEM_RES2      .set   (PIT_MAX + 1 + LH_UP_L) 
SIZ_RES2      .set   (MEM_RES2 + L_SUBFR) 
SIZ_Y_UP      .set   ((F_UP_PST-1) * L_SUBFRP1) 
SIZ_TAB_HUP_L .set   ((F_UP_PST-1) * LH2_L) 
SIZ_TAB_HUP_S .set   ((F_UP_PST-1) * LH2_S) 
 
;*------------------------------------------------------------------------- 
;* Bitstream constants and functions 
;*-------------------------------------------------------------------------- 
 
BIT_0     .set   0x007f ;/* definition of zero-bit in bit-stream      */ 
BIT_1     .set   0x0081 ;/* definition of one-bit in bit-stream       */ 
SYNC_WORD .set   0x6b21 ;/* definition of frame erasure flag         */ 
SIZE_WORD .set   80     ;/* number of speech bits                    */ 
 
Sig1	 .set     1 
Algthm  .set     35 
Fixed    .set     120 
Tame	 .set     128 
Pitch    .set     1835 
Lsp  	 .set     2232 
Speech	 .set     3750