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 - Wideband (AMR-WB) speech codec
23 Available from http://www.3gpp.org
25 (C) 2007, 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 ------------------------------------------------------------------------------
34 Filename: weight_amrwb_lpc.cpp
36 ------------------------------------------------------------------------------
37 INPUT AND OUTPUT DEFINITIONS
39 int16 a[], (i) Q12 : a[m+1] LPC coefficients
40 int16 ap[], (o) Q12 : Spectral expanded LPC coefficients
41 int16 gamma, (i) Q15 : Spectral expansion factor.
42 int16 m (i) : LPC order.
44 ------------------------------------------------------------------------------
47 Weighting of LPC coefficients.
48 ap[i] = a[i] (gamma i)
50 ------------------------------------------------------------------------------
54 ------------------------------------------------------------------------------
57 ------------------------------------------------------------------------------
60 ------------------------------------------------------------------------------
64 /*----------------------------------------------------------------------------
66 ----------------------------------------------------------------------------*/
68 #include "pv_amr_wb_type_defs.h"
69 #include "pvamrwbdecoder_basic_op.h"
70 #include "pvamrwbdecoder_acelp.h"
72 /*----------------------------------------------------------------------------
74 ; Define module specific macros here
75 ----------------------------------------------------------------------------*/
78 /*----------------------------------------------------------------------------
80 ; Include all pre-processor statements here. Include conditional
81 ; compile variables also.
82 ----------------------------------------------------------------------------*/
84 /*----------------------------------------------------------------------------
85 ; LOCAL FUNCTION DEFINITIONS
86 ; Function Prototype declaration
87 ----------------------------------------------------------------------------*/
89 /*----------------------------------------------------------------------------
90 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
91 ; Variable declaration - defined here and used outside this module
92 ----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------
95 ; EXTERNAL FUNCTION REFERENCES
96 ; Declare functions defined elsewhere and referenced in this module
97 ----------------------------------------------------------------------------*/
99 /*----------------------------------------------------------------------------
100 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
101 ; Declare variables used in this module but defined elsewhere
102 ----------------------------------------------------------------------------*/
104 /*----------------------------------------------------------------------------
106 ----------------------------------------------------------------------------*/
108 void weight_amrwb_lpc(
109 int16 a[], /* (i) Q12 : a[m+1] LPC coefficients */
110 int16 ap[], /* (o) Q12 : Spectral expanded LPC coefficients */
111 int16 gamma, /* (i) Q15 : Spectral expansion factor. */
112 int16 m /* (i) : LPC order. */
116 int32 roundFactor = 0x00004000L;
119 for (i = 1; i < m; i++)
121 ap[i] = (int16)(fxp_mac_16by16(a[i], fac, roundFactor) >> 15);
122 fac = (int16)(fxp_mac_16by16(fac, gamma, roundFactor) >> 15);
124 ap[i] = (int16)(fxp_mac_16by16(a[i], fac, roundFactor) >> 15);