1
|
1 /*
|
|
2 * idct_mmx.c
|
10303
|
3 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
|
9852
|
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
|
1
|
5 *
|
|
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
|
9852
|
7 * See http://libmpeg2.sourceforge.net/ for updates.
|
1
|
8 *
|
|
9 * mpeg2dec is free software; you can redistribute it and/or modify
|
|
10 * it under the terms of the GNU General Public License as published by
|
|
11 * the Free Software Foundation; either version 2 of the License, or
|
|
12 * (at your option) any later version.
|
|
13 *
|
|
14 * mpeg2dec is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 * GNU General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU General Public License
|
|
20 * along with this program; if not, write to the Free Software
|
|
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22 */
|
|
23
|
|
24 #include "config.h"
|
|
25
|
|
26 #ifdef ARCH_X86
|
|
27
|
|
28 #include <inttypes.h>
|
|
29
|
9852
|
30 #include "mpeg2.h"
|
12932
|
31 #include "attributes.h"
|
1
|
32 #include "mpeg2_internal.h"
|
|
33 #include "mmx.h"
|
|
34
|
12932
|
35 #define ROW_SHIFT 15
|
1
|
36 #define COL_SHIFT 6
|
|
37
|
|
38 #define round(bias) ((int)(((bias)+0.5) * (1<<ROW_SHIFT)))
|
|
39 #define rounder(bias) {round (bias), round (bias)}
|
|
40
|
|
41
|
|
42 #if 0
|
36
|
43 /* C row IDCT - its just here to document the MMXEXT and MMX versions */
|
1
|
44 static inline void idct_row (int16_t * row, int offset,
|
|
45 int16_t * table, int32_t * rounder)
|
|
46 {
|
|
47 int C1, C2, C3, C4, C5, C6, C7;
|
|
48 int a0, a1, a2, a3, b0, b1, b2, b3;
|
|
49
|
|
50 row += offset;
|
|
51
|
|
52 C1 = table[1];
|
|
53 C2 = table[2];
|
|
54 C3 = table[3];
|
|
55 C4 = table[4];
|
|
56 C5 = table[5];
|
|
57 C6 = table[6];
|
|
58 C7 = table[7];
|
|
59
|
|
60 a0 = C4*row[0] + C2*row[2] + C4*row[4] + C6*row[6] + *rounder;
|
|
61 a1 = C4*row[0] + C6*row[2] - C4*row[4] - C2*row[6] + *rounder;
|
|
62 a2 = C4*row[0] - C6*row[2] - C4*row[4] + C2*row[6] + *rounder;
|
|
63 a3 = C4*row[0] - C2*row[2] + C4*row[4] - C6*row[6] + *rounder;
|
|
64
|
|
65 b0 = C1*row[1] + C3*row[3] + C5*row[5] + C7*row[7];
|
|
66 b1 = C3*row[1] - C7*row[3] - C1*row[5] - C5*row[7];
|
|
67 b2 = C5*row[1] - C1*row[3] + C7*row[5] + C3*row[7];
|
|
68 b3 = C7*row[1] - C5*row[3] + C3*row[5] - C1*row[7];
|
|
69
|
|
70 row[0] = (a0 + b0) >> ROW_SHIFT;
|
|
71 row[1] = (a1 + b1) >> ROW_SHIFT;
|
|
72 row[2] = (a2 + b2) >> ROW_SHIFT;
|
|
73 row[3] = (a3 + b3) >> ROW_SHIFT;
|
|
74 row[4] = (a3 - b3) >> ROW_SHIFT;
|
|
75 row[5] = (a2 - b2) >> ROW_SHIFT;
|
|
76 row[6] = (a1 - b1) >> ROW_SHIFT;
|
|
77 row[7] = (a0 - b0) >> ROW_SHIFT;
|
|
78 }
|
|
79 #endif
|
|
80
|
|
81
|
36
|
82 /* MMXEXT row IDCT */
|
1
|
83
|
|
84 #define mmxext_table(c1,c2,c3,c4,c5,c6,c7) { c4, c2, -c4, -c2, \
|
|
85 c4, c6, c4, c6, \
|
|
86 c1, c3, -c1, -c5, \
|
|
87 c5, c7, c3, -c7, \
|
|
88 c4, -c6, c4, -c6, \
|
|
89 -c4, c2, c4, -c2, \
|
|
90 c5, -c1, c3, -c1, \
|
|
91 c7, c3, c7, -c5 }
|
|
92
|
9852
|
93 static inline void mmxext_row_head (int16_t * const row, const int offset,
|
|
94 const int16_t * const table)
|
1
|
95 {
|
9852
|
96 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
|
1
|
97
|
9852
|
98 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
|
|
99 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
|
1
|
100
|
9852
|
101 movq_m2r (*table, mm3); /* mm3 = -C2 -C4 C2 C4 */
|
|
102 movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
|
1
|
103
|
9852
|
104 movq_m2r (*(table+4), mm4); /* mm4 = C6 C4 C6 C4 */
|
|
105 pmaddwd_r2r (mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
|
1
|
106
|
9852
|
107 pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
|
1
|
108 }
|
|
109
|
9852
|
110 static inline void mmxext_row (const int16_t * const table,
|
|
111 const int32_t * const rounder)
|
1
|
112 {
|
9852
|
113 movq_m2r (*(table+8), mm1); /* mm1 = -C5 -C1 C3 C1 */
|
|
114 pmaddwd_r2r (mm2, mm4); /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */
|
1
|
115
|
9852
|
116 pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */
|
|
117 pshufw_r2r (mm6, mm6, 0x4e); /* mm6 = x3 x1 x7 x5 */
|
1
|
118
|
9852
|
119 movq_m2r (*(table+12), mm7); /* mm7 = -C7 C3 C7 C5 */
|
|
120 pmaddwd_r2r (mm5, mm1); /* mm1 = -C1*x5-C5*x7 C1*x1+C3*x3 */
|
1
|
121
|
9852
|
122 paddd_m2r (*rounder, mm3); /* mm3 += rounder */
|
|
123 pmaddwd_r2r (mm6, mm7); /* mm7 = C3*x1-C7*x3 C5*x5+C7*x7 */
|
1
|
124
|
9852
|
125 pmaddwd_m2r (*(table+20), mm2); /* mm2 = C4*x0-C2*x2 -C4*x4+C2*x6 */
|
|
126 paddd_r2r (mm4, mm3); /* mm3 = a1 a0 + rounder */
|
1
|
127
|
9852
|
128 pmaddwd_m2r (*(table+24), mm5); /* mm5 = C3*x5-C1*x7 C5*x1-C1*x3 */
|
|
129 movq_r2r (mm3, mm4); /* mm4 = a1 a0 + rounder */
|
1
|
130
|
9852
|
131 pmaddwd_m2r (*(table+28), mm6); /* mm6 = C7*x1-C5*x3 C7*x5+C3*x7 */
|
|
132 paddd_r2r (mm7, mm1); /* mm1 = b1 b0 */
|
1
|
133
|
9852
|
134 paddd_m2r (*rounder, mm0); /* mm0 += rounder */
|
|
135 psubd_r2r (mm1, mm3); /* mm3 = a1-b1 a0-b0 + rounder */
|
1
|
136
|
9852
|
137 psrad_i2r (ROW_SHIFT, mm3); /* mm3 = y6 y7 */
|
|
138 paddd_r2r (mm4, mm1); /* mm1 = a1+b1 a0+b0 + rounder */
|
1
|
139
|
9852
|
140 paddd_r2r (mm2, mm0); /* mm0 = a3 a2 + rounder */
|
|
141 psrad_i2r (ROW_SHIFT, mm1); /* mm1 = y1 y0 */
|
1
|
142
|
9852
|
143 paddd_r2r (mm6, mm5); /* mm5 = b3 b2 */
|
|
144 movq_r2r (mm0, mm4); /* mm4 = a3 a2 + rounder */
|
1
|
145
|
9852
|
146 paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
|
|
147 psubd_r2r (mm5, mm4); /* mm4 = a3-b3 a2-b2 + rounder */
|
1
|
148 }
|
|
149
|
9852
|
150 static inline void mmxext_row_tail (int16_t * const row, const int store)
|
1
|
151 {
|
9852
|
152 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
|
1
|
153
|
9852
|
154 psrad_i2r (ROW_SHIFT, mm4); /* mm4 = y4 y5 */
|
1
|
155
|
9852
|
156 packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
|
1
|
157
|
9852
|
158 packssdw_r2r (mm3, mm4); /* mm4 = y6 y7 y4 y5 */
|
1
|
159
|
9852
|
160 movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
|
|
161 pshufw_r2r (mm4, mm4, 0xb1); /* mm4 = y7 y6 y5 y4 */
|
1
|
162
|
36
|
163 /* slot */
|
1
|
164
|
9852
|
165 movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */
|
1
|
166 }
|
|
167
|
9852
|
168 static inline void mmxext_row_mid (int16_t * const row, const int store,
|
|
169 const int offset,
|
|
170 const int16_t * const table)
|
1
|
171 {
|
9852
|
172 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
|
|
173 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
|
1
|
174
|
9852
|
175 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
|
|
176 psrad_i2r (ROW_SHIFT, mm4); /* mm4 = y4 y5 */
|
1
|
177
|
9852
|
178 packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
|
|
179 movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
|
1
|
180
|
9852
|
181 packssdw_r2r (mm3, mm4); /* mm4 = y6 y7 y4 y5 */
|
|
182 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
|
1
|
183
|
9852
|
184 movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
|
|
185 pshufw_r2r (mm4, mm4, 0xb1); /* mm4 = y7 y6 y5 y4 */
|
1
|
186
|
9852
|
187 movq_m2r (*table, mm3); /* mm3 = -C2 -C4 C2 C4 */
|
|
188 movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */
|
1
|
189
|
9852
|
190 pmaddwd_r2r (mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
|
1
|
191
|
9852
|
192 movq_m2r (*(table+4), mm4); /* mm4 = C6 C4 C6 C4 */
|
|
193 pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
|
1
|
194 }
|
|
195
|
|
196
|
36
|
197 /* MMX row IDCT */
|
1
|
198
|
|
199 #define mmx_table(c1,c2,c3,c4,c5,c6,c7) { c4, c2, c4, c6, \
|
|
200 c4, c6, -c4, -c2, \
|
|
201 c1, c3, c3, -c7, \
|
|
202 c5, c7, -c1, -c5, \
|
|
203 c4, -c6, c4, -c2, \
|
|
204 -c4, c2, c4, -c6, \
|
|
205 c5, -c1, c7, -c5, \
|
|
206 c7, c3, c3, -c1 }
|
|
207
|
9852
|
208 static inline void mmx_row_head (int16_t * const row, const int offset,
|
|
209 const int16_t * const table)
|
1
|
210 {
|
9852
|
211 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
|
1
|
212
|
9852
|
213 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
|
|
214 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
|
1
|
215
|
9852
|
216 movq_m2r (*table, mm3); /* mm3 = C6 C4 C2 C4 */
|
|
217 movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
|
1
|
218
|
9852
|
219 punpckldq_r2r (mm0, mm0); /* mm0 = x2 x0 x2 x0 */
|
1
|
220
|
9852
|
221 movq_m2r (*(table+4), mm4); /* mm4 = -C2 -C4 C6 C4 */
|
|
222 pmaddwd_r2r (mm0, mm3); /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
|
1
|
223
|
9852
|
224 movq_m2r (*(table+8), mm1); /* mm1 = -C7 C3 C3 C1 */
|
|
225 punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */
|
1
|
226 }
|
|
227
|
9852
|
228 static inline void mmx_row (const int16_t * const table,
|
|
229 const int32_t * const rounder)
|
1
|
230 {
|
9852
|
231 pmaddwd_r2r (mm2, mm4); /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */
|
|
232 punpckldq_r2r (mm5, mm5); /* mm5 = x3 x1 x3 x1 */
|
1
|
233
|
9852
|
234 pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */
|
|
235 punpckhdq_r2r (mm6, mm6); /* mm6 = x7 x5 x7 x5 */
|
1
|
236
|
9852
|
237 movq_m2r (*(table+12), mm7); /* mm7 = -C5 -C1 C7 C5 */
|
|
238 pmaddwd_r2r (mm5, mm1); /* mm1 = C3*x1-C7*x3 C1*x1+C3*x3 */
|
1
|
239
|
9852
|
240 paddd_m2r (*rounder, mm3); /* mm3 += rounder */
|
|
241 pmaddwd_r2r (mm6, mm7); /* mm7 = -C1*x5-C5*x7 C5*x5+C7*x7 */
|
1
|
242
|
9852
|
243 pmaddwd_m2r (*(table+20), mm2); /* mm2 = C4*x4-C6*x6 -C4*x4+C2*x6 */
|
|
244 paddd_r2r (mm4, mm3); /* mm3 = a1 a0 + rounder */
|
1
|
245
|
9852
|
246 pmaddwd_m2r (*(table+24), mm5); /* mm5 = C7*x1-C5*x3 C5*x1-C1*x3 */
|
|
247 movq_r2r (mm3, mm4); /* mm4 = a1 a0 + rounder */
|
1
|
248
|
9852
|
249 pmaddwd_m2r (*(table+28), mm6); /* mm6 = C3*x5-C1*x7 C7*x5+C3*x7 */
|
|
250 paddd_r2r (mm7, mm1); /* mm1 = b1 b0 */
|
1
|
251
|
9852
|
252 paddd_m2r (*rounder, mm0); /* mm0 += rounder */
|
|
253 psubd_r2r (mm1, mm3); /* mm3 = a1-b1 a0-b0 + rounder */
|
1
|
254
|
9852
|
255 psrad_i2r (ROW_SHIFT, mm3); /* mm3 = y6 y7 */
|
|
256 paddd_r2r (mm4, mm1); /* mm1 = a1+b1 a0+b0 + rounder */
|
1
|
257
|
9852
|
258 paddd_r2r (mm2, mm0); /* mm0 = a3 a2 + rounder */
|
|
259 psrad_i2r (ROW_SHIFT, mm1); /* mm1 = y1 y0 */
|
1
|
260
|
9852
|
261 paddd_r2r (mm6, mm5); /* mm5 = b3 b2 */
|
|
262 movq_r2r (mm0, mm7); /* mm7 = a3 a2 + rounder */
|
1
|
263
|
9852
|
264 paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
|
|
265 psubd_r2r (mm5, mm7); /* mm7 = a3-b3 a2-b2 + rounder */
|
1
|
266 }
|
|
267
|
9852
|
268 static inline void mmx_row_tail (int16_t * const row, const int store)
|
1
|
269 {
|
9852
|
270 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
|
1
|
271
|
9852
|
272 psrad_i2r (ROW_SHIFT, mm7); /* mm7 = y4 y5 */
|
1
|
273
|
9852
|
274 packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
|
1
|
275
|
9852
|
276 packssdw_r2r (mm3, mm7); /* mm7 = y6 y7 y4 y5 */
|
1
|
277
|
9852
|
278 movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
|
|
279 movq_r2r (mm7, mm4); /* mm4 = y6 y7 y4 y5 */
|
1
|
280
|
9852
|
281 pslld_i2r (16, mm7); /* mm7 = y7 0 y5 0 */
|
1
|
282
|
9852
|
283 psrld_i2r (16, mm4); /* mm4 = 0 y6 0 y4 */
|
1
|
284
|
9852
|
285 por_r2r (mm4, mm7); /* mm7 = y7 y6 y5 y4 */
|
1
|
286
|
36
|
287 /* slot */
|
1
|
288
|
9852
|
289 movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */
|
1
|
290 }
|
|
291
|
9852
|
292 static inline void mmx_row_mid (int16_t * const row, const int store,
|
|
293 const int offset, const int16_t * const table)
|
1
|
294 {
|
9852
|
295 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
|
|
296 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
|
1
|
297
|
9852
|
298 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
|
|
299 psrad_i2r (ROW_SHIFT, mm7); /* mm7 = y4 y5 */
|
1
|
300
|
9852
|
301 packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
|
|
302 movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
|
1
|
303
|
9852
|
304 packssdw_r2r (mm3, mm7); /* mm7 = y6 y7 y4 y5 */
|
|
305 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
|
1
|
306
|
9852
|
307 movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
|
|
308 movq_r2r (mm7, mm1); /* mm1 = y6 y7 y4 y5 */
|
1
|
309
|
9852
|
310 punpckldq_r2r (mm0, mm0); /* mm0 = x2 x0 x2 x0 */
|
|
311 psrld_i2r (16, mm7); /* mm7 = 0 y6 0 y4 */
|
1
|
312
|
9852
|
313 movq_m2r (*table, mm3); /* mm3 = C6 C4 C2 C4 */
|
|
314 pslld_i2r (16, mm1); /* mm1 = y7 0 y5 0 */
|
1
|
315
|
9852
|
316 movq_m2r (*(table+4), mm4); /* mm4 = -C2 -C4 C6 C4 */
|
|
317 por_r2r (mm1, mm7); /* mm7 = y7 y6 y5 y4 */
|
1
|
318
|
9852
|
319 movq_m2r (*(table+8), mm1); /* mm1 = -C7 C3 C3 C1 */
|
|
320 punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */
|
1
|
321
|
9852
|
322 movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */
|
|
323 pmaddwd_r2r (mm0, mm3); /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
|
1
|
324 }
|
|
325
|
|
326
|
|
327 #if 0
|
9852
|
328 /* C column IDCT - its just here to document the MMXEXT and MMX versions */
|
1
|
329 static inline void idct_col (int16_t * col, int offset)
|
|
330 {
|
36
|
331 /* multiplication - as implemented on mmx */
|
1
|
332 #define F(c,x) (((c) * (x)) >> 16)
|
|
333
|
36
|
334 /* saturation - it helps us handle torture test cases */
|
1
|
335 #define S(x) (((x)>32767) ? 32767 : ((x)<-32768) ? -32768 : (x))
|
|
336
|
|
337 int16_t x0, x1, x2, x3, x4, x5, x6, x7;
|
|
338 int16_t y0, y1, y2, y3, y4, y5, y6, y7;
|
|
339 int16_t a0, a1, a2, a3, b0, b1, b2, b3;
|
|
340 int16_t u04, v04, u26, v26, u17, v17, u35, v35, u12, v12;
|
|
341
|
|
342 col += offset;
|
|
343
|
|
344 x0 = col[0*8];
|
|
345 x1 = col[1*8];
|
|
346 x2 = col[2*8];
|
|
347 x3 = col[3*8];
|
|
348 x4 = col[4*8];
|
|
349 x5 = col[5*8];
|
|
350 x6 = col[6*8];
|
|
351 x7 = col[7*8];
|
|
352
|
|
353 u04 = S (x0 + x4);
|
|
354 v04 = S (x0 - x4);
|
36
|
355 u26 = S (F (T2, x6) + x2);
|
|
356 v26 = S (F (T2, x2) - x6);
|
1
|
357
|
|
358 a0 = S (u04 + u26);
|
|
359 a1 = S (v04 + v26);
|
|
360 a2 = S (v04 - v26);
|
|
361 a3 = S (u04 - u26);
|
|
362
|
36
|
363 u17 = S (F (T1, x7) + x1);
|
|
364 v17 = S (F (T1, x1) - x7);
|
|
365 u35 = S (F (T3, x5) + x3);
|
|
366 v35 = S (F (T3, x3) - x5);
|
1
|
367
|
|
368 b0 = S (u17 + u35);
|
|
369 b3 = S (v17 - v35);
|
|
370 u12 = S (u17 - u35);
|
|
371 v12 = S (v17 + v35);
|
36
|
372 u12 = S (2 * F (C4, u12));
|
|
373 v12 = S (2 * F (C4, v12));
|
1
|
374 b1 = S (u12 + v12);
|
|
375 b2 = S (u12 - v12);
|
|
376
|
|
377 y0 = S (a0 + b0) >> COL_SHIFT;
|
|
378 y1 = S (a1 + b1) >> COL_SHIFT;
|
|
379 y2 = S (a2 + b2) >> COL_SHIFT;
|
|
380 y3 = S (a3 + b3) >> COL_SHIFT;
|
|
381
|
|
382 y4 = S (a3 - b3) >> COL_SHIFT;
|
|
383 y5 = S (a2 - b2) >> COL_SHIFT;
|
|
384 y6 = S (a1 - b1) >> COL_SHIFT;
|
|
385 y7 = S (a0 - b0) >> COL_SHIFT;
|
|
386
|
|
387 col[0*8] = y0;
|
|
388 col[1*8] = y1;
|
|
389 col[2*8] = y2;
|
|
390 col[3*8] = y3;
|
|
391 col[4*8] = y4;
|
|
392 col[5*8] = y5;
|
|
393 col[6*8] = y6;
|
|
394 col[7*8] = y7;
|
|
395 }
|
|
396 #endif
|
|
397
|
|
398
|
9852
|
399 /* MMX column IDCT */
|
|
400 static inline void idct_col (int16_t * const col, const int offset)
|
1
|
401 {
|
|
402 #define T1 13036
|
|
403 #define T2 27146
|
|
404 #define T3 43790
|
|
405 #define C4 23170
|
|
406
|
9852
|
407 static const short _T1[] ATTR_ALIGN(8) = {T1,T1,T1,T1};
|
|
408 static const short _T2[] ATTR_ALIGN(8) = {T2,T2,T2,T2};
|
|
409 static const short _T3[] ATTR_ALIGN(8) = {T3,T3,T3,T3};
|
|
410 static const short _C4[] ATTR_ALIGN(8) = {C4,C4,C4,C4};
|
1
|
411
|
|
412 /* column code adapted from peter gubanov */
|
|
413 /* http://www.elecard.com/peter/idct.shtml */
|
|
414
|
9852
|
415 movq_m2r (*_T1, mm0); /* mm0 = T1 */
|
1
|
416
|
9852
|
417 movq_m2r (*(col+offset+1*8), mm1); /* mm1 = x1 */
|
|
418 movq_r2r (mm0, mm2); /* mm2 = T1 */
|
1
|
419
|
9852
|
420 movq_m2r (*(col+offset+7*8), mm4); /* mm4 = x7 */
|
|
421 pmulhw_r2r (mm1, mm0); /* mm0 = T1*x1 */
|
1
|
422
|
9852
|
423 movq_m2r (*_T3, mm5); /* mm5 = T3 */
|
|
424 pmulhw_r2r (mm4, mm2); /* mm2 = T1*x7 */
|
1
|
425
|
9852
|
426 movq_m2r (*(col+offset+5*8), mm6); /* mm6 = x5 */
|
|
427 movq_r2r (mm5, mm7); /* mm7 = T3-1 */
|
1
|
428
|
9852
|
429 movq_m2r (*(col+offset+3*8), mm3); /* mm3 = x3 */
|
|
430 psubsw_r2r (mm4, mm0); /* mm0 = v17 */
|
1
|
431
|
9852
|
432 movq_m2r (*_T2, mm4); /* mm4 = T2 */
|
|
433 pmulhw_r2r (mm3, mm5); /* mm5 = (T3-1)*x3 */
|
1
|
434
|
9852
|
435 paddsw_r2r (mm2, mm1); /* mm1 = u17 */
|
|
436 pmulhw_r2r (mm6, mm7); /* mm7 = (T3-1)*x5 */
|
1
|
437
|
36
|
438 /* slot */
|
1
|
439
|
9852
|
440 movq_r2r (mm4, mm2); /* mm2 = T2 */
|
|
441 paddsw_r2r (mm3, mm5); /* mm5 = T3*x3 */
|
1
|
442
|
9852
|
443 pmulhw_m2r (*(col+offset+2*8), mm4);/* mm4 = T2*x2 */
|
|
444 paddsw_r2r (mm6, mm7); /* mm7 = T3*x5 */
|
1
|
445
|
9852
|
446 psubsw_r2r (mm6, mm5); /* mm5 = v35 */
|
|
447 paddsw_r2r (mm3, mm7); /* mm7 = u35 */
|
1
|
448
|
9852
|
449 movq_m2r (*(col+offset+6*8), mm3); /* mm3 = x6 */
|
|
450 movq_r2r (mm0, mm6); /* mm6 = v17 */
|
1
|
451
|
9852
|
452 pmulhw_r2r (mm3, mm2); /* mm2 = T2*x6 */
|
|
453 psubsw_r2r (mm5, mm0); /* mm0 = b3 */
|
1
|
454
|
9852
|
455 psubsw_r2r (mm3, mm4); /* mm4 = v26 */
|
|
456 paddsw_r2r (mm6, mm5); /* mm5 = v12 */
|
1
|
457
|
9852
|
458 movq_r2m (mm0, *(col+offset+3*8)); /* save b3 in scratch0 */
|
|
459 movq_r2r (mm1, mm6); /* mm6 = u17 */
|
1
|
460
|
9852
|
461 paddsw_m2r (*(col+offset+2*8), mm2);/* mm2 = u26 */
|
|
462 paddsw_r2r (mm7, mm6); /* mm6 = b0 */
|
1
|
463
|
9852
|
464 psubsw_r2r (mm7, mm1); /* mm1 = u12 */
|
|
465 movq_r2r (mm1, mm7); /* mm7 = u12 */
|
1
|
466
|
9852
|
467 movq_m2r (*(col+offset+0*8), mm3); /* mm3 = x0 */
|
|
468 paddsw_r2r (mm5, mm1); /* mm1 = u12+v12 */
|
1
|
469
|
9852
|
470 movq_m2r (*_C4, mm0); /* mm0 = C4/2 */
|
|
471 psubsw_r2r (mm5, mm7); /* mm7 = u12-v12 */
|
1
|
472
|
9852
|
473 movq_r2m (mm6, *(col+offset+5*8)); /* save b0 in scratch1 */
|
|
474 pmulhw_r2r (mm0, mm1); /* mm1 = b1/2 */
|
1
|
475
|
9852
|
476 movq_r2r (mm4, mm6); /* mm6 = v26 */
|
|
477 pmulhw_r2r (mm0, mm7); /* mm7 = b2/2 */
|
1
|
478
|
9852
|
479 movq_m2r (*(col+offset+4*8), mm5); /* mm5 = x4 */
|
|
480 movq_r2r (mm3, mm0); /* mm0 = x0 */
|
1
|
481
|
9852
|
482 psubsw_r2r (mm5, mm3); /* mm3 = v04 */
|
|
483 paddsw_r2r (mm5, mm0); /* mm0 = u04 */
|
1
|
484
|
9852
|
485 paddsw_r2r (mm3, mm4); /* mm4 = a1 */
|
|
486 movq_r2r (mm0, mm5); /* mm5 = u04 */
|
1
|
487
|
9852
|
488 psubsw_r2r (mm6, mm3); /* mm3 = a2 */
|
|
489 paddsw_r2r (mm2, mm5); /* mm5 = a0 */
|
1
|
490
|
9852
|
491 paddsw_r2r (mm1, mm1); /* mm1 = b1 */
|
|
492 psubsw_r2r (mm2, mm0); /* mm0 = a3 */
|
1
|
493
|
9852
|
494 paddsw_r2r (mm7, mm7); /* mm7 = b2 */
|
|
495 movq_r2r (mm3, mm2); /* mm2 = a2 */
|
1
|
496
|
9852
|
497 movq_r2r (mm4, mm6); /* mm6 = a1 */
|
|
498 paddsw_r2r (mm7, mm3); /* mm3 = a2+b2 */
|
1
|
499
|
9852
|
500 psraw_i2r (COL_SHIFT, mm3); /* mm3 = y2 */
|
|
501 paddsw_r2r (mm1, mm4); /* mm4 = a1+b1 */
|
1
|
502
|
9852
|
503 psraw_i2r (COL_SHIFT, mm4); /* mm4 = y1 */
|
|
504 psubsw_r2r (mm1, mm6); /* mm6 = a1-b1 */
|
1
|
505
|
9852
|
506 movq_m2r (*(col+offset+5*8), mm1); /* mm1 = b0 */
|
|
507 psubsw_r2r (mm7, mm2); /* mm2 = a2-b2 */
|
1
|
508
|
9852
|
509 psraw_i2r (COL_SHIFT, mm6); /* mm6 = y6 */
|
|
510 movq_r2r (mm5, mm7); /* mm7 = a0 */
|
1
|
511
|
9852
|
512 movq_r2m (mm4, *(col+offset+1*8)); /* save y1 */
|
|
513 psraw_i2r (COL_SHIFT, mm2); /* mm2 = y5 */
|
1
|
514
|
9852
|
515 movq_r2m (mm3, *(col+offset+2*8)); /* save y2 */
|
|
516 paddsw_r2r (mm1, mm5); /* mm5 = a0+b0 */
|
1
|
517
|
9852
|
518 movq_m2r (*(col+offset+3*8), mm4); /* mm4 = b3 */
|
|
519 psubsw_r2r (mm1, mm7); /* mm7 = a0-b0 */
|
1
|
520
|
9852
|
521 psraw_i2r (COL_SHIFT, mm5); /* mm5 = y0 */
|
|
522 movq_r2r (mm0, mm3); /* mm3 = a3 */
|
1
|
523
|
9852
|
524 movq_r2m (mm2, *(col+offset+5*8)); /* save y5 */
|
|
525 psubsw_r2r (mm4, mm3); /* mm3 = a3-b3 */
|
1
|
526
|
9852
|
527 psraw_i2r (COL_SHIFT, mm7); /* mm7 = y7 */
|
|
528 paddsw_r2r (mm0, mm4); /* mm4 = a3+b3 */
|
1
|
529
|
9852
|
530 movq_r2m (mm5, *(col+offset+0*8)); /* save y0 */
|
|
531 psraw_i2r (COL_SHIFT, mm3); /* mm3 = y4 */
|
1
|
532
|
9852
|
533 movq_r2m (mm6, *(col+offset+6*8)); /* save y6 */
|
|
534 psraw_i2r (COL_SHIFT, mm4); /* mm4 = y3 */
|
1
|
535
|
9852
|
536 movq_r2m (mm7, *(col+offset+7*8)); /* save y7 */
|
1
|
537
|
9852
|
538 movq_r2m (mm3, *(col+offset+4*8)); /* save y4 */
|
1
|
539
|
9852
|
540 movq_r2m (mm4, *(col+offset+3*8)); /* save y3 */
|
1
|
541 }
|
|
542
|
|
543
|
9852
|
544 static const int32_t rounder0[] ATTR_ALIGN(8) =
|
1
|
545 rounder ((1 << (COL_SHIFT - 1)) - 0.5);
|
9852
|
546 static const int32_t rounder4[] ATTR_ALIGN(8) = rounder (0);
|
|
547 static const int32_t rounder1[] ATTR_ALIGN(8) =
|
36
|
548 rounder (1.25683487303); /* C1*(C1/C4+C1+C7)/2 */
|
9852
|
549 static const int32_t rounder7[] ATTR_ALIGN(8) =
|
36
|
550 rounder (-0.25); /* C1*(C7/C4+C7-C1)/2 */
|
9852
|
551 static const int32_t rounder2[] ATTR_ALIGN(8) =
|
36
|
552 rounder (0.60355339059); /* C2 * (C6+C2)/2 */
|
9852
|
553 static const int32_t rounder6[] ATTR_ALIGN(8) =
|
36
|
554 rounder (-0.25); /* C2 * (C6-C2)/2 */
|
9852
|
555 static const int32_t rounder3[] ATTR_ALIGN(8) =
|
36
|
556 rounder (0.087788325588); /* C3*(-C3/C4+C3+C5)/2 */
|
9852
|
557 static const int32_t rounder5[] ATTR_ALIGN(8) =
|
36
|
558 rounder (-0.441341716183); /* C3*(-C5/C4+C5-C3)/2 */
|
1
|
559
|
|
560
|
|
561 #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \
|
9852
|
562 static inline void idct (int16_t * const block) \
|
1
|
563 { \
|
9852
|
564 static const int16_t table04[] ATTR_ALIGN(16) = \
|
1
|
565 table (22725, 21407, 19266, 16384, 12873, 8867, 4520); \
|
9852
|
566 static const int16_t table17[] ATTR_ALIGN(16) = \
|
1
|
567 table (31521, 29692, 26722, 22725, 17855, 12299, 6270); \
|
9852
|
568 static const int16_t table26[] ATTR_ALIGN(16) = \
|
1
|
569 table (29692, 27969, 25172, 21407, 16819, 11585, 5906); \
|
9852
|
570 static const int16_t table35[] ATTR_ALIGN(16) = \
|
1
|
571 table (26722, 25172, 22654, 19266, 15137, 10426, 5315); \
|
|
572 \
|
|
573 idct_row_head (block, 0*8, table04); \
|
|
574 idct_row (table04, rounder0); \
|
|
575 idct_row_mid (block, 0*8, 4*8, table04); \
|
|
576 idct_row (table04, rounder4); \
|
|
577 idct_row_mid (block, 4*8, 1*8, table17); \
|
|
578 idct_row (table17, rounder1); \
|
|
579 idct_row_mid (block, 1*8, 7*8, table17); \
|
|
580 idct_row (table17, rounder7); \
|
|
581 idct_row_mid (block, 7*8, 2*8, table26); \
|
|
582 idct_row (table26, rounder2); \
|
|
583 idct_row_mid (block, 2*8, 6*8, table26); \
|
|
584 idct_row (table26, rounder6); \
|
|
585 idct_row_mid (block, 6*8, 3*8, table35); \
|
|
586 idct_row (table35, rounder3); \
|
|
587 idct_row_mid (block, 3*8, 5*8, table35); \
|
|
588 idct_row (table35, rounder5); \
|
|
589 idct_row_tail (block, 5*8); \
|
|
590 \
|
|
591 idct_col (block, 0); \
|
|
592 idct_col (block, 4); \
|
|
593 }
|
|
594
|
|
595
|
|
596 #define COPY_MMX(offset,r0,r1,r2) \
|
|
597 do { \
|
|
598 movq_m2r (*(block+offset), r0); \
|
|
599 dest += stride; \
|
|
600 movq_m2r (*(block+offset+4), r1); \
|
|
601 movq_r2m (r2, *dest); \
|
|
602 packuswb_r2r (r1, r0); \
|
|
603 } while (0)
|
|
604
|
9852
|
605 static inline void block_copy (int16_t * const block, uint8_t * dest,
|
|
606 const int stride)
|
1
|
607 {
|
|
608 movq_m2r (*(block+0*8), mm0);
|
|
609 movq_m2r (*(block+0*8+4), mm1);
|
|
610 movq_m2r (*(block+1*8), mm2);
|
|
611 packuswb_r2r (mm1, mm0);
|
|
612 movq_m2r (*(block+1*8+4), mm3);
|
|
613 movq_r2m (mm0, *dest);
|
|
614 packuswb_r2r (mm3, mm2);
|
|
615 COPY_MMX (2*8, mm0, mm1, mm2);
|
|
616 COPY_MMX (3*8, mm2, mm3, mm0);
|
|
617 COPY_MMX (4*8, mm0, mm1, mm2);
|
|
618 COPY_MMX (5*8, mm2, mm3, mm0);
|
|
619 COPY_MMX (6*8, mm0, mm1, mm2);
|
|
620 COPY_MMX (7*8, mm2, mm3, mm0);
|
|
621 movq_r2m (mm2, *(dest+stride));
|
|
622 }
|
|
623
|
|
624
|
|
625 #define ADD_MMX(offset,r1,r2,r3,r4) \
|
|
626 do { \
|
|
627 movq_m2r (*(dest+2*stride), r1); \
|
|
628 packuswb_r2r (r4, r3); \
|
|
629 movq_r2r (r1, r2); \
|
|
630 dest += stride; \
|
|
631 movq_r2m (r3, *dest); \
|
|
632 punpcklbw_r2r (mm0, r1); \
|
|
633 paddsw_m2r (*(block+offset), r1); \
|
|
634 punpckhbw_r2r (mm0, r2); \
|
|
635 paddsw_m2r (*(block+offset+4), r2); \
|
|
636 } while (0)
|
|
637
|
9852
|
638 static inline void block_add (int16_t * const block, uint8_t * dest,
|
|
639 const int stride)
|
1
|
640 {
|
|
641 movq_m2r (*dest, mm1);
|
|
642 pxor_r2r (mm0, mm0);
|
|
643 movq_m2r (*(dest+stride), mm3);
|
|
644 movq_r2r (mm1, mm2);
|
|
645 punpcklbw_r2r (mm0, mm1);
|
|
646 movq_r2r (mm3, mm4);
|
|
647 paddsw_m2r (*(block+0*8), mm1);
|
|
648 punpckhbw_r2r (mm0, mm2);
|
|
649 paddsw_m2r (*(block+0*8+4), mm2);
|
|
650 punpcklbw_r2r (mm0, mm3);
|
|
651 paddsw_m2r (*(block+1*8), mm3);
|
|
652 packuswb_r2r (mm2, mm1);
|
|
653 punpckhbw_r2r (mm0, mm4);
|
|
654 movq_r2m (mm1, *dest);
|
|
655 paddsw_m2r (*(block+1*8+4), mm4);
|
|
656 ADD_MMX (2*8, mm1, mm2, mm3, mm4);
|
|
657 ADD_MMX (3*8, mm3, mm4, mm1, mm2);
|
|
658 ADD_MMX (4*8, mm1, mm2, mm3, mm4);
|
|
659 ADD_MMX (5*8, mm3, mm4, mm1, mm2);
|
|
660 ADD_MMX (6*8, mm1, mm2, mm3, mm4);
|
|
661 ADD_MMX (7*8, mm3, mm4, mm1, mm2);
|
|
662 packuswb_r2r (mm4, mm3);
|
|
663 movq_r2m (mm3, *(dest+stride));
|
|
664 }
|
|
665
|
|
666
|
9852
|
667 static inline void block_zero (int16_t * const block)
|
|
668 {
|
|
669 pxor_r2r (mm0, mm0);
|
|
670 movq_r2m (mm0, *(block+0*4));
|
|
671 movq_r2m (mm0, *(block+1*4));
|
|
672 movq_r2m (mm0, *(block+2*4));
|
|
673 movq_r2m (mm0, *(block+3*4));
|
|
674 movq_r2m (mm0, *(block+4*4));
|
|
675 movq_r2m (mm0, *(block+5*4));
|
|
676 movq_r2m (mm0, *(block+6*4));
|
|
677 movq_r2m (mm0, *(block+7*4));
|
|
678 movq_r2m (mm0, *(block+8*4));
|
|
679 movq_r2m (mm0, *(block+9*4));
|
|
680 movq_r2m (mm0, *(block+10*4));
|
|
681 movq_r2m (mm0, *(block+11*4));
|
|
682 movq_r2m (mm0, *(block+12*4));
|
|
683 movq_r2m (mm0, *(block+13*4));
|
|
684 movq_r2m (mm0, *(block+14*4));
|
|
685 movq_r2m (mm0, *(block+15*4));
|
|
686 }
|
|
687
|
|
688
|
|
689 #define CPU_MMXEXT 0
|
|
690 #define CPU_MMX 1
|
|
691
|
|
692 #define dup4(reg) \
|
|
693 do { \
|
|
694 if (cpu != CPU_MMXEXT) { \
|
|
695 punpcklwd_r2r (reg, reg); \
|
|
696 punpckldq_r2r (reg, reg); \
|
|
697 } else \
|
|
698 pshufw_r2r (reg, reg, 0x00); \
|
|
699 } while (0)
|
|
700
|
|
701 static inline void block_add_DC (int16_t * const block, uint8_t * dest,
|
|
702 const int stride, const int cpu)
|
|
703 {
|
12932
|
704 movd_v2r ((block[0] + 64) >> 7, mm0);
|
9852
|
705 pxor_r2r (mm1, mm1);
|
|
706 movq_m2r (*dest, mm2);
|
|
707 dup4 (mm0);
|
|
708 psubsw_r2r (mm0, mm1);
|
|
709 packuswb_r2r (mm0, mm0);
|
|
710 paddusb_r2r (mm0, mm2);
|
|
711 packuswb_r2r (mm1, mm1);
|
|
712 movq_m2r (*(dest + stride), mm3);
|
|
713 psubusb_r2r (mm1, mm2);
|
|
714 block[0] = 0;
|
|
715 paddusb_r2r (mm0, mm3);
|
|
716 movq_r2m (mm2, *dest);
|
|
717 psubusb_r2r (mm1, mm3);
|
|
718 movq_m2r (*(dest + 2*stride), mm2);
|
|
719 dest += stride;
|
|
720 movq_r2m (mm3, *dest);
|
|
721 paddusb_r2r (mm0, mm2);
|
|
722 movq_m2r (*(dest + 2*stride), mm3);
|
|
723 psubusb_r2r (mm1, mm2);
|
|
724 dest += stride;
|
|
725 paddusb_r2r (mm0, mm3);
|
|
726 movq_r2m (mm2, *dest);
|
|
727 psubusb_r2r (mm1, mm3);
|
|
728 movq_m2r (*(dest + 2*stride), mm2);
|
|
729 dest += stride;
|
|
730 movq_r2m (mm3, *dest);
|
|
731 paddusb_r2r (mm0, mm2);
|
|
732 movq_m2r (*(dest + 2*stride), mm3);
|
|
733 psubusb_r2r (mm1, mm2);
|
|
734 dest += stride;
|
|
735 paddusb_r2r (mm0, mm3);
|
|
736 movq_r2m (mm2, *dest);
|
|
737 psubusb_r2r (mm1, mm3);
|
|
738 movq_m2r (*(dest + 2*stride), mm2);
|
|
739 dest += stride;
|
|
740 movq_r2m (mm3, *dest);
|
|
741 paddusb_r2r (mm0, mm2);
|
|
742 movq_m2r (*(dest + 2*stride), mm3);
|
|
743 psubusb_r2r (mm1, mm2);
|
|
744 block[63] = 0;
|
|
745 paddusb_r2r (mm0, mm3);
|
|
746 movq_r2m (mm2, *(dest + stride));
|
|
747 psubusb_r2r (mm1, mm3);
|
|
748 movq_r2m (mm3, *(dest + 2*stride));
|
|
749 }
|
|
750
|
|
751
|
1
|
752 declare_idct (mmxext_idct, mmxext_table,
|
|
753 mmxext_row_head, mmxext_row, mmxext_row_tail, mmxext_row_mid)
|
|
754
|
9852
|
755 void mpeg2_idct_copy_mmxext (int16_t * const block, uint8_t * const dest,
|
|
756 const int stride)
|
1
|
757 {
|
|
758 mmxext_idct (block);
|
|
759 block_copy (block, dest, stride);
|
9852
|
760 block_zero (block);
|
1
|
761 }
|
|
762
|
9852
|
763 void mpeg2_idct_add_mmxext (const int last, int16_t * const block,
|
|
764 uint8_t * const dest, const int stride)
|
1
|
765 {
|
12932
|
766 if (last != 129 || (block[0] & (7 << 4)) == (4 << 4)) {
|
9852
|
767 mmxext_idct (block);
|
|
768 block_add (block, dest, stride);
|
|
769 block_zero (block);
|
|
770 } else
|
|
771 block_add_DC (block, dest, stride, CPU_MMXEXT);
|
1
|
772 }
|
|
773
|
|
774
|
|
775 declare_idct (mmx_idct, mmx_table,
|
|
776 mmx_row_head, mmx_row, mmx_row_tail, mmx_row_mid)
|
|
777
|
9852
|
778 void mpeg2_idct_copy_mmx (int16_t * const block, uint8_t * const dest,
|
|
779 const int stride)
|
1
|
780 {
|
|
781 mmx_idct (block);
|
|
782 block_copy (block, dest, stride);
|
9852
|
783 block_zero (block);
|
1
|
784 }
|
|
785
|
9852
|
786 void mpeg2_idct_add_mmx (const int last, int16_t * const block,
|
|
787 uint8_t * const dest, const int stride)
|
1
|
788 {
|
12932
|
789 if (last != 129 || (block[0] & (7 << 4)) == (4 << 4)) {
|
9852
|
790 mmx_idct (block);
|
|
791 block_add (block, dest, stride);
|
|
792 block_zero (block);
|
|
793 } else
|
|
794 block_add_DC (block, dest, stride, CPU_MMX);
|
1
|
795 }
|
|
796
|
|
797
|
9852
|
798 void mpeg2_idct_mmx_init (void)
|
1
|
799 {
|
9852
|
800 extern uint8_t mpeg2_scan_norm[64];
|
|
801 extern uint8_t mpeg2_scan_alt[64];
|
1
|
802 int i, j;
|
|
803
|
36
|
804 /* the mmx/mmxext idct uses a reordered input, so we patch scan tables */
|
1
|
805
|
|
806 for (i = 0; i < 64; i++) {
|
9852
|
807 j = mpeg2_scan_norm[i];
|
|
808 mpeg2_scan_norm[i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2);
|
|
809 j = mpeg2_scan_alt[i];
|
|
810 mpeg2_scan_alt[i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2);
|
1
|
811 }
|
|
812 }
|
|
813
|
|
814 #endif
|