q_plsf.h revision 4f1efc098cb5791c3e9f483f2af84aef70d2d0a0
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.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)
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: /audio/gsm_amr/c/include/q_plsf.h
32
33------------------------------------------------------------------------------
34 REVISION HISTORY
35
36 Description: Placed header file in the proper template format.  Added
37 parameter pOverflow for the basic math ops.
38
39 Description:  Replaced "int" and/or "char" with OSCL defined types.
40
41 Description: Moved _cplusplus #ifdef after Include section.
42
43 Who:                       Date:
44 Description:
45
46------------------------------------------------------------------------------
47 INCLUDE DESCRIPTION
48
49 This file contains all the constant definitions and prototype definitions
50 needed by the q_plsf_3.c and q_plsf_5.c
51
52------------------------------------------------------------------------------
53*/
54
55/*----------------------------------------------------------------------------
56; CONTINUE ONLY IF NOT ALREADY DEFINED
57----------------------------------------------------------------------------*/
58#ifndef q_plsf_h
59#define q_plsf_h "$Id $"
60
61/*----------------------------------------------------------------------------
62; INCLUDES
63----------------------------------------------------------------------------*/
64#include "typedef.h"
65#include "cnst.h"
66#include "mode.h"
67
68/*--------------------------------------------------------------------------*/
69#ifdef __cplusplus
70extern "C"
71{
72#endif
73
74    /*----------------------------------------------------------------------------
75    ; MACROS
76    ; Define module specific macros here
77    ----------------------------------------------------------------------------*/
78
79    /*----------------------------------------------------------------------------
80    ; DEFINES
81    ; Include all pre-processor statements here.
82    ----------------------------------------------------------------------------*/
83#define MR795_1_SIZE  512
84#define PAST_RQ_INIT_SIZE 8
85
86#define DICO1_SIZE  256
87#define DICO2_SIZE  512
88#define DICO3_SIZE  512
89
90#define DICO1_5_SIZE  128
91#define DICO2_5_SIZE  256
92#define DICO3_5_SIZE  256
93#define DICO4_5_SIZE  256
94#define DICO5_5_SIZE  64
95
96#define MR515_3_SIZE  128
97
98    /*----------------------------------------------------------------------------
99    ; EXTERNAL VARIABLES REFERENCES
100    ; Declare variables used in this module but defined elsewhere
101    ----------------------------------------------------------------------------*/
102
103    /*----------------------------------------------------------------------------
104    ; SIMPLE TYPEDEF'S
105    ----------------------------------------------------------------------------*/
106
107    /*----------------------------------------------------------------------------
108    ; ENUMERATED TYPEDEF'S
109    ----------------------------------------------------------------------------*/
110
111    /*----------------------------------------------------------------------------
112    ; STRUCTURES TYPEDEF'S
113    ----------------------------------------------------------------------------*/
114    typedef struct
115    {
116        Word16 past_rq[M];    /* Past quantized prediction error, Q15 */
117
118    } Q_plsfState;
119
120    /*----------------------------------------------------------------------------
121    ; GLOBAL FUNCTION DEFINITIONS
122    ; Function Prototype declaration
123    ----------------------------------------------------------------------------*/
124
125    Word16 Q_plsf_init(Q_plsfState **st);
126    /* initialize one instance of the state.
127       Stores pointer to filter status struct in *st. This pointer has to
128       be passed to Q_plsf_5 / Q_plsf_3 in each call.
129       returns 0 on success
130     */
131
132    Word16 Q_plsf_reset(Q_plsfState *st);
133    /* reset of state (i.e. set state memory to zero)
134       returns 0 on success
135     */
136
137    void Q_plsf_exit(Q_plsfState **st);
138    /* de-initialize state (i.e. free status struct)
139       stores NULL in *st
140     */
141
142    void Q_plsf_3(
143        Q_plsfState *st,    /* i/o: state struct                             */
144        enum Mode mode,     /* i  : coder mode                               */
145        Word16 *lsp1,       /* i  : 1st LSP vector                      Q15  */
146        Word16 *lsp1_q,     /* o  : quantized 1st LSP vector            Q15  */
147        Word16 *indice,     /* o  : quantization indices of 3 vectors   Q0   */
148        Word16 *pred_init_i,/* o  : init index for MA prediction in DTX mode */
149        Flag  *pOverflow    /* o : Flag set when overflow occurs             */
150    );
151
152    void Q_plsf_5(
153        Q_plsfState *st,
154        Word16 *lsp1,      /* i  : 1st LSP vector,                     Q15 */
155        Word16 *lsp2,      /* i  : 2nd LSP vector,                     Q15 */
156        Word16 *lsp1_q,    /* o  : quantized 1st LSP vector,           Q15 */
157        Word16 *lsp2_q,    /* o  : quantized 2nd LSP vector,           Q15 */
158        Word16 *indice,    /* o  : quantization indices of 5 matrices, Q0  */
159        Flag  *pOverflow   /* o : Flag set when overflow occurs            */
160    );
161    /*----------------------------------------------------------------------------
162    ; END
163    ----------------------------------------------------------------------------*/
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* _Q_PLSF_H_ */
169
170