1 /******************************************************************************
2 *
3 * Copyright 2014 The Android Open Source Project
4 * Copyright 2003 - 2004 Open Interface North America, Inc. All rights
5 * reserved.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at:
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ******************************************************************************/
20
21 /**
22 @file
23
24 DO NOT EDIT THIS FILE DIRECTLY
25
26 This file is automatically generated by the "synthesis-gen.pl" script.
27 Any changes to this generated file will be lost when the script is re-run.
28
29 These functions are called by functions in synthesis.c to perform the synthesis
30 filterbank computations for the SBC decoder.
31
32
33 */
34
35 #include <oi_codec_sbc_private.h>
36
37 #ifndef CLIP_INT16
38 #define CLIP_INT16(x) \
39 do { \
40 if ((x) > OI_INT16_MAX) { \
41 (x) = OI_INT16_MAX; \
42 } else if ((x) < OI_INT16_MIN) { \
43 (x) = OI_INT16_MIN; \
44 } \
45 } while (0)
46 #endif
47
48 #define MUL_16S_16S(_x, _y) ((_x) * (_y))
49
SynthWindow80_generated(int16_t * pcm,SBC_BUFFER_T const * RESTRICT buffer,OI_UINT strideShift)50 PRIVATE void SynthWindow80_generated(int16_t* pcm,
51 SBC_BUFFER_T const* RESTRICT buffer,
52 OI_UINT strideShift) {
53 int32_t pcm_a, pcm_b;
54 /* 1 - stage 0 */ pcm_b = 0;
55 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(8235, buffer[12])) >> 3;
56 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(-23167, buffer[20])) >> 3;
57 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(26479, buffer[28])) >> 2;
58 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(-17397, buffer[36])) << 1;
59 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(9399, buffer[44])) << 3;
60 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(17397, buffer[52])) << 1;
61 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(26479, buffer[60])) >> 2;
62 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(23167, buffer[68])) >> 3;
63 /* 1 - stage 0 */ pcm_b += (MUL_16S_16S(8235, buffer[76])) >> 3;
64 /* 1 - stage 0 */ pcm_b /= 32768;
65 CLIP_INT16(pcm_b);
66 pcm[0 << strideShift] = (int16_t)pcm_b;
67 /* 1 - stage 1 */ pcm_a = 0;
68 /* 1 - stage 1 */ pcm_b = 0;
69 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(-3263, buffer[5])) >> 5;
70 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(9293, buffer[5])) >> 3;
71 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(29293, buffer[11])) >> 5;
72 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(-6087, buffer[11])) >> 2;
73 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(-5229, buffer[21]));
74 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(1247, buffer[21])) << 3;
75 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(30835, buffer[27])) >> 3;
76 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(-2893, buffer[27])) << 3;
77 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(-27021, buffer[37])) << 1;
78 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(23671, buffer[37])) << 2;
79 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(31633, buffer[43])) << 1;
80 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(18055, buffer[43])) << 1;
81 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(17319, buffer[53])) << 1;
82 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(11537, buffer[53])) >> 1;
83 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(26663, buffer[59])) >> 2;
84 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(1747, buffer[59])) << 1;
85 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(4555, buffer[69])) >> 1;
86 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(685, buffer[69])) << 1;
87 /* 1 - stage 1 */ pcm_a += (MUL_16S_16S(12419, buffer[75])) >> 4;
88 /* 1 - stage 1 */ pcm_b += (MUL_16S_16S(8721, buffer[75])) >> 7;
89 /* 1 - stage 1 */ pcm_a /= 32768;
90 CLIP_INT16(pcm_a);
91 pcm[1 << strideShift] = (int16_t)pcm_a;
92 /* 1 - stage 1 */ pcm_b /= 32768;
93 CLIP_INT16(pcm_b);
94 pcm[7 << strideShift] = (int16_t)pcm_b;
95 /* 1 - stage 2 */ pcm_a = 0;
96 /* 1 - stage 2 */ pcm_b = 0;
97 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(-10385, buffer[6])) >> 6;
98 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(11167, buffer[6])) >> 4;
99 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(24995, buffer[10])) >> 5;
100 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(-10337, buffer[10])) >> 4;
101 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(-309, buffer[22])) << 4;
102 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(1917, buffer[22])) << 2;
103 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(9161, buffer[26])) >> 3;
104 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(-30605, buffer[26])) >> 1;
105 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(-23063, buffer[38])) << 1;
106 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(8317, buffer[38])) << 3;
107 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(27561, buffer[42])) << 1;
108 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(9553, buffer[42])) << 2;
109 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(2309, buffer[54])) << 3;
110 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(22117, buffer[54])) >> 4;
111 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(12705, buffer[58])) >> 1;
112 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(16383, buffer[58])) >> 2;
113 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(6239, buffer[70])) >> 3;
114 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(7543, buffer[70])) >> 3;
115 /* 1 - stage 2 */ pcm_a += (MUL_16S_16S(9251, buffer[74])) >> 4;
116 /* 1 - stage 2 */ pcm_b += (MUL_16S_16S(8603, buffer[74])) >> 6;
117 /* 1 - stage 2 */ pcm_a /= 32768;
118 CLIP_INT16(pcm_a);
119 pcm[2 << strideShift] = (int16_t)pcm_a;
120 /* 1 - stage 2 */ pcm_b /= 32768;
121 CLIP_INT16(pcm_b);
122 pcm[6 << strideShift] = (int16_t)pcm_b;
123 /* 1 - stage 3 */ pcm_a = 0;
124 /* 1 - stage 3 */ pcm_b = 0;
125 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(-16457, buffer[7])) >> 6;
126 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(16913, buffer[7])) >> 5;
127 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(19083, buffer[9])) >> 5;
128 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(-8443, buffer[9])) >> 7;
129 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(-23641, buffer[23])) >> 2;
130 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(3687, buffer[23])) << 1;
131 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(-29015, buffer[25])) >> 4;
132 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(-301, buffer[25])) << 5;
133 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(-12889, buffer[39])) << 2;
134 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(15447, buffer[39])) << 2;
135 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(6145, buffer[41])) << 3;
136 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(10255, buffer[41])) << 2;
137 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(24211, buffer[55])) >> 1;
138 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(-18233, buffer[55])) >> 3;
139 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(23469, buffer[57])) >> 2;
140 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(9405, buffer[57])) >> 1;
141 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(21223, buffer[71])) >> 8;
142 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(1499, buffer[71])) >> 1;
143 /* 1 - stage 3 */ pcm_a += (MUL_16S_16S(26913, buffer[73])) >> 6;
144 /* 1 - stage 3 */ pcm_b += (MUL_16S_16S(26189, buffer[73])) >> 7;
145 /* 1 - stage 3 */ pcm_a /= 32768;
146 CLIP_INT16(pcm_a);
147 pcm[3 << strideShift] = (int16_t)pcm_a;
148 /* 1 - stage 3 */ pcm_b /= 32768;
149 CLIP_INT16(pcm_b);
150 pcm[5 << strideShift] = (int16_t)pcm_b;
151 /* 1 - stage 4 */ pcm_a = 0;
152 /* 1 - stage 4 */ pcm_a += (MUL_16S_16S(10445, buffer[8])) >> 4;
153 /* 1 - stage 4 */ pcm_a += (MUL_16S_16S(-5297, buffer[24])) << 1;
154 /* 1 - stage 4 */ pcm_a += (MUL_16S_16S(22299, buffer[40])) << 2;
155 /* 1 - stage 4 */ pcm_a += (MUL_16S_16S(10603, buffer[56]));
156 /* 1 - stage 4 */ pcm_a += (MUL_16S_16S(9539, buffer[72])) >> 4;
157 /* 1 - stage 4 */ pcm_a /= 32768;
158 CLIP_INT16(pcm_a);
159 pcm[4 << strideShift] = (int16_t)pcm_a;
160 }
161