• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 1999-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This file contains the code that performs Analysis of the input audio
22  *  stream.
23  *
24  ******************************************************************************/
25 #include <string.h>
26 #include "sbc_enc_func_declare.h"
27 #include "sbc_encoder.h"
28 /*#include <math.h>*/
29 
30 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
31 #define WIND_4_SUBBANDS_0_1                                              \
32   (int32_t)0x01659F45 /* gas32CoeffFor4SBs[8] = -gas32CoeffFor4SBs[32] = \
33                          0x01659F45 */
34 #define WIND_4_SUBBANDS_0_2                                               \
35   (int32_t)0x115B1ED2 /* gas32CoeffFor4SBs[16] = -gas32CoeffFor4SBs[24] = \
36                          0x115B1ED2 */
37 #define WIND_4_SUBBANDS_1_0 \
38   (int32_t)0x001194E6 /* gas32CoeffFor4SBs[1 et 39] = 0x001194E6 */
39 #define WIND_4_SUBBANDS_1_1 \
40   (int32_t)0x029DBAA3 /* gas32CoeffFor4SBs[9 et 31] = 0x029DBAA3 */
41 #define WIND_4_SUBBANDS_1_2 \
42   (int32_t)0x18F55C90 /* gas32CoeffFor4SBs[17 et 23] = 0x18F55C90 */
43 #define WIND_4_SUBBANDS_1_3 \
44   (int32_t)0xF60FAF37 /* gas32CoeffFor4SBs[15 et 25] = 0xF60FAF37 */
45 #define WIND_4_SUBBANDS_1_4 \
46   (int32_t)0xFF9BB9D5 /* gas32CoeffFor4SBs[7 et 33] = 0xFF9BB9D5 */
47 #define WIND_4_SUBBANDS_2_0 \
48   (int32_t)0x0030E2D3 /* gas32CoeffFor4SBs[2 et 38] = 0x0030E2D3 */
49 #define WIND_4_SUBBANDS_2_1 \
50   (int32_t)0x03B23341 /* gas32CoeffFor4SBs[10 et 30] = 0x03B23341 */
51 #define WIND_4_SUBBANDS_2_2 \
52   (int32_t)0x1F91CA46 /* gas32CoeffFor4SBs[18 et 22] = 0x1F91CA46 */
53 #define WIND_4_SUBBANDS_2_3 \
54   (int32_t)0xFC4F91D4 /* gas32CoeffFor4SBs[14 et 26] = 0xFC4F91D4 */
55 #define WIND_4_SUBBANDS_2_4 \
56   (int32_t)0x003D239B /* gas32CoeffFor4SBs[6 et 34] = 0x003D239B */
57 #define WIND_4_SUBBANDS_3_0 \
58   (int32_t)0x00599403 /* gas32CoeffFor4SBs[3 et 37] = 0x00599403 */
59 #define WIND_4_SUBBANDS_3_1 \
60   (int32_t)0x041EEE40 /* gas32CoeffFor4SBs[11 et 29] = 0x041EEE40 */
61 #define WIND_4_SUBBANDS_3_2 \
62   (int32_t)0x2412F251 /* gas32CoeffFor4SBs[19 et 21] = 0x2412F251 */
63 #define WIND_4_SUBBANDS_3_3 \
64   (int32_t)0x00C8F2BC /* gas32CoeffFor4SBs[13 et 27] = 0x00C8F2BC */
65 #define WIND_4_SUBBANDS_3_4 \
66   (int32_t)0x007F88E4 /* gas32CoeffFor4SBs[5 et 35] = 0x007F88E4 */
67 #define WIND_4_SUBBANDS_4_0 \
68   (int32_t)0x007DBCC8 /* gas32CoeffFor4SBs[4 et 36] = 0x007DBCC8 */
69 #define WIND_4_SUBBANDS_4_1 \
70   (int32_t)0x034FEE2C /* gas32CoeffFor4SBs[12 et 28] = 0x034FEE2C */
71 #define WIND_4_SUBBANDS_4_2 \
72   (int32_t)0x25AC1FF2 /* gas32CoeffFor4SBs[20] = 0x25AC1FF2 */
73 
74 #define WIND_8_SUBBANDS_0_1 (int32_t)0x00B97348 /* 16 0x00B97348 */
75 #define WIND_8_SUBBANDS_0_2 (int32_t)0x08B4307A /* 32 0x08B4307A */
76 #define WIND_8_SUBBANDS_1_0 (int32_t)0x00052173 /* 1 et 79 = 0x00052173 */
77 #define WIND_8_SUBBANDS_1_1 (int32_t)0x01071B96 /* 17 et 63 = 0x01071B96 */
78 #define WIND_8_SUBBANDS_1_2 (int32_t)0x0A9F3E9A /* 33 et 47 = 0x0A9F3E9A*/
79 #define WIND_8_SUBBANDS_1_3 (int32_t)0xF9312891 /* 31 et 49 = 0xF9312891 */
80 #define WIND_8_SUBBANDS_1_4 (int32_t)0xFF8D6793 /* 15 et 65 = 0xFF8D6793 */
81 #define WIND_8_SUBBANDS_2_0 (int32_t)0x000B3F71 /* 2 et 78 = 0x000B3F71 */
82 #define WIND_8_SUBBANDS_2_1 (int32_t)0x0156B3CA /* 18 et 62 = 0x0156B3CA */
83 #define WIND_8_SUBBANDS_2_2 (int32_t)0x0C7D59B6 /* 34 et 46 = 0x0C7D59B6 */
84 #define WIND_8_SUBBANDS_2_3 (int32_t)0xFAFF95FC /* 30 et 50 = 0xFAFF95FC */
85 #define WIND_8_SUBBANDS_2_4 (int32_t)0xFFC9F10E /* 14 et 66 = 0xFFC9F10E */
86 #define WIND_8_SUBBANDS_3_0 (int32_t)0x00122C7D /* 3 et 77 = 0x00122C7D*/
87 #define WIND_8_SUBBANDS_3_1 (int32_t)0x01A1B38B /* 19 et 61 = 0x01A1B38B */
88 #define WIND_8_SUBBANDS_3_2 (int32_t)0x0E3BB16F /* 35 et 45 = 0x0E3BB16F */
89 #define WIND_8_SUBBANDS_3_3 (int32_t)0xFCA86E7E /* 29 et 51 = 0xFCA86E7E */
90 #define WIND_8_SUBBANDS_3_4 (int32_t)0xFFFA2413 /* 13 et 67 = 0xFFFA2413 */
91 #define WIND_8_SUBBANDS_4_0 (int32_t)0x001AFF89 /* 4 et 66 = 0x001AFF89 */
92 #define WIND_8_SUBBANDS_4_1 (int32_t)0x01E0224C /* 20 et 60 = 0x01E0224C */
93 #define WIND_8_SUBBANDS_4_2 (int32_t)0x0FC721F9 /* 36 et 44 = 0x0FC721F9 */
94 #define WIND_8_SUBBANDS_4_3 (int32_t)0xFE20435D /* 28 et 52 = 0xFE20435D */
95 #define WIND_8_SUBBANDS_4_4 (int32_t)0x001D8FD2 /* 12 et 68 = 0x001D8FD2 */
96 #define WIND_8_SUBBANDS_5_0 (int32_t)0x00255A62 /* 5 et 75 = 0x00255A62 */
97 #define WIND_8_SUBBANDS_5_1 (int32_t)0x0209291F /* 21 et 59 = 0x0209291F */
98 #define WIND_8_SUBBANDS_5_2 (int32_t)0x110ECEF0 /* 37 et 43 = 0x110ECEF0 */
99 #define WIND_8_SUBBANDS_5_3 (int32_t)0xFF5EEB73 /* 27 et  53 = 0xFF5EEB73 */
100 #define WIND_8_SUBBANDS_5_4 (int32_t)0x0034F8B6 /* 11 et 69 = 0x0034F8B6 */
101 #define WIND_8_SUBBANDS_6_0 (int32_t)0x003060F4 /* 6 et 74 = 0x003060F4 */
102 #define WIND_8_SUBBANDS_6_1 (int32_t)0x02138653 /* 22 et 58 = 0x02138653 */
103 #define WIND_8_SUBBANDS_6_2 (int32_t)0x120435FA /* 38 et 42 = 0x120435FA */
104 #define WIND_8_SUBBANDS_6_3 (int32_t)0x005FD0FF /* 26 et 54 = 0x005FD0FF */
105 #define WIND_8_SUBBANDS_6_4 (int32_t)0x00415B75 /* 10 et 70 = 0x00415B75 */
106 #define WIND_8_SUBBANDS_7_0 (int32_t)0x003A72E7 /* 7 et 73 = 0x003A72E7 */
107 #define WIND_8_SUBBANDS_7_1 (int32_t)0x01F5F424 /* 23 et 57 = 0x01F5F424 */
108 #define WIND_8_SUBBANDS_7_2 (int32_t)0x129C226F /* 39 et 41 = 0x129C226F */
109 #define WIND_8_SUBBANDS_7_3 (int32_t)0x01223EBA /* 25 et 55 = 0x01223EBA */
110 #define WIND_8_SUBBANDS_7_4 (int32_t)0x0044EF48 /* 9 et 71 = 0x0044EF48 */
111 #define WIND_8_SUBBANDS_8_0 (int32_t)0x0041EC6A /* 8 et 72 = 0x0041EC6A */
112 #define WIND_8_SUBBANDS_8_1 (int32_t)0x01A7ECEF /* 24 et 56 = 0x01A7ECEF */
113 #define WIND_8_SUBBANDS_8_2 (int32_t)0x12CF6C75 /* 40 = 0x12CF6C75 */
114 #else
115 #define WIND_4_SUBBANDS_0_1                                          \
116   (int16_t)0x0166 /* gas32CoeffFor4SBs[8] = -gas32CoeffFor4SBs[32] = \
117                      0x01659F45 */
118 #define WIND_4_SUBBANDS_0_2                                           \
119   (int16_t)0x115B /* gas32CoeffFor4SBs[16] = -gas32CoeffFor4SBs[24] = \
120                      0x115B1ED2 */
121 #define WIND_4_SUBBANDS_1_0 \
122   (int16_t)0x0012 /* gas32CoeffFor4SBs[1 et 39] = 0x001194E6 */
123 #define WIND_4_SUBBANDS_1_1 \
124   (int16_t)0x029E /* gas32CoeffFor4SBs[9 et 31] = 0x029DBAA3 */
125 #define WIND_4_SUBBANDS_1_2 \
126   (int16_t)0x18F5 /* gas32CoeffFor4SBs[17 et 23] = 0x18F55C90 */
127 #define WIND_4_SUBBANDS_1_3 \
128   (int16_t)0xF610 /* gas32CoeffFor4SBs[15 et 25] = 0xF60FAF37 */
129 #define WIND_4_SUBBANDS_1_4 \
130   (int16_t)0xFF9C /* gas32CoeffFor4SBs[7 et 33] = 0xFF9BB9D5 */
131 #define WIND_4_SUBBANDS_2_0 \
132   (int16_t)0x0031 /* gas32CoeffFor4SBs[2 et 38] = 0x0030E2D3 */
133 #define WIND_4_SUBBANDS_2_1 \
134   (int16_t)0x03B2 /* gas32CoeffFor4SBs[10 et 30] = 0x03B23341 */
135 #define WIND_4_SUBBANDS_2_2 \
136   (int16_t)0x1F91 /* gas32CoeffFor4SBs[18 et 22] = 0x1F91CA46 */
137 #define WIND_4_SUBBANDS_2_3 \
138   (int16_t)0xFC50 /* gas32CoeffFor4SBs[14 et 26] = 0xFC4F91D4 */
139 #define WIND_4_SUBBANDS_2_4 \
140   (int16_t)0x003D /* gas32CoeffFor4SBs[6 et 34] = 0x003D239B */
141 #define WIND_4_SUBBANDS_3_0 \
142   (int16_t)0x005A /* gas32CoeffFor4SBs[3 et 37] = 0x00599403 */
143 #define WIND_4_SUBBANDS_3_1 \
144   (int16_t)0x041F /* gas32CoeffFor4SBs[11 et 29] = 0x041EEE40 */
145 #define WIND_4_SUBBANDS_3_2 \
146   (int16_t)0x2413 /* gas32CoeffFor4SBs[19 et 21] = 0x2412F251 */
147 #define WIND_4_SUBBANDS_3_3 \
148   (int16_t)0x00C9 /* gas32CoeffFor4SBs[13 et 27] = 0x00C8F2BC */
149 #define WIND_4_SUBBANDS_3_4 \
150   (int16_t)0x0080 /* gas32CoeffFor4SBs[5 et 35] = 0x007F88E4 */
151 #define WIND_4_SUBBANDS_4_0 \
152   (int16_t)0x007E /* gas32CoeffFor4SBs[4 et 36] = 0x007DBCC8 */
153 #define WIND_4_SUBBANDS_4_1 \
154   (int16_t)0x0350 /* gas32CoeffFor4SBs[12 et 28] = 0x034FEE2C */
155 #define WIND_4_SUBBANDS_4_2 \
156   (int16_t)0x25AC /* gas32CoeffFor4SBs[20] = 25AC1FF2 */
157 
158 #define WIND_8_SUBBANDS_0_1 (int16_t)0x00B9 /* 16 0x12CF6C75 */
159 #define WIND_8_SUBBANDS_0_2 (int16_t)0x08B4 /* 32 0x08B4307A */
160 #define WIND_8_SUBBANDS_1_0 (int16_t)0x0005 /* 1 et 79 = 0x00052173 */
161 #define WIND_8_SUBBANDS_1_1 (int16_t)0x0107 /* 17 et 63 = 0x01071B96 */
162 #define WIND_8_SUBBANDS_1_2 (int16_t)0x0A9F /* 33 et 47 = 0x0A9F3E9A*/
163 #define WIND_8_SUBBANDS_1_3 (int16_t)0xF931 /* 31 et 49 = 0xF9312891 */
164 #define WIND_8_SUBBANDS_1_4 (int16_t)0xFF8D /* 15 et 65 = 0xFF8D6793 */
165 #define WIND_8_SUBBANDS_2_0 (int16_t)0x000B /* 2 et 78 = 0x000B3F71 */
166 #define WIND_8_SUBBANDS_2_1 (int16_t)0x0157 /* 18 et 62 = 0x0156B3CA */
167 #define WIND_8_SUBBANDS_2_2 (int16_t)0x0C7D /* 34 et 46 = 0x0C7D59B6 */
168 #define WIND_8_SUBBANDS_2_3 (int16_t)0xFB00 /* 30 et 50 = 0xFAFF95FC */
169 #define WIND_8_SUBBANDS_2_4 (int16_t)0xFFCA /* 14 et 66 = 0xFFC9F10E */
170 #define WIND_8_SUBBANDS_3_0 (int16_t)0x0012 /* 3 et 77 = 0x00122C7D*/
171 #define WIND_8_SUBBANDS_3_1 (int16_t)0x01A2 /* 19 et 61 = 0x01A1B38B */
172 #define WIND_8_SUBBANDS_3_2 (int16_t)0x0E3C /* 35 et 45 = 0x0E3BB16F */
173 #define WIND_8_SUBBANDS_3_3 (int16_t)0xFCA8 /* 29 et 51 = 0xFCA86E7E */
174 #define WIND_8_SUBBANDS_3_4 (int16_t)0xFFFA /* 13 et 67 = 0xFFFA2413 */
175 #define WIND_8_SUBBANDS_4_0 (int16_t)0x001B /* 4 et 66 = 0x001AFF89 */
176 #define WIND_8_SUBBANDS_4_1 (int16_t)0x01E0 /* 20 et 60 = 0x01E0224C */
177 #define WIND_8_SUBBANDS_4_2 (int16_t)0x0FC7 /* 36 et 44 = 0x0FC721F9 */
178 #define WIND_8_SUBBANDS_4_3 (int16_t)0xFE20 /* 28 et 52 = 0xFE20435D */
179 #define WIND_8_SUBBANDS_4_4 (int16_t)0x001E /* 12 et 68 = 0x001D8FD2 */
180 #define WIND_8_SUBBANDS_5_0 (int16_t)0x0025 /* 5 et 75 = 0x00255A62 */
181 #define WIND_8_SUBBANDS_5_1 (int16_t)0x0209 /* 21 et 59 = 0x0209291F */
182 #define WIND_8_SUBBANDS_5_2 (int16_t)0x110F /* 37 et 43 = 0x110ECEF0 */
183 #define WIND_8_SUBBANDS_5_3 (int16_t)0xFF5F /* 27 et  53 = 0xFF5EEB73 */
184 #define WIND_8_SUBBANDS_5_4 (int16_t)0x0035 /* 11 et 69 = 0x0034F8B6 */
185 #define WIND_8_SUBBANDS_6_0 (int16_t)0x0030 /* 6 et 74 = 0x003060F4 */
186 #define WIND_8_SUBBANDS_6_1 (int16_t)0x0214 /* 22 et 58 = 0x02138653 */
187 #define WIND_8_SUBBANDS_6_2 (int16_t)0x1204 /* 38 et 42 = 0x120435FA */
188 #define WIND_8_SUBBANDS_6_3 (int16_t)0x0060 /* 26 et 54 = 0x005FD0FF */
189 #define WIND_8_SUBBANDS_6_4 (int16_t)0x0041 /* 10 et 70 = 0x00415B75 */
190 #define WIND_8_SUBBANDS_7_0 (int16_t)0x003A /* 7 et 73 = 0x003A72E7 */
191 #define WIND_8_SUBBANDS_7_1 (int16_t)0x01F6 /* 23 et 57 = 0x01F5F424 */
192 #define WIND_8_SUBBANDS_7_2 (int16_t)0x129C /* 39 et 41 = 0x129C226F */
193 #define WIND_8_SUBBANDS_7_3 (int16_t)0x0122 /* 25 et 55 = 0x01223EBA */
194 #define WIND_8_SUBBANDS_7_4 (int16_t)0x0045 /* 9 et 71 = 0x0044EF48 */
195 #define WIND_8_SUBBANDS_8_0 (int16_t)0x0042 /* 8 et 72 = 0x0041EC6A */
196 #define WIND_8_SUBBANDS_8_1 (int16_t)0x01A8 /* 24 et 56 = 0x01A7ECEF */
197 #define WIND_8_SUBBANDS_8_2 (int16_t)0x12CF /* 40 = 0x12CF6C75 */
198 #endif
199 
200 #if (SBC_USE_ARM_PRAGMA == TRUE)
201 #pragma arm section zidata = "sbc_s32_analysis_section"
202 #endif
203 static int32_t s32DCTY[16] = {0};
204 static int32_t s32X[ENC_VX_BUFFER_SIZE / 2];
205 static int16_t* s16X =
206     (int16_t*)s32X; /* s16X must be 32 bits aligned cf  SHIFTUP_X8_2*/
207 #if (SBC_USE_ARM_PRAGMA == TRUE)
208 #pragma arm section zidata
209 #endif
210 
211 /* This macro is for 4 subbands */
212 #define SHIFTUP_X4                                      \
213   {                                                     \
214     ps32X = (int32_t*)(s16X + EncMaxShiftCounter + 38); \
215     for (i = 0; i < 9; i++) {                           \
216       *ps32X = *(ps32X - 2 - (ShiftCounter >> 1));      \
217       ps32X--;                                          \
218       *ps32X = *(ps32X - 2 - (ShiftCounter >> 1));      \
219       ps32X--;                                          \
220     }                                                   \
221   }
222 #define SHIFTUP_X4_2                                            \
223   {                                                             \
224     ps32X = (int32_t*)(s16X + EncMaxShiftCounter + 38);         \
225     ps32X2 = (int32_t*)(s16X + (EncMaxShiftCounter << 1) + 78); \
226     for (i = 0; i < 9; i++) {                                   \
227       *ps32X = *(ps32X - 2 - (ShiftCounter >> 1));              \
228       *(ps32X2) = *(ps32X2 - 2 - (ShiftCounter >> 1));          \
229       ps32X--;                                                  \
230       ps32X2--;                                                 \
231       *ps32X = *(ps32X - 2 - (ShiftCounter >> 1));              \
232       *(ps32X2) = *(ps32X2 - 2 - (ShiftCounter >> 1));          \
233       ps32X--;                                                  \
234       ps32X2--;                                                 \
235     }                                                           \
236   }
237 
238 /* This macro is for 8 subbands */
239 #define SHIFTUP_X8                                      \
240   {                                                     \
241     ps32X = (int32_t*)(s16X + EncMaxShiftCounter + 78); \
242     for (i = 0; i < 9; i++) {                           \
243       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));      \
244       ps32X--;                                          \
245       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));      \
246       ps32X--;                                          \
247       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));      \
248       ps32X--;                                          \
249       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));      \
250       ps32X--;                                          \
251     }                                                   \
252   }
253 #define SHIFTUP_X8_2                                             \
254   {                                                              \
255     ps32X = (int32_t*)(s16X + EncMaxShiftCounter + 78);          \
256     ps32X2 = (int32_t*)(s16X + (EncMaxShiftCounter << 1) + 158); \
257     for (i = 0; i < 9; i++) {                                    \
258       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));               \
259       *(ps32X2) = *(ps32X2 - 4 - (ShiftCounter >> 1));           \
260       ps32X--;                                                   \
261       ps32X2--;                                                  \
262       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));               \
263       *(ps32X2) = *(ps32X2 - 4 - (ShiftCounter >> 1));           \
264       ps32X--;                                                   \
265       ps32X2--;                                                  \
266       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));               \
267       *(ps32X2) = *(ps32X2 - 4 - (ShiftCounter >> 1));           \
268       ps32X--;                                                   \
269       ps32X2--;                                                  \
270       *ps32X = *(ps32X - 4 - (ShiftCounter >> 1));               \
271       *(ps32X2) = *(ps32X2 - 4 - (ShiftCounter >> 1));           \
272       ps32X--;                                                   \
273       ps32X2--;                                                  \
274     }                                                            \
275   }
276 
277 #if (SBC_ARM_ASM_OPT == TRUE)
278 #define WINDOW_ACCU_8_0                                                                                                                                                                                      \
279   {                                                                                                                                                                                                          \
280     __asm {\
281         MUL s32Hi,WIND_8_SUBBANDS_0_1,(s16X[ChOffset+16]-s16X[ChOffset+64]);\
282         MLA s32Hi,WIND_8_SUBBANDS_0_2,(s16X[ChOffset+32]-s16X[ChOffset+48]),s32Hi;\
283         MOV s32DCTY[0],s32Hi; \
284     }                                                                                                                                                                                                        \
285   }
286 #define WINDOW_ACCU_8_1_15                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \
287   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \
288     __asm {\
289         MUL s32Hi,WIND_8_SUBBANDS_1_0,s16X[ChOffset+1];\
290         MUL s32Hi2,WIND_8_SUBBANDS_1_0,s16X[ChOffset+64+15];\
291         MLA s32Hi,WIND_8_SUBBANDS_1_1,s16X[ChOffset+16+1],s32Hi;\
292         MLA s32Hi2,WIND_8_SUBBANDS_1_1,s16X[ChOffset+48+15],s32Hi2;\
293         MLA s32Hi,WIND_8_SUBBANDS_1_2,s16X[ChOffset+32+1],s32Hi;\
294         MLA s32Hi2,WIND_8_SUBBANDS_1_2,s16X[ChOffset+32+15],s32Hi2;\
295         MLA s32Hi,WIND_8_SUBBANDS_1_3,s16X[ChOffset+48+1],s32Hi;\
296         MLA s32Hi2,WIND_8_SUBBANDS_1_3,s16X[ChOffset+16+15],s32Hi2;\
297         MLA s32Hi,WIND_8_SUBBANDS_1_4,s16X[ChOffset+64+1],s32Hi;\
298         MLA s32Hi2,WIND_8_SUBBANDS_1_4,s16X[ChOffset+15],s32Hi2;\
299         MOV s32DCTY[1],s32Hi;\
300         MOV s32DCTY[15],s32Hi2; \
301     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
302   }
303 #define WINDOW_ACCU_8_2_14                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \
304   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \
305     __asm {\
306         MUL s32Hi,WIND_8_SUBBANDS_2_0,s16X[ChOffset+2];\
307         MUL s32Hi2,WIND_8_SUBBANDS_2_0,s16X[ChOffset+64+14];\
308         MLA s32Hi,WIND_8_SUBBANDS_2_1,s16X[ChOffset+16+2],s32Hi;\
309         MLA s32Hi2,WIND_8_SUBBANDS_2_1,s16X[ChOffset+48+14],s32Hi2;\
310         MLA s32Hi,WIND_8_SUBBANDS_2_2,s16X[ChOffset+32+2],s32Hi;\
311         MLA s32Hi2,WIND_8_SUBBANDS_2_2,s16X[ChOffset+32+14],s32Hi2;\
312         MLA s32Hi,WIND_8_SUBBANDS_2_3,s16X[ChOffset+48+2],s32Hi;\
313         MLA s32Hi2,WIND_8_SUBBANDS_2_3,s16X[ChOffset+16+14],s32Hi2;\
314         MLA s32Hi,WIND_8_SUBBANDS_2_4,s16X[ChOffset+64+2],s32Hi;\
315         MLA s32Hi2,WIND_8_SUBBANDS_2_4,s16X[ChOffset+14],s32Hi2;\
316         MOV s32DCTY[2],s32Hi;\
317         MOV s32DCTY[14],s32Hi2; \
318     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
319   }
320 #define WINDOW_ACCU_8_3_13                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \
321   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \
322     __asm {\
323         MUL s32Hi,WIND_8_SUBBANDS_3_0,s16X[ChOffset+3];\
324         MUL s32Hi2,WIND_8_SUBBANDS_3_0,s16X[ChOffset+64+13];\
325         MLA s32Hi,WIND_8_SUBBANDS_3_1,s16X[ChOffset+16+3],s32Hi;\
326         MLA s32Hi2,WIND_8_SUBBANDS_3_1,s16X[ChOffset+48+13],s32Hi2;\
327         MLA s32Hi,WIND_8_SUBBANDS_3_2,s16X[ChOffset+32+3],s32Hi;\
328         MLA s32Hi2,WIND_8_SUBBANDS_3_2,s16X[ChOffset+32+13],s32Hi2;\
329         MLA s32Hi,WIND_8_SUBBANDS_3_3,s16X[ChOffset+48+3],s32Hi;\
330         MLA s32Hi2,WIND_8_SUBBANDS_3_3,s16X[ChOffset+16+13],s32Hi2;\
331         MLA s32Hi,WIND_8_SUBBANDS_3_4,s16X[ChOffset+64+3],s32Hi;\
332         MLA s32Hi2,WIND_8_SUBBANDS_3_4,s16X[ChOffset+13],s32Hi2;\
333         MOV s32DCTY[3],s32Hi;\
334         MOV s32DCTY[13],s32Hi2; \
335     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
336   }
337 #define WINDOW_ACCU_8_4_12                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \
338   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \
339     __asm {\
340         MUL s32Hi,WIND_8_SUBBANDS_4_0,s16X[ChOffset+4];\
341         MUL s32Hi2,WIND_8_SUBBANDS_4_0,s16X[ChOffset+64+12];\
342         MLA s32Hi,WIND_8_SUBBANDS_4_1,s16X[ChOffset+16+4],s32Hi;\
343         MLA s32Hi2,WIND_8_SUBBANDS_4_1,s16X[ChOffset+48+12],s32Hi2;\
344         MLA s32Hi,WIND_8_SUBBANDS_4_2,s16X[ChOffset+32+4],s32Hi;\
345         MLA s32Hi2,WIND_8_SUBBANDS_4_2,s16X[ChOffset+32+12],s32Hi2;\
346         MLA s32Hi,WIND_8_SUBBANDS_4_3,s16X[ChOffset+48+4],s32Hi;\
347         MLA s32Hi2,WIND_8_SUBBANDS_4_3,s16X[ChOffset+16+12],s32Hi2;\
348         MLA s32Hi,WIND_8_SUBBANDS_4_4,s16X[ChOffset+64+4],s32Hi;\
349         MLA s32Hi2,WIND_8_SUBBANDS_4_4,s16X[ChOffset+12],s32Hi2;\
350         MOV s32DCTY[4],s32Hi;\
351         MOV s32DCTY[12],s32Hi2; \
352     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
353   }
354 #define WINDOW_ACCU_8_5_11                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \
355   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \
356     __asm {\
357         MUL s32Hi,WIND_8_SUBBANDS_5_0,s16X[ChOffset+5];\
358         MUL s32Hi2,WIND_8_SUBBANDS_5_0,s16X[ChOffset+64+11];\
359         MLA s32Hi,WIND_8_SUBBANDS_5_1,s16X[ChOffset+16+5],s32Hi;\
360         MLA s32Hi2,WIND_8_SUBBANDS_5_1,s16X[ChOffset+48+11],s32Hi2;\
361         MLA s32Hi,WIND_8_SUBBANDS_5_2,s16X[ChOffset+32+5],s32Hi;\
362         MLA s32Hi2,WIND_8_SUBBANDS_5_2,s16X[ChOffset+32+11],s32Hi2;\
363         MLA s32Hi,WIND_8_SUBBANDS_5_3,s16X[ChOffset+48+5],s32Hi;\
364         MLA s32Hi2,WIND_8_SUBBANDS_5_3,s16X[ChOffset+16+11],s32Hi2;\
365         MLA s32Hi,WIND_8_SUBBANDS_5_4,s16X[ChOffset+64+5],s32Hi;\
366         MLA s32Hi2,WIND_8_SUBBANDS_5_4,s16X[ChOffset+11],s32Hi2;\
367         MOV s32DCTY[5],s32Hi;\
368         MOV s32DCTY[11],s32Hi2; \
369     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
370   }
371 #define WINDOW_ACCU_8_6_10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  \
372   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \
373     __asm {\
374         MUL s32Hi,WIND_8_SUBBANDS_6_0,s16X[ChOffset+6];\
375         MUL s32Hi2,WIND_8_SUBBANDS_6_0,s16X[ChOffset+64+10];\
376         MLA s32Hi,WIND_8_SUBBANDS_6_1,s16X[ChOffset+16+6],s32Hi;\
377         MLA s32Hi2,WIND_8_SUBBANDS_6_1,s16X[ChOffset+48+10],s32Hi2;\
378         MLA s32Hi,WIND_8_SUBBANDS_6_2,s16X[ChOffset+32+6],s32Hi;\
379         MLA s32Hi2,WIND_8_SUBBANDS_6_2,s16X[ChOffset+32+10],s32Hi2;\
380         MLA s32Hi,WIND_8_SUBBANDS_6_3,s16X[ChOffset+48+6],s32Hi;\
381         MLA s32Hi2,WIND_8_SUBBANDS_6_3,s16X[ChOffset+16+10],s32Hi2;\
382         MLA s32Hi,WIND_8_SUBBANDS_6_4,s16X[ChOffset+64+6],s32Hi;\
383         MLA s32Hi2,WIND_8_SUBBANDS_6_4,s16X[ChOffset+10],s32Hi2;\
384         MOV s32DCTY[6],s32Hi;\
385         MOV s32DCTY[10],s32Hi2; \
386     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
387   }
388 #define WINDOW_ACCU_8_7_9                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             \
389   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   \
390     __asm {\
391         MUL s32Hi,WIND_8_SUBBANDS_7_0,s16X[ChOffset+7];\
392         MUL s32Hi2,WIND_8_SUBBANDS_7_0,s16X[ChOffset+64+9];\
393         MLA s32Hi,WIND_8_SUBBANDS_7_1,s16X[ChOffset+16+7],s32Hi;\
394         MLA s32Hi2,WIND_8_SUBBANDS_7_1,s16X[ChOffset+48+9],s32Hi2;\
395         MLA s32Hi,WIND_8_SUBBANDS_7_2,s16X[ChOffset+32+7],s32Hi;\
396         MLA s32Hi2,WIND_8_SUBBANDS_7_2,s16X[ChOffset+32+9],s32Hi2;\
397         MLA s32Hi,WIND_8_SUBBANDS_7_3,s16X[ChOffset+48+7],s32Hi;\
398         MLA s32Hi2,WIND_8_SUBBANDS_7_3,s16X[ChOffset+16+9],s32Hi2;\
399         MLA s32Hi,WIND_8_SUBBANDS_7_4,s16X[ChOffset+64+7],s32Hi;\
400         MLA s32Hi2,WIND_8_SUBBANDS_7_4,s16X[ChOffset+9],s32Hi2;\
401         MOV s32DCTY[7],s32Hi;\
402         MOV s32DCTY[9],s32Hi2; \
403     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 \
404   }
405 #define WINDOW_ACCU_8_8                                                                                                                                                                                                                                                             \
406   {                                                                                                                                                                                                                                                                                 \
407     __asm {\
408         MUL s32Hi,WIND_8_SUBBANDS_8_0,(s16X[ChOffset+8]+s16X[ChOffset+8+64]);\
409         MLA s32Hi,WIND_8_SUBBANDS_8_1,(s16X[ChOffset+8+16]+s16X[ChOffset+8+64]),s32Hi;\
410         MLA s32Hi,WIND_8_SUBBANDS_8_2,s16X[ChOffset+8+32],s32Hi;\
411         MOV s32DCTY[8],s32Hi; \
412     }                                                                                                                                                                                                                                                                               \
413   }
414 #define WINDOW_ACCU_4_0                                                                                                                                                                                     \
415   {                                                                                                                                                                                                         \
416     __asm {\
417         MUL s32Hi,WIND_4_SUBBANDS_0_1,(s16X[ChOffset+8]-s16X[ChOffset+32]);\
418         MLA s32Hi,WIND_4_SUBBANDS_0_2,(s16X[ChOffset+16]-s16X[ChOffset+24]),s32Hi;\
419         MOV s32DCTY[0],s32Hi; \
420     }                                                                                                                                                                                                       \
421   }
422 #define WINDOW_ACCU_4_1_7                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           \
423   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 \
424     __asm {\
425         MUL s32Hi,WIND_4_SUBBANDS_1_0,s16X[ChOffset+1];\
426         MUL s32Hi2,WIND_4_SUBBANDS_1_0,s16X[ChOffset+32+7];\
427         MLA s32Hi,WIND_4_SUBBANDS_1_1,s16X[ChOffset+8+1],s32Hi;\
428         MLA s32Hi2,WIND_4_SUBBANDS_1_1,s16X[ChOffset+24+7],s32Hi2;\
429         MLA s32Hi,WIND_4_SUBBANDS_1_2,s16X[ChOffset+16+1],s32Hi;\
430         MLA s32Hi2,WIND_4_SUBBANDS_1_2,s16X[ChOffset+16+7],s32Hi2;\
431         MLA s32Hi,WIND_4_SUBBANDS_1_3,s16X[ChOffset+24+1],s32Hi;\
432         MLA s32Hi2,WIND_4_SUBBANDS_1_3,s16X[ChOffset+8+7],s32Hi2;\
433         MLA s32Hi,WIND_4_SUBBANDS_1_4,s16X[ChOffset+32+1],s32Hi;\
434         MLA s32Hi2,WIND_4_SUBBANDS_1_4,s16X[ChOffset+7],s32Hi2;\
435         MOV s32DCTY[1],s32Hi;\
436         MOV s32DCTY[7],s32Hi2; \
437     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               \
438   }
439 #define WINDOW_ACCU_4_2_6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           \
440   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 \
441     __asm {\
442         MUL s32Hi,WIND_4_SUBBANDS_2_0,s16X[ChOffset+2];\
443         MUL s32Hi2,WIND_4_SUBBANDS_2_0,s16X[ChOffset+32+6];\
444         MLA s32Hi,WIND_4_SUBBANDS_2_1,s16X[ChOffset+8+2],s32Hi;\
445         MLA s32Hi2,WIND_4_SUBBANDS_2_1,s16X[ChOffset+24+6],s32Hi2;\
446         MLA s32Hi,WIND_4_SUBBANDS_2_2,s16X[ChOffset+16+2],s32Hi;\
447         MLA s32Hi2,WIND_4_SUBBANDS_2_2,s16X[ChOffset+16+6],s32Hi2;\
448         MLA s32Hi,WIND_4_SUBBANDS_2_3,s16X[ChOffset+24+2],s32Hi;\
449         MLA s32Hi2,WIND_4_SUBBANDS_2_3,s16X[ChOffset+8+6],s32Hi2;\
450         MLA s32Hi,WIND_4_SUBBANDS_2_4,s16X[ChOffset+32+2],s32Hi;\
451         MLA s32Hi2,WIND_4_SUBBANDS_2_4,s16X[ChOffset+6],s32Hi2;\
452         MOV s32DCTY[2],s32Hi;\
453         MOV s32DCTY[6],s32Hi2; \
454     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               \
455   }
456 #define WINDOW_ACCU_4_3_5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           \
457   {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 \
458     __asm {\
459         MUL s32Hi,WIND_4_SUBBANDS_3_0,s16X[ChOffset+3];\
460         MUL s32Hi2,WIND_4_SUBBANDS_3_0,s16X[ChOffset+32+5];\
461         MLA s32Hi,WIND_4_SUBBANDS_3_1,s16X[ChOffset+8+3],s32Hi;\
462         MLA s32Hi2,WIND_4_SUBBANDS_3_1,s16X[ChOffset+24+5],s32Hi2;\
463         MLA s32Hi,WIND_4_SUBBANDS_3_2,s16X[ChOffset+16+3],s32Hi;\
464         MLA s32Hi2,WIND_4_SUBBANDS_3_2,s16X[ChOffset+16+5],s32Hi2;\
465         MLA s32Hi,WIND_4_SUBBANDS_3_3,s16X[ChOffset+24+3],s32Hi;\
466         MLA s32Hi2,WIND_4_SUBBANDS_3_3,s16X[ChOffset+8+5],s32Hi2;\
467         MLA s32Hi,WIND_4_SUBBANDS_3_4,s16X[ChOffset+32+3],s32Hi;\
468         MLA s32Hi2,WIND_4_SUBBANDS_3_4,s16X[ChOffset+5],s32Hi2;\
469         MOV s32DCTY[3],s32Hi;\
470         MOV s32DCTY[5],s32Hi2; \
471     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               \
472   }
473 #define WINDOW_ACCU_4_4                                                                                                                                                                                                                                                            \
474   {                                                                                                                                                                                                                                                                                \
475     __asm {\
476         MUL s32Hi,WIND_4_SUBBANDS_4_0,(s16X[ChOffset+4]+s16X[ChOffset+4+32]);\
477         MLA s32Hi,WIND_4_SUBBANDS_4_1,(s16X[ChOffset+4+8]+s16X[ChOffset+4+24]),s32Hi;\
478         MLA s32Hi,WIND_4_SUBBANDS_4_2,s16X[ChOffset+4+16],s32Hi;\
479         MOV s32DCTY[4],s32Hi; \
480     }                                                                                                                                                                                                                                                                              \
481   }
482 
483 #define WINDOW_PARTIAL_4 \
484   {                      \
485     WINDOW_ACCU_4_0;     \
486     WINDOW_ACCU_4_1_7;   \
487     WINDOW_ACCU_4_2_6;   \
488     WINDOW_ACCU_4_3_5;   \
489     WINDOW_ACCU_4_4;     \
490   }
491 
492 #define WINDOW_PARTIAL_8 \
493   {                      \
494     WINDOW_ACCU_8_0;     \
495     WINDOW_ACCU_8_1_15;  \
496     WINDOW_ACCU_8_2_14;  \
497     WINDOW_ACCU_8_3_13;  \
498     WINDOW_ACCU_8_4_12;  \
499     WINDOW_ACCU_8_5_11;  \
500     WINDOW_ACCU_8_6_10;  \
501     WINDOW_ACCU_8_7_9;   \
502     WINDOW_ACCU_8_8;     \
503   }
504 
505 #else
506 #if (SBC_IPAQ_OPT == TRUE)
507 
508 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
509 #define WINDOW_ACCU_8_0                                              \
510   {                                                                  \
511     s64Temp = (int64_t)WIND_8_SUBBANDS_0_1 *                         \
512               (int64_t)(s16X[ChOffset + 16] - s16X[ChOffset + 64]);  \
513     s64Temp += (int64_t)WIND_8_SUBBANDS_0_2 *                        \
514                (int64_t)(s16X[ChOffset + 32] - s16X[ChOffset + 48]); \
515     s32DCTY[0] = (int32_t)(s64Temp >> 16);                           \
516   }
517 #define WINDOW_ACCU_8_1_15                                                   \
518   {                                                                          \
519     s64Temp = (int64_t)WIND_8_SUBBANDS_1_0 * (int64_t)s16X[ChOffset + 1];    \
520     s64Temp2 =                                                               \
521         (int64_t)WIND_8_SUBBANDS_1_0 * (int64_t)s16X[ChOffset + 64 + 15];    \
522     s64Temp +=                                                               \
523         (int64_t)WIND_8_SUBBANDS_1_1 * (int64_t)s16X[ChOffset + 16 + 1];     \
524     s64Temp2 +=                                                              \
525         (int64_t)WIND_8_SUBBANDS_1_1 * (int64_t)s16X[ChOffset + 48 + 15];    \
526     s64Temp +=                                                               \
527         (int64_t)WIND_8_SUBBANDS_1_2 * (int64_t)s16X[ChOffset + 32 + 1];     \
528     s64Temp2 +=                                                              \
529         (int64_t)WIND_8_SUBBANDS_1_2 * (int64_t)s16X[ChOffset + 32 + 15];    \
530     s64Temp +=                                                               \
531         (int64_t)WIND_8_SUBBANDS_1_3 * (int64_t)s16X[ChOffset + 48 + 1];     \
532     s64Temp2 +=                                                              \
533         (int64_t)WIND_8_SUBBANDS_1_3 * (int64_t)s16X[ChOffset + 16 + 15];    \
534     s64Temp +=                                                               \
535         (int64_t)WIND_8_SUBBANDS_1_4 * (int64_t)s16X[ChOffset + 64 + 1];     \
536     s64Temp2 += (int64_t)WIND_8_SUBBANDS_1_4 * (int64_t)s16X[ChOffset + 15]; \
537     s32DCTY[1] = (int32_t)(s64Temp >> 16);                                   \
538     s32DCTY[15] = (int32_t)(s64Temp2 >> 16);                                 \
539   }
540 #define WINDOW_ACCU_8_2_14                                                   \
541   {                                                                          \
542     s64Temp = (int64_t)WIND_8_SUBBANDS_2_0 * (int64_t)s16X[ChOffset + 2];    \
543     s64Temp2 =                                                               \
544         (int64_t)WIND_8_SUBBANDS_2_0 * (int64_t)s16X[ChOffset + 64 + 14];    \
545     s64Temp +=                                                               \
546         (int64_t)WIND_8_SUBBANDS_2_1 * (int64_t)s16X[ChOffset + 16 + 2];     \
547     s64Temp2 +=                                                              \
548         (int64_t)WIND_8_SUBBANDS_2_1 * (int64_t)s16X[ChOffset + 48 + 14];    \
549     s64Temp +=                                                               \
550         (int64_t)WIND_8_SUBBANDS_2_2 * (int64_t)s16X[ChOffset + 32 + 2];     \
551     s64Temp2 +=                                                              \
552         (int64_t)WIND_8_SUBBANDS_2_2 * (int64_t)s16X[ChOffset + 32 + 14];    \
553     s64Temp +=                                                               \
554         (int64_t)WIND_8_SUBBANDS_2_3 * (int64_t)s16X[ChOffset + 48 + 2];     \
555     s64Temp2 +=                                                              \
556         (int64_t)WIND_8_SUBBANDS_2_3 * (int64_t)s16X[ChOffset + 16 + 14];    \
557     s64Temp +=                                                               \
558         (int64_t)WIND_8_SUBBANDS_2_4 * (int64_t)s16X[ChOffset + 64 + 2];     \
559     s64Temp2 += (int64_t)WIND_8_SUBBANDS_2_4 * (int64_t)s16X[ChOffset + 14]; \
560     s32DCTY[2] = (int32_t)(s64Temp >> 16);                                   \
561     s32DCTY[14] = (int32_t)(s64Temp2 >> 16);                                 \
562   }
563 #define WINDOW_ACCU_8_3_13                                                   \
564   {                                                                          \
565     s64Temp = (int64_t)WIND_8_SUBBANDS_3_0 * (int64_t)s16X[ChOffset + 3];    \
566     s64Temp2 =                                                               \
567         (int64_t)WIND_8_SUBBANDS_3_0 * (int64_t)s16X[ChOffset + 64 + 13];    \
568     s64Temp +=                                                               \
569         (int64_t)WIND_8_SUBBANDS_3_1 * (int64_t)s16X[ChOffset + 16 + 3];     \
570     s64Temp2 +=                                                              \
571         (int64_t)WIND_8_SUBBANDS_3_1 * (int64_t)s16X[ChOffset + 48 + 13];    \
572     s64Temp +=                                                               \
573         (int64_t)WIND_8_SUBBANDS_3_2 * (int64_t)s16X[ChOffset + 32 + 3];     \
574     s64Temp2 +=                                                              \
575         (int64_t)WIND_8_SUBBANDS_3_2 * (int64_t)s16X[ChOffset + 32 + 13];    \
576     s64Temp +=                                                               \
577         (int64_t)WIND_8_SUBBANDS_3_3 * (int64_t)s16X[ChOffset + 48 + 3];     \
578     s64Temp2 +=                                                              \
579         (int64_t)WIND_8_SUBBANDS_3_3 * (int64_t)s16X[ChOffset + 16 + 13];    \
580     s64Temp +=                                                               \
581         (int64_t)WIND_8_SUBBANDS_3_4 * (int64_t)s16X[ChOffset + 64 + 3];     \
582     s64Temp2 += (int64_t)WIND_8_SUBBANDS_3_4 * (int64_t)s16X[ChOffset + 13]; \
583     s32DCTY[3] = (int32_t)(s64Temp >> 16);                                   \
584     s32DCTY[13] = (int32_t)(s64Temp2 >> 16);                                 \
585   }
586 #define WINDOW_ACCU_8_4_12                                                   \
587   {                                                                          \
588     s64Temp = (int64_t)WIND_8_SUBBANDS_4_0 * (int64_t)s16X[ChOffset + 4];    \
589     s64Temp2 =                                                               \
590         (int64_t)WIND_8_SUBBANDS_4_0 * (int64_t)s16X[ChOffset + 64 + 12];    \
591     s64Temp +=                                                               \
592         (int64_t)WIND_8_SUBBANDS_4_1 * (int64_t)s16X[ChOffset + 16 + 4];     \
593     s64Temp2 +=                                                              \
594         (int64_t)WIND_8_SUBBANDS_4_1 * (int64_t)s16X[ChOffset + 48 + 12];    \
595     s64Temp +=                                                               \
596         (int64_t)WIND_8_SUBBANDS_4_2 * (int64_t)s16X[ChOffset + 32 + 4];     \
597     s64Temp2 +=                                                              \
598         (int64_t)WIND_8_SUBBANDS_4_2 * (int64_t)s16X[ChOffset + 32 + 12];    \
599     s64Temp +=                                                               \
600         (int64_t)WIND_8_SUBBANDS_4_3 * (int64_t)s16X[ChOffset + 48 + 4];     \
601     s64Temp2 +=                                                              \
602         (int64_t)WIND_8_SUBBANDS_4_3 * (int64_t)s16X[ChOffset + 16 + 12];    \
603     s64Temp +=                                                               \
604         (int64_t)WIND_8_SUBBANDS_4_4 * (int64_t)s16X[ChOffset + 64 + 4];     \
605     s64Temp2 += (int64_t)WIND_8_SUBBANDS_4_4 * (int64_t)s16X[ChOffset + 12]; \
606     s32DCTY[4] = (int32_t)(s64Temp >> 16);                                   \
607     s32DCTY[12] = (int32_t)(s64Temp2 >> 16);                                 \
608   }
609 #define WINDOW_ACCU_8_5_11                                                   \
610   {                                                                          \
611     s64Temp = (int64_t)WIND_8_SUBBANDS_5_0 * (int64_t)s16X[ChOffset + 5];    \
612     s64Temp2 =                                                               \
613         (int64_t)WIND_8_SUBBANDS_5_0 * (int64_t)s16X[ChOffset + 64 + 11];    \
614     s64Temp +=                                                               \
615         (int64_t)WIND_8_SUBBANDS_5_1 * (int64_t)s16X[ChOffset + 16 + 5];     \
616     s64Temp2 +=                                                              \
617         (int64_t)WIND_8_SUBBANDS_5_1 * (int64_t)s16X[ChOffset + 48 + 11];    \
618     s64Temp +=                                                               \
619         (int64_t)WIND_8_SUBBANDS_5_2 * (int64_t)s16X[ChOffset + 32 + 5];     \
620     s64Temp2 +=                                                              \
621         (int64_t)WIND_8_SUBBANDS_5_2 * (int64_t)s16X[ChOffset + 32 + 11];    \
622     s64Temp +=                                                               \
623         (int64_t)WIND_8_SUBBANDS_5_3 * (int64_t)s16X[ChOffset + 48 + 5];     \
624     s64Temp2 +=                                                              \
625         (int64_t)WIND_8_SUBBANDS_5_3 * (int64_t)s16X[ChOffset + 16 + 11];    \
626     s64Temp +=                                                               \
627         (int64_t)WIND_8_SUBBANDS_5_4 * (int64_t)s16X[ChOffset + 64 + 5];     \
628     s64Temp2 += (int64_t)WIND_8_SUBBANDS_5_4 * (int64_t)s16X[ChOffset + 11]; \
629     s32DCTY[5] = (int32_t)(s64Temp >> 16);                                   \
630     s32DCTY[11] = (int32_t)(s64Temp2 >> 16);                                 \
631   }
632 #define WINDOW_ACCU_8_6_10                                                   \
633   {                                                                          \
634     s64Temp = (int64_t)WIND_8_SUBBANDS_6_0 * (int64_t)s16X[ChOffset + 6];    \
635     s64Temp2 =                                                               \
636         (int64_t)WIND_8_SUBBANDS_6_0 * (int64_t)s16X[ChOffset + 64 + 10];    \
637     s64Temp +=                                                               \
638         (int64_t)WIND_8_SUBBANDS_6_1 * (int64_t)s16X[ChOffset + 16 + 6];     \
639     s64Temp2 +=                                                              \
640         (int64_t)WIND_8_SUBBANDS_6_1 * (int64_t)s16X[ChOffset + 48 + 10];    \
641     s64Temp +=                                                               \
642         (int64_t)WIND_8_SUBBANDS_6_2 * (int64_t)s16X[ChOffset + 32 + 6];     \
643     s64Temp2 +=                                                              \
644         (int64_t)WIND_8_SUBBANDS_6_2 * (int64_t)s16X[ChOffset + 32 + 10];    \
645     s64Temp +=                                                               \
646         (int64_t)WIND_8_SUBBANDS_6_3 * (int64_t)s16X[ChOffset + 48 + 6];     \
647     s64Temp2 +=                                                              \
648         (int64_t)WIND_8_SUBBANDS_6_3 * (int64_t)s16X[ChOffset + 16 + 10];    \
649     s64Temp +=                                                               \
650         (int64_t)WIND_8_SUBBANDS_6_4 * (int64_t)s16X[ChOffset + 64 + 6];     \
651     s64Temp2 += (int64_t)WIND_8_SUBBANDS_6_4 * (int64_t)s16X[ChOffset + 10]; \
652     s32DCTY[6] = (int32_t)(s64Temp >> 16);                                   \
653     s32DCTY[10] = (int32_t)(s64Temp2 >> 16);                                 \
654   }
655 #define WINDOW_ACCU_8_7_9                                                   \
656   {                                                                         \
657     s64Temp = (int64_t)WIND_8_SUBBANDS_7_0 * (int64_t)s16X[ChOffset + 7];   \
658     s64Temp2 =                                                              \
659         (int64_t)WIND_8_SUBBANDS_7_0 * (int64_t)s16X[ChOffset + 64 + 9];    \
660     s64Temp +=                                                              \
661         (int64_t)WIND_8_SUBBANDS_7_1 * (int64_t)s16X[ChOffset + 16 + 7];    \
662     s64Temp2 +=                                                             \
663         (int64_t)WIND_8_SUBBANDS_7_1 * (int64_t)s16X[ChOffset + 48 + 9];    \
664     s64Temp +=                                                              \
665         (int64_t)WIND_8_SUBBANDS_7_2 * (int64_t)s16X[ChOffset + 32 + 7];    \
666     s64Temp2 +=                                                             \
667         (int64_t)WIND_8_SUBBANDS_7_2 * (int64_t)s16X[ChOffset + 32 + 9];    \
668     s64Temp +=                                                              \
669         (int64_t)WIND_8_SUBBANDS_7_3 * (int64_t)s16X[ChOffset + 48 + 7];    \
670     s64Temp2 +=                                                             \
671         (int64_t)WIND_8_SUBBANDS_7_3 * (int64_t)s16X[ChOffset + 16 + 9];    \
672     s64Temp +=                                                              \
673         (int64_t)WIND_8_SUBBANDS_7_4 * (int64_t)s16X[ChOffset + 64 + 7];    \
674     s64Temp2 += (int64_t)WIND_8_SUBBANDS_7_4 * (int64_t)s16X[ChOffset + 9]; \
675     s32DCTY[7] = (int32_t)(s64Temp >> 16);                                  \
676     s32DCTY[9] = (int32_t)(s64Temp2 >> 16);                                 \
677   }
678 #define WINDOW_ACCU_8_8                                                      \
679   {                                                                          \
680     s64Temp = (int64_t)WIND_8_SUBBANDS_8_0 *                                 \
681               (int64_t)(s16X[ChOffset + 8] + s16X[ChOffset + 64 + 8]);       \
682     s64Temp += (int64_t)WIND_8_SUBBANDS_8_1 *                                \
683                (int64_t)(s16X[ChOffset + 16 + 8] + s16X[ChOffset + 48 + 8]); \
684     s64Temp +=                                                               \
685         (int64_t)WIND_8_SUBBANDS_8_2 * (int64_t)s16X[ChOffset + 32 + 8];     \
686     s32DCTY[8] = (int32_t)(s64Temp >> 16);                                   \
687   }
688 #define WINDOW_ACCU_4_0                                              \
689   {                                                                  \
690     s64Temp = (int64_t)WIND_4_SUBBANDS_0_1 *                         \
691               (int64_t)(s16X[ChOffset + 8] - s16X[ChOffset + 32]);   \
692     s64Temp += (int64_t)WIND_4_SUBBANDS_0_2 *                        \
693                (int64_t)(s16X[ChOffset + 16] - s16X[ChOffset + 24]); \
694     s32DCTY[0] = (int32_t)(s64Temp >> 16);                           \
695   }
696 #define WINDOW_ACCU_4_1_7                                                      \
697   {                                                                            \
698     s64Temp = (int64_t)WIND_4_SUBBANDS_1_0 * (int64_t)s16X[ChOffset + 1];      \
699     s64Temp2 =                                                                 \
700         (int64_t)WIND_4_SUBBANDS_1_0 * (int64_t)s16X[ChOffset + 32 + 7];       \
701     s64Temp += (int64_t)WIND_4_SUBBANDS_1_1 * (int64_t)s16X[ChOffset + 8 + 1]; \
702     s64Temp2 +=                                                                \
703         (int64_t)WIND_4_SUBBANDS_1_1 * (int64_t)s16X[ChOffset + 24 + 7];       \
704     s64Temp +=                                                                 \
705         (int64_t)WIND_4_SUBBANDS_1_2 * (int64_t)s16X[ChOffset + 16 + 1];       \
706     s64Temp2 +=                                                                \
707         (int64_t)WIND_4_SUBBANDS_1_2 * (int64_t)s16X[ChOffset + 16 + 7];       \
708     s64Temp +=                                                                 \
709         (int64_t)WIND_4_SUBBANDS_1_3 * (int64_t)s16X[ChOffset + 24 + 1];       \
710     s64Temp2 +=                                                                \
711         (int64_t)WIND_4_SUBBANDS_1_3 * (int64_t)s16X[ChOffset + 8 + 7];        \
712     s64Temp +=                                                                 \
713         (int64_t)WIND_4_SUBBANDS_1_4 * (int64_t)s16X[ChOffset + 32 + 1];       \
714     s64Temp2 += (int64_t)WIND_4_SUBBANDS_1_4 * (int64_t)s16X[ChOffset + 7];    \
715     s32DCTY[1] = (int32_t)(s64Temp >> 16);                                     \
716     s32DCTY[7] = (int32_t)(s64Temp2 >> 16);                                    \
717   }
718 #define WINDOW_ACCU_4_2_6                                                      \
719   {                                                                            \
720     s64Temp = (int64_t)WIND_4_SUBBANDS_2_0 * (int64_t)s16X[ChOffset + 2];      \
721     s64Temp2 =                                                                 \
722         (int64_t)WIND_4_SUBBANDS_2_0 * (int64_t)s16X[ChOffset + 32 + 6];       \
723     s64Temp += (int64_t)WIND_4_SUBBANDS_2_1 * (int64_t)s16X[ChOffset + 8 + 2]; \
724     s64Temp2 +=                                                                \
725         (int64_t)WIND_4_SUBBANDS_2_1 * (int64_t)s16X[ChOffset + 24 + 6];       \
726     s64Temp +=                                                                 \
727         (int64_t)WIND_4_SUBBANDS_2_2 * (int64_t)s16X[ChOffset + 16 + 2];       \
728     s64Temp2 +=                                                                \
729         (int64_t)WIND_4_SUBBANDS_2_2 * (int64_t)s16X[ChOffset + 16 + 6];       \
730     s64Temp +=                                                                 \
731         (int64_t)WIND_4_SUBBANDS_2_3 * (int64_t)s16X[ChOffset + 24 + 2];       \
732     s64Temp2 +=                                                                \
733         (int64_t)WIND_4_SUBBANDS_2_3 * (int64_t)s16X[ChOffset + 8 + 6];        \
734     s64Temp +=                                                                 \
735         (int64_t)WIND_4_SUBBANDS_2_4 * (int64_t)s16X[ChOffset + 32 + 2];       \
736     s64Temp2 += (int64_t)WIND_4_SUBBANDS_2_4 * (int64_t)s16X[ChOffset + 6];    \
737     s32DCTY[2] = (int32_t)(s64Temp >> 16);                                     \
738     s32DCTY[6] = (int32_t)(s64Temp2 >> 16);                                    \
739   }
740 #define WINDOW_ACCU_4_3_5                                                      \
741   {                                                                            \
742     s64Temp = (int64_t)WIND_4_SUBBANDS_3_0 * (int64_t)s16X[ChOffset + 3];      \
743     s64Temp2 =                                                                 \
744         (int64_t)WIND_4_SUBBANDS_3_0 * (int64_t)s16X[ChOffset + 32 + 5];       \
745     s64Temp += (int64_t)WIND_4_SUBBANDS_3_1 * (int64_t)s16X[ChOffset + 8 + 3]; \
746     s64Temp2 +=                                                                \
747         (int64_t)WIND_4_SUBBANDS_3_1 * (int64_t)s16X[ChOffset + 24 + 5];       \
748     s64Temp +=                                                                 \
749         (int64_t)WIND_4_SUBBANDS_3_2 * (int64_t)s16X[ChOffset + 16 + 3];       \
750     s64Temp2 +=                                                                \
751         (int64_t)WIND_4_SUBBANDS_3_2 * (int64_t)s16X[ChOffset + 16 + 5];       \
752     s64Temp +=                                                                 \
753         (int64_t)WIND_4_SUBBANDS_3_3 * (int64_t)s16X[ChOffset + 24 + 3];       \
754     s64Temp2 +=                                                                \
755         (int64_t)WIND_4_SUBBANDS_3_3 * (int64_t)s16X[ChOffset + 8 + 5];        \
756     s64Temp +=                                                                 \
757         (int64_t)WIND_4_SUBBANDS_3_4 * (int64_t)s16X[ChOffset + 32 + 3];       \
758     s64Temp2 += (int64_t)WIND_4_SUBBANDS_3_4 * (int64_t)s16X[ChOffset + 5];    \
759     s32DCTY[3] = (int32_t)(s64Temp >> 16);                                     \
760     s32DCTY[5] = (int32_t)(s64Temp2 >> 16);                                    \
761   }
762 
763 #define WINDOW_ACCU_4_4                                                     \
764   {                                                                         \
765     s64Temp = (int64_t)WIND_4_SUBBANDS_4_0 *                                \
766               (int64_t)(s16X[ChOffset + 4] + s16X[ChOffset + 4 + 32]);      \
767     s64Temp += (int64_t)WIND_4_SUBBANDS_4_1 *                               \
768                (int64_t)(s16X[ChOffset + 4 + 8] + s16X[ChOffset + 4 + 24]); \
769     s64Temp +=                                                              \
770         (int64_t)WIND_4_SUBBANDS_4_2 * (int64_t)s16X[ChOffset + 4 + 16];    \
771     s32DCTY[4] = (int32_t)(s64Temp >> 16);                                  \
772   }
773 #else /* SBC_IS_64_MULT_IN_WINDOW_ACCU == FALSE */
774 #define WINDOW_ACCU_8_0                                              \
775   {                                                                  \
776     s32Temp = (int32_t)WIND_8_SUBBANDS_0_1 *                         \
777               (int32_t)(s16X[ChOffset + 16] - s16X[ChOffset + 64]);  \
778     s32Temp += (int32_t)WIND_8_SUBBANDS_0_2 *                        \
779                (int32_t)(s16X[ChOffset + 32] - s16X[ChOffset + 48]); \
780     s32DCTY[0] = (int32_t)s32Temp;                                   \
781   }
782 #define WINDOW_ACCU_8_1_15                                                   \
783   {                                                                          \
784     s32Temp = (int32_t)WIND_8_SUBBANDS_1_0 * (int32_t)s16X[ChOffset + 1];    \
785     s32Temp2 =                                                               \
786         (int32_t)WIND_8_SUBBANDS_1_0 * (int32_t)s16X[ChOffset + 64 + 15];    \
787     s32Temp +=                                                               \
788         (int32_t)WIND_8_SUBBANDS_1_1 * (int32_t)s16X[ChOffset + 16 + 1];     \
789     s32Temp2 +=                                                              \
790         (int32_t)WIND_8_SUBBANDS_1_1 * (int32_t)s16X[ChOffset + 48 + 15];    \
791     s32Temp +=                                                               \
792         (int32_t)WIND_8_SUBBANDS_1_2 * (int32_t)s16X[ChOffset + 32 + 1];     \
793     s32Temp2 +=                                                              \
794         (int32_t)WIND_8_SUBBANDS_1_2 * (int32_t)s16X[ChOffset + 32 + 15];    \
795     s32Temp +=                                                               \
796         (int32_t)WIND_8_SUBBANDS_1_3 * (int32_t)s16X[ChOffset + 48 + 1];     \
797     s32Temp2 +=                                                              \
798         (int32_t)WIND_8_SUBBANDS_1_3 * (int32_t)s16X[ChOffset + 16 + 15];    \
799     s32Temp +=                                                               \
800         (int32_t)WIND_8_SUBBANDS_1_4 * (int32_t)s16X[ChOffset + 64 + 1];     \
801     s32Temp2 += (int32_t)WIND_8_SUBBANDS_1_4 * (int32_t)s16X[ChOffset + 15]; \
802     s32DCTY[1] = (int32_t)s32Temp;                                           \
803     s32DCTY[15] = (int32_t)s32Temp2;                                         \
804   }
805 #define WINDOW_ACCU_8_2_14                                                   \
806   {                                                                          \
807     s32Temp = (int32_t)WIND_8_SUBBANDS_2_0 * (int32_t)s16X[ChOffset + 2];    \
808     s32Temp2 =                                                               \
809         (int32_t)WIND_8_SUBBANDS_2_0 * (int32_t)s16X[ChOffset + 64 + 14];    \
810     s32Temp +=                                                               \
811         (int32_t)WIND_8_SUBBANDS_2_1 * (int32_t)s16X[ChOffset + 16 + 2];     \
812     s32Temp2 +=                                                              \
813         (int32_t)WIND_8_SUBBANDS_2_1 * (int32_t)s16X[ChOffset + 48 + 14];    \
814     s32Temp +=                                                               \
815         (int32_t)WIND_8_SUBBANDS_2_2 * (int32_t)s16X[ChOffset + 32 + 2];     \
816     s32Temp2 +=                                                              \
817         (int32_t)WIND_8_SUBBANDS_2_2 * (int32_t)s16X[ChOffset + 32 + 14];    \
818     s32Temp +=                                                               \
819         (int32_t)WIND_8_SUBBANDS_2_3 * (int32_t)s16X[ChOffset + 48 + 2];     \
820     s32Temp2 +=                                                              \
821         (int32_t)WIND_8_SUBBANDS_2_3 * (int32_t)s16X[ChOffset + 16 + 14];    \
822     s32Temp +=                                                               \
823         (int32_t)WIND_8_SUBBANDS_2_4 * (int32_t)s16X[ChOffset + 64 + 2];     \
824     s32Temp2 += (int32_t)WIND_8_SUBBANDS_2_4 * (int32_t)s16X[ChOffset + 14]; \
825     s32DCTY[2] = (int32_t)s32Temp;                                           \
826     s32DCTY[14] = (int32_t)s32Temp2;                                         \
827   }
828 #define WINDOW_ACCU_8_3_13                                                   \
829   {                                                                          \
830     s32Temp = (int32_t)WIND_8_SUBBANDS_3_0 * (int32_t)s16X[ChOffset + 3];    \
831     s32Temp2 =                                                               \
832         (int32_t)WIND_8_SUBBANDS_3_0 * (int32_t)s16X[ChOffset + 64 + 13];    \
833     s32Temp +=                                                               \
834         (int32_t)WIND_8_SUBBANDS_3_1 * (int32_t)s16X[ChOffset + 16 + 3];     \
835     s32Temp2 +=                                                              \
836         (int32_t)WIND_8_SUBBANDS_3_1 * (int32_t)s16X[ChOffset + 48 + 13];    \
837     s32Temp +=                                                               \
838         (int32_t)WIND_8_SUBBANDS_3_2 * (int32_t)s16X[ChOffset + 32 + 3];     \
839     s32Temp2 +=                                                              \
840         (int32_t)WIND_8_SUBBANDS_3_2 * (int32_t)s16X[ChOffset + 32 + 13];    \
841     s32Temp +=                                                               \
842         (int32_t)WIND_8_SUBBANDS_3_3 * (int32_t)s16X[ChOffset + 48 + 3];     \
843     s32Temp2 +=                                                              \
844         (int32_t)WIND_8_SUBBANDS_3_3 * (int32_t)s16X[ChOffset + 16 + 13];    \
845     s32Temp +=                                                               \
846         (int32_t)WIND_8_SUBBANDS_3_4 * (int32_t)s16X[ChOffset + 64 + 3];     \
847     s32Temp2 += (int32_t)WIND_8_SUBBANDS_3_4 * (int32_t)s16X[ChOffset + 13]; \
848     s32DCTY[3] = (int32_t)s32Temp;                                           \
849     s32DCTY[13] = (int32_t)s32Temp2;                                         \
850   }
851 #define WINDOW_ACCU_8_4_12                                                   \
852   {                                                                          \
853     s32Temp = (int32_t)WIND_8_SUBBANDS_4_0 * (int32_t)s16X[ChOffset + 4];    \
854     s32Temp2 =                                                               \
855         (int32_t)WIND_8_SUBBANDS_4_0 * (int32_t)s16X[ChOffset + 64 + 12];    \
856     s32Temp +=                                                               \
857         (int32_t)WIND_8_SUBBANDS_4_1 * (int32_t)s16X[ChOffset + 16 + 4];     \
858     s32Temp2 +=                                                              \
859         (int32_t)WIND_8_SUBBANDS_4_1 * (int32_t)s16X[ChOffset + 48 + 12];    \
860     s32Temp +=                                                               \
861         (int32_t)WIND_8_SUBBANDS_4_2 * (int32_t)s16X[ChOffset + 32 + 4];     \
862     s32Temp2 +=                                                              \
863         (int32_t)WIND_8_SUBBANDS_4_2 * (int32_t)s16X[ChOffset + 32 + 12];    \
864     s32Temp +=                                                               \
865         (int32_t)WIND_8_SUBBANDS_4_3 * (int32_t)s16X[ChOffset + 48 + 4];     \
866     s32Temp2 +=                                                              \
867         (int32_t)WIND_8_SUBBANDS_4_3 * (int32_t)s16X[ChOffset + 16 + 12];    \
868     s32Temp +=                                                               \
869         (int32_t)WIND_8_SUBBANDS_4_4 * (int32_t)s16X[ChOffset + 64 + 4];     \
870     s32Temp2 += (int32_t)WIND_8_SUBBANDS_4_4 * (int32_t)s16X[ChOffset + 12]; \
871     s32DCTY[4] = (int32_t)s32Temp;                                           \
872     s32DCTY[12] = (int32_t)s32Temp2;                                         \
873   }
874 #define WINDOW_ACCU_8_5_11                                                   \
875   {                                                                          \
876     s32Temp = (int32_t)WIND_8_SUBBANDS_5_0 * (int32_t)s16X[ChOffset + 5];    \
877     s32Temp2 =                                                               \
878         (int32_t)WIND_8_SUBBANDS_5_0 * (int32_t)s16X[ChOffset + 64 + 11];    \
879     s32Temp +=                                                               \
880         (int32_t)WIND_8_SUBBANDS_5_1 * (int32_t)s16X[ChOffset + 16 + 5];     \
881     s32Temp2 +=                                                              \
882         (int32_t)WIND_8_SUBBANDS_5_1 * (int32_t)s16X[ChOffset + 48 + 11];    \
883     s32Temp +=                                                               \
884         (int32_t)WIND_8_SUBBANDS_5_2 * (int32_t)s16X[ChOffset + 32 + 5];     \
885     s32Temp2 +=                                                              \
886         (int32_t)WIND_8_SUBBANDS_5_2 * (int32_t)s16X[ChOffset + 32 + 11];    \
887     s32Temp +=                                                               \
888         (int32_t)WIND_8_SUBBANDS_5_3 * (int32_t)s16X[ChOffset + 48 + 5];     \
889     s32Temp2 +=                                                              \
890         (int32_t)WIND_8_SUBBANDS_5_3 * (int32_t)s16X[ChOffset + 16 + 11];    \
891     s32Temp +=                                                               \
892         (int32_t)WIND_8_SUBBANDS_5_4 * (int32_t)s16X[ChOffset + 64 + 5];     \
893     s32Temp2 += (int32_t)WIND_8_SUBBANDS_5_4 * (int32_t)s16X[ChOffset + 11]; \
894     s32DCTY[5] = (int32_t)s32Temp;                                           \
895     s32DCTY[11] = (int32_t)s32Temp2;                                         \
896   }
897 #define WINDOW_ACCU_8_6_10                                                   \
898   {                                                                          \
899     s32Temp = (int32_t)WIND_8_SUBBANDS_6_0 * (int32_t)s16X[ChOffset + 6];    \
900     s32Temp2 =                                                               \
901         (int32_t)WIND_8_SUBBANDS_6_0 * (int32_t)s16X[ChOffset + 64 + 10];    \
902     s32Temp +=                                                               \
903         (int32_t)WIND_8_SUBBANDS_6_1 * (int32_t)s16X[ChOffset + 16 + 6];     \
904     s32Temp2 +=                                                              \
905         (int32_t)WIND_8_SUBBANDS_6_1 * (int32_t)s16X[ChOffset + 48 + 10];    \
906     s32Temp +=                                                               \
907         (int32_t)WIND_8_SUBBANDS_6_2 * (int32_t)s16X[ChOffset + 32 + 6];     \
908     s32Temp2 +=                                                              \
909         (int32_t)WIND_8_SUBBANDS_6_2 * (int32_t)s16X[ChOffset + 32 + 10];    \
910     s32Temp +=                                                               \
911         (int32_t)WIND_8_SUBBANDS_6_3 * (int32_t)s16X[ChOffset + 48 + 6];     \
912     s32Temp2 +=                                                              \
913         (int32_t)WIND_8_SUBBANDS_6_3 * (int32_t)s16X[ChOffset + 16 + 10];    \
914     s32Temp +=                                                               \
915         (int32_t)WIND_8_SUBBANDS_6_4 * (int32_t)s16X[ChOffset + 64 + 6];     \
916     s32Temp2 += (int32_t)WIND_8_SUBBANDS_6_4 * (int32_t)s16X[ChOffset + 10]; \
917     s32DCTY[6] = (int32_t)s32Temp;                                           \
918     s32DCTY[10] = (int32_t)s32Temp2;                                         \
919   }
920 #define WINDOW_ACCU_8_7_9                                                   \
921   {                                                                         \
922     s32Temp = (int32_t)WIND_8_SUBBANDS_7_0 * (int32_t)s16X[ChOffset + 7];   \
923     s32Temp2 =                                                              \
924         (int32_t)WIND_8_SUBBANDS_7_0 * (int32_t)s16X[ChOffset + 64 + 9];    \
925     s32Temp +=                                                              \
926         (int32_t)WIND_8_SUBBANDS_7_1 * (int32_t)s16X[ChOffset + 16 + 7];    \
927     s32Temp2 +=                                                             \
928         (int32_t)WIND_8_SUBBANDS_7_1 * (int32_t)s16X[ChOffset + 48 + 9];    \
929     s32Temp +=                                                              \
930         (int32_t)WIND_8_SUBBANDS_7_2 * (int32_t)s16X[ChOffset + 32 + 7];    \
931     s32Temp2 +=                                                             \
932         (int32_t)WIND_8_SUBBANDS_7_2 * (int32_t)s16X[ChOffset + 32 + 9];    \
933     s32Temp +=                                                              \
934         (int32_t)WIND_8_SUBBANDS_7_3 * (int32_t)s16X[ChOffset + 48 + 7];    \
935     s32Temp2 +=                                                             \
936         (int32_t)WIND_8_SUBBANDS_7_3 * (int32_t)s16X[ChOffset + 16 + 9];    \
937     s32Temp +=                                                              \
938         (int32_t)WIND_8_SUBBANDS_7_4 * (int32_t)s16X[ChOffset + 64 + 7];    \
939     s32Temp2 += (int32_t)WIND_8_SUBBANDS_7_4 * (int32_t)s16X[ChOffset + 9]; \
940     s32DCTY[7] = (int32_t)s32Temp;                                          \
941     s32DCTY[9] = (int32_t)s32Temp2;                                         \
942   }
943 #define WINDOW_ACCU_8_8                                                      \
944   {                                                                          \
945     s32Temp = (int32_t)WIND_8_SUBBANDS_8_0 *                                 \
946               (int32_t)(s16X[ChOffset + 8] + s16X[ChOffset + 64 + 8]);       \
947     s32Temp += (int32_t)WIND_8_SUBBANDS_8_1 *                                \
948                (int32_t)(s16X[ChOffset + 16 + 8] + s16X[ChOffset + 48 + 8]); \
949     s32Temp +=                                                               \
950         (int32_t)WIND_8_SUBBANDS_8_2 * (int32_t)s16X[ChOffset + 32 + 8];     \
951     s32DCTY[8] = (int32_t)s32Temp;                                           \
952   }
953 #define WINDOW_ACCU_4_0                                              \
954   {                                                                  \
955     s32Temp = (int32_t)WIND_4_SUBBANDS_0_1 *                         \
956               (int32_t)(s16X[ChOffset + 8] - s16X[ChOffset + 32]);   \
957     s32Temp += (int32_t)WIND_4_SUBBANDS_0_2 *                        \
958                (int32_t)(s16X[ChOffset + 16] - s16X[ChOffset + 24]); \
959     s32DCTY[0] = (int32_t)(s32Temp);                                 \
960   }
961 #define WINDOW_ACCU_4_1_7                                                      \
962   {                                                                            \
963     s32Temp = (int32_t)WIND_4_SUBBANDS_1_0 * (int32_t)s16X[ChOffset + 1];      \
964     s32Temp2 =                                                                 \
965         (int32_t)WIND_4_SUBBANDS_1_0 * (int32_t)s16X[ChOffset + 32 + 7];       \
966     s32Temp += (int32_t)WIND_4_SUBBANDS_1_1 * (int32_t)s16X[ChOffset + 8 + 1]; \
967     s32Temp2 +=                                                                \
968         (int32_t)WIND_4_SUBBANDS_1_1 * (int32_t)s16X[ChOffset + 24 + 7];       \
969     s32Temp +=                                                                 \
970         (int32_t)WIND_4_SUBBANDS_1_2 * (int32_t)s16X[ChOffset + 16 + 1];       \
971     s32Temp2 +=                                                                \
972         (int32_t)WIND_4_SUBBANDS_1_2 * (int32_t)s16X[ChOffset + 16 + 7];       \
973     s32Temp +=                                                                 \
974         (int32_t)WIND_4_SUBBANDS_1_3 * (int32_t)s16X[ChOffset + 24 + 1];       \
975     s32Temp2 +=                                                                \
976         (int32_t)WIND_4_SUBBANDS_1_3 * (int32_t)s16X[ChOffset + 8 + 7];        \
977     s32Temp +=                                                                 \
978         (int32_t)WIND_4_SUBBANDS_1_4 * (int32_t)s16X[ChOffset + 32 + 1];       \
979     s32Temp2 += (int32_t)WIND_4_SUBBANDS_1_4 * (int32_t)s16X[ChOffset + 7];    \
980     s32DCTY[1] = (int32_t)(s32Temp);                                           \
981     s32DCTY[7] = (int32_t)(s32Temp2);                                          \
982   }
983 #define WINDOW_ACCU_4_2_6                                                      \
984   {                                                                            \
985     s32Temp = (int32_t)WIND_4_SUBBANDS_2_0 * (int32_t)s16X[ChOffset + 2];      \
986     s32Temp2 =                                                                 \
987         (int32_t)WIND_4_SUBBANDS_2_0 * (int32_t)s16X[ChOffset + 32 + 6];       \
988     s32Temp += (int32_t)WIND_4_SUBBANDS_2_1 * (int32_t)s16X[ChOffset + 8 + 2]; \
989     s32Temp2 +=                                                                \
990         (int32_t)WIND_4_SUBBANDS_2_1 * (int32_t)s16X[ChOffset + 24 + 6];       \
991     s32Temp +=                                                                 \
992         (int32_t)WIND_4_SUBBANDS_2_2 * (int32_t)s16X[ChOffset + 16 + 2];       \
993     s32Temp2 +=                                                                \
994         (int32_t)WIND_4_SUBBANDS_2_2 * (int32_t)s16X[ChOffset + 16 + 6];       \
995     s32Temp +=                                                                 \
996         (int32_t)WIND_4_SUBBANDS_2_3 * (int32_t)s16X[ChOffset + 24 + 2];       \
997     s32Temp2 +=                                                                \
998         (int32_t)WIND_4_SUBBANDS_2_3 * (int32_t)s16X[ChOffset + 8 + 6];        \
999     s32Temp +=                                                                 \
1000         (int32_t)WIND_4_SUBBANDS_2_4 * (int32_t)s16X[ChOffset + 32 + 2];       \
1001     s32Temp2 += (int32_t)WIND_4_SUBBANDS_2_4 * (int32_t)s16X[ChOffset + 6];    \
1002     s32DCTY[2] = (int32_t)(s32Temp);                                           \
1003     s32DCTY[6] = (int32_t)(s32Temp2);                                          \
1004   }
1005 #define WINDOW_ACCU_4_3_5                                                      \
1006   {                                                                            \
1007     s32Temp = (int32_t)WIND_4_SUBBANDS_3_0 * (int32_t)s16X[ChOffset + 3];      \
1008     s32Temp2 =                                                                 \
1009         (int32_t)WIND_4_SUBBANDS_3_0 * (int32_t)s16X[ChOffset + 32 + 5];       \
1010     s32Temp += (int32_t)WIND_4_SUBBANDS_3_1 * (int32_t)s16X[ChOffset + 8 + 3]; \
1011     s32Temp2 +=                                                                \
1012         (int32_t)WIND_4_SUBBANDS_3_1 * (int32_t)s16X[ChOffset + 24 + 5];       \
1013     s32Temp +=                                                                 \
1014         (int32_t)WIND_4_SUBBANDS_3_2 * (int32_t)s16X[ChOffset + 16 + 3];       \
1015     s32Temp2 +=                                                                \
1016         (int32_t)WIND_4_SUBBANDS_3_2 * (int32_t)s16X[ChOffset + 16 + 5];       \
1017     s32Temp +=                                                                 \
1018         (int32_t)WIND_4_SUBBANDS_3_3 * (int32_t)s16X[ChOffset + 24 + 3];       \
1019     s32Temp2 +=                                                                \
1020         (int32_t)WIND_4_SUBBANDS_3_3 * (int32_t)s16X[ChOffset + 8 + 5];        \
1021     s32Temp +=                                                                 \
1022         (int32_t)WIND_4_SUBBANDS_3_4 * (int32_t)s16X[ChOffset + 32 + 3];       \
1023     s32Temp2 += (int32_t)WIND_4_SUBBANDS_3_4 * (int32_t)s16X[ChOffset + 5];    \
1024     s32DCTY[3] = (int32_t)(s32Temp);                                           \
1025     s32DCTY[5] = (int32_t)(s32Temp2);                                          \
1026   }
1027 
1028 #define WINDOW_ACCU_4_4                                                     \
1029   {                                                                         \
1030     s32Temp = (int32_t)WIND_4_SUBBANDS_4_0 *                                \
1031               (int32_t)(s16X[ChOffset + 4] + s16X[ChOffset + 4 + 32]);      \
1032     s32Temp += (int32_t)WIND_4_SUBBANDS_4_1 *                               \
1033                (int32_t)(s16X[ChOffset + 4 + 8] + s16X[ChOffset + 4 + 24]); \
1034     s32Temp +=                                                              \
1035         (int32_t)WIND_4_SUBBANDS_4_2 * (int32_t)s16X[ChOffset + 4 + 16];    \
1036     s32DCTY[4] = (int32_t)(s32Temp);                                        \
1037   }
1038 #endif
1039 #define WINDOW_PARTIAL_4 \
1040   {                      \
1041     WINDOW_ACCU_4_0;     \
1042     WINDOW_ACCU_4_1_7;   \
1043     WINDOW_ACCU_4_2_6;   \
1044     WINDOW_ACCU_4_3_5;   \
1045     WINDOW_ACCU_4_4;     \
1046   }
1047 
1048 #define WINDOW_PARTIAL_8 \
1049   {                      \
1050     WINDOW_ACCU_8_0;     \
1051     WINDOW_ACCU_8_1_15;  \
1052     WINDOW_ACCU_8_2_14;  \
1053     WINDOW_ACCU_8_3_13;  \
1054     WINDOW_ACCU_8_4_12;  \
1055     WINDOW_ACCU_8_5_11;  \
1056     WINDOW_ACCU_8_6_10;  \
1057     WINDOW_ACCU_8_7_9;   \
1058     WINDOW_ACCU_8_8;     \
1059   }
1060 #else
1061 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1062 #define WINDOW_ACCU_4(i)                                                     \
1063   {                                                                          \
1064     s64Temp = ((int64_t)gas32CoeffFor4SBs[i] * (int64_t)s16X[ChOffset + i]); \
1065     s64Temp += ((int64_t)gas32CoeffFor4SBs[(i + 8)] *                        \
1066                 (int64_t)s16X[ChOffset + i + 8]);                            \
1067     s64Temp += ((int64_t)gas32CoeffFor4SBs[(i + 16)] *                       \
1068                 (int64_t)s16X[ChOffset + i + 16]);                           \
1069     s64Temp += ((int64_t)gas32CoeffFor4SBs[(i + 24)] *                       \
1070                 (int64_t)s16X[ChOffset + i + 24]);                           \
1071     s64Temp += ((int64_t)gas32CoeffFor4SBs[(i + 32)] *                       \
1072                 (int64_t)s16X[ChOffset + i + 32]);                           \
1073     s32DCTY[i] = (int32_t)(s64Temp >> 16);                                   \
1074     /*printf("s32DCTY4: 0x%x \n", s32DCTY[i]);*/                             \
1075   }
1076 #else
1077 #define WINDOW_ACCU_4(i)                                                 \
1078   {                                                                      \
1079     s32DCTY[i] = (gas32CoeffFor4SBs[i * 2] * s16X[ChOffset + i]) +       \
1080                  (((int32_t)(uint16_t)(gas32CoeffFor4SBs[(i * 2) + 1]) * \
1081                    s16X[ChOffset + i]) >>                                \
1082                   16);                                                   \
1083     s32DCTY[i] +=                                                        \
1084         (gas32CoeffFor4SBs[(i + 8) * 2] * s16X[ChOffset + i + 8]) +      \
1085         (((int32_t)(uint16_t)(gas32CoeffFor4SBs[((i + 8) * 2) + 1]) *    \
1086           s16X[ChOffset + i + 8]) >>                                     \
1087          16);                                                            \
1088     s32DCTY[i] +=                                                        \
1089         (gas32CoeffFor4SBs[(i + 16) * 2] * s16X[ChOffset + i + 16]) +    \
1090         (((int32_t)(uint16_t)(gas32CoeffFor4SBs[((i + 16) * 2) + 1]) *   \
1091           s16X[ChOffset + i + 16]) >>                                    \
1092          16);                                                            \
1093     s32DCTY[i] +=                                                        \
1094         (gas32CoeffFor4SBs[(i + 24) * 2] * s16X[ChOffset + i + 24]) +    \
1095         (((int32_t)(uint16_t)(gas32CoeffFor4SBs[((i + 24) * 2) + 1]) *   \
1096           s16X[ChOffset + i + 24]) >>                                    \
1097          16);                                                            \
1098     s32DCTY[i] +=                                                        \
1099         (gas32CoeffFor4SBs[(i + 32) * 2] * s16X[ChOffset + i + 32]) +    \
1100         (((int32_t)(uint16_t)(gas32CoeffFor4SBs[((i + 32) * 2) + 1]) *   \
1101           s16X[ChOffset + i + 32]) >>                                    \
1102          16);                                                            \
1103   }
1104 #endif
1105 #define WINDOW_PARTIAL_4 \
1106   {                      \
1107     WINDOW_ACCU_4(0);    \
1108     WINDOW_ACCU_4(1);    \
1109     WINDOW_ACCU_4(2);    \
1110     WINDOW_ACCU_4(3);    \
1111     WINDOW_ACCU_4(4);    \
1112     WINDOW_ACCU_4(5);    \
1113     WINDOW_ACCU_4(6);    \
1114     WINDOW_ACCU_4(7);    \
1115   }
1116 
1117 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1118 #define WINDOW_ACCU_8(i)                                                    \
1119   {                                                                         \
1120     s64Temp =                                                               \
1121         ((((int64_t)gas32CoeffFor8SBs[i] * (int64_t)s16X[ChOffset + i])));  \
1122     s64Temp += ((((int64_t)gas32CoeffFor8SBs[(i + 16)] *                    \
1123                   (int64_t)s16X[ChOffset + i + 16])));                      \
1124     s64Temp += ((((int64_t)gas32CoeffFor8SBs[(i + 32)] *                    \
1125                   (int64_t)s16X[ChOffset + i + 32])));                      \
1126     s64Temp += ((((int64_t)gas32CoeffFor8SBs[(i + 48)] *                    \
1127                   (int64_t)s16X[ChOffset + i + 48])));                      \
1128     s64Temp += ((((int64_t)gas32CoeffFor8SBs[(i + 64)] *                    \
1129                   (int64_t)s16X[ChOffset + i + 64])));                      \
1130     /*printf("s32DCTY8: %d= 0x%x * %d\n", s32DCTY[i], gas32CoeffFor8SBs[i], \
1131      * s16X[ChOffset+i]);*/                                                 \
1132     s32DCTY[i] = (int32_t)(s64Temp >> 16);                                  \
1133   }
1134 #else
1135 #define WINDOW_ACCU_8(i)                                                       \
1136   {                                                                            \
1137     s32DCTY[i] = (gas32CoeffFor8SBs[i * 2] * s16X[ChOffset + i]) +             \
1138                  (((int32_t)(uint16_t)(gas32CoeffFor8SBs[(i * 2) + 1]) *       \
1139                    s16X[ChOffset + i]) >>                                      \
1140                   16);                                                         \
1141     s32DCTY[i] +=                                                              \
1142         (gas32CoeffFor8SBs[(i + 16) * 2] * s16X[ChOffset + i + 16]) +          \
1143         (((int32_t)(uint16_t)(gas32CoeffFor8SBs[((i + 16) * 2) + 1]) *         \
1144           s16X[ChOffset + i + 16]) >>                                          \
1145          16);                                                                  \
1146     s32DCTY[i] +=                                                              \
1147         (gas32CoeffFor8SBs[(i + 32) * 2] * s16X[ChOffset + i + 32]) +          \
1148         (((int32_t)(uint16_t)(gas32CoeffFor8SBs[((i + 32) * 2) + 1]) *         \
1149           s16X[ChOffset + i + 32]) >>                                          \
1150          16);                                                                  \
1151     s32DCTY[i] +=                                                              \
1152         (gas32CoeffFor8SBs[(i + 48) * 2] * s16X[ChOffset + i + 48]) +          \
1153         (((int32_t)(uint16_t)(gas32CoeffFor8SBs[((i + 48) * 2) + 1]) *         \
1154           s16X[ChOffset + i + 48]) >>                                          \
1155          16);                                                                  \
1156     s32DCTY[i] +=                                                              \
1157         (gas32CoeffFor8SBs[(i + 64) * 2] * s16X[ChOffset + i + 64]) +          \
1158         (((int32_t)(uint16_t)(gas32CoeffFor8SBs[((i + 64) * 2) + 1]) *         \
1159           s16X[ChOffset + i + 64]) >>                                          \
1160          16);                                                                  \
1161     /*printf("s32DCTY8: %d = 0x%4x%4x * %d\n", s32DCTY[i], gas32CoeffFor8SBs[i \
1162      * * 2], (gas32CoeffFor8SBs[(i * 2) + 1]), s16X[ChOffset+i]);*/            \
1163     /*s32DCTY[i]=(int32_t)(s64Temp>>16);*/                                     \
1164   }
1165 #endif
1166 #define WINDOW_PARTIAL_8 \
1167   {                      \
1168     WINDOW_ACCU_8(0);    \
1169     WINDOW_ACCU_8(1);    \
1170     WINDOW_ACCU_8(2);    \
1171     WINDOW_ACCU_8(3);    \
1172     WINDOW_ACCU_8(4);    \
1173     WINDOW_ACCU_8(5);    \
1174     WINDOW_ACCU_8(6);    \
1175     WINDOW_ACCU_8(7);    \
1176     WINDOW_ACCU_8(8);    \
1177     WINDOW_ACCU_8(9);    \
1178     WINDOW_ACCU_8(10);   \
1179     WINDOW_ACCU_8(11);   \
1180     WINDOW_ACCU_8(12);   \
1181     WINDOW_ACCU_8(13);   \
1182     WINDOW_ACCU_8(14);   \
1183     WINDOW_ACCU_8(15);   \
1184   }
1185 #endif
1186 #endif
1187 
1188 static int16_t ShiftCounter = 0;
1189 extern int16_t EncMaxShiftCounter;
1190 /****************************************************************************
1191 * SbcAnalysisFilter - performs Analysis of the input audio stream
1192 *
1193 * RETURNS : N/A
1194 */
SbcAnalysisFilter4(SBC_ENC_PARAMS * pstrEncParams,int16_t * input)1195 void SbcAnalysisFilter4(SBC_ENC_PARAMS* pstrEncParams, int16_t* input) {
1196   int16_t* ps16PcmBuf;
1197   int32_t* ps32SbBuf;
1198   int32_t s32Blk, s32Ch;
1199   int32_t s32NumOfChannels, s32NumOfBlocks;
1200   int32_t i, *ps32X, *ps32X2;
1201   int32_t Offset, Offset2, ChOffset;
1202 #if (SBC_ARM_ASM_OPT == TRUE)
1203   register int32_t s32Hi, s32Hi2;
1204 #else
1205 #if (SBC_IPAQ_OPT == TRUE)
1206 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1207   register int64_t s64Temp, s64Temp2;
1208 #else
1209   register int32_t s32Temp, s32Temp2;
1210 #endif
1211 #else
1212 
1213 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1214   int64_t s64Temp;
1215 #endif
1216 
1217 #endif
1218 #endif
1219 
1220   s32NumOfChannels = pstrEncParams->s16NumOfChannels;
1221   s32NumOfBlocks = pstrEncParams->s16NumOfBlocks;
1222 
1223   ps16PcmBuf = input;
1224 
1225   ps32SbBuf = pstrEncParams->s32SbBuffer;
1226   Offset2 = (int32_t)(EncMaxShiftCounter + 40);
1227   for (s32Blk = 0; s32Blk < s32NumOfBlocks; s32Blk++) {
1228     Offset = (int32_t)(EncMaxShiftCounter - ShiftCounter);
1229     /* Store new samples */
1230     if (s32NumOfChannels == 1) {
1231       s16X[3 + Offset] = *ps16PcmBuf;
1232       ps16PcmBuf++;
1233       s16X[2 + Offset] = *ps16PcmBuf;
1234       ps16PcmBuf++;
1235       s16X[1 + Offset] = *ps16PcmBuf;
1236       ps16PcmBuf++;
1237       s16X[0 + Offset] = *ps16PcmBuf;
1238       ps16PcmBuf++;
1239     } else {
1240       s16X[3 + Offset] = *ps16PcmBuf;
1241       ps16PcmBuf++;
1242       s16X[Offset2 + 3 + Offset] = *ps16PcmBuf;
1243       ps16PcmBuf++;
1244       s16X[2 + Offset] = *ps16PcmBuf;
1245       ps16PcmBuf++;
1246       s16X[Offset2 + 2 + Offset] = *ps16PcmBuf;
1247       ps16PcmBuf++;
1248       s16X[1 + Offset] = *ps16PcmBuf;
1249       ps16PcmBuf++;
1250       s16X[Offset2 + 1 + Offset] = *ps16PcmBuf;
1251       ps16PcmBuf++;
1252       s16X[0 + Offset] = *ps16PcmBuf;
1253       ps16PcmBuf++;
1254       s16X[Offset2 + 0 + Offset] = *ps16PcmBuf;
1255       ps16PcmBuf++;
1256     }
1257     for (s32Ch = 0; s32Ch < s32NumOfChannels; s32Ch++) {
1258       ChOffset = s32Ch * Offset2 + Offset;
1259 
1260       WINDOW_PARTIAL_4
1261 
1262       SBC_FastIDCT4(s32DCTY, ps32SbBuf);
1263 
1264       ps32SbBuf += SUB_BANDS_4;
1265     }
1266     if (s32NumOfChannels == 1) {
1267       if (ShiftCounter >= EncMaxShiftCounter) {
1268         SHIFTUP_X4;
1269         ShiftCounter = 0;
1270       } else {
1271         ShiftCounter += SUB_BANDS_4;
1272       }
1273     } else {
1274       if (ShiftCounter >= EncMaxShiftCounter) {
1275         SHIFTUP_X4_2;
1276         ShiftCounter = 0;
1277       } else {
1278         ShiftCounter += SUB_BANDS_4;
1279       }
1280     }
1281   }
1282 }
1283 
1284 /* ////////////////////////////////////////////////////////////////////////// */
SbcAnalysisFilter8(SBC_ENC_PARAMS * pstrEncParams,int16_t * input)1285 void SbcAnalysisFilter8(SBC_ENC_PARAMS* pstrEncParams, int16_t* input) {
1286   int16_t* ps16PcmBuf;
1287   int32_t* ps32SbBuf;
1288   int32_t s32Blk, s32Ch; /* counter for block*/
1289   int32_t Offset, Offset2;
1290   int32_t s32NumOfChannels, s32NumOfBlocks;
1291   int32_t i, *ps32X, *ps32X2;
1292   int32_t ChOffset;
1293 #if (SBC_ARM_ASM_OPT == TRUE)
1294   register int32_t s32Hi, s32Hi2;
1295 #else
1296 #if (SBC_IPAQ_OPT == TRUE)
1297 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1298   register int64_t s64Temp, s64Temp2;
1299 #else
1300   register int32_t s32Temp, s32Temp2;
1301 #endif
1302 #else
1303 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1304   int64_t s64Temp;
1305 #endif
1306 #endif
1307 #endif
1308 
1309   s32NumOfChannels = pstrEncParams->s16NumOfChannels;
1310   s32NumOfBlocks = pstrEncParams->s16NumOfBlocks;
1311 
1312   ps16PcmBuf = input;
1313 
1314   ps32SbBuf = pstrEncParams->s32SbBuffer;
1315   Offset2 = (int32_t)(EncMaxShiftCounter + 80);
1316   for (s32Blk = 0; s32Blk < s32NumOfBlocks; s32Blk++) {
1317     Offset = (int32_t)(EncMaxShiftCounter - ShiftCounter);
1318     /* Store new samples */
1319     if (s32NumOfChannels == 1) {
1320       s16X[7 + Offset] = *ps16PcmBuf;
1321       ps16PcmBuf++;
1322       s16X[6 + Offset] = *ps16PcmBuf;
1323       ps16PcmBuf++;
1324       s16X[5 + Offset] = *ps16PcmBuf;
1325       ps16PcmBuf++;
1326       s16X[4 + Offset] = *ps16PcmBuf;
1327       ps16PcmBuf++;
1328       s16X[3 + Offset] = *ps16PcmBuf;
1329       ps16PcmBuf++;
1330       s16X[2 + Offset] = *ps16PcmBuf;
1331       ps16PcmBuf++;
1332       s16X[1 + Offset] = *ps16PcmBuf;
1333       ps16PcmBuf++;
1334       s16X[0 + Offset] = *ps16PcmBuf;
1335       ps16PcmBuf++;
1336     } else {
1337       s16X[7 + Offset] = *ps16PcmBuf;
1338       ps16PcmBuf++;
1339       s16X[Offset2 + 7 + Offset] = *ps16PcmBuf;
1340       ps16PcmBuf++;
1341       s16X[6 + Offset] = *ps16PcmBuf;
1342       ps16PcmBuf++;
1343       s16X[Offset2 + 6 + Offset] = *ps16PcmBuf;
1344       ps16PcmBuf++;
1345       s16X[5 + Offset] = *ps16PcmBuf;
1346       ps16PcmBuf++;
1347       s16X[Offset2 + 5 + Offset] = *ps16PcmBuf;
1348       ps16PcmBuf++;
1349       s16X[4 + Offset] = *ps16PcmBuf;
1350       ps16PcmBuf++;
1351       s16X[Offset2 + 4 + Offset] = *ps16PcmBuf;
1352       ps16PcmBuf++;
1353       s16X[3 + Offset] = *ps16PcmBuf;
1354       ps16PcmBuf++;
1355       s16X[Offset2 + 3 + Offset] = *ps16PcmBuf;
1356       ps16PcmBuf++;
1357       s16X[2 + Offset] = *ps16PcmBuf;
1358       ps16PcmBuf++;
1359       s16X[Offset2 + 2 + Offset] = *ps16PcmBuf;
1360       ps16PcmBuf++;
1361       s16X[1 + Offset] = *ps16PcmBuf;
1362       ps16PcmBuf++;
1363       s16X[Offset2 + 1 + Offset] = *ps16PcmBuf;
1364       ps16PcmBuf++;
1365       s16X[0 + Offset] = *ps16PcmBuf;
1366       ps16PcmBuf++;
1367       s16X[Offset2 + 0 + Offset] = *ps16PcmBuf;
1368       ps16PcmBuf++;
1369     }
1370     for (s32Ch = 0; s32Ch < s32NumOfChannels; s32Ch++) {
1371       ChOffset = s32Ch * Offset2 + Offset;
1372 
1373       WINDOW_PARTIAL_8
1374 
1375       SBC_FastIDCT8(s32DCTY, ps32SbBuf);
1376 
1377       ps32SbBuf += SUB_BANDS_8;
1378     }
1379     if (s32NumOfChannels == 1) {
1380       if (ShiftCounter >= EncMaxShiftCounter) {
1381         SHIFTUP_X8;
1382         ShiftCounter = 0;
1383       } else {
1384         ShiftCounter += SUB_BANDS_8;
1385       }
1386     } else {
1387       if (ShiftCounter >= EncMaxShiftCounter) {
1388         SHIFTUP_X8_2;
1389         ShiftCounter = 0;
1390       } else {
1391         ShiftCounter += SUB_BANDS_8;
1392       }
1393     }
1394   }
1395 }
1396 
SbcAnalysisInit(void)1397 void SbcAnalysisInit(void) {
1398   memset(s16X, 0, ENC_VX_BUFFER_SIZE * sizeof(int16_t));
1399   ShiftCounter = 0;
1400 }
1401