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 ****************************************************************************************/
31 Filename: weight_a.cpp
33 ------------------------------------------------------------------------------
36 /*----------------------------------------------------------------------------
38 ----------------------------------------------------------------------------*/
43 /*----------------------------------------------------------------------------
45 ; Define module specific macros here
46 ----------------------------------------------------------------------------*/
49 /*----------------------------------------------------------------------------
51 ; Include all pre-processor statements here. Include conditional
52 ; compile variables also.
53 ----------------------------------------------------------------------------*/
56 /*----------------------------------------------------------------------------
57 ; LOCAL FUNCTION DEFINITIONS
58 ; Function Prototype declaration
59 ----------------------------------------------------------------------------*/
62 /*----------------------------------------------------------------------------
63 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
64 ; Variable declaration - defined here and used outside this module
65 ----------------------------------------------------------------------------*/
69 ------------------------------------------------------------------------------
70 FUNCTION NAME: Weight_Ai
71 ------------------------------------------------------------------------------
72 INPUT AND OUTPUT DEFINITIONS
75 a = LPC coefficients (Word16)
76 fac = Spectral expansion factors (Word16)
77 a_exp = Spectral expanded LPC coefficients (Word16)
80 a_exp points to the updated spectral expanded LPC coefficients
85 Global Variables Used:
88 Local Variables Needed:
91 ------------------------------------------------------------------------------
94 This function calculates the spectral expansion for the LP coefficients of
96 a_exp[i] = a[i] * fac[i-1] ; i=1..M
98 ------------------------------------------------------------------------------
103 ------------------------------------------------------------------------------
106 weight_a.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
108 ------------------------------------------------------------------------------
112 Word16 a[], // (i) : a[M+1] LPC coefficients (M=10)
113 const Word16 fac[], // (i) : Spectral expansion factors.
114 Word16 a_exp[] // (o) : Spectral expanded LPC coefficients
120 for (i = 1; i <= M; i++)
122 a_exp[i] = pv_round (L_mult (a[i], fac[i - 1]));
127 ------------------------------------------------------------------------------
129 [State any special notes, constraints or cautions for users of this function]
131 ------------------------------------------------------------------------------
134 OSCL_EXPORT_REF void Weight_Ai(
135 Word16 a[], /* (i) : a[M+1] LPC coefficients (M=10) */
136 const Word16 fac[], /* (i) : Spectral expansion factors. */
137 Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */
144 for (i = M; i >= 1; i--)
149 *(a_exp) = (Word16)((((Word32) * (a)) * *(fac - 1)
150 + 0x00004000L) >> 15);