1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
18 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
22 ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23 Available from http://www.3gpp.org
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 ****************************************************************************************/
30 ------------------------------------------------------------------------------
36 ------------------------------------------------------------------------------
39 Big subframe (2 subframes) preprocessing
40 ------------------------------------------------------------------------------
43 /*----------------------------------------------------------------------------
45 ----------------------------------------------------------------------------*/
54 /*----------------------------------------------------------------------------
56 ; Define module specific macros here
57 ----------------------------------------------------------------------------*/
59 /*----------------------------------------------------------------------------
61 ; Include all pre-processor statements here. Include conditional
62 ; compile variables also.
63 ----------------------------------------------------------------------------*/
65 /*----------------------------------------------------------------------------
66 ; LOCAL FUNCTION DEFINITIONS
67 ; Function Prototype declaration
68 ----------------------------------------------------------------------------*/
70 /*----------------------------------------------------------------------------
71 ; LOCAL VARIABLE DEFINITIONS
72 ; Variable declaration - defined here and used outside this module
73 ----------------------------------------------------------------------------*/
76 ------------------------------------------------------------------------------
77 FUNCTION NAME: pre_big
78 ------------------------------------------------------------------------------
79 INPUT AND OUTPUT DEFINITIONS
82 mode = enum Mode -- coder mode
83 gamma1 = array of type const Word16 -- spectral exp. factor 1
84 gamma1_12k2 = array of type const Word16 -- spectral exp. factor 1 for EFR
85 gamma2 = array of type const Word16 -- spectral exp. factor 2
86 A_t = array of type Word16 -- A(z) unquantized, for 4 subframes, Q12
87 frameOffset = Word16 -- Start position in speech vector, Q0
88 speech[] = array of type Word16 -- speech, Q0
91 mem_w = array of type Word16 -- synthesis filter memory state, Q0
92 wsp = array of type Word16 -- weighted speech Q0
93 pOverflow = pointer of type Flag -- overflow indicator
98 Global Variables Used:
101 Local Variables Needed:
104 ------------------------------------------------------------------------------
108 ------------------------------------------------------------------------------
113 ------------------------------------------------------------------------------
116 pre_big.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
118 ------------------------------------------------------------------------------
122 ------------------------------------------------------------------------------
124 [State any special notes, constraints or cautions for users of this function]
126 ------------------------------------------------------------------------------
130 enum Mode mode, /* i : coder mode */
131 const Word16 gamma1[], /* i : spectral exp. factor 1 */
132 const Word16 gamma1_12k2[],/* i : spectral exp. factor 1 for EFR */
133 const Word16 gamma2[], /* i : spectral exp. factor 2 */
134 Word16 A_t[], /* i : A(z) unquantized, for 4 subframes, Q12 */
135 Word16 frameOffset, /* i : Start position in speech vector, Q0 */
136 Word16 speech[], /* i : speech, Q0 */
137 Word16 mem_w[], /* i/o: synthesis filter memory state, Q0 */
138 Word16 wsp[], /* o : weighted speech Q0 */
139 Flag *pOverflow /* o : overflow indicator */
142 Word16 Ap1[MP1]; /* A(z) with spectral expansion */
143 Word16 Ap2[MP1]; /* A(z) with spectral expansion */
144 const Word16 *g1; /* Pointer to correct gammma1 vector */
166 /* process two subframes (which form the "big" subframe) */
167 for (i = 0; i < 2; i++)
169 Weight_Ai(&A_t[aOffset], g1, Ap1);
170 Weight_Ai(&A_t[aOffset], gamma2, Ap2);
171 Residu(Ap1, &speech[frameOffset], &wsp[frameOffset], L_SUBFR);
173 Syn_filt(Ap2, &wsp[frameOffset], &wsp[frameOffset], L_SUBFR, mem_w, 1);
177 frameOffset += L_SUBFR;