1 /*
2  ** Copyright 2003-2010, VisualOn, Inc.
3  **
4  ** Licensed under the Apache License, Version 2.0 (the "License");
5  ** you may not use this file except in compliance with the License.
6  ** You may obtain a copy of the License at
7  **
8  **     http://www.apache.org/licenses/LICENSE-2.0
9  **
10  ** Unless required by applicable law or agreed to in writing, software
11  ** distributed under the License is distributed on an "AS IS" BASIS,
12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ** See the License for the specific language governing permissions and
14  ** limitations under the License.
15  */
16 
17 
18 /*--------------------------------------------------------------------------*
19  *                         COD_MAIN.H                                       *
20  *--------------------------------------------------------------------------*
21  *       Static memory in the encoder				            *
22  *--------------------------------------------------------------------------*/
23 #ifndef __COD_MAIN_H__
24 #define __COD_MAIN_H__
25 
26 #include "cnst.h"                          /* coder constant parameters */
27 
28 #include "wb_vad.h"
29 #include "dtx.h"
30 #include "stream.h"
31 #include "voAMRWB.h"
32 
33 typedef struct
34 {
35     Word16 mem_decim[2 * L_FILT16k];       /* speech decimated filter memory */
36     Word16 mem_sig_in[6];                  /* hp50 filter memory */
37     Word16 mem_preemph;                    /* speech preemph filter memory */
38     Word16 old_speech[L_TOTAL - L_FRAME];  /* old speech vector at 12.8kHz */
39     Word16 old_wsp[PIT_MAX / OPL_DECIM];   /* old decimated weighted speech vector */
40     Word16 old_exc[PIT_MAX + L_INTERPOL];  /* old excitation vector */
41     Word16 mem_levinson[M + 2];            /* levinson routine memory */
42     Word16 ispold[M];                      /* old isp (immittance spectral pairs) */
43     Word16 ispold_q[M];                    /* quantized old isp */
44     Word16 past_isfq[M];                   /* past isf quantizer */
45     Word16 mem_wsp;                        /* wsp vector memory */
46     Word16 mem_decim2[3];                  /* wsp decimation filter memory */
47     Word16 mem_w0;                         /* target vector memory */
48     Word16 mem_syn[M];                     /* synthesis memory */
49     Word16 tilt_code;                      /* tilt of code */
50     Word16 old_wsp_max;                    /* old wsp maximum value */
51     Word16 old_wsp_shift;                  /* old wsp shift */
52     Word16 Q_old;                          /* old scaling factor */
53     Word16 Q_max[2];                       /* old maximum scaling factor */
54     Word16 gp_clip[2];                     /* gain of pitch clipping memory */
55     Word16 qua_gain[4];                    /* gain quantizer memory */
56 
57     Word16 old_T0_med;
58     Word16 ol_gain;
59     Word16 ada_w;
60     Word16 ol_wght_flg;
61     Word16 old_ol_lag[5];
62     Word16 hp_wsp_mem[9];
63     Word16 old_hp_wsp[L_FRAME / OPL_DECIM + (PIT_MAX / OPL_DECIM)];
64     VadVars *vadSt;
65     dtx_encState *dtx_encSt;
66     Word16 first_frame;
67     Word16 isfold[M];                      /* old isf (frequency domain) */
68     Word32 L_gc_thres;                     /* threshold for noise enhancer */
69     Word16 mem_syn_hi[M];                  /* modified synthesis memory (MSB) */
70     Word16 mem_syn_lo[M];                  /* modified synthesis memory (LSB) */
71     Word16 mem_deemph;                     /* speech deemph filter memory */
72     Word16 mem_sig_out[6];                 /* hp50 filter memory for synthesis */
73     Word16 mem_hp400[6];                   /* hp400 filter memory for synthesis */
74     Word16 mem_oversamp[2 * L_FILT];       /* synthesis oversampled filter memory */
75     Word16 mem_syn_hf[M];                  /* HF synthesis memory */
76     Word16 mem_hf[2 * L_FILT16k];          /* HF band-pass filter memory */
77     Word16 mem_hf2[2 * L_FILT16k];         /* HF band-pass filter memory */
78     Word16 seed2;                          /* random memory for HF generation */
79     Word16 vad_hist;
80     Word16 gain_alpha;
81     /*  TX_State structure  */
82 	Word16 sid_update_counter;
83     Word16 sid_handover_debt;
84     Word16 prev_ft;
85 	Word16 allow_dtx;
86 	/*some input/output buffer parameters */
87 	unsigned char       *inputStream;
88 	int			        inputSize;
89 	VOAMRWBMODE  		mode;
90 	VOAMRWBFRAMETYPE	frameType;
91 	unsigned short      *outputStream;
92 	int			        outputSize;
93 	FrameStream         *stream;
94 	VO_MEM_OPERATOR     *pvoMemop;
95 	VO_MEM_OPERATOR     voMemoprator;
96 	VO_PTR              hCheck;
97 } Coder_State;
98 
99 typedef void* HAMRENC;
100 
101 #endif  //__COD_MAIN_H__
102 
103 
104