weight_a.c revision 5d5c3a132bb446ac78a37dfaac24a46cacf0dd73
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: weight_a.c                                               *
19*                                                                      *
20*       Description:Weighting of LPC coefficients                      *
21*                  ap[i] = a[i] * (gamma ** i)                     *
22*                                                                      *
23************************************************************************/
24
25#include "typedef.h"
26#include "basic_op.h"
27
28void Weight_a(
29        Word16 a[],                           /* (i) Q12 : a[m+1]  LPC coefficients             */
30        Word16 ap[],                          /* (o) Q12 : Spectral expanded LPC coefficients   */
31        Word16 gamma,                         /* (i) Q15 : Spectral expansion factor.           */
32        Word16 m                              /* (i)     : LPC order.                           */
33         )
34{
35    Word32 num = m - 1, fac;
36    *ap++ = *a++;
37    fac = gamma;
38    do{
39        *ap++ =(Word16)(((vo_L_mult((*a++), fac)) + 0x8000) >> 16);
40        fac = (vo_L_mult(fac, gamma) + 0x8000) >> 16;
41    }while(--num != 0);
42
43    *ap++ = (Word16)(((vo_L_mult((*a++), fac)) + 0x8000) >> 16);
44    return;
45}
46
47
48
49