1 /******************************************************************************
2 *
3 * Copyright (C) 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_encoder.h"
27 #include "sbc_enc_func_declare.h"
28 /*#include <math.h>*/
29
30 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
31 #define WIND_4_SUBBANDS_0_1 (SINT32)0x01659F45 /* gas32CoeffFor4SBs[8] = -gas32CoeffFor4SBs[32] = 0x01659F45 */
32 #define WIND_4_SUBBANDS_0_2 (SINT32)0x115B1ED2 /* gas32CoeffFor4SBs[16] = -gas32CoeffFor4SBs[24] = 0x115B1ED2 */
33 #define WIND_4_SUBBANDS_1_0 (SINT32)0x001194E6 /* gas32CoeffFor4SBs[1 et 39] = 0x001194E6 */
34 #define WIND_4_SUBBANDS_1_1 (SINT32)0x029DBAA3 /* gas32CoeffFor4SBs[9 et 31] = 0x029DBAA3 */
35 #define WIND_4_SUBBANDS_1_2 (SINT32)0x18F55C90 /* gas32CoeffFor4SBs[17 et 23] = 0x18F55C90 */
36 #define WIND_4_SUBBANDS_1_3 (SINT32)0xF60FAF37 /* gas32CoeffFor4SBs[15 et 25] = 0xF60FAF37 */
37 #define WIND_4_SUBBANDS_1_4 (SINT32)0xFF9BB9D5 /* gas32CoeffFor4SBs[7 et 33] = 0xFF9BB9D5 */
38 #define WIND_4_SUBBANDS_2_0 (SINT32)0x0030E2D3 /* gas32CoeffFor4SBs[2 et 38] = 0x0030E2D3 */
39 #define WIND_4_SUBBANDS_2_1 (SINT32)0x03B23341 /* gas32CoeffFor4SBs[10 et 30] = 0x03B23341 */
40 #define WIND_4_SUBBANDS_2_2 (SINT32)0x1F91CA46 /* gas32CoeffFor4SBs[18 et 22] = 0x1F91CA46 */
41 #define WIND_4_SUBBANDS_2_3 (SINT32)0xFC4F91D4 /* gas32CoeffFor4SBs[14 et 26] = 0xFC4F91D4 */
42 #define WIND_4_SUBBANDS_2_4 (SINT32)0x003D239B /* gas32CoeffFor4SBs[6 et 34] = 0x003D239B */
43 #define WIND_4_SUBBANDS_3_0 (SINT32)0x00599403 /* gas32CoeffFor4SBs[3 et 37] = 0x00599403 */
44 #define WIND_4_SUBBANDS_3_1 (SINT32)0x041EEE40 /* gas32CoeffFor4SBs[11 et 29] = 0x041EEE40 */
45 #define WIND_4_SUBBANDS_3_2 (SINT32)0x2412F251 /* gas32CoeffFor4SBs[19 et 21] = 0x2412F251 */
46 #define WIND_4_SUBBANDS_3_3 (SINT32)0x00C8F2BC /* gas32CoeffFor4SBs[13 et 27] = 0x00C8F2BC */
47 #define WIND_4_SUBBANDS_3_4 (SINT32)0x007F88E4 /* gas32CoeffFor4SBs[5 et 35] = 0x007F88E4 */
48 #define WIND_4_SUBBANDS_4_0 (SINT32)0x007DBCC8 /* gas32CoeffFor4SBs[4 et 36] = 0x007DBCC8 */
49 #define WIND_4_SUBBANDS_4_1 (SINT32)0x034FEE2C /* gas32CoeffFor4SBs[12 et 28] = 0x034FEE2C */
50 #define WIND_4_SUBBANDS_4_2 (SINT32)0x25AC1FF2 /* gas32CoeffFor4SBs[20] = 0x25AC1FF2 */
51
52 #define WIND_8_SUBBANDS_0_1 (SINT32)0x00B97348 /* 16 0x00B97348 */
53 #define WIND_8_SUBBANDS_0_2 (SINT32)0x08B4307A /* 32 0x08B4307A */
54 #define WIND_8_SUBBANDS_1_0 (SINT32)0x00052173 /* 1 et 79 = 0x00052173 */
55 #define WIND_8_SUBBANDS_1_1 (SINT32)0x01071B96 /* 17 et 63 = 0x01071B96 */
56 #define WIND_8_SUBBANDS_1_2 (SINT32)0x0A9F3E9A /* 33 et 47 = 0x0A9F3E9A*/
57 #define WIND_8_SUBBANDS_1_3 (SINT32)0xF9312891 /* 31 et 49 = 0xF9312891 */
58 #define WIND_8_SUBBANDS_1_4 (SINT32)0xFF8D6793 /* 15 et 65 = 0xFF8D6793 */
59 #define WIND_8_SUBBANDS_2_0 (SINT32)0x000B3F71 /* 2 et 78 = 0x000B3F71 */
60 #define WIND_8_SUBBANDS_2_1 (SINT32)0x0156B3CA /* 18 et 62 = 0x0156B3CA */
61 #define WIND_8_SUBBANDS_2_2 (SINT32)0x0C7D59B6 /* 34 et 46 = 0x0C7D59B6 */
62 #define WIND_8_SUBBANDS_2_3 (SINT32)0xFAFF95FC /* 30 et 50 = 0xFAFF95FC */
63 #define WIND_8_SUBBANDS_2_4 (SINT32)0xFFC9F10E /* 14 et 66 = 0xFFC9F10E */
64 #define WIND_8_SUBBANDS_3_0 (SINT32)0x00122C7D /* 3 et 77 = 0x00122C7D*/
65 #define WIND_8_SUBBANDS_3_1 (SINT32)0x01A1B38B /* 19 et 61 = 0x01A1B38B */
66 #define WIND_8_SUBBANDS_3_2 (SINT32)0x0E3BB16F /* 35 et 45 = 0x0E3BB16F */
67 #define WIND_8_SUBBANDS_3_3 (SINT32)0xFCA86E7E /* 29 et 51 = 0xFCA86E7E */
68 #define WIND_8_SUBBANDS_3_4 (SINT32)0xFFFA2413 /* 13 et 67 = 0xFFFA2413 */
69 #define WIND_8_SUBBANDS_4_0 (SINT32)0x001AFF89 /* 4 et 66 = 0x001AFF89 */
70 #define WIND_8_SUBBANDS_4_1 (SINT32)0x01E0224C /* 20 et 60 = 0x01E0224C */
71 #define WIND_8_SUBBANDS_4_2 (SINT32)0x0FC721F9 /* 36 et 44 = 0x0FC721F9 */
72 #define WIND_8_SUBBANDS_4_3 (SINT32)0xFE20435D /* 28 et 52 = 0xFE20435D */
73 #define WIND_8_SUBBANDS_4_4 (SINT32)0x001D8FD2 /* 12 et 68 = 0x001D8FD2 */
74 #define WIND_8_SUBBANDS_5_0 (SINT32)0x00255A62 /* 5 et 75 = 0x00255A62 */
75 #define WIND_8_SUBBANDS_5_1 (SINT32)0x0209291F /* 21 et 59 = 0x0209291F */
76 #define WIND_8_SUBBANDS_5_2 (SINT32)0x110ECEF0 /* 37 et 43 = 0x110ECEF0 */
77 #define WIND_8_SUBBANDS_5_3 (SINT32)0xFF5EEB73 /* 27 et 53 = 0xFF5EEB73 */
78 #define WIND_8_SUBBANDS_5_4 (SINT32)0x0034F8B6 /* 11 et 69 = 0x0034F8B6 */
79 #define WIND_8_SUBBANDS_6_0 (SINT32)0x003060F4 /* 6 et 74 = 0x003060F4 */
80 #define WIND_8_SUBBANDS_6_1 (SINT32)0x02138653 /* 22 et 58 = 0x02138653 */
81 #define WIND_8_SUBBANDS_6_2 (SINT32)0x120435FA /* 38 et 42 = 0x120435FA */
82 #define WIND_8_SUBBANDS_6_3 (SINT32)0x005FD0FF /* 26 et 54 = 0x005FD0FF */
83 #define WIND_8_SUBBANDS_6_4 (SINT32)0x00415B75 /* 10 et 70 = 0x00415B75 */
84 #define WIND_8_SUBBANDS_7_0 (SINT32)0x003A72E7 /* 7 et 73 = 0x003A72E7 */
85 #define WIND_8_SUBBANDS_7_1 (SINT32)0x01F5F424 /* 23 et 57 = 0x01F5F424 */
86 #define WIND_8_SUBBANDS_7_2 (SINT32)0x129C226F /* 39 et 41 = 0x129C226F */
87 #define WIND_8_SUBBANDS_7_3 (SINT32)0x01223EBA /* 25 et 55 = 0x01223EBA */
88 #define WIND_8_SUBBANDS_7_4 (SINT32)0x0044EF48 /* 9 et 71 = 0x0044EF48 */
89 #define WIND_8_SUBBANDS_8_0 (SINT32)0x0041EC6A /* 8 et 72 = 0x0041EC6A */
90 #define WIND_8_SUBBANDS_8_1 (SINT32)0x01A7ECEF /* 24 et 56 = 0x01A7ECEF */
91 #define WIND_8_SUBBANDS_8_2 (SINT32)0x12CF6C75 /* 40 = 0x12CF6C75 */
92 #else
93 #define WIND_4_SUBBANDS_0_1 (SINT16)0x0166 /* gas32CoeffFor4SBs[8] = -gas32CoeffFor4SBs[32] = 0x01659F45 */
94 #define WIND_4_SUBBANDS_0_2 (SINT16)0x115B /* gas32CoeffFor4SBs[16] = -gas32CoeffFor4SBs[24] = 0x115B1ED2 */
95 #define WIND_4_SUBBANDS_1_0 (SINT16)0x0012 /* gas32CoeffFor4SBs[1 et 39] = 0x001194E6 */
96 #define WIND_4_SUBBANDS_1_1 (SINT16)0x029E /* gas32CoeffFor4SBs[9 et 31] = 0x029DBAA3 */
97 #define WIND_4_SUBBANDS_1_2 (SINT16)0x18F5 /* gas32CoeffFor4SBs[17 et 23] = 0x18F55C90 */
98 #define WIND_4_SUBBANDS_1_3 (SINT16)0xF610 /* gas32CoeffFor4SBs[15 et 25] = 0xF60FAF37 */
99 #define WIND_4_SUBBANDS_1_4 (SINT16)0xFF9C /* gas32CoeffFor4SBs[7 et 33] = 0xFF9BB9D5 */
100 #define WIND_4_SUBBANDS_2_0 (SINT16)0x0031 /* gas32CoeffFor4SBs[2 et 38] = 0x0030E2D3 */
101 #define WIND_4_SUBBANDS_2_1 (SINT16)0x03B2 /* gas32CoeffFor4SBs[10 et 30] = 0x03B23341 */
102 #define WIND_4_SUBBANDS_2_2 (SINT16)0x1F91 /* gas32CoeffFor4SBs[18 et 22] = 0x1F91CA46 */
103 #define WIND_4_SUBBANDS_2_3 (SINT16)0xFC50 /* gas32CoeffFor4SBs[14 et 26] = 0xFC4F91D4 */
104 #define WIND_4_SUBBANDS_2_4 (SINT16)0x003D /* gas32CoeffFor4SBs[6 et 34] = 0x003D239B */
105 #define WIND_4_SUBBANDS_3_0 (SINT16)0x005A /* gas32CoeffFor4SBs[3 et 37] = 0x00599403 */
106 #define WIND_4_SUBBANDS_3_1 (SINT16)0x041F /* gas32CoeffFor4SBs[11 et 29] = 0x041EEE40 */
107 #define WIND_4_SUBBANDS_3_2 (SINT16)0x2413 /* gas32CoeffFor4SBs[19 et 21] = 0x2412F251 */
108 #define WIND_4_SUBBANDS_3_3 (SINT16)0x00C9 /* gas32CoeffFor4SBs[13 et 27] = 0x00C8F2BC */
109 #define WIND_4_SUBBANDS_3_4 (SINT16)0x0080 /* gas32CoeffFor4SBs[5 et 35] = 0x007F88E4 */
110 #define WIND_4_SUBBANDS_4_0 (SINT16)0x007E /* gas32CoeffFor4SBs[4 et 36] = 0x007DBCC8 */
111 #define WIND_4_SUBBANDS_4_1 (SINT16)0x0350 /* gas32CoeffFor4SBs[12 et 28] = 0x034FEE2C */
112 #define WIND_4_SUBBANDS_4_2 (SINT16)0x25AC /* gas32CoeffFor4SBs[20] = 25AC1FF2 */
113
114 #define WIND_8_SUBBANDS_0_1 (SINT16)0x00B9 /* 16 0x12CF6C75 */
115 #define WIND_8_SUBBANDS_0_2 (SINT16)0x08B4 /* 32 0x08B4307A */
116 #define WIND_8_SUBBANDS_1_0 (SINT16)0x0005 /* 1 et 79 = 0x00052173 */
117 #define WIND_8_SUBBANDS_1_1 (SINT16)0x0107 /* 17 et 63 = 0x01071B96 */
118 #define WIND_8_SUBBANDS_1_2 (SINT16)0x0A9F /* 33 et 47 = 0x0A9F3E9A*/
119 #define WIND_8_SUBBANDS_1_3 (SINT16)0xF931 /* 31 et 49 = 0xF9312891 */
120 #define WIND_8_SUBBANDS_1_4 (SINT16)0xFF8D /* 15 et 65 = 0xFF8D6793 */
121 #define WIND_8_SUBBANDS_2_0 (SINT16)0x000B /* 2 et 78 = 0x000B3F71 */
122 #define WIND_8_SUBBANDS_2_1 (SINT16)0x0157 /* 18 et 62 = 0x0156B3CA */
123 #define WIND_8_SUBBANDS_2_2 (SINT16)0x0C7D /* 34 et 46 = 0x0C7D59B6 */
124 #define WIND_8_SUBBANDS_2_3 (SINT16)0xFB00 /* 30 et 50 = 0xFAFF95FC */
125 #define WIND_8_SUBBANDS_2_4 (SINT16)0xFFCA /* 14 et 66 = 0xFFC9F10E */
126 #define WIND_8_SUBBANDS_3_0 (SINT16)0x0012 /* 3 et 77 = 0x00122C7D*/
127 #define WIND_8_SUBBANDS_3_1 (SINT16)0x01A2 /* 19 et 61 = 0x01A1B38B */
128 #define WIND_8_SUBBANDS_3_2 (SINT16)0x0E3C /* 35 et 45 = 0x0E3BB16F */
129 #define WIND_8_SUBBANDS_3_3 (SINT16)0xFCA8 /* 29 et 51 = 0xFCA86E7E */
130 #define WIND_8_SUBBANDS_3_4 (SINT16)0xFFFA /* 13 et 67 = 0xFFFA2413 */
131 #define WIND_8_SUBBANDS_4_0 (SINT16)0x001B /* 4 et 66 = 0x001AFF89 */
132 #define WIND_8_SUBBANDS_4_1 (SINT16)0x01E0 /* 20 et 60 = 0x01E0224C */
133 #define WIND_8_SUBBANDS_4_2 (SINT16)0x0FC7 /* 36 et 44 = 0x0FC721F9 */
134 #define WIND_8_SUBBANDS_4_3 (SINT16)0xFE20 /* 28 et 52 = 0xFE20435D */
135 #define WIND_8_SUBBANDS_4_4 (SINT16)0x001E /* 12 et 68 = 0x001D8FD2 */
136 #define WIND_8_SUBBANDS_5_0 (SINT16)0x0025 /* 5 et 75 = 0x00255A62 */
137 #define WIND_8_SUBBANDS_5_1 (SINT16)0x0209 /* 21 et 59 = 0x0209291F */
138 #define WIND_8_SUBBANDS_5_2 (SINT16)0x110F /* 37 et 43 = 0x110ECEF0 */
139 #define WIND_8_SUBBANDS_5_3 (SINT16)0xFF5F /* 27 et 53 = 0xFF5EEB73 */
140 #define WIND_8_SUBBANDS_5_4 (SINT16)0x0035 /* 11 et 69 = 0x0034F8B6 */
141 #define WIND_8_SUBBANDS_6_0 (SINT16)0x0030 /* 6 et 74 = 0x003060F4 */
142 #define WIND_8_SUBBANDS_6_1 (SINT16)0x0214 /* 22 et 58 = 0x02138653 */
143 #define WIND_8_SUBBANDS_6_2 (SINT16)0x1204 /* 38 et 42 = 0x120435FA */
144 #define WIND_8_SUBBANDS_6_3 (SINT16)0x0060 /* 26 et 54 = 0x005FD0FF */
145 #define WIND_8_SUBBANDS_6_4 (SINT16)0x0041 /* 10 et 70 = 0x00415B75 */
146 #define WIND_8_SUBBANDS_7_0 (SINT16)0x003A /* 7 et 73 = 0x003A72E7 */
147 #define WIND_8_SUBBANDS_7_1 (SINT16)0x01F6 /* 23 et 57 = 0x01F5F424 */
148 #define WIND_8_SUBBANDS_7_2 (SINT16)0x129C /* 39 et 41 = 0x129C226F */
149 #define WIND_8_SUBBANDS_7_3 (SINT16)0x0122 /* 25 et 55 = 0x01223EBA */
150 #define WIND_8_SUBBANDS_7_4 (SINT16)0x0045 /* 9 et 71 = 0x0044EF48 */
151 #define WIND_8_SUBBANDS_8_0 (SINT16)0x0042 /* 8 et 72 = 0x0041EC6A */
152 #define WIND_8_SUBBANDS_8_1 (SINT16)0x01A8 /* 24 et 56 = 0x01A7ECEF */
153 #define WIND_8_SUBBANDS_8_2 (SINT16)0x12CF /* 40 = 0x12CF6C75 */
154 #endif
155
156 #if (SBC_USE_ARM_PRAGMA==TRUE)
157 #pragma arm section zidata = "sbc_s32_analysis_section"
158 #endif
159 static SINT32 s32DCTY[16] = {0};
160 static SINT32 s32X[ENC_VX_BUFFER_SIZE/2];
161 static SINT16 *s16X=(SINT16*) s32X; /* s16X must be 32 bits aligned cf SHIFTUP_X8_2*/
162 #if (SBC_USE_ARM_PRAGMA==TRUE)
163 #pragma arm section zidata
164 #endif
165
166 /* This macro is for 4 subbands */
167 #define SHIFTUP_X4 \
168 { \
169 ps32X=(SINT32 *)(s16X+EncMaxShiftCounter+38); \
170 for (i=0;i<9;i++) \
171 { \
172 *ps32X=*(ps32X-2-(ShiftCounter>>1)); ps32X--; \
173 *ps32X=*(ps32X-2-(ShiftCounter>>1)); ps32X--; \
174 } \
175 }
176 #define SHIFTUP_X4_2 \
177 { \
178 ps32X=(SINT32 *)(s16X+EncMaxShiftCounter+38); \
179 ps32X2=(SINT32 *)(s16X+(EncMaxShiftCounter<<1)+78); \
180 for (i=0;i<9;i++) \
181 { \
182 *ps32X=*(ps32X-2-(ShiftCounter>>1)); *(ps32X2)=*(ps32X2-2-(ShiftCounter>>1)); ps32X--; ps32X2--; \
183 *ps32X=*(ps32X-2-(ShiftCounter>>1)); *(ps32X2)=*(ps32X2-2-(ShiftCounter>>1)); ps32X--; ps32X2--; \
184 } \
185 }
186
187 /* This macro is for 8 subbands */
188 #define SHIFTUP_X8 \
189 { \
190 ps32X=(SINT32 *)(s16X+EncMaxShiftCounter+78); \
191 for (i=0;i<9;i++) \
192 { \
193 *ps32X=*(ps32X-4-(ShiftCounter>>1)); ps32X--; \
194 *ps32X=*(ps32X-4-(ShiftCounter>>1)); ps32X--; \
195 *ps32X=*(ps32X-4-(ShiftCounter>>1)); ps32X--; \
196 *ps32X=*(ps32X-4-(ShiftCounter>>1)); ps32X--; \
197 } \
198 }
199 #define SHIFTUP_X8_2 \
200 { \
201 ps32X=(SINT32 *)(s16X+EncMaxShiftCounter+78); \
202 ps32X2=(SINT32 *)(s16X+(EncMaxShiftCounter<<1)+158); \
203 for (i=0;i<9;i++) \
204 { \
205 *ps32X=*(ps32X-4-(ShiftCounter>>1)); *(ps32X2)=*(ps32X2-4-(ShiftCounter>>1)); ps32X--; ps32X2--; \
206 *ps32X=*(ps32X-4-(ShiftCounter>>1)); *(ps32X2)=*(ps32X2-4-(ShiftCounter>>1)); ps32X--; ps32X2--; \
207 *ps32X=*(ps32X-4-(ShiftCounter>>1)); *(ps32X2)=*(ps32X2-4-(ShiftCounter>>1)); ps32X--; ps32X2--; \
208 *ps32X=*(ps32X-4-(ShiftCounter>>1)); *(ps32X2)=*(ps32X2-4-(ShiftCounter>>1)); ps32X--; ps32X2--; \
209 } \
210 }
211
212 #if (SBC_ARM_ASM_OPT==TRUE)
213 #define WINDOW_ACCU_8_0 \
214 {\
215 __asm\
216 {\
217 MUL s32Hi,WIND_8_SUBBANDS_0_1,(s16X[ChOffset+16]-s16X[ChOffset+64]);\
218 MLA s32Hi,WIND_8_SUBBANDS_0_2,(s16X[ChOffset+32]-s16X[ChOffset+48]),s32Hi;\
219 MOV s32DCTY[0],s32Hi;\
220 }\
221 }
222 #define WINDOW_ACCU_8_1_15 \
223 {\
224 __asm\
225 {\
226 MUL s32Hi,WIND_8_SUBBANDS_1_0,s16X[ChOffset+1];\
227 MUL s32Hi2,WIND_8_SUBBANDS_1_0,s16X[ChOffset+64+15];\
228 MLA s32Hi,WIND_8_SUBBANDS_1_1,s16X[ChOffset+16+1],s32Hi;\
229 MLA s32Hi2,WIND_8_SUBBANDS_1_1,s16X[ChOffset+48+15],s32Hi2;\
230 MLA s32Hi,WIND_8_SUBBANDS_1_2,s16X[ChOffset+32+1],s32Hi;\
231 MLA s32Hi2,WIND_8_SUBBANDS_1_2,s16X[ChOffset+32+15],s32Hi2;\
232 MLA s32Hi,WIND_8_SUBBANDS_1_3,s16X[ChOffset+48+1],s32Hi;\
233 MLA s32Hi2,WIND_8_SUBBANDS_1_3,s16X[ChOffset+16+15],s32Hi2;\
234 MLA s32Hi,WIND_8_SUBBANDS_1_4,s16X[ChOffset+64+1],s32Hi;\
235 MLA s32Hi2,WIND_8_SUBBANDS_1_4,s16X[ChOffset+15],s32Hi2;\
236 MOV s32DCTY[1],s32Hi;\
237 MOV s32DCTY[15],s32Hi2;\
238 }\
239 }
240 #define WINDOW_ACCU_8_2_14 \
241 {\
242 __asm\
243 {\
244 MUL s32Hi,WIND_8_SUBBANDS_2_0,s16X[ChOffset+2];\
245 MUL s32Hi2,WIND_8_SUBBANDS_2_0,s16X[ChOffset+64+14];\
246 MLA s32Hi,WIND_8_SUBBANDS_2_1,s16X[ChOffset+16+2],s32Hi;\
247 MLA s32Hi2,WIND_8_SUBBANDS_2_1,s16X[ChOffset+48+14],s32Hi2;\
248 MLA s32Hi,WIND_8_SUBBANDS_2_2,s16X[ChOffset+32+2],s32Hi;\
249 MLA s32Hi2,WIND_8_SUBBANDS_2_2,s16X[ChOffset+32+14],s32Hi2;\
250 MLA s32Hi,WIND_8_SUBBANDS_2_3,s16X[ChOffset+48+2],s32Hi;\
251 MLA s32Hi2,WIND_8_SUBBANDS_2_3,s16X[ChOffset+16+14],s32Hi2;\
252 MLA s32Hi,WIND_8_SUBBANDS_2_4,s16X[ChOffset+64+2],s32Hi;\
253 MLA s32Hi2,WIND_8_SUBBANDS_2_4,s16X[ChOffset+14],s32Hi2;\
254 MOV s32DCTY[2],s32Hi;\
255 MOV s32DCTY[14],s32Hi2;\
256 }\
257 }
258 #define WINDOW_ACCU_8_3_13 \
259 {\
260 __asm\
261 {\
262 MUL s32Hi,WIND_8_SUBBANDS_3_0,s16X[ChOffset+3];\
263 MUL s32Hi2,WIND_8_SUBBANDS_3_0,s16X[ChOffset+64+13];\
264 MLA s32Hi,WIND_8_SUBBANDS_3_1,s16X[ChOffset+16+3],s32Hi;\
265 MLA s32Hi2,WIND_8_SUBBANDS_3_1,s16X[ChOffset+48+13],s32Hi2;\
266 MLA s32Hi,WIND_8_SUBBANDS_3_2,s16X[ChOffset+32+3],s32Hi;\
267 MLA s32Hi2,WIND_8_SUBBANDS_3_2,s16X[ChOffset+32+13],s32Hi2;\
268 MLA s32Hi,WIND_8_SUBBANDS_3_3,s16X[ChOffset+48+3],s32Hi;\
269 MLA s32Hi2,WIND_8_SUBBANDS_3_3,s16X[ChOffset+16+13],s32Hi2;\
270 MLA s32Hi,WIND_8_SUBBANDS_3_4,s16X[ChOffset+64+3],s32Hi;\
271 MLA s32Hi2,WIND_8_SUBBANDS_3_4,s16X[ChOffset+13],s32Hi2;\
272 MOV s32DCTY[3],s32Hi;\
273 MOV s32DCTY[13],s32Hi2;\
274 }\
275 }
276 #define WINDOW_ACCU_8_4_12 \
277 {\
278 __asm\
279 {\
280 MUL s32Hi,WIND_8_SUBBANDS_4_0,s16X[ChOffset+4];\
281 MUL s32Hi2,WIND_8_SUBBANDS_4_0,s16X[ChOffset+64+12];\
282 MLA s32Hi,WIND_8_SUBBANDS_4_1,s16X[ChOffset+16+4],s32Hi;\
283 MLA s32Hi2,WIND_8_SUBBANDS_4_1,s16X[ChOffset+48+12],s32Hi2;\
284 MLA s32Hi,WIND_8_SUBBANDS_4_2,s16X[ChOffset+32+4],s32Hi;\
285 MLA s32Hi2,WIND_8_SUBBANDS_4_2,s16X[ChOffset+32+12],s32Hi2;\
286 MLA s32Hi,WIND_8_SUBBANDS_4_3,s16X[ChOffset+48+4],s32Hi;\
287 MLA s32Hi2,WIND_8_SUBBANDS_4_3,s16X[ChOffset+16+12],s32Hi2;\
288 MLA s32Hi,WIND_8_SUBBANDS_4_4,s16X[ChOffset+64+4],s32Hi;\
289 MLA s32Hi2,WIND_8_SUBBANDS_4_4,s16X[ChOffset+12],s32Hi2;\
290 MOV s32DCTY[4],s32Hi;\
291 MOV s32DCTY[12],s32Hi2;\
292 }\
293 }
294 #define WINDOW_ACCU_8_5_11 \
295 {\
296 __asm\
297 {\
298 MUL s32Hi,WIND_8_SUBBANDS_5_0,s16X[ChOffset+5];\
299 MUL s32Hi2,WIND_8_SUBBANDS_5_0,s16X[ChOffset+64+11];\
300 MLA s32Hi,WIND_8_SUBBANDS_5_1,s16X[ChOffset+16+5],s32Hi;\
301 MLA s32Hi2,WIND_8_SUBBANDS_5_1,s16X[ChOffset+48+11],s32Hi2;\
302 MLA s32Hi,WIND_8_SUBBANDS_5_2,s16X[ChOffset+32+5],s32Hi;\
303 MLA s32Hi2,WIND_8_SUBBANDS_5_2,s16X[ChOffset+32+11],s32Hi2;\
304 MLA s32Hi,WIND_8_SUBBANDS_5_3,s16X[ChOffset+48+5],s32Hi;\
305 MLA s32Hi2,WIND_8_SUBBANDS_5_3,s16X[ChOffset+16+11],s32Hi2;\
306 MLA s32Hi,WIND_8_SUBBANDS_5_4,s16X[ChOffset+64+5],s32Hi;\
307 MLA s32Hi2,WIND_8_SUBBANDS_5_4,s16X[ChOffset+11],s32Hi2;\
308 MOV s32DCTY[5],s32Hi;\
309 MOV s32DCTY[11],s32Hi2;\
310 }\
311 }
312 #define WINDOW_ACCU_8_6_10 \
313 {\
314 __asm\
315 {\
316 MUL s32Hi,WIND_8_SUBBANDS_6_0,s16X[ChOffset+6];\
317 MUL s32Hi2,WIND_8_SUBBANDS_6_0,s16X[ChOffset+64+10];\
318 MLA s32Hi,WIND_8_SUBBANDS_6_1,s16X[ChOffset+16+6],s32Hi;\
319 MLA s32Hi2,WIND_8_SUBBANDS_6_1,s16X[ChOffset+48+10],s32Hi2;\
320 MLA s32Hi,WIND_8_SUBBANDS_6_2,s16X[ChOffset+32+6],s32Hi;\
321 MLA s32Hi2,WIND_8_SUBBANDS_6_2,s16X[ChOffset+32+10],s32Hi2;\
322 MLA s32Hi,WIND_8_SUBBANDS_6_3,s16X[ChOffset+48+6],s32Hi;\
323 MLA s32Hi2,WIND_8_SUBBANDS_6_3,s16X[ChOffset+16+10],s32Hi2;\
324 MLA s32Hi,WIND_8_SUBBANDS_6_4,s16X[ChOffset+64+6],s32Hi;\
325 MLA s32Hi2,WIND_8_SUBBANDS_6_4,s16X[ChOffset+10],s32Hi2;\
326 MOV s32DCTY[6],s32Hi;\
327 MOV s32DCTY[10],s32Hi2;\
328 }\
329 }
330 #define WINDOW_ACCU_8_7_9 \
331 {\
332 __asm\
333 {\
334 MUL s32Hi,WIND_8_SUBBANDS_7_0,s16X[ChOffset+7];\
335 MUL s32Hi2,WIND_8_SUBBANDS_7_0,s16X[ChOffset+64+9];\
336 MLA s32Hi,WIND_8_SUBBANDS_7_1,s16X[ChOffset+16+7],s32Hi;\
337 MLA s32Hi2,WIND_8_SUBBANDS_7_1,s16X[ChOffset+48+9],s32Hi2;\
338 MLA s32Hi,WIND_8_SUBBANDS_7_2,s16X[ChOffset+32+7],s32Hi;\
339 MLA s32Hi2,WIND_8_SUBBANDS_7_2,s16X[ChOffset+32+9],s32Hi2;\
340 MLA s32Hi,WIND_8_SUBBANDS_7_3,s16X[ChOffset+48+7],s32Hi;\
341 MLA s32Hi2,WIND_8_SUBBANDS_7_3,s16X[ChOffset+16+9],s32Hi2;\
342 MLA s32Hi,WIND_8_SUBBANDS_7_4,s16X[ChOffset+64+7],s32Hi;\
343 MLA s32Hi2,WIND_8_SUBBANDS_7_4,s16X[ChOffset+9],s32Hi2;\
344 MOV s32DCTY[7],s32Hi;\
345 MOV s32DCTY[9],s32Hi2;\
346 }\
347 }
348 #define WINDOW_ACCU_8_8 \
349 {\
350 __asm\
351 {\
352 MUL s32Hi,WIND_8_SUBBANDS_8_0,(s16X[ChOffset+8]+s16X[ChOffset+8+64]);\
353 MLA s32Hi,WIND_8_SUBBANDS_8_1,(s16X[ChOffset+8+16]+s16X[ChOffset+8+64]),s32Hi;\
354 MLA s32Hi,WIND_8_SUBBANDS_8_2,s16X[ChOffset+8+32],s32Hi;\
355 MOV s32DCTY[8],s32Hi;\
356 }\
357 }
358 #define WINDOW_ACCU_4_0 \
359 {\
360 __asm\
361 {\
362 MUL s32Hi,WIND_4_SUBBANDS_0_1,(s16X[ChOffset+8]-s16X[ChOffset+32]);\
363 MLA s32Hi,WIND_4_SUBBANDS_0_2,(s16X[ChOffset+16]-s16X[ChOffset+24]),s32Hi;\
364 MOV s32DCTY[0],s32Hi;\
365 }\
366 }
367 #define WINDOW_ACCU_4_1_7 \
368 {\
369 __asm\
370 {\
371 MUL s32Hi,WIND_4_SUBBANDS_1_0,s16X[ChOffset+1];\
372 MUL s32Hi2,WIND_4_SUBBANDS_1_0,s16X[ChOffset+32+7];\
373 MLA s32Hi,WIND_4_SUBBANDS_1_1,s16X[ChOffset+8+1],s32Hi;\
374 MLA s32Hi2,WIND_4_SUBBANDS_1_1,s16X[ChOffset+24+7],s32Hi2;\
375 MLA s32Hi,WIND_4_SUBBANDS_1_2,s16X[ChOffset+16+1],s32Hi;\
376 MLA s32Hi2,WIND_4_SUBBANDS_1_2,s16X[ChOffset+16+7],s32Hi2;\
377 MLA s32Hi,WIND_4_SUBBANDS_1_3,s16X[ChOffset+24+1],s32Hi;\
378 MLA s32Hi2,WIND_4_SUBBANDS_1_3,s16X[ChOffset+8+7],s32Hi2;\
379 MLA s32Hi,WIND_4_SUBBANDS_1_4,s16X[ChOffset+32+1],s32Hi;\
380 MLA s32Hi2,WIND_4_SUBBANDS_1_4,s16X[ChOffset+7],s32Hi2;\
381 MOV s32DCTY[1],s32Hi;\
382 MOV s32DCTY[7],s32Hi2;\
383 }\
384 }
385 #define WINDOW_ACCU_4_2_6 \
386 {\
387 __asm\
388 {\
389 MUL s32Hi,WIND_4_SUBBANDS_2_0,s16X[ChOffset+2];\
390 MUL s32Hi2,WIND_4_SUBBANDS_2_0,s16X[ChOffset+32+6];\
391 MLA s32Hi,WIND_4_SUBBANDS_2_1,s16X[ChOffset+8+2],s32Hi;\
392 MLA s32Hi2,WIND_4_SUBBANDS_2_1,s16X[ChOffset+24+6],s32Hi2;\
393 MLA s32Hi,WIND_4_SUBBANDS_2_2,s16X[ChOffset+16+2],s32Hi;\
394 MLA s32Hi2,WIND_4_SUBBANDS_2_2,s16X[ChOffset+16+6],s32Hi2;\
395 MLA s32Hi,WIND_4_SUBBANDS_2_3,s16X[ChOffset+24+2],s32Hi;\
396 MLA s32Hi2,WIND_4_SUBBANDS_2_3,s16X[ChOffset+8+6],s32Hi2;\
397 MLA s32Hi,WIND_4_SUBBANDS_2_4,s16X[ChOffset+32+2],s32Hi;\
398 MLA s32Hi2,WIND_4_SUBBANDS_2_4,s16X[ChOffset+6],s32Hi2;\
399 MOV s32DCTY[2],s32Hi;\
400 MOV s32DCTY[6],s32Hi2;\
401 }\
402 }
403 #define WINDOW_ACCU_4_3_5 \
404 {\
405 __asm\
406 {\
407 MUL s32Hi,WIND_4_SUBBANDS_3_0,s16X[ChOffset+3];\
408 MUL s32Hi2,WIND_4_SUBBANDS_3_0,s16X[ChOffset+32+5];\
409 MLA s32Hi,WIND_4_SUBBANDS_3_1,s16X[ChOffset+8+3],s32Hi;\
410 MLA s32Hi2,WIND_4_SUBBANDS_3_1,s16X[ChOffset+24+5],s32Hi2;\
411 MLA s32Hi,WIND_4_SUBBANDS_3_2,s16X[ChOffset+16+3],s32Hi;\
412 MLA s32Hi2,WIND_4_SUBBANDS_3_2,s16X[ChOffset+16+5],s32Hi2;\
413 MLA s32Hi,WIND_4_SUBBANDS_3_3,s16X[ChOffset+24+3],s32Hi;\
414 MLA s32Hi2,WIND_4_SUBBANDS_3_3,s16X[ChOffset+8+5],s32Hi2;\
415 MLA s32Hi,WIND_4_SUBBANDS_3_4,s16X[ChOffset+32+3],s32Hi;\
416 MLA s32Hi2,WIND_4_SUBBANDS_3_4,s16X[ChOffset+5],s32Hi2;\
417 MOV s32DCTY[3],s32Hi;\
418 MOV s32DCTY[5],s32Hi2;\
419 }\
420 }
421 #define WINDOW_ACCU_4_4 \
422 {\
423 __asm\
424 {\
425 MUL s32Hi,WIND_4_SUBBANDS_4_0,(s16X[ChOffset+4]+s16X[ChOffset+4+32]);\
426 MLA s32Hi,WIND_4_SUBBANDS_4_1,(s16X[ChOffset+4+8]+s16X[ChOffset+4+24]),s32Hi;\
427 MLA s32Hi,WIND_4_SUBBANDS_4_2,s16X[ChOffset+4+16],s32Hi;\
428 MOV s32DCTY[4],s32Hi;\
429 }\
430 }
431
432 #define WINDOW_PARTIAL_4 \
433 {\
434 WINDOW_ACCU_4_0; WINDOW_ACCU_4_1_7;\
435 WINDOW_ACCU_4_2_6; WINDOW_ACCU_4_3_5;\
436 WINDOW_ACCU_4_4;\
437 }
438
439 #define WINDOW_PARTIAL_8 \
440 {\
441 WINDOW_ACCU_8_0; WINDOW_ACCU_8_1_15;\
442 WINDOW_ACCU_8_2_14; WINDOW_ACCU_8_3_13;\
443 WINDOW_ACCU_8_4_12; WINDOW_ACCU_8_5_11;\
444 WINDOW_ACCU_8_6_10; WINDOW_ACCU_8_7_9;\
445 WINDOW_ACCU_8_8;\
446 }
447
448 #else
449 #if (SBC_IPAQ_OPT==TRUE)
450
451 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
452 #define WINDOW_ACCU_8_0 \
453 {\
454 s64Temp=(SINT64)WIND_8_SUBBANDS_0_1*(SINT64)(s16X[ChOffset+16]-s16X[ChOffset+64]);\
455 s64Temp+=(SINT64)WIND_8_SUBBANDS_0_2*(SINT64)(s16X[ChOffset+32]-s16X[ChOffset+48]);\
456 s32DCTY[0]=(SINT32)(s64Temp>>16);\
457 }
458 #define WINDOW_ACCU_8_1_15 \
459 {\
460 s64Temp=(SINT64)WIND_8_SUBBANDS_1_0*(SINT64)s16X[ChOffset+1];\
461 s64Temp2=(SINT64)WIND_8_SUBBANDS_1_0*(SINT64)s16X[ChOffset+64+15];\
462 s64Temp+=(SINT64)WIND_8_SUBBANDS_1_1*(SINT64)s16X[ChOffset+16+1];\
463 s64Temp2+=(SINT64)WIND_8_SUBBANDS_1_1*(SINT64)s16X[ChOffset+48+15];\
464 s64Temp+=(SINT64)WIND_8_SUBBANDS_1_2*(SINT64)s16X[ChOffset+32+1];\
465 s64Temp2+=(SINT64)WIND_8_SUBBANDS_1_2*(SINT64)s16X[ChOffset+32+15];\
466 s64Temp+=(SINT64)WIND_8_SUBBANDS_1_3*(SINT64)s16X[ChOffset+48+1];\
467 s64Temp2+=(SINT64)WIND_8_SUBBANDS_1_3*(SINT64)s16X[ChOffset+16+15];\
468 s64Temp+=(SINT64)WIND_8_SUBBANDS_1_4*(SINT64)s16X[ChOffset+64+1];\
469 s64Temp2+=(SINT64)WIND_8_SUBBANDS_1_4*(SINT64)s16X[ChOffset+15];\
470 s32DCTY[1]=(SINT32)(s64Temp>>16);\
471 s32DCTY[15]=(SINT32)(s64Temp2>>16);\
472 }
473 #define WINDOW_ACCU_8_2_14 \
474 {\
475 s64Temp=(SINT64)WIND_8_SUBBANDS_2_0*(SINT64)s16X[ChOffset+2];\
476 s64Temp2=(SINT64)WIND_8_SUBBANDS_2_0*(SINT64)s16X[ChOffset+64+14];\
477 s64Temp+=(SINT64)WIND_8_SUBBANDS_2_1*(SINT64)s16X[ChOffset+16+2];\
478 s64Temp2+=(SINT64)WIND_8_SUBBANDS_2_1*(SINT64)s16X[ChOffset+48+14];\
479 s64Temp+=(SINT64)WIND_8_SUBBANDS_2_2*(SINT64)s16X[ChOffset+32+2];\
480 s64Temp2+=(SINT64)WIND_8_SUBBANDS_2_2*(SINT64)s16X[ChOffset+32+14];\
481 s64Temp+=(SINT64)WIND_8_SUBBANDS_2_3*(SINT64)s16X[ChOffset+48+2];\
482 s64Temp2+=(SINT64)WIND_8_SUBBANDS_2_3*(SINT64)s16X[ChOffset+16+14];\
483 s64Temp+=(SINT64)WIND_8_SUBBANDS_2_4*(SINT64)s16X[ChOffset+64+2];\
484 s64Temp2+=(SINT64)WIND_8_SUBBANDS_2_4*(SINT64)s16X[ChOffset+14];\
485 s32DCTY[2]=(SINT32)(s64Temp>>16);\
486 s32DCTY[14]=(SINT32)(s64Temp2>>16);\
487 }
488 #define WINDOW_ACCU_8_3_13 \
489 {\
490 s64Temp=(SINT64)WIND_8_SUBBANDS_3_0*(SINT64)s16X[ChOffset+3];\
491 s64Temp2=(SINT64)WIND_8_SUBBANDS_3_0*(SINT64)s16X[ChOffset+64+13];\
492 s64Temp+=(SINT64)WIND_8_SUBBANDS_3_1*(SINT64)s16X[ChOffset+16+3];\
493 s64Temp2+=(SINT64)WIND_8_SUBBANDS_3_1*(SINT64)s16X[ChOffset+48+13];\
494 s64Temp+=(SINT64)WIND_8_SUBBANDS_3_2*(SINT64)s16X[ChOffset+32+3];\
495 s64Temp2+=(SINT64)WIND_8_SUBBANDS_3_2*(SINT64)s16X[ChOffset+32+13];\
496 s64Temp+=(SINT64)WIND_8_SUBBANDS_3_3*(SINT64)s16X[ChOffset+48+3];\
497 s64Temp2+=(SINT64)WIND_8_SUBBANDS_3_3*(SINT64)s16X[ChOffset+16+13];\
498 s64Temp+=(SINT64)WIND_8_SUBBANDS_3_4*(SINT64)s16X[ChOffset+64+3];\
499 s64Temp2+=(SINT64)WIND_8_SUBBANDS_3_4*(SINT64)s16X[ChOffset+13];\
500 s32DCTY[3]=(SINT32)(s64Temp>>16);\
501 s32DCTY[13]=(SINT32)(s64Temp2>>16);\
502 }
503 #define WINDOW_ACCU_8_4_12 \
504 {\
505 s64Temp=(SINT64)WIND_8_SUBBANDS_4_0*(SINT64)s16X[ChOffset+4];\
506 s64Temp2=(SINT64)WIND_8_SUBBANDS_4_0*(SINT64)s16X[ChOffset+64+12];\
507 s64Temp+=(SINT64)WIND_8_SUBBANDS_4_1*(SINT64)s16X[ChOffset+16+4];\
508 s64Temp2+=(SINT64)WIND_8_SUBBANDS_4_1*(SINT64)s16X[ChOffset+48+12];\
509 s64Temp+=(SINT64)WIND_8_SUBBANDS_4_2*(SINT64)s16X[ChOffset+32+4];\
510 s64Temp2+=(SINT64)WIND_8_SUBBANDS_4_2*(SINT64)s16X[ChOffset+32+12];\
511 s64Temp+=(SINT64)WIND_8_SUBBANDS_4_3*(SINT64)s16X[ChOffset+48+4];\
512 s64Temp2+=(SINT64)WIND_8_SUBBANDS_4_3*(SINT64)s16X[ChOffset+16+12];\
513 s64Temp+=(SINT64)WIND_8_SUBBANDS_4_4*(SINT64)s16X[ChOffset+64+4];\
514 s64Temp2+=(SINT64)WIND_8_SUBBANDS_4_4*(SINT64)s16X[ChOffset+12];\
515 s32DCTY[4]=(SINT32)(s64Temp>>16);\
516 s32DCTY[12]=(SINT32)(s64Temp2>>16);\
517 }
518 #define WINDOW_ACCU_8_5_11 \
519 {\
520 s64Temp=(SINT64)WIND_8_SUBBANDS_5_0*(SINT64)s16X[ChOffset+5];\
521 s64Temp2=(SINT64)WIND_8_SUBBANDS_5_0*(SINT64)s16X[ChOffset+64+11];\
522 s64Temp+=(SINT64)WIND_8_SUBBANDS_5_1*(SINT64)s16X[ChOffset+16+5];\
523 s64Temp2+=(SINT64)WIND_8_SUBBANDS_5_1*(SINT64)s16X[ChOffset+48+11];\
524 s64Temp+=(SINT64)WIND_8_SUBBANDS_5_2*(SINT64)s16X[ChOffset+32+5];\
525 s64Temp2+=(SINT64)WIND_8_SUBBANDS_5_2*(SINT64)s16X[ChOffset+32+11];\
526 s64Temp+=(SINT64)WIND_8_SUBBANDS_5_3*(SINT64)s16X[ChOffset+48+5];\
527 s64Temp2+=(SINT64)WIND_8_SUBBANDS_5_3*(SINT64)s16X[ChOffset+16+11];\
528 s64Temp+=(SINT64)WIND_8_SUBBANDS_5_4*(SINT64)s16X[ChOffset+64+5];\
529 s64Temp2+=(SINT64)WIND_8_SUBBANDS_5_4*(SINT64)s16X[ChOffset+11];\
530 s32DCTY[5]=(SINT32)(s64Temp>>16);\
531 s32DCTY[11]=(SINT32)(s64Temp2>>16);\
532 }
533 #define WINDOW_ACCU_8_6_10 \
534 {\
535 s64Temp=(SINT64)WIND_8_SUBBANDS_6_0*(SINT64)s16X[ChOffset+6];\
536 s64Temp2=(SINT64)WIND_8_SUBBANDS_6_0*(SINT64)s16X[ChOffset+64+10];\
537 s64Temp+=(SINT64)WIND_8_SUBBANDS_6_1*(SINT64)s16X[ChOffset+16+6];\
538 s64Temp2+=(SINT64)WIND_8_SUBBANDS_6_1*(SINT64)s16X[ChOffset+48+10];\
539 s64Temp+=(SINT64)WIND_8_SUBBANDS_6_2*(SINT64)s16X[ChOffset+32+6];\
540 s64Temp2+=(SINT64)WIND_8_SUBBANDS_6_2*(SINT64)s16X[ChOffset+32+10];\
541 s64Temp+=(SINT64)WIND_8_SUBBANDS_6_3*(SINT64)s16X[ChOffset+48+6];\
542 s64Temp2+=(SINT64)WIND_8_SUBBANDS_6_3*(SINT64)s16X[ChOffset+16+10];\
543 s64Temp+=(SINT64)WIND_8_SUBBANDS_6_4*(SINT64)s16X[ChOffset+64+6];\
544 s64Temp2+=(SINT64)WIND_8_SUBBANDS_6_4*(SINT64)s16X[ChOffset+10];\
545 s32DCTY[6]=(SINT32)(s64Temp>>16);\
546 s32DCTY[10]=(SINT32)(s64Temp2>>16);\
547 }
548 #define WINDOW_ACCU_8_7_9 \
549 {\
550 s64Temp=(SINT64)WIND_8_SUBBANDS_7_0*(SINT64)s16X[ChOffset+7];\
551 s64Temp2=(SINT64)WIND_8_SUBBANDS_7_0*(SINT64)s16X[ChOffset+64+9];\
552 s64Temp+=(SINT64)WIND_8_SUBBANDS_7_1*(SINT64)s16X[ChOffset+16+7];\
553 s64Temp2+=(SINT64)WIND_8_SUBBANDS_7_1*(SINT64)s16X[ChOffset+48+9];\
554 s64Temp+=(SINT64)WIND_8_SUBBANDS_7_2*(SINT64)s16X[ChOffset+32+7];\
555 s64Temp2+=(SINT64)WIND_8_SUBBANDS_7_2*(SINT64)s16X[ChOffset+32+9];\
556 s64Temp+=(SINT64)WIND_8_SUBBANDS_7_3*(SINT64)s16X[ChOffset+48+7];\
557 s64Temp2+=(SINT64)WIND_8_SUBBANDS_7_3*(SINT64)s16X[ChOffset+16+9];\
558 s64Temp+=(SINT64)WIND_8_SUBBANDS_7_4*(SINT64)s16X[ChOffset+64+7];\
559 s64Temp2+=(SINT64)WIND_8_SUBBANDS_7_4*(SINT64)s16X[ChOffset+9];\
560 s32DCTY[7]=(SINT32)(s64Temp>>16);\
561 s32DCTY[9]=(SINT32)(s64Temp2>>16);\
562 }
563 #define WINDOW_ACCU_8_8 \
564 {\
565 s64Temp=(SINT64)WIND_8_SUBBANDS_8_0*(SINT64)(s16X[ChOffset+8]+s16X[ChOffset+64+8]);\
566 s64Temp+=(SINT64)WIND_8_SUBBANDS_8_1*(SINT64)(s16X[ChOffset+16+8]+s16X[ChOffset+48+8]);\
567 s64Temp+=(SINT64)WIND_8_SUBBANDS_8_2*(SINT64)s16X[ChOffset+32+8];\
568 s32DCTY[8]=(SINT32)(s64Temp>>16);\
569 }
570 #define WINDOW_ACCU_4_0 \
571 {\
572 s64Temp=(SINT64)WIND_4_SUBBANDS_0_1*(SINT64)(s16X[ChOffset+8]-s16X[ChOffset+32]);\
573 s64Temp+=(SINT64)WIND_4_SUBBANDS_0_2*(SINT64)(s16X[ChOffset+16]-s16X[ChOffset+24]);\
574 s32DCTY[0]=(SINT32)(s64Temp>>16);\
575 }
576 #define WINDOW_ACCU_4_1_7 \
577 {\
578 s64Temp=(SINT64)WIND_4_SUBBANDS_1_0*(SINT64)s16X[ChOffset+1];\
579 s64Temp2=(SINT64)WIND_4_SUBBANDS_1_0*(SINT64)s16X[ChOffset+32+7];\
580 s64Temp+=(SINT64)WIND_4_SUBBANDS_1_1*(SINT64)s16X[ChOffset+8+1];\
581 s64Temp2+=(SINT64)WIND_4_SUBBANDS_1_1*(SINT64)s16X[ChOffset+24+7];\
582 s64Temp+=(SINT64)WIND_4_SUBBANDS_1_2*(SINT64)s16X[ChOffset+16+1];\
583 s64Temp2+=(SINT64)WIND_4_SUBBANDS_1_2*(SINT64)s16X[ChOffset+16+7];\
584 s64Temp+=(SINT64)WIND_4_SUBBANDS_1_3*(SINT64)s16X[ChOffset+24+1];\
585 s64Temp2+=(SINT64)WIND_4_SUBBANDS_1_3*(SINT64)s16X[ChOffset+8+7];\
586 s64Temp+=(SINT64)WIND_4_SUBBANDS_1_4*(SINT64)s16X[ChOffset+32+1];\
587 s64Temp2+=(SINT64)WIND_4_SUBBANDS_1_4*(SINT64)s16X[ChOffset+7];\
588 s32DCTY[1]=(SINT32)(s64Temp>>16);\
589 s32DCTY[7]=(SINT32)(s64Temp2>>16);\
590 }
591 #define WINDOW_ACCU_4_2_6 \
592 {\
593 s64Temp=(SINT64)WIND_4_SUBBANDS_2_0*(SINT64)s16X[ChOffset+2];\
594 s64Temp2=(SINT64)WIND_4_SUBBANDS_2_0*(SINT64)s16X[ChOffset+32+6];\
595 s64Temp+=(SINT64)WIND_4_SUBBANDS_2_1*(SINT64)s16X[ChOffset+8+2];\
596 s64Temp2+=(SINT64)WIND_4_SUBBANDS_2_1*(SINT64)s16X[ChOffset+24+6];\
597 s64Temp+=(SINT64)WIND_4_SUBBANDS_2_2*(SINT64)s16X[ChOffset+16+2];\
598 s64Temp2+=(SINT64)WIND_4_SUBBANDS_2_2*(SINT64)s16X[ChOffset+16+6];\
599 s64Temp+=(SINT64)WIND_4_SUBBANDS_2_3*(SINT64)s16X[ChOffset+24+2];\
600 s64Temp2+=(SINT64)WIND_4_SUBBANDS_2_3*(SINT64)s16X[ChOffset+8+6];\
601 s64Temp+=(SINT64)WIND_4_SUBBANDS_2_4*(SINT64)s16X[ChOffset+32+2];\
602 s64Temp2+=(SINT64)WIND_4_SUBBANDS_2_4*(SINT64)s16X[ChOffset+6];\
603 s32DCTY[2]=(SINT32)(s64Temp>>16);\
604 s32DCTY[6]=(SINT32)(s64Temp2>>16);\
605 }
606 #define WINDOW_ACCU_4_3_5 \
607 {\
608 s64Temp=(SINT64)WIND_4_SUBBANDS_3_0*(SINT64)s16X[ChOffset+3];\
609 s64Temp2=(SINT64)WIND_4_SUBBANDS_3_0*(SINT64)s16X[ChOffset+32+5];\
610 s64Temp+=(SINT64)WIND_4_SUBBANDS_3_1*(SINT64)s16X[ChOffset+8+3];\
611 s64Temp2+=(SINT64)WIND_4_SUBBANDS_3_1*(SINT64)s16X[ChOffset+24+5];\
612 s64Temp+=(SINT64)WIND_4_SUBBANDS_3_2*(SINT64)s16X[ChOffset+16+3];\
613 s64Temp2+=(SINT64)WIND_4_SUBBANDS_3_2*(SINT64)s16X[ChOffset+16+5];\
614 s64Temp+=(SINT64)WIND_4_SUBBANDS_3_3*(SINT64)s16X[ChOffset+24+3];\
615 s64Temp2+=(SINT64)WIND_4_SUBBANDS_3_3*(SINT64)s16X[ChOffset+8+5];\
616 s64Temp+=(SINT64)WIND_4_SUBBANDS_3_4*(SINT64)s16X[ChOffset+32+3];\
617 s64Temp2+=(SINT64)WIND_4_SUBBANDS_3_4*(SINT64)s16X[ChOffset+5];\
618 s32DCTY[3]=(SINT32)(s64Temp>>16);\
619 s32DCTY[5]=(SINT32)(s64Temp2>>16);\
620 }
621
622 #define WINDOW_ACCU_4_4 \
623 {\
624 s64Temp=(SINT64)WIND_4_SUBBANDS_4_0*(SINT64)(s16X[ChOffset+4]+s16X[ChOffset+4+32]);\
625 s64Temp+=(SINT64)WIND_4_SUBBANDS_4_1*(SINT64)(s16X[ChOffset+4+8]+s16X[ChOffset+4+24]);\
626 s64Temp+=(SINT64)WIND_4_SUBBANDS_4_2*(SINT64)s16X[ChOffset+4+16];\
627 s32DCTY[4]=(SINT32)(s64Temp>>16);\
628 }
629 #else /* SBC_IS_64_MULT_IN_WINDOW_ACCU == FALSE */
630 #define WINDOW_ACCU_8_0 \
631 {\
632 s32Temp=(SINT32)WIND_8_SUBBANDS_0_1*(SINT32)(s16X[ChOffset+16]-s16X[ChOffset+64]);\
633 s32Temp+=(SINT32)WIND_8_SUBBANDS_0_2*(SINT32)(s16X[ChOffset+32]-s16X[ChOffset+48]);\
634 s32DCTY[0]=(SINT32)s32Temp;\
635 }
636 #define WINDOW_ACCU_8_1_15 \
637 {\
638 s32Temp=(SINT32)WIND_8_SUBBANDS_1_0*(SINT32)s16X[ChOffset+1];\
639 s32Temp2=(SINT32)WIND_8_SUBBANDS_1_0*(SINT32)s16X[ChOffset+64+15];\
640 s32Temp+=(SINT32)WIND_8_SUBBANDS_1_1*(SINT32)s16X[ChOffset+16+1];\
641 s32Temp2+=(SINT32)WIND_8_SUBBANDS_1_1*(SINT32)s16X[ChOffset+48+15];\
642 s32Temp+=(SINT32)WIND_8_SUBBANDS_1_2*(SINT32)s16X[ChOffset+32+1];\
643 s32Temp2+=(SINT32)WIND_8_SUBBANDS_1_2*(SINT32)s16X[ChOffset+32+15];\
644 s32Temp+=(SINT32)WIND_8_SUBBANDS_1_3*(SINT32)s16X[ChOffset+48+1];\
645 s32Temp2+=(SINT32)WIND_8_SUBBANDS_1_3*(SINT32)s16X[ChOffset+16+15];\
646 s32Temp+=(SINT32)WIND_8_SUBBANDS_1_4*(SINT32)s16X[ChOffset+64+1];\
647 s32Temp2+=(SINT32)WIND_8_SUBBANDS_1_4*(SINT32)s16X[ChOffset+15];\
648 s32DCTY[1]=(SINT32)s32Temp;\
649 s32DCTY[15]=(SINT32)s32Temp2;\
650 }
651 #define WINDOW_ACCU_8_2_14 \
652 {\
653 s32Temp=(SINT32)WIND_8_SUBBANDS_2_0*(SINT32)s16X[ChOffset+2];\
654 s32Temp2=(SINT32)WIND_8_SUBBANDS_2_0*(SINT32)s16X[ChOffset+64+14];\
655 s32Temp+=(SINT32)WIND_8_SUBBANDS_2_1*(SINT32)s16X[ChOffset+16+2];\
656 s32Temp2+=(SINT32)WIND_8_SUBBANDS_2_1*(SINT32)s16X[ChOffset+48+14];\
657 s32Temp+=(SINT32)WIND_8_SUBBANDS_2_2*(SINT32)s16X[ChOffset+32+2];\
658 s32Temp2+=(SINT32)WIND_8_SUBBANDS_2_2*(SINT32)s16X[ChOffset+32+14];\
659 s32Temp+=(SINT32)WIND_8_SUBBANDS_2_3*(SINT32)s16X[ChOffset+48+2];\
660 s32Temp2+=(SINT32)WIND_8_SUBBANDS_2_3*(SINT32)s16X[ChOffset+16+14];\
661 s32Temp+=(SINT32)WIND_8_SUBBANDS_2_4*(SINT32)s16X[ChOffset+64+2];\
662 s32Temp2+=(SINT32)WIND_8_SUBBANDS_2_4*(SINT32)s16X[ChOffset+14];\
663 s32DCTY[2]=(SINT32)s32Temp;\
664 s32DCTY[14]=(SINT32)s32Temp2;\
665 }
666 #define WINDOW_ACCU_8_3_13 \
667 {\
668 s32Temp=(SINT32)WIND_8_SUBBANDS_3_0*(SINT32)s16X[ChOffset+3];\
669 s32Temp2=(SINT32)WIND_8_SUBBANDS_3_0*(SINT32)s16X[ChOffset+64+13];\
670 s32Temp+=(SINT32)WIND_8_SUBBANDS_3_1*(SINT32)s16X[ChOffset+16+3];\
671 s32Temp2+=(SINT32)WIND_8_SUBBANDS_3_1*(SINT32)s16X[ChOffset+48+13];\
672 s32Temp+=(SINT32)WIND_8_SUBBANDS_3_2*(SINT32)s16X[ChOffset+32+3];\
673 s32Temp2+=(SINT32)WIND_8_SUBBANDS_3_2*(SINT32)s16X[ChOffset+32+13];\
674 s32Temp+=(SINT32)WIND_8_SUBBANDS_3_3*(SINT32)s16X[ChOffset+48+3];\
675 s32Temp2+=(SINT32)WIND_8_SUBBANDS_3_3*(SINT32)s16X[ChOffset+16+13];\
676 s32Temp+=(SINT32)WIND_8_SUBBANDS_3_4*(SINT32)s16X[ChOffset+64+3];\
677 s32Temp2+=(SINT32)WIND_8_SUBBANDS_3_4*(SINT32)s16X[ChOffset+13];\
678 s32DCTY[3]=(SINT32)s32Temp;\
679 s32DCTY[13]=(SINT32)s32Temp2;\
680 }
681 #define WINDOW_ACCU_8_4_12 \
682 {\
683 s32Temp=(SINT32)WIND_8_SUBBANDS_4_0*(SINT32)s16X[ChOffset+4];\
684 s32Temp2=(SINT32)WIND_8_SUBBANDS_4_0*(SINT32)s16X[ChOffset+64+12];\
685 s32Temp+=(SINT32)WIND_8_SUBBANDS_4_1*(SINT32)s16X[ChOffset+16+4];\
686 s32Temp2+=(SINT32)WIND_8_SUBBANDS_4_1*(SINT32)s16X[ChOffset+48+12];\
687 s32Temp+=(SINT32)WIND_8_SUBBANDS_4_2*(SINT32)s16X[ChOffset+32+4];\
688 s32Temp2+=(SINT32)WIND_8_SUBBANDS_4_2*(SINT32)s16X[ChOffset+32+12];\
689 s32Temp+=(SINT32)WIND_8_SUBBANDS_4_3*(SINT32)s16X[ChOffset+48+4];\
690 s32Temp2+=(SINT32)WIND_8_SUBBANDS_4_3*(SINT32)s16X[ChOffset+16+12];\
691 s32Temp+=(SINT32)WIND_8_SUBBANDS_4_4*(SINT32)s16X[ChOffset+64+4];\
692 s32Temp2+=(SINT32)WIND_8_SUBBANDS_4_4*(SINT32)s16X[ChOffset+12];\
693 s32DCTY[4]=(SINT32)s32Temp;\
694 s32DCTY[12]=(SINT32)s32Temp2;\
695 }
696 #define WINDOW_ACCU_8_5_11 \
697 {\
698 s32Temp=(SINT32)WIND_8_SUBBANDS_5_0*(SINT32)s16X[ChOffset+5];\
699 s32Temp2=(SINT32)WIND_8_SUBBANDS_5_0*(SINT32)s16X[ChOffset+64+11];\
700 s32Temp+=(SINT32)WIND_8_SUBBANDS_5_1*(SINT32)s16X[ChOffset+16+5];\
701 s32Temp2+=(SINT32)WIND_8_SUBBANDS_5_1*(SINT32)s16X[ChOffset+48+11];\
702 s32Temp+=(SINT32)WIND_8_SUBBANDS_5_2*(SINT32)s16X[ChOffset+32+5];\
703 s32Temp2+=(SINT32)WIND_8_SUBBANDS_5_2*(SINT32)s16X[ChOffset+32+11];\
704 s32Temp+=(SINT32)WIND_8_SUBBANDS_5_3*(SINT32)s16X[ChOffset+48+5];\
705 s32Temp2+=(SINT32)WIND_8_SUBBANDS_5_3*(SINT32)s16X[ChOffset+16+11];\
706 s32Temp+=(SINT32)WIND_8_SUBBANDS_5_4*(SINT32)s16X[ChOffset+64+5];\
707 s32Temp2+=(SINT32)WIND_8_SUBBANDS_5_4*(SINT32)s16X[ChOffset+11];\
708 s32DCTY[5]=(SINT32)s32Temp;\
709 s32DCTY[11]=(SINT32)s32Temp2;\
710 }
711 #define WINDOW_ACCU_8_6_10 \
712 {\
713 s32Temp=(SINT32)WIND_8_SUBBANDS_6_0*(SINT32)s16X[ChOffset+6];\
714 s32Temp2=(SINT32)WIND_8_SUBBANDS_6_0*(SINT32)s16X[ChOffset+64+10];\
715 s32Temp+=(SINT32)WIND_8_SUBBANDS_6_1*(SINT32)s16X[ChOffset+16+6];\
716 s32Temp2+=(SINT32)WIND_8_SUBBANDS_6_1*(SINT32)s16X[ChOffset+48+10];\
717 s32Temp+=(SINT32)WIND_8_SUBBANDS_6_2*(SINT32)s16X[ChOffset+32+6];\
718 s32Temp2+=(SINT32)WIND_8_SUBBANDS_6_2*(SINT32)s16X[ChOffset+32+10];\
719 s32Temp+=(SINT32)WIND_8_SUBBANDS_6_3*(SINT32)s16X[ChOffset+48+6];\
720 s32Temp2+=(SINT32)WIND_8_SUBBANDS_6_3*(SINT32)s16X[ChOffset+16+10];\
721 s32Temp+=(SINT32)WIND_8_SUBBANDS_6_4*(SINT32)s16X[ChOffset+64+6];\
722 s32Temp2+=(SINT32)WIND_8_SUBBANDS_6_4*(SINT32)s16X[ChOffset+10];\
723 s32DCTY[6]=(SINT32)s32Temp;\
724 s32DCTY[10]=(SINT32)s32Temp2;\
725 }
726 #define WINDOW_ACCU_8_7_9 \
727 {\
728 s32Temp=(SINT32)WIND_8_SUBBANDS_7_0*(SINT32)s16X[ChOffset+7];\
729 s32Temp2=(SINT32)WIND_8_SUBBANDS_7_0*(SINT32)s16X[ChOffset+64+9];\
730 s32Temp+=(SINT32)WIND_8_SUBBANDS_7_1*(SINT32)s16X[ChOffset+16+7];\
731 s32Temp2+=(SINT32)WIND_8_SUBBANDS_7_1*(SINT32)s16X[ChOffset+48+9];\
732 s32Temp+=(SINT32)WIND_8_SUBBANDS_7_2*(SINT32)s16X[ChOffset+32+7];\
733 s32Temp2+=(SINT32)WIND_8_SUBBANDS_7_2*(SINT32)s16X[ChOffset+32+9];\
734 s32Temp+=(SINT32)WIND_8_SUBBANDS_7_3*(SINT32)s16X[ChOffset+48+7];\
735 s32Temp2+=(SINT32)WIND_8_SUBBANDS_7_3*(SINT32)s16X[ChOffset+16+9];\
736 s32Temp+=(SINT32)WIND_8_SUBBANDS_7_4*(SINT32)s16X[ChOffset+64+7];\
737 s32Temp2+=(SINT32)WIND_8_SUBBANDS_7_4*(SINT32)s16X[ChOffset+9];\
738 s32DCTY[7]=(SINT32)s32Temp;\
739 s32DCTY[9]=(SINT32)s32Temp2;\
740 }
741 #define WINDOW_ACCU_8_8 \
742 {\
743 s32Temp=(SINT32)WIND_8_SUBBANDS_8_0*(SINT32)(s16X[ChOffset+8]+s16X[ChOffset+64+8]);\
744 s32Temp+=(SINT32)WIND_8_SUBBANDS_8_1*(SINT32)(s16X[ChOffset+16+8]+s16X[ChOffset+48+8]);\
745 s32Temp+=(SINT32)WIND_8_SUBBANDS_8_2*(SINT32)s16X[ChOffset+32+8];\
746 s32DCTY[8]=(SINT32)s32Temp;\
747 }
748 #define WINDOW_ACCU_4_0 \
749 {\
750 s32Temp=(SINT32)WIND_4_SUBBANDS_0_1*(SINT32)(s16X[ChOffset+8]-s16X[ChOffset+32]);\
751 s32Temp+=(SINT32)WIND_4_SUBBANDS_0_2*(SINT32)(s16X[ChOffset+16]-s16X[ChOffset+24]);\
752 s32DCTY[0]=(SINT32)(s32Temp);\
753 }
754 #define WINDOW_ACCU_4_1_7 \
755 {\
756 s32Temp=(SINT32)WIND_4_SUBBANDS_1_0*(SINT32)s16X[ChOffset+1];\
757 s32Temp2=(SINT32)WIND_4_SUBBANDS_1_0*(SINT32)s16X[ChOffset+32+7];\
758 s32Temp+=(SINT32)WIND_4_SUBBANDS_1_1*(SINT32)s16X[ChOffset+8+1];\
759 s32Temp2+=(SINT32)WIND_4_SUBBANDS_1_1*(SINT32)s16X[ChOffset+24+7];\
760 s32Temp+=(SINT32)WIND_4_SUBBANDS_1_2*(SINT32)s16X[ChOffset+16+1];\
761 s32Temp2+=(SINT32)WIND_4_SUBBANDS_1_2*(SINT32)s16X[ChOffset+16+7];\
762 s32Temp+=(SINT32)WIND_4_SUBBANDS_1_3*(SINT32)s16X[ChOffset+24+1];\
763 s32Temp2+=(SINT32)WIND_4_SUBBANDS_1_3*(SINT32)s16X[ChOffset+8+7];\
764 s32Temp+=(SINT32)WIND_4_SUBBANDS_1_4*(SINT32)s16X[ChOffset+32+1];\
765 s32Temp2+=(SINT32)WIND_4_SUBBANDS_1_4*(SINT32)s16X[ChOffset+7];\
766 s32DCTY[1]=(SINT32)(s32Temp);\
767 s32DCTY[7]=(SINT32)(s32Temp2);\
768 }
769 #define WINDOW_ACCU_4_2_6 \
770 {\
771 s32Temp=(SINT32)WIND_4_SUBBANDS_2_0*(SINT32)s16X[ChOffset+2];\
772 s32Temp2=(SINT32)WIND_4_SUBBANDS_2_0*(SINT32)s16X[ChOffset+32+6];\
773 s32Temp+=(SINT32)WIND_4_SUBBANDS_2_1*(SINT32)s16X[ChOffset+8+2];\
774 s32Temp2+=(SINT32)WIND_4_SUBBANDS_2_1*(SINT32)s16X[ChOffset+24+6];\
775 s32Temp+=(SINT32)WIND_4_SUBBANDS_2_2*(SINT32)s16X[ChOffset+16+2];\
776 s32Temp2+=(SINT32)WIND_4_SUBBANDS_2_2*(SINT32)s16X[ChOffset+16+6];\
777 s32Temp+=(SINT32)WIND_4_SUBBANDS_2_3*(SINT32)s16X[ChOffset+24+2];\
778 s32Temp2+=(SINT32)WIND_4_SUBBANDS_2_3*(SINT32)s16X[ChOffset+8+6];\
779 s32Temp+=(SINT32)WIND_4_SUBBANDS_2_4*(SINT32)s16X[ChOffset+32+2];\
780 s32Temp2+=(SINT32)WIND_4_SUBBANDS_2_4*(SINT32)s16X[ChOffset+6];\
781 s32DCTY[2]=(SINT32)(s32Temp);\
782 s32DCTY[6]=(SINT32)(s32Temp2);\
783 }
784 #define WINDOW_ACCU_4_3_5 \
785 {\
786 s32Temp=(SINT32)WIND_4_SUBBANDS_3_0*(SINT32)s16X[ChOffset+3];\
787 s32Temp2=(SINT32)WIND_4_SUBBANDS_3_0*(SINT32)s16X[ChOffset+32+5];\
788 s32Temp+=(SINT32)WIND_4_SUBBANDS_3_1*(SINT32)s16X[ChOffset+8+3];\
789 s32Temp2+=(SINT32)WIND_4_SUBBANDS_3_1*(SINT32)s16X[ChOffset+24+5];\
790 s32Temp+=(SINT32)WIND_4_SUBBANDS_3_2*(SINT32)s16X[ChOffset+16+3];\
791 s32Temp2+=(SINT32)WIND_4_SUBBANDS_3_2*(SINT32)s16X[ChOffset+16+5];\
792 s32Temp+=(SINT32)WIND_4_SUBBANDS_3_3*(SINT32)s16X[ChOffset+24+3];\
793 s32Temp2+=(SINT32)WIND_4_SUBBANDS_3_3*(SINT32)s16X[ChOffset+8+5];\
794 s32Temp+=(SINT32)WIND_4_SUBBANDS_3_4*(SINT32)s16X[ChOffset+32+3];\
795 s32Temp2+=(SINT32)WIND_4_SUBBANDS_3_4*(SINT32)s16X[ChOffset+5];\
796 s32DCTY[3]=(SINT32)(s32Temp);\
797 s32DCTY[5]=(SINT32)(s32Temp2);\
798 }
799
800 #define WINDOW_ACCU_4_4 \
801 {\
802 s32Temp=(SINT32)WIND_4_SUBBANDS_4_0*(SINT32)(s16X[ChOffset+4]+s16X[ChOffset+4+32]);\
803 s32Temp+=(SINT32)WIND_4_SUBBANDS_4_1*(SINT32)(s16X[ChOffset+4+8]+s16X[ChOffset+4+24]);\
804 s32Temp+=(SINT32)WIND_4_SUBBANDS_4_2*(SINT32)s16X[ChOffset+4+16];\
805 s32DCTY[4]=(SINT32)(s32Temp);\
806 }
807 #endif
808 #define WINDOW_PARTIAL_4 \
809 {\
810 WINDOW_ACCU_4_0; WINDOW_ACCU_4_1_7;\
811 WINDOW_ACCU_4_2_6; WINDOW_ACCU_4_3_5;\
812 WINDOW_ACCU_4_4;\
813 }
814
815 #define WINDOW_PARTIAL_8 \
816 {\
817 WINDOW_ACCU_8_0; WINDOW_ACCU_8_1_15;\
818 WINDOW_ACCU_8_2_14; WINDOW_ACCU_8_3_13;\
819 WINDOW_ACCU_8_4_12; WINDOW_ACCU_8_5_11;\
820 WINDOW_ACCU_8_6_10; WINDOW_ACCU_8_7_9;\
821 WINDOW_ACCU_8_8;\
822 }
823 #else
824 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
825 #define WINDOW_ACCU_4(i) \
826 {\
827 s64Temp=((SINT64)gas32CoeffFor4SBs[i] * (SINT64)s16X[ChOffset+i]); \
828 s64Temp+=((SINT64)gas32CoeffFor4SBs[(i+8)] * (SINT64)s16X[ChOffset+i+8]); \
829 s64Temp+=((SINT64)gas32CoeffFor4SBs[(i+16)] * (SINT64)s16X[ChOffset+i+16]); \
830 s64Temp+=((SINT64)gas32CoeffFor4SBs[(i+24)] * (SINT64)s16X[ChOffset+i+24]); \
831 s64Temp+=((SINT64)gas32CoeffFor4SBs[(i+32)] * (SINT64)s16X[ChOffset+i+32]); \
832 s32DCTY[i]=(SINT32)(s64Temp>>16);\
833 /*printf("s32DCTY4: 0x%x \n", s32DCTY[i]);*/\
834 }
835 #else
836 #define WINDOW_ACCU_4(i) \
837 {\
838 s32DCTY[i]=(gas32CoeffFor4SBs[i * 2] * s16X[ChOffset+i]) \
839 + (((SINT32)(UINT16)(gas32CoeffFor4SBs[(i * 2) + 1]) * s16X[ChOffset+i]) >> 16); \
840 s32DCTY[i]+=(gas32CoeffFor4SBs[(i+8) * 2] * s16X[ChOffset+i+8]) \
841 + (((SINT32)(UINT16)(gas32CoeffFor4SBs[((i+8) * 2) + 1]) * s16X[ChOffset+i+8]) >> 16); \
842 s32DCTY[i]+=(gas32CoeffFor4SBs[(i+16) * 2] * s16X[ChOffset+i+16]) \
843 + (((SINT32)(UINT16)(gas32CoeffFor4SBs[((i+16) * 2) + 1]) * s16X[ChOffset+i+16]) >> 16); \
844 s32DCTY[i]+=(gas32CoeffFor4SBs[(i+24) * 2] * s16X[ChOffset+i+24]) \
845 + (((SINT32)(UINT16)(gas32CoeffFor4SBs[((i+24) * 2) + 1]) * s16X[ChOffset+i+24]) >> 16); \
846 s32DCTY[i]+=(gas32CoeffFor4SBs[(i+32) * 2] * s16X[ChOffset+i+32]) \
847 + (((SINT32)(UINT16)(gas32CoeffFor4SBs[((i+32) * 2) + 1]) * s16X[ChOffset+i+32]) >> 16); \
848 }
849 #endif
850 #define WINDOW_PARTIAL_4 \
851 {\
852 WINDOW_ACCU_4(0); WINDOW_ACCU_4(1);\
853 WINDOW_ACCU_4(2); WINDOW_ACCU_4(3);\
854 WINDOW_ACCU_4(4); WINDOW_ACCU_4(5);\
855 WINDOW_ACCU_4(6); WINDOW_ACCU_4(7);\
856 }
857
858 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
859 #define WINDOW_ACCU_8(i) \
860 {\
861 s64Temp = ((((SINT64)gas32CoeffFor8SBs[i] * (SINT64)s16X[ChOffset+i] ))); \
862 s64Temp+= ((((SINT64)gas32CoeffFor8SBs[(i+16)] * (SINT64)s16X[ChOffset+i+16]))); \
863 s64Temp+= ((((SINT64)gas32CoeffFor8SBs[(i+32)] * (SINT64)s16X[ChOffset+i+32]))); \
864 s64Temp+= ((((SINT64)gas32CoeffFor8SBs[(i+48)] * (SINT64)s16X[ChOffset+i+48]))); \
865 s64Temp+= ((((SINT64)gas32CoeffFor8SBs[(i+64)] * (SINT64)s16X[ChOffset+i+64]))); \
866 /*printf("s32DCTY8: %d= 0x%x * %d\n", s32DCTY[i], gas32CoeffFor8SBs[i], s16X[ChOffset+i]);*/ \
867 s32DCTY[i]=(SINT32)(s64Temp>>16);\
868 }
869 #else
870 #define WINDOW_ACCU_8(i) \
871 {\
872 s32DCTY[i]=(gas32CoeffFor8SBs[i * 2] * s16X[ChOffset+i]) \
873 + (((SINT32)(UINT16)(gas32CoeffFor8SBs[(i * 2) + 1]) * s16X[ChOffset+i]) >> 16); \
874 s32DCTY[i]+=(gas32CoeffFor8SBs[(i+16) * 2] * s16X[ChOffset+i+16]) \
875 + (((SINT32)(UINT16)(gas32CoeffFor8SBs[((i+16) * 2) + 1]) * s16X[ChOffset+i+16]) >> 16); \
876 s32DCTY[i]+=(gas32CoeffFor8SBs[(i+32) * 2] * s16X[ChOffset+i+32]) \
877 + (((SINT32)(UINT16)(gas32CoeffFor8SBs[((i+32) * 2) + 1]) * s16X[ChOffset+i+32]) >> 16); \
878 s32DCTY[i]+=(gas32CoeffFor8SBs[(i+48) * 2] * s16X[ChOffset+i+48]) \
879 + (((SINT32)(UINT16)(gas32CoeffFor8SBs[((i+48) * 2) + 1]) * s16X[ChOffset+i+48]) >> 16); \
880 s32DCTY[i]+=(gas32CoeffFor8SBs[(i+64) * 2] * s16X[ChOffset+i+64]) \
881 + (((SINT32)(UINT16)(gas32CoeffFor8SBs[((i+64) * 2) + 1]) * s16X[ChOffset+i+64]) >> 16); \
882 /*printf("s32DCTY8: %d = 0x%4x%4x * %d\n", s32DCTY[i], gas32CoeffFor8SBs[i * 2], (gas32CoeffFor8SBs[(i * 2) + 1]), s16X[ChOffset+i]);*/\
883 /*s32DCTY[i]=(SINT32)(s64Temp>>16);*/\
884 }
885 #endif
886 #define WINDOW_PARTIAL_8 \
887 {\
888 WINDOW_ACCU_8(0); WINDOW_ACCU_8(1);\
889 WINDOW_ACCU_8(2); WINDOW_ACCU_8(3);\
890 WINDOW_ACCU_8(4); WINDOW_ACCU_8(5);\
891 WINDOW_ACCU_8(6); WINDOW_ACCU_8(7);\
892 WINDOW_ACCU_8(8); WINDOW_ACCU_8(9);\
893 WINDOW_ACCU_8(10); WINDOW_ACCU_8(11);\
894 WINDOW_ACCU_8(12); WINDOW_ACCU_8(13);\
895 WINDOW_ACCU_8(14); WINDOW_ACCU_8(15);\
896 }
897 #endif
898 #endif
899
900 static SINT16 ShiftCounter=0;
901 extern SINT16 EncMaxShiftCounter;
902 /****************************************************************************
903 * SbcAnalysisFilter - performs Analysis of the input audio stream
904 *
905 * RETURNS : N/A
906 */
SbcAnalysisFilter4(SBC_ENC_PARAMS * pstrEncParams)907 void SbcAnalysisFilter4(SBC_ENC_PARAMS *pstrEncParams)
908 {
909 SINT16 *ps16PcmBuf;
910 SINT32 *ps32SbBuf;
911 SINT32 s32Blk,s32Ch;
912 SINT32 s32NumOfChannels, s32NumOfBlocks;
913 SINT32 i,*ps32X,*ps32X2;
914 SINT32 Offset,Offset2,ChOffset;
915 #if (SBC_ARM_ASM_OPT==TRUE)
916 register SINT32 s32Hi,s32Hi2;
917 #else
918 #if (SBC_IPAQ_OPT==TRUE)
919 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
920 register SINT64 s64Temp,s64Temp2;
921 #else
922 register SINT32 s32Temp,s32Temp2;
923 #endif
924 #else
925
926 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
927 SINT64 s64Temp;
928 #endif
929
930 #endif
931 #endif
932
933 s32NumOfChannels = pstrEncParams->s16NumOfChannels;
934 s32NumOfBlocks = pstrEncParams->s16NumOfBlocks;
935
936 ps16PcmBuf = pstrEncParams->ps16NextPcmBuffer;
937
938 ps32SbBuf = pstrEncParams->s32SbBuffer;
939 Offset2=(SINT32)(EncMaxShiftCounter+40);
940 for (s32Blk=0; s32Blk <s32NumOfBlocks; s32Blk++)
941 {
942 Offset=(SINT32)(EncMaxShiftCounter-ShiftCounter);
943 /* Store new samples */
944 if (s32NumOfChannels==1)
945 {
946 s16X[3+Offset] = *ps16PcmBuf; ps16PcmBuf++;
947 s16X[2+Offset] = *ps16PcmBuf; ps16PcmBuf++;
948 s16X[1+Offset] = *ps16PcmBuf; ps16PcmBuf++;
949 s16X[0+Offset] = *ps16PcmBuf; ps16PcmBuf++;
950 }
951 else
952 {
953 s16X[3+Offset] = *ps16PcmBuf; ps16PcmBuf++;
954 s16X[Offset2+3+Offset] = *ps16PcmBuf; ps16PcmBuf++;
955 s16X[2+Offset] = *ps16PcmBuf; ps16PcmBuf++;
956 s16X[Offset2+2+Offset] = *ps16PcmBuf; ps16PcmBuf++;
957 s16X[1+Offset] = *ps16PcmBuf; ps16PcmBuf++;
958 s16X[Offset2+1+Offset] = *ps16PcmBuf; ps16PcmBuf++;
959 s16X[0+Offset] = *ps16PcmBuf; ps16PcmBuf++;
960 s16X[Offset2+0+Offset] = *ps16PcmBuf; ps16PcmBuf++;
961 }
962 for (s32Ch=0;s32Ch<s32NumOfChannels;s32Ch++)
963 {
964 ChOffset=s32Ch*Offset2+Offset;
965
966 WINDOW_PARTIAL_4
967
968 SBC_FastIDCT4(s32DCTY, ps32SbBuf);
969
970 ps32SbBuf +=SUB_BANDS_4;
971 }
972 if (s32NumOfChannels==1)
973 {
974 if (ShiftCounter>=EncMaxShiftCounter)
975 {
976 SHIFTUP_X4;
977 ShiftCounter=0;
978 }
979 else
980 {
981 ShiftCounter+=SUB_BANDS_4;
982 }
983 }
984 else
985 {
986 if (ShiftCounter>=EncMaxShiftCounter)
987 {
988 SHIFTUP_X4_2;
989 ShiftCounter=0;
990 }
991 else
992 {
993 ShiftCounter+=SUB_BANDS_4;
994 }
995 }
996 }
997 }
998
999 /* //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
SbcAnalysisFilter8(SBC_ENC_PARAMS * pstrEncParams)1000 void SbcAnalysisFilter8 (SBC_ENC_PARAMS *pstrEncParams)
1001 {
1002 SINT16 *ps16PcmBuf;
1003 SINT32 *ps32SbBuf;
1004 SINT32 s32Blk,s32Ch; /* counter for block*/
1005 SINT32 Offset,Offset2;
1006 SINT32 s32NumOfChannels, s32NumOfBlocks;
1007 SINT32 i,*ps32X,*ps32X2;
1008 SINT32 ChOffset;
1009 #if (SBC_ARM_ASM_OPT==TRUE)
1010 register SINT32 s32Hi,s32Hi2;
1011 #else
1012 #if (SBC_IPAQ_OPT==TRUE)
1013 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1014 register SINT64 s64Temp,s64Temp2;
1015 #else
1016 register SINT32 s32Temp,s32Temp2;
1017 #endif
1018 #else
1019 #if (SBC_IS_64_MULT_IN_WINDOW_ACCU == TRUE)
1020 SINT64 s64Temp;
1021 #endif
1022 #endif
1023 #endif
1024
1025 s32NumOfChannels = pstrEncParams->s16NumOfChannels;
1026 s32NumOfBlocks = pstrEncParams->s16NumOfBlocks;
1027
1028 ps16PcmBuf = pstrEncParams->ps16NextPcmBuffer;
1029
1030 ps32SbBuf = pstrEncParams->s32SbBuffer;
1031 Offset2=(SINT32)(EncMaxShiftCounter+80);
1032 for (s32Blk=0; s32Blk <s32NumOfBlocks; s32Blk++)
1033 {
1034 Offset=(SINT32)(EncMaxShiftCounter-ShiftCounter);
1035 /* Store new samples */
1036 if (s32NumOfChannels==1)
1037 {
1038 s16X[7+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1039 s16X[6+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1040 s16X[5+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1041 s16X[4+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1042 s16X[3+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1043 s16X[2+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1044 s16X[1+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1045 s16X[0+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1046 }
1047 else
1048 {
1049 s16X[7+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1050 s16X[Offset2+7+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1051 s16X[6+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1052 s16X[Offset2+6+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1053 s16X[5+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1054 s16X[Offset2+5+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1055 s16X[4+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1056 s16X[Offset2+4+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1057 s16X[3+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1058 s16X[Offset2+3+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1059 s16X[2+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1060 s16X[Offset2+2+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1061 s16X[1+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1062 s16X[Offset2+1+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1063 s16X[0+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1064 s16X[Offset2+0+Offset] = *ps16PcmBuf; ps16PcmBuf++;
1065 }
1066 for (s32Ch=0;s32Ch<s32NumOfChannels;s32Ch++)
1067 {
1068 ChOffset=s32Ch*Offset2+Offset;
1069
1070 WINDOW_PARTIAL_8
1071
1072 SBC_FastIDCT8 (s32DCTY, ps32SbBuf);
1073
1074 ps32SbBuf +=SUB_BANDS_8;
1075 }
1076 if (s32NumOfChannels==1)
1077 {
1078 if (ShiftCounter>=EncMaxShiftCounter)
1079 {
1080 SHIFTUP_X8;
1081 ShiftCounter=0;
1082 }
1083 else
1084 {
1085 ShiftCounter+=SUB_BANDS_8;
1086 }
1087 }
1088 else
1089 {
1090 if (ShiftCounter>=EncMaxShiftCounter)
1091 {
1092 SHIFTUP_X8_2;
1093 ShiftCounter=0;
1094 }
1095 else
1096 {
1097 ShiftCounter+=SUB_BANDS_8;
1098 }
1099 }
1100 }
1101 }
1102
SbcAnalysisInit(void)1103 void SbcAnalysisInit (void)
1104 {
1105 memset(s16X,0,ENC_VX_BUFFER_SIZE*sizeof(SINT16));
1106 ShiftCounter=0;
1107 }
1108