1/* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18/****************************************************************************************
19Portions of this file are derived from the following 3GPP standard:
20
21    3GPP TS 26.173
22    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
23    Available from http://www.3gpp.org
24
25(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
26Permission to distribute, modify and use this file under the standard license
27terms listed above has been obtained from the copyright holder.
28****************************************************************************************/
29/*
30
31 Filename: e_pv_amrwbdec.h
32 Funtions:
33
34
35     Date: 05/03/2007
36
37------------------------------------------------------------------------------
38 REVISION HISTORY
39
40
41 Description:
42------------------------------------------------------------------------------
43*/
44
45/*----------------------------------------------------------------------------
46; CONTINUE ONLY IF NOT ALREADY DEFINED
47----------------------------------------------------------------------------*/
48#ifndef E_PV_AMRWBDEC_H
49#define E_PV_AMRWBDEC_H
50
51/*----------------------------------------------------------------------------
52; INCLUDES
53----------------------------------------------------------------------------*/
54
55#include "pvamrwbdecoder_cnst.h"             /* coder constant parameters */
56#include "dtx.h"
57
58/*----------------------------------------------------------------------------
59; MACROS
60; Define module specific macros here
61----------------------------------------------------------------------------*/
62
63/*----------------------------------------------------------------------------
64; DEFINES
65; Include all pre-processor statements here.
66----------------------------------------------------------------------------*/
67
68/*----------------------------------------------------------------------------
69; EXTERNAL VARIABLES REFERENCES
70; Declare variables used in this module but defined elsewhere
71----------------------------------------------------------------------------*/
72
73/*----------------------------------------------------------------------------
74; SIMPLE TYPEDEF'S
75----------------------------------------------------------------------------*/
76
77/*----------------------------------------------------------------------------
78; ENUMERATED TYPEDEF'S
79----------------------------------------------------------------------------*/
80
81/*----------------------------------------------------------------------------
82; STRUCTURES TYPEDEF'S
83----------------------------------------------------------------------------*/
84
85
86typedef struct
87{
88    int16 old_exc[PIT_MAX + L_INTERPOL];  /* old excitation vector */
89    int16 ispold[M];                      /* old isp (immittance spectral pairs)*/
90    int16 isfold[M];                      /* old isf (frequency domain) */
91    int16 isf_buf[L_MEANBUF * M];         /* isf buffer(frequency domain) */
92    int16 past_isfq[M];                   /* past isf quantizer */
93    int16 tilt_code;                      /* tilt of code */
94    int16 Q_old;                          /* old scaling factor */
95    int16 Qsubfr[4];                      /* old maximum scaling factor */
96    int32 L_gc_thres;                     /* threshold for noise enhancer */
97    int16 mem_syn_hi[M];                  /* modified synthesis memory (MSB) */
98    int16 mem_syn_lo[M];                  /* modified synthesis memory (LSB) */
99    int16 mem_deemph;                     /* speech deemph filter memory */
100    int16 mem_sig_out[6];                 /* hp50 filter memory for synthesis */
101    int16 mem_oversamp[2 * L_FILT];       /* synthesis oversampled filter memory */
102    int16 mem_syn_hf[M16k];               /* HF synthesis memory */
103    int16 mem_hf[2 * L_FILT16k];          /* HF band-pass filter memory */
104    int16 mem_hf2[2 * L_FILT16k];         /* HF band-pass filter memory */
105    int16 mem_hf3[2 * L_FILT16k];         /* HF band-pass filter memory */
106    int16 seed;                           /* random memory for frame erasure */
107    int16 seed2;                          /* random memory for HF generation */
108    int16 old_T0;                         /* old pitch lag */
109    int16 old_T0_frac;                    /* old pitch fraction lag */
110    int16 lag_hist[5];
111    int16 dec_gain[23];                   /* gain decoder memory */
112    int16 seed3;                          /* random memory for lag concealment */
113    int16 disp_mem[8];                    /* phase dispersion memory */
114    int16 mem_hp400[6];                   /* hp400 filter memory for synthesis */
115
116    int16 prev_bfi;
117    int16 state;
118    int16 first_frame;
119    dtx_decState dtx_decSt;
120    int16 vad_hist;
121
122} Decoder_State;
123
124typedef struct
125{
126    Decoder_State state;
127    int16 ScratchMem[L_SUBFR + L_SUBFR16k + ((L_SUBFR + M + M16k +1)<<1) + \
128                     (2*L_FRAME + 1) + PIT_MAX + L_INTERPOL + NB_SUBFR*(M+1) \
129                     + 3*(M+L_SUBFR) + M16k];
130} PV_AmrWbDec;
131
132
133/*----------------------------------------------------------------------------
134; END
135----------------------------------------------------------------------------*/
136#endif
137