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/lsp_avg.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: Moved _cplusplus #ifdef after Include section.
40
41 Who:                       Date:
42 Description:
43
44------------------------------------------------------------------------------
45 INCLUDE DESCRIPTION
46
47 This file contains all the constant definitions and prototype definitions
48 needed by the lsp_avg.c
49
50------------------------------------------------------------------------------
51*/
52
53/*----------------------------------------------------------------------------
54; CONTINUE ONLY IF NOT ALREADY DEFINED
55----------------------------------------------------------------------------*/
56#ifndef int_lpc_h
57#define int_lpc_h "$Id $"
58
59/*----------------------------------------------------------------------------
60; INCLUDES
61----------------------------------------------------------------------------*/
62#include "typedef.h"
63
64/*--------------------------------------------------------------------------*/
65#ifdef __cplusplus
66extern "C"
67{
68#endif
69
70    /*----------------------------------------------------------------------------
71    ; MACROS
72    ; Define module specific macros here
73    ----------------------------------------------------------------------------*/
74
75    /*----------------------------------------------------------------------------
76    ; DEFINES
77    ; Include all pre-processor statements here.
78    ----------------------------------------------------------------------------*/
79
80    /*----------------------------------------------------------------------------
81    ; EXTERNAL VARIABLES REFERENCES
82    ; Declare variables used in this module but defined elsewhere
83    ----------------------------------------------------------------------------*/
84
85    /*----------------------------------------------------------------------------
86    ; SIMPLE TYPEDEF'S
87    ----------------------------------------------------------------------------*/
88
89    /*----------------------------------------------------------------------------
90    ; ENUMERATED TYPEDEF'S
91    ----------------------------------------------------------------------------*/
92
93    /*----------------------------------------------------------------------------
94    ; STRUCTURES TYPEDEF'S
95    ----------------------------------------------------------------------------*/
96
97    /*----------------------------------------------------------------------------
98    ; GLOBAL FUNCTION DEFINITIONS
99    ; Function Prototype declaration
100    ----------------------------------------------------------------------------*/
101
102    /*
103    **************************************************************************
104    *
105    *  Function    : Int_lpc_1and3
106    *  Purpose     : Interpolates the LSPs and converts to LPC parameters
107    *                to get a different LP filter in each subframe.
108    *  Description : The 20 ms speech frame is divided into 4 subframes.
109    *                The LSPs are quantized and transmitted at the 2nd and
110    *                4th subframes (twice per frame) and interpolated at the
111    *                1st and 3rd subframe.
112    *
113    *                      |------|------|------|------|
114    *                         sf1    sf2    sf3    sf4
115    *                   F0            Fm            F1
116    *
117    *                 sf1:   1/2 Fm + 1/2 F0         sf3:   1/2 F1 + 1/2 Fm
118    *                 sf2:       Fm                  sf4:       F1
119    *  Returns     : void
120    *
121    **************************************************************************
122    */
123    void Int_lpc_1and3(
124        Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
125        Word16 lsp_mid[],  /* i : LSP vector at the 2nd subfr. of
126                              present frame (M)                              */
127        Word16 lsp_new[],  /* i : LSP vector at the 4th subfr. of
128                              present frame (M)                              */
129        Word16 Az[],       /* o : interpolated LP parameters in all subfr.
130                              (AZ_SIZE)                                      */
131        Flag   *pOverflow
132    );
133
134    /*
135    **************************************************************************
136    *
137    *  Function    : Int_lpc_1and3_2
138    *  Purpose     : Interpolation of the LPC parameters. Same as the Int_lpc
139    *                function but we do not recompute Az() for subframe 2 and
140    *                4 because it is already available.
141    *  Returns     : void
142    *
143    **************************************************************************
144    */
145    void Int_lpc_1and3_2(
146        Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
147        Word16 lsp_mid[],  /* i : LSP vector at the 2nd subframe of
148                             present frame (M)                                  */
149        Word16 lsp_new[],  /* i : LSP vector at the 4th subframe of
150                             present frame (M)                                  */
151        Word16 Az[],       /* o :interpolated LP parameters
152                             in subframes 1 and 3 (AZ_SIZE)                     */
153        Flag   *pOverflow
154    );
155
156    /*
157    **************************************************************************
158    *
159    *  Function    : Int_lpc_1to3
160    *  Purpose     : Interpolates the LSPs and converts to LPC parameters
161    *                to get a different LP filter in each subframe.
162    *  Description : The 20 ms speech frame is divided into 4 subframes.
163    *                The LSPs are quantized and transmitted at the 4th
164    *                subframes (once per frame) and interpolated at the
165    *                1st, 2nd and 3rd subframe.
166    *
167    *                      |------|------|------|------|
168    *                         sf1    sf2    sf3    sf4
169    *                   F0                          F1
170    *
171    *                 sf1:   3/4 F0 + 1/4 F1         sf3:   1/4 F0 + 3/4 F1
172    *                 sf2:   1/2 F0 + 1/2 F1         sf4:       F1
173    *  Returns     : void
174    *
175    **************************************************************************
176    */
177    void Int_lpc_1to3(
178        Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M)      */
179        Word16 lsp_new[], /* i : LSP vector at the 4th SF of present frame (M)   */
180        Word16 Az[],      /* o : interpolated LP parameters in all SFs (AZ_SIZE) */
181        Flag   *pOverflow
182    );
183
184    /*
185    **************************************************************************
186    *
187    *  Function    : Int_lpc_1to3_2
188    *  Purpose     : Interpolation of the LPC parameters. Same as the Int_lpc
189    *                function but we do not recompute Az() for subframe 4
190    *                because it is already available.
191    *  Returns     : void
192    *
193    **************************************************************************
194    */
195    void Int_lpc_1to3_2(
196        Word16 lsp_old[],  /* i : LSP vector at the 4th SF of past frame (M) */
197        Word16 lsp_new[],  /* i : LSP vector at the 4th SF present frame (M) */
198        Word16 Az[],       /* o :interpolated LP parameters in SFs 1, 2, 3
199                             (AZ_SIZE)                                   */
200        Flag   *pOverflow
201    );
202
203    /*----------------------------------------------------------------------------
204    ; END
205    ----------------------------------------------------------------------------*/
206#ifdef __cplusplus
207}
208#endif
209
210#endif /* _INT_LPC_H_ */
211
212
213