OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / media / libstagefright / codecs / amrwbenc / src / residu.c
1 /*\r
2  ** Copyright 2003-2010, VisualOn, Inc.\r
3  **\r
4  ** Licensed under the Apache License, Version 2.0 (the "License");\r
5  ** you may not use this file except in compliance with the License.\r
6  ** You may obtain a copy of the License at\r
7  **\r
8  **     http://www.apache.org/licenses/LICENSE-2.0\r
9  **\r
10  ** Unless required by applicable law or agreed to in writing, software\r
11  ** distributed under the License is distributed on an "AS IS" BASIS,\r
12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  ** See the License for the specific language governing permissions and\r
14  ** limitations under the License.\r
15  */\r
16 \r
17 /***********************************************************************\r
18 *  File: residu.c                                                      *\r
19 *                                                                      *\r
20 *  Description: Compute the LPC residual by filtering                  *\r
21 *             the input speech through A(z)                            *\r
22 *                                                                      *\r
23 ************************************************************************/\r
24 \r
25 #include "typedef.h"\r
26 #include "basic_op.h"\r
27 \r
28 void Residu(\r
29                 Word16 a[],                           /* (i) Q12 : prediction coefficients                     */\r
30                 Word16 x[],                           /* (i)     : speech (values x[-m..-1] are needed         */\r
31                 Word16 y[],                           /* (o) x2  : residual signal                             */\r
32                 Word16 lg                             /* (i)     : size of filtering                           */\r
33                 )\r
34 {\r
35         Word16 i,*p1, *p2;\r
36         Word32 s;\r
37         for (i = 0; i < lg; i++)\r
38         {\r
39                 p1 = a;\r
40                 p2 = &x[i];\r
41                 s  = vo_mult32((*p1++), (*p2--));\r
42                 s += vo_mult32((*p1++), (*p2--));\r
43                 s += vo_mult32((*p1++), (*p2--));\r
44                 s += vo_mult32((*p1++), (*p2--));\r
45                 s += vo_mult32((*p1++), (*p2--));\r
46                 s += vo_mult32((*p1++), (*p2--));\r
47                 s += vo_mult32((*p1++), (*p2--));\r
48                 s += vo_mult32((*p1++), (*p2--));\r
49                 s += vo_mult32((*p1++), (*p2--));\r
50                 s += vo_mult32((*p1++), (*p2--));\r
51                 s += vo_mult32((*p1++), (*p2--));\r
52                 s += vo_mult32((*p1++), (*p2--));\r
53                 s += vo_mult32((*p1++), (*p2--));\r
54                 s += vo_mult32((*p1++), (*p2--));\r
55                 s += vo_mult32((*p1++), (*p2--));\r
56                 s += vo_mult32((*p1++), (*p2--));\r
57                 s += vo_mult32((*p1), (*p2));\r
58 \r
59                 s = L_shl2(s, 5); \r
60                 y[i] = extract_h(L_add(s, 0x8000));\r
61         }\r
62 \r
63         return;\r
64 }\r
65 \r
66 \r
67 \r