1 /* Copyright (C) 2006 Jean-Marc Valin
2    File: window.c
3 
4    Redistribution and use in source and binary forms, with or without
5    modification, are permitted provided that the following conditions
6    are met:
7 
8    - Redistributions of source code must retain the above copyright
9    notice, this list of conditions and the following disclaimer.
10 
11    - Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in the
13    documentation and/or other materials provided with the distribution.
14 
15    - Neither the name of the Xiph.org Foundation nor the names of its
16    contributors may be used to endorse or promote products derived from
17    this software without specific prior written permission.
18 
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
23    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31 
32 #ifdef HAVE_CONFIG_H
33 #include "config.h"
34 #endif
35 
36 #include "arch.h"
37 
38 #ifdef FIXED_POINT
39 const spx_word16_t lag_window[11] = {
40    16384, 16337, 16199, 15970, 15656, 15260, 14790, 14254, 13659, 13015, 12330
41 };
42 
43 const spx_word16_t lpc_window[200] = {
44 1310, 1313, 1321, 1333, 1352, 1375, 1403, 1436,
45 1475, 1518, 1567, 1621, 1679, 1743, 1811, 1884,
46 1962, 2044, 2132, 2224, 2320, 2421, 2526, 2636,
47 2750, 2868, 2990, 3116, 3246, 3380, 3518, 3659,
48 3804, 3952, 4104, 4259, 4417, 4578, 4742, 4909,
49 5079, 5251, 5425, 5602, 5781, 5963, 6146, 6331,
50 6518, 6706, 6896, 7087, 7280, 7473, 7668, 7863,
51 8059, 8256, 8452, 8650, 8847, 9044, 9241, 9438,
52 9635, 9831, 10026, 10220, 10414, 10606, 10797, 10987,
53 11176, 11363, 11548, 11731, 11912, 12091, 12268, 12443,
54 12615, 12785, 12952, 13116, 13277, 13435, 13590, 13742,
55 13890, 14035, 14176, 14314, 14448, 14578, 14704, 14826,
56 14944, 15058, 15168, 15273, 15374, 15470, 15562, 15649,
57 15732, 15810, 15883, 15951, 16015, 16073, 16127, 16175,
58 16219, 16257, 16291, 16319, 16342, 16360, 16373, 16381,
59 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
60 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
61 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
62 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
63 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
64 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
65 16384, 16384, 16384, 16361, 16294, 16183, 16028, 15830,
66 15588, 15304, 14979, 14613, 14207, 13763, 13282, 12766,
67 12215, 11631, 11016, 10373, 9702, 9007, 8289, 7551,
68 6797, 6028, 5251, 4470, 3695, 2943, 2248, 1696
69 };
70 #else
71 const spx_word16_t lag_window[11] = {
72    1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998, 0.83367, 0.79434, 0.75258
73 };
74 
75 const spx_word16_t lpc_window[200] = {
76    0.080000f, 0.080158f, 0.080630f, 0.081418f, 0.082520f, 0.083935f, 0.085663f, 0.087703f,
77    0.090052f, 0.092710f, 0.095674f, 0.098943f, 0.102514f, 0.106385f, 0.110553f, 0.115015f,
78    0.119769f, 0.124811f, 0.130137f, 0.135744f, 0.141628f, 0.147786f, 0.154212f, 0.160902f,
79    0.167852f, 0.175057f, 0.182513f, 0.190213f, 0.198153f, 0.206328f, 0.214731f, 0.223357f,
80    0.232200f, 0.241254f, 0.250513f, 0.259970f, 0.269619f, 0.279453f, 0.289466f, 0.299651f,
81    0.310000f, 0.320507f, 0.331164f, 0.341965f, 0.352901f, 0.363966f, 0.375151f, 0.386449f,
82    0.397852f, 0.409353f, 0.420943f, 0.432615f, 0.444361f, 0.456172f, 0.468040f, 0.479958f,
83    0.491917f, 0.503909f, 0.515925f, 0.527959f, 0.540000f, 0.552041f, 0.564075f, 0.576091f,
84    0.588083f, 0.600042f, 0.611960f, 0.623828f, 0.635639f, 0.647385f, 0.659057f, 0.670647f,
85    0.682148f, 0.693551f, 0.704849f, 0.716034f, 0.727099f, 0.738035f, 0.748836f, 0.759493f,
86    0.770000f, 0.780349f, 0.790534f, 0.800547f, 0.810381f, 0.820030f, 0.829487f, 0.838746f,
87    0.847800f, 0.856643f, 0.865269f, 0.873672f, 0.881847f, 0.889787f, 0.897487f, 0.904943f,
88    0.912148f, 0.919098f, 0.925788f, 0.932214f, 0.938372f, 0.944256f, 0.949863f, 0.955189f,
89    0.960231f, 0.964985f, 0.969447f, 0.973615f, 0.977486f, 0.981057f, 0.984326f, 0.987290f,
90    0.989948f, 0.992297f, 0.994337f, 0.996065f, 0.997480f, 0.998582f, 0.999370f, 0.999842f,
91    1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
92    1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
93    1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
94    1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
95    1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
96    1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f,
97    1.000000f, 1.000000f, 1.000000f, 0.998640f, 0.994566f, 0.987787f, 0.978324f, 0.966203f,
98    0.951458f, 0.934131f, 0.914270f, 0.891931f, 0.867179f, 0.840084f, 0.810723f, 0.779182f,
99    0.745551f, 0.709930f, 0.672424f, 0.633148f, 0.592223f, 0.549781f, 0.505964f, 0.460932f,
100    0.414863f, 0.367968f, 0.320511f, 0.272858f, 0.225569f, 0.179655f, 0.137254f, 0.103524f
101 };
102 #endif
103