int_lpc.c revision 956c553ab0ce72f8074ad0fda2ffd66a0305700c
1/*
2 ** Copyright 2003-2010, VisualOn, Inc.
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 express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16
17/***********************************************************************
18*      File: int_lpc.c                                                 *
19*                                                                      *
20*      Description:Interpolation of the LP parameters in 4 subframes.  *
21*                                                                      *
22************************************************************************/
23
24#include "typedef.h"
25#include "basic_op.h"
26#include "cnst.h"
27#include "acelp.h"
28
29#define MP1 (M+1)
30
31
32void Int_isp(
33		Word16 isp_old[],                     /* input : isps from past frame              */
34		Word16 isp_new[],                     /* input : isps from present frame           */
35		Word16 frac[],                        /* input : fraction for 3 first subfr (Q15)  */
36		Word16 Az[]                           /* output: LP coefficients in 4 subframes    */
37	    )
38{
39	Word32 i, k;
40	Word16 fac_old, fac_new;
41	Word16 isp[M];
42	Word32 L_tmp;
43
44	for (k = 0; k < 3; k++)
45	{
46		fac_new = frac[k];
47		fac_old = (32767 - fac_new) + 1;  /* 1.0 - fac_new */
48
49		for (i = 0; i < M; i++)
50		{
51			L_tmp = (isp_old[i] * fac_old)<<1;
52			L_tmp += (isp_new[i] * fac_new)<<1;
53			isp[i] = (L_tmp + 0x8000)>>16;
54		}
55		Isp_Az(isp, Az, M, 0);
56		Az += MP1;
57	}
58
59	/* 4th subframe: isp_new (frac=1.0) */
60	Isp_Az(isp_new, Az, M, 0);
61
62	return;
63}
64
65
66
67