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: interpolate_isp.cpp
36 ------------------------------------------------------------------------------
37 INPUT AND OUTPUT DEFINITIONS
39 int16 isp_old[], input : isps from past frame
40 int16 isp_new[], input : isps from present frame
41 const int16 frac[], input : fraction for 3 first subfr (Q15)
42 int16 Az[] output: LP coefficients in 4 subframes
45 ------------------------------------------------------------------------------
48 Interpolation of the LP parameters in 4 subframes
51 ------------------------------------------------------------------------------
55 ------------------------------------------------------------------------------
58 ------------------------------------------------------------------------------
61 ------------------------------------------------------------------------------
65 /*----------------------------------------------------------------------------
67 ----------------------------------------------------------------------------*/
69 #include "pv_amr_wb_type_defs.h"
70 #include "pvamrwbdecoder_basic_op.h"
71 #include "pvamrwbdecoder_cnst.h"
72 #include "pvamrwbdecoder_acelp.h"
74 /*----------------------------------------------------------------------------
76 ; Define module specific macros here
77 ----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------
82 ; Include all pre-processor statements here. Include conditional
83 ; compile variables also.
84 ----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------
89 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
90 ; Variable declaration - defined here and used outside this module
91 ----------------------------------------------------------------------------*/
93 /*----------------------------------------------------------------------------
94 ; EXTERNAL FUNCTION REFERENCES
95 ; Declare functions defined elsewhere and referenced in this module
96 ----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------
99 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
100 ; Declare variables used in this module but defined elsewhere
101 ----------------------------------------------------------------------------*/
103 /*----------------------------------------------------------------------------
105 ----------------------------------------------------------------------------*/
107 void interpolate_isp(
108 int16 isp_old[], /* input : isps from past frame */
109 int16 isp_new[], /* input : isps from present frame */
110 const int16 frac[], /* input : fraction for 3 first subfr (Q15) */
111 int16 Az[] /* output: LP coefficients in 4 subframes */
114 int16 i, k, fac_old, fac_new;
118 for (k = 0; k < 3; k++)
121 fac_old = add_int16(sub_int16(32767, fac_new), 1); /* 1.0 - fac_new */
123 for (i = 0; i < M; i++)
125 L_tmp = mul_16by16_to_int32(isp_old[i], fac_old);
126 L_tmp = mac_16by16_to_int32(L_tmp, isp_new[i], fac_new);
127 isp[i] = amr_wb_round(L_tmp);
129 Isp_Az(isp, Az, M, 0);
133 /* 4th subframe: isp_new (frac=1.0) */
135 Isp_Az(isp_new, Az, M, 0);