Git init
[external/opencore-amr.git] / opencore / codecs_v2 / audio / gsm_amr / amr_nb / enc / src / cl_ltp.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
32
33
34  Filename: cl_ltp.h
35
36 ------------------------------------------------------------------------------
37  INCLUDE DESCRIPTION
38
39  This file contains all the constant definitions and prototype definitions
40  needed by the cl_ltp.c
41
42 ------------------------------------------------------------------------------
43 */
44
45 /*----------------------------------------------------------------------------
46 ; CONTINUE ONLY IF NOT ALREADY DEFINED
47 ----------------------------------------------------------------------------*/
48 #ifndef cl_ltp_h
49 #define cl_ltp_h "$Id $"
50
51
52 /*----------------------------------------------------------------------------
53 ; INCLUDES
54 ----------------------------------------------------------------------------*/
55 #include "typedef.h"
56 #include "mode.h"
57 #include "pitch_fr.h"
58 #include "ton_stab.h"
59
60 /*--------------------------------------------------------------------------*/
61 #ifdef __cplusplus
62 extern "C"
63 {
64 #endif
65
66     /*----------------------------------------------------------------------------
67     ; MACROS
68     ; Define module specific macros here
69     ----------------------------------------------------------------------------*/
70
71     /*----------------------------------------------------------------------------
72     ; DEFINES
73     ; Include all pre-processor statements here.
74     ----------------------------------------------------------------------------*/
75
76     /*----------------------------------------------------------------------------
77     ; EXTERNAL VARIABLES REFERENCES
78     ; Declare variables used in this module but defined elsewhere
79     ----------------------------------------------------------------------------*/
80
81     /*----------------------------------------------------------------------------
82     ; SIMPLE TYPEDEF'S
83     ----------------------------------------------------------------------------*/
84
85     /*----------------------------------------------------------------------------
86     ; ENUMERATED TYPEDEF'S
87     ----------------------------------------------------------------------------*/
88
89     /*----------------------------------------------------------------------------
90     ; STRUCTURES TYPEDEF'S
91     ----------------------------------------------------------------------------*/
92
93     /* state variable */
94     typedef struct
95     {
96         Pitch_frState *pitchSt;
97     } clLtpState;
98
99     /*----------------------------------------------------------------------------
100     ; GLOBAL FUNCTION DEFINITIONS
101     ; Function Prototype declaration
102     ----------------------------------------------------------------------------*/
103     Word16 cl_ltp_init(clLtpState **st);
104     /* initialize one instance of the pre processing state.
105        Stores pointer to filter status struct in *st. This pointer has to
106        be passed to cl_ltp in each call.
107        returns 0 on success
108      */
109
110     Word16 cl_ltp_reset(clLtpState *st);
111     /* reset of pre processing state (i.e. set state memory to zero)
112        returns 0 on success
113      */
114     void cl_ltp_exit(clLtpState **st);
115     /* de-initialize pre processing state (i.e. free status struct)
116        stores NULL in *st
117      */
118
119     void cl_ltp(
120         clLtpState *clSt,    /* i/o : State struct                              */
121         tonStabState *tonSt, /* i/o : State struct                              */
122         enum Mode mode,      /* i   : coder mode                                */
123         Word16 frameOffset,  /* i   : Offset to subframe                        */
124         Word16 T_op[],       /* i   : Open loop pitch lags                      */
125         Word16 *h1,          /* i   : Impulse response vector               Q12 */
126         Word16 *exc,         /* i/o : Excitation vector                      Q0 */
127         Word16 res2[],       /* i/o : Long term prediction residual          Q0 */
128         Word16 xn[],         /* i   : Target vector for pitch search         Q0 */
129         Word16 lsp_flag,     /* i   : LSP resonance flag                        */
130         Word16 xn2[],        /* o   : Target vector for codebook search      Q0 */
131         Word16 y1[],         /* o   : Filtered adaptive excitation           Q0 */
132         Word16 *T0,          /* o   : Pitch delay (integer part)                */
133         Word16 *T0_frac,     /* o   : Pitch delay (fractional part)             */
134         Word16 *gain_pit,    /* o   : Pitch gain                            Q14 */
135         Word16 g_coeff[],    /* o   : Correlations between xn, y1, & y2         */
136         Word16 **anap,       /* o   : Analysis parameters                       */
137         Word16 *gp_limit,    /* o   : pitch gain limit                          */
138         const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table         */
139         Flag   *pOverflow    /* o   : overflow indicator                        */
140     );
141
142     /*----------------------------------------------------------------------------
143     ; END
144     ----------------------------------------------------------------------------*/
145 #ifdef __cplusplus
146 }
147 #endif
148
149 #endif /* _CL_LTP_H_ */
150