Git init
[external/opencore-amr.git] / opencore / codecs_v2 / audio / gsm_amr / amr_nb / common / include / q_plsf.h
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 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
20
21     3GPP TS 26.073
22     ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23     Available from http://www.3gpp.org
24
25 (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
26 Permission to distribute, modify and use this file under the standard license
27 terms listed above has been obtained from the copyright holder.
28 ****************************************************************************************/
29 /*
30
31  Filename: q_plsf.h
32
33 ------------------------------------------------------------------------------
34  INCLUDE DESCRIPTION
35
36  This file contains all the constant definitions and prototype definitions
37  needed by the q_plsf_3.c and q_plsf_5.c
38
39 ------------------------------------------------------------------------------
40 */
41
42 /*----------------------------------------------------------------------------
43 ; CONTINUE ONLY IF NOT ALREADY DEFINED
44 ----------------------------------------------------------------------------*/
45 #ifndef q_plsf_h
46 #define q_plsf_h "$Id $"
47
48 /*----------------------------------------------------------------------------
49 ; INCLUDES
50 ----------------------------------------------------------------------------*/
51 #include "typedef.h"
52 #include "cnst.h"
53 #include "mode.h"
54
55 /*--------------------------------------------------------------------------*/
56 #ifdef __cplusplus
57 extern "C"
58 {
59 #endif
60
61     /*----------------------------------------------------------------------------
62     ; MACROS
63     ; Define module specific macros here
64     ----------------------------------------------------------------------------*/
65
66     /*----------------------------------------------------------------------------
67     ; DEFINES
68     ; Include all pre-processor statements here.
69     ----------------------------------------------------------------------------*/
70 #define MR795_1_SIZE  512
71 #define PAST_RQ_INIT_SIZE 8
72
73 #define DICO1_SIZE  256
74 #define DICO2_SIZE  512
75 #define DICO3_SIZE  512
76
77 #define DICO1_5_SIZE  128
78 #define DICO2_5_SIZE  256
79 #define DICO3_5_SIZE  256
80 #define DICO4_5_SIZE  256
81 #define DICO5_5_SIZE  64
82
83 #define MR515_3_SIZE  128
84
85     /*----------------------------------------------------------------------------
86     ; EXTERNAL VARIABLES REFERENCES
87     ; Declare variables used in this module but defined elsewhere
88     ----------------------------------------------------------------------------*/
89
90     /*----------------------------------------------------------------------------
91     ; SIMPLE TYPEDEF'S
92     ----------------------------------------------------------------------------*/
93
94     /*----------------------------------------------------------------------------
95     ; ENUMERATED TYPEDEF'S
96     ----------------------------------------------------------------------------*/
97
98     /*----------------------------------------------------------------------------
99     ; STRUCTURES TYPEDEF'S
100     ----------------------------------------------------------------------------*/
101     typedef struct
102     {
103         Word16 past_rq[M];    /* Past quantized prediction error, Q15 */
104
105     } Q_plsfState;
106
107     /*----------------------------------------------------------------------------
108     ; GLOBAL FUNCTION DEFINITIONS
109     ; Function Prototype declaration
110     ----------------------------------------------------------------------------*/
111
112     Word16 Q_plsf_init(Q_plsfState **st);
113     /* initialize one instance of the state.
114        Stores pointer to filter status struct in *st. This pointer has to
115        be passed to Q_plsf_5 / Q_plsf_3 in each call.
116        returns 0 on success
117      */
118
119     Word16 Q_plsf_reset(Q_plsfState *st);
120     /* reset of state (i.e. set state memory to zero)
121        returns 0 on success
122      */
123
124     void Q_plsf_exit(Q_plsfState **st);
125     /* de-initialize state (i.e. free status struct)
126        stores NULL in *st
127      */
128
129     OSCL_IMPORT_REF void Q_plsf_3(
130         Q_plsfState *st,    /* i/o: state struct                             */
131         enum Mode mode,     /* i  : coder mode                               */
132         Word16 *lsp1,       /* i  : 1st LSP vector                      Q15  */
133         Word16 *lsp1_q,     /* o  : quantized 1st LSP vector            Q15  */
134         Word16 *indice,     /* o  : quantization indices of 3 vectors   Q0   */
135         Word16 *pred_init_i,/* o  : init index for MA prediction in DTX mode */
136         Flag  *pOverflow    /* o : Flag set when overflow occurs             */
137     );
138
139     OSCL_IMPORT_REF void Q_plsf_5(
140         Q_plsfState *st,
141         Word16 *lsp1,      /* i  : 1st LSP vector,                     Q15 */
142         Word16 *lsp2,      /* i  : 2nd LSP vector,                     Q15 */
143         Word16 *lsp1_q,    /* o  : quantized 1st LSP vector,           Q15 */
144         Word16 *lsp2_q,    /* o  : quantized 2nd LSP vector,           Q15 */
145         Word16 *indice,    /* o  : quantization indices of 5 matrices, Q0  */
146         Flag  *pOverflow   /* o : Flag set when overflow occurs            */
147     );
148     /*----------------------------------------------------------------------------
149     ; END
150     ----------------------------------------------------------------------------*/
151 #ifdef __cplusplus
152 }
153 #endif
154
155 #endif /* _Q_PLSF_H_ */
156