|
1 /* |
|
2 * jsimd_x86_64.c |
|
3 * |
|
4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
|
5 * Copyright 2009-2011 D. R. Commander |
|
6 * |
|
7 * Based on the x86 SIMD extension for IJG JPEG library, |
|
8 * Copyright (C) 1999-2006, MIYASAKA Masaru. |
|
9 * For conditions of distribution and use, see copyright notice in jsimdext.inc |
|
10 * |
|
11 * This file contains the interface between the "normal" portions |
|
12 * of the library and the SIMD implementations when running on a |
|
13 * x86_64 architecture. |
|
14 */ |
|
15 |
|
16 #define JPEG_INTERNALS |
|
17 #include "../jinclude.h" |
|
18 #include "../jpeglib.h" |
|
19 #include "../jsimd.h" |
|
20 #include "../jdct.h" |
|
21 #include "../jsimddct.h" |
|
22 #include "jsimd.h" |
|
23 |
|
24 /* |
|
25 * In the PIC cases, we have no guarantee that constants will keep |
|
26 * their alignment. This macro allows us to verify it at runtime. |
|
27 */ |
|
28 #define IS_ALIGNED(ptr, order) (((size_t)ptr & ((1 << order) - 1)) == 0) |
|
29 |
|
30 #define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ |
|
31 |
|
32 GLOBAL(int) |
|
33 jsimd_can_rgb_ycc (void) |
|
34 { |
|
35 /* The code is optimised for these values only */ |
|
36 if (BITS_IN_JSAMPLE != 8) |
|
37 return 0; |
|
38 if (sizeof(JDIMENSION) != 4) |
|
39 return 0; |
|
40 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
|
41 return 0; |
|
42 |
|
43 if (!IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) |
|
44 return 0; |
|
45 |
|
46 return 1; |
|
47 } |
|
48 |
|
49 GLOBAL(int) |
|
50 jsimd_can_rgb_gray (void) |
|
51 { |
|
52 /* The code is optimised for these values only */ |
|
53 if (BITS_IN_JSAMPLE != 8) |
|
54 return 0; |
|
55 if (sizeof(JDIMENSION) != 4) |
|
56 return 0; |
|
57 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
|
58 return 0; |
|
59 |
|
60 if (!IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2)) |
|
61 return 0; |
|
62 |
|
63 return 1; |
|
64 } |
|
65 |
|
66 GLOBAL(int) |
|
67 jsimd_can_ycc_rgb (void) |
|
68 { |
|
69 /* The code is optimised for these values only */ |
|
70 if (BITS_IN_JSAMPLE != 8) |
|
71 return 0; |
|
72 if (sizeof(JDIMENSION) != 4) |
|
73 return 0; |
|
74 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
|
75 return 0; |
|
76 |
|
77 if (!IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) |
|
78 return 0; |
|
79 |
|
80 return 1; |
|
81 } |
|
82 |
|
83 GLOBAL(void) |
|
84 jsimd_rgb_ycc_convert (j_compress_ptr cinfo, |
|
85 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
|
86 JDIMENSION output_row, int num_rows) |
|
87 { |
|
88 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); |
|
89 |
|
90 switch(cinfo->in_color_space) |
|
91 { |
|
92 case JCS_EXT_RGB: |
|
93 sse2fct=jsimd_extrgb_ycc_convert_sse2; |
|
94 break; |
|
95 case JCS_EXT_RGBX: |
|
96 case JCS_EXT_RGBA: |
|
97 sse2fct=jsimd_extrgbx_ycc_convert_sse2; |
|
98 break; |
|
99 case JCS_EXT_BGR: |
|
100 sse2fct=jsimd_extbgr_ycc_convert_sse2; |
|
101 break; |
|
102 case JCS_EXT_BGRX: |
|
103 case JCS_EXT_BGRA: |
|
104 sse2fct=jsimd_extbgrx_ycc_convert_sse2; |
|
105 break; |
|
106 case JCS_EXT_XBGR: |
|
107 case JCS_EXT_ABGR: |
|
108 sse2fct=jsimd_extxbgr_ycc_convert_sse2; |
|
109 break; |
|
110 case JCS_EXT_XRGB: |
|
111 case JCS_EXT_ARGB: |
|
112 sse2fct=jsimd_extxrgb_ycc_convert_sse2; |
|
113 break; |
|
114 default: |
|
115 sse2fct=jsimd_rgb_ycc_convert_sse2; |
|
116 break; |
|
117 } |
|
118 |
|
119 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); |
|
120 } |
|
121 |
|
122 GLOBAL(void) |
|
123 jsimd_rgb_gray_convert (j_compress_ptr cinfo, |
|
124 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
|
125 JDIMENSION output_row, int num_rows) |
|
126 { |
|
127 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); |
|
128 |
|
129 switch(cinfo->in_color_space) |
|
130 { |
|
131 case JCS_EXT_RGB: |
|
132 sse2fct=jsimd_extrgb_gray_convert_sse2; |
|
133 break; |
|
134 case JCS_EXT_RGBX: |
|
135 case JCS_EXT_RGBA: |
|
136 sse2fct=jsimd_extrgbx_gray_convert_sse2; |
|
137 break; |
|
138 case JCS_EXT_BGR: |
|
139 sse2fct=jsimd_extbgr_gray_convert_sse2; |
|
140 break; |
|
141 case JCS_EXT_BGRX: |
|
142 case JCS_EXT_BGRA: |
|
143 sse2fct=jsimd_extbgrx_gray_convert_sse2; |
|
144 break; |
|
145 case JCS_EXT_XBGR: |
|
146 case JCS_EXT_ABGR: |
|
147 sse2fct=jsimd_extxbgr_gray_convert_sse2; |
|
148 break; |
|
149 case JCS_EXT_XRGB: |
|
150 case JCS_EXT_ARGB: |
|
151 sse2fct=jsimd_extxrgb_gray_convert_sse2; |
|
152 break; |
|
153 default: |
|
154 sse2fct=jsimd_rgb_gray_convert_sse2; |
|
155 break; |
|
156 } |
|
157 |
|
158 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); |
|
159 } |
|
160 |
|
161 GLOBAL(void) |
|
162 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, |
|
163 JSAMPIMAGE input_buf, JDIMENSION input_row, |
|
164 JSAMPARRAY output_buf, int num_rows) |
|
165 { |
|
166 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); |
|
167 |
|
168 switch(cinfo->out_color_space) |
|
169 { |
|
170 case JCS_EXT_RGB: |
|
171 sse2fct=jsimd_ycc_extrgb_convert_sse2; |
|
172 break; |
|
173 case JCS_EXT_RGBX: |
|
174 case JCS_EXT_RGBA: |
|
175 sse2fct=jsimd_ycc_extrgbx_convert_sse2; |
|
176 break; |
|
177 case JCS_EXT_BGR: |
|
178 sse2fct=jsimd_ycc_extbgr_convert_sse2; |
|
179 break; |
|
180 case JCS_EXT_BGRX: |
|
181 case JCS_EXT_BGRA: |
|
182 sse2fct=jsimd_ycc_extbgrx_convert_sse2; |
|
183 break; |
|
184 case JCS_EXT_XBGR: |
|
185 case JCS_EXT_ABGR: |
|
186 sse2fct=jsimd_ycc_extxbgr_convert_sse2; |
|
187 break; |
|
188 case JCS_EXT_XRGB: |
|
189 case JCS_EXT_ARGB: |
|
190 sse2fct=jsimd_ycc_extxrgb_convert_sse2; |
|
191 break; |
|
192 default: |
|
193 sse2fct=jsimd_ycc_rgb_convert_sse2; |
|
194 break; |
|
195 } |
|
196 |
|
197 sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); |
|
198 } |
|
199 |
|
200 GLOBAL(int) |
|
201 jsimd_can_h2v2_downsample (void) |
|
202 { |
|
203 /* The code is optimised for these values only */ |
|
204 if (BITS_IN_JSAMPLE != 8) |
|
205 return 0; |
|
206 if (sizeof(JDIMENSION) != 4) |
|
207 return 0; |
|
208 |
|
209 return 1; |
|
210 } |
|
211 |
|
212 GLOBAL(int) |
|
213 jsimd_can_h2v1_downsample (void) |
|
214 { |
|
215 /* The code is optimised for these values only */ |
|
216 if (BITS_IN_JSAMPLE != 8) |
|
217 return 0; |
|
218 if (sizeof(JDIMENSION) != 4) |
|
219 return 0; |
|
220 |
|
221 return 1; |
|
222 } |
|
223 |
|
224 GLOBAL(void) |
|
225 jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
|
226 JSAMPARRAY input_data, JSAMPARRAY output_data) |
|
227 { |
|
228 jsimd_h2v2_downsample_sse2(cinfo->image_width, |
|
229 cinfo->max_v_samp_factor, |
|
230 compptr->v_samp_factor, |
|
231 compptr->width_in_blocks, |
|
232 input_data, output_data); |
|
233 } |
|
234 |
|
235 GLOBAL(void) |
|
236 jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
|
237 JSAMPARRAY input_data, JSAMPARRAY output_data) |
|
238 { |
|
239 jsimd_h2v1_downsample_sse2(cinfo->image_width, |
|
240 cinfo->max_v_samp_factor, |
|
241 compptr->v_samp_factor, |
|
242 compptr->width_in_blocks, |
|
243 input_data, output_data); |
|
244 } |
|
245 |
|
246 GLOBAL(int) |
|
247 jsimd_can_h2v2_upsample (void) |
|
248 { |
|
249 /* The code is optimised for these values only */ |
|
250 if (BITS_IN_JSAMPLE != 8) |
|
251 return 0; |
|
252 if (sizeof(JDIMENSION) != 4) |
|
253 return 0; |
|
254 |
|
255 return 1; |
|
256 } |
|
257 |
|
258 GLOBAL(int) |
|
259 jsimd_can_h2v1_upsample (void) |
|
260 { |
|
261 /* The code is optimised for these values only */ |
|
262 if (BITS_IN_JSAMPLE != 8) |
|
263 return 0; |
|
264 if (sizeof(JDIMENSION) != 4) |
|
265 return 0; |
|
266 |
|
267 return 1; |
|
268 } |
|
269 |
|
270 GLOBAL(void) |
|
271 jsimd_h2v2_upsample (j_decompress_ptr cinfo, |
|
272 jpeg_component_info * compptr, |
|
273 JSAMPARRAY input_data, |
|
274 JSAMPARRAY * output_data_ptr) |
|
275 { |
|
276 jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, |
|
277 cinfo->output_width, |
|
278 input_data, output_data_ptr); |
|
279 } |
|
280 |
|
281 GLOBAL(void) |
|
282 jsimd_h2v1_upsample (j_decompress_ptr cinfo, |
|
283 jpeg_component_info * compptr, |
|
284 JSAMPARRAY input_data, |
|
285 JSAMPARRAY * output_data_ptr) |
|
286 { |
|
287 jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, |
|
288 cinfo->output_width, |
|
289 input_data, output_data_ptr); |
|
290 } |
|
291 |
|
292 GLOBAL(int) |
|
293 jsimd_can_h2v2_fancy_upsample (void) |
|
294 { |
|
295 /* The code is optimised for these values only */ |
|
296 if (BITS_IN_JSAMPLE != 8) |
|
297 return 0; |
|
298 if (sizeof(JDIMENSION) != 4) |
|
299 return 0; |
|
300 |
|
301 if (!IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) |
|
302 return 0; |
|
303 |
|
304 return 1; |
|
305 } |
|
306 |
|
307 GLOBAL(int) |
|
308 jsimd_can_h2v1_fancy_upsample (void) |
|
309 { |
|
310 /* The code is optimised for these values only */ |
|
311 if (BITS_IN_JSAMPLE != 8) |
|
312 return 0; |
|
313 if (sizeof(JDIMENSION) != 4) |
|
314 return 0; |
|
315 |
|
316 if (!IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) |
|
317 return 0; |
|
318 |
|
319 return 1; |
|
320 } |
|
321 |
|
322 GLOBAL(void) |
|
323 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, |
|
324 jpeg_component_info * compptr, |
|
325 JSAMPARRAY input_data, |
|
326 JSAMPARRAY * output_data_ptr) |
|
327 { |
|
328 jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor, |
|
329 compptr->downsampled_width, |
|
330 input_data, output_data_ptr); |
|
331 } |
|
332 |
|
333 GLOBAL(void) |
|
334 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, |
|
335 jpeg_component_info * compptr, |
|
336 JSAMPARRAY input_data, |
|
337 JSAMPARRAY * output_data_ptr) |
|
338 { |
|
339 jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, |
|
340 compptr->downsampled_width, |
|
341 input_data, output_data_ptr); |
|
342 } |
|
343 |
|
344 GLOBAL(int) |
|
345 jsimd_can_h2v2_merged_upsample (void) |
|
346 { |
|
347 /* The code is optimised for these values only */ |
|
348 if (BITS_IN_JSAMPLE != 8) |
|
349 return 0; |
|
350 if (sizeof(JDIMENSION) != 4) |
|
351 return 0; |
|
352 |
|
353 if (!IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) |
|
354 return 0; |
|
355 |
|
356 return 1; |
|
357 } |
|
358 |
|
359 GLOBAL(int) |
|
360 jsimd_can_h2v1_merged_upsample (void) |
|
361 { |
|
362 /* The code is optimised for these values only */ |
|
363 if (BITS_IN_JSAMPLE != 8) |
|
364 return 0; |
|
365 if (sizeof(JDIMENSION) != 4) |
|
366 return 0; |
|
367 |
|
368 if (!IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) |
|
369 return 0; |
|
370 |
|
371 return 1; |
|
372 } |
|
373 |
|
374 GLOBAL(void) |
|
375 jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, |
|
376 JSAMPIMAGE input_buf, |
|
377 JDIMENSION in_row_group_ctr, |
|
378 JSAMPARRAY output_buf) |
|
379 { |
|
380 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); |
|
381 |
|
382 switch(cinfo->out_color_space) |
|
383 { |
|
384 case JCS_EXT_RGB: |
|
385 sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; |
|
386 break; |
|
387 case JCS_EXT_RGBX: |
|
388 case JCS_EXT_RGBA: |
|
389 sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2; |
|
390 break; |
|
391 case JCS_EXT_BGR: |
|
392 sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2; |
|
393 break; |
|
394 case JCS_EXT_BGRX: |
|
395 case JCS_EXT_BGRA: |
|
396 sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2; |
|
397 break; |
|
398 case JCS_EXT_XBGR: |
|
399 case JCS_EXT_ABGR: |
|
400 sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2; |
|
401 break; |
|
402 case JCS_EXT_XRGB: |
|
403 case JCS_EXT_ARGB: |
|
404 sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2; |
|
405 break; |
|
406 default: |
|
407 sse2fct=jsimd_h2v2_merged_upsample_sse2; |
|
408 break; |
|
409 } |
|
410 |
|
411 sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); |
|
412 } |
|
413 |
|
414 GLOBAL(void) |
|
415 jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, |
|
416 JSAMPIMAGE input_buf, |
|
417 JDIMENSION in_row_group_ctr, |
|
418 JSAMPARRAY output_buf) |
|
419 { |
|
420 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); |
|
421 |
|
422 switch(cinfo->out_color_space) |
|
423 { |
|
424 case JCS_EXT_RGB: |
|
425 sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; |
|
426 break; |
|
427 case JCS_EXT_RGBX: |
|
428 case JCS_EXT_RGBA: |
|
429 sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2; |
|
430 break; |
|
431 case JCS_EXT_BGR: |
|
432 sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2; |
|
433 break; |
|
434 case JCS_EXT_BGRX: |
|
435 case JCS_EXT_BGRA: |
|
436 sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2; |
|
437 break; |
|
438 case JCS_EXT_XBGR: |
|
439 case JCS_EXT_ABGR: |
|
440 sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2; |
|
441 break; |
|
442 case JCS_EXT_XRGB: |
|
443 case JCS_EXT_ARGB: |
|
444 sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2; |
|
445 break; |
|
446 default: |
|
447 sse2fct=jsimd_h2v1_merged_upsample_sse2; |
|
448 break; |
|
449 } |
|
450 |
|
451 sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); |
|
452 } |
|
453 |
|
454 GLOBAL(int) |
|
455 jsimd_can_convsamp (void) |
|
456 { |
|
457 /* The code is optimised for these values only */ |
|
458 if (DCTSIZE != 8) |
|
459 return 0; |
|
460 if (BITS_IN_JSAMPLE != 8) |
|
461 return 0; |
|
462 if (sizeof(JDIMENSION) != 4) |
|
463 return 0; |
|
464 if (sizeof(DCTELEM) != 2) |
|
465 return 0; |
|
466 |
|
467 return 1; |
|
468 } |
|
469 |
|
470 GLOBAL(int) |
|
471 jsimd_can_convsamp_float (void) |
|
472 { |
|
473 /* The code is optimised for these values only */ |
|
474 if (DCTSIZE != 8) |
|
475 return 0; |
|
476 if (BITS_IN_JSAMPLE != 8) |
|
477 return 0; |
|
478 if (sizeof(JDIMENSION) != 4) |
|
479 return 0; |
|
480 if (sizeof(FAST_FLOAT) != 4) |
|
481 return 0; |
|
482 |
|
483 return 1; |
|
484 } |
|
485 |
|
486 GLOBAL(void) |
|
487 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, |
|
488 DCTELEM * workspace) |
|
489 { |
|
490 jsimd_convsamp_sse2(sample_data, start_col, workspace); |
|
491 } |
|
492 |
|
493 GLOBAL(void) |
|
494 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, |
|
495 FAST_FLOAT * workspace) |
|
496 { |
|
497 jsimd_convsamp_float_sse2(sample_data, start_col, workspace); |
|
498 } |
|
499 |
|
500 GLOBAL(int) |
|
501 jsimd_can_fdct_islow (void) |
|
502 { |
|
503 /* The code is optimised for these values only */ |
|
504 if (DCTSIZE != 8) |
|
505 return 0; |
|
506 if (sizeof(DCTELEM) != 2) |
|
507 return 0; |
|
508 |
|
509 if (!IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) |
|
510 return 0; |
|
511 |
|
512 return 1; |
|
513 } |
|
514 |
|
515 GLOBAL(int) |
|
516 jsimd_can_fdct_ifast (void) |
|
517 { |
|
518 /* The code is optimised for these values only */ |
|
519 if (DCTSIZE != 8) |
|
520 return 0; |
|
521 if (sizeof(DCTELEM) != 2) |
|
522 return 0; |
|
523 |
|
524 if (!IS_ALIGNED_SSE(jconst_fdct_ifast_sse2)) |
|
525 return 0; |
|
526 |
|
527 return 1; |
|
528 } |
|
529 |
|
530 GLOBAL(int) |
|
531 jsimd_can_fdct_float (void) |
|
532 { |
|
533 /* The code is optimised for these values only */ |
|
534 if (DCTSIZE != 8) |
|
535 return 0; |
|
536 if (sizeof(FAST_FLOAT) != 4) |
|
537 return 0; |
|
538 |
|
539 if (!IS_ALIGNED_SSE(jconst_fdct_float_sse)) |
|
540 return 0; |
|
541 |
|
542 return 1; |
|
543 } |
|
544 |
|
545 GLOBAL(void) |
|
546 jsimd_fdct_islow (DCTELEM * data) |
|
547 { |
|
548 jsimd_fdct_islow_sse2(data); |
|
549 } |
|
550 |
|
551 GLOBAL(void) |
|
552 jsimd_fdct_ifast (DCTELEM * data) |
|
553 { |
|
554 jsimd_fdct_ifast_sse2(data); |
|
555 } |
|
556 |
|
557 GLOBAL(void) |
|
558 jsimd_fdct_float (FAST_FLOAT * data) |
|
559 { |
|
560 jsimd_fdct_float_sse(data); |
|
561 } |
|
562 |
|
563 GLOBAL(int) |
|
564 jsimd_can_quantize (void) |
|
565 { |
|
566 /* The code is optimised for these values only */ |
|
567 if (DCTSIZE != 8) |
|
568 return 0; |
|
569 if (sizeof(JCOEF) != 2) |
|
570 return 0; |
|
571 if (sizeof(DCTELEM) != 2) |
|
572 return 0; |
|
573 |
|
574 return 1; |
|
575 } |
|
576 |
|
577 GLOBAL(int) |
|
578 jsimd_can_quantize_float (void) |
|
579 { |
|
580 /* The code is optimised for these values only */ |
|
581 if (DCTSIZE != 8) |
|
582 return 0; |
|
583 if (sizeof(JCOEF) != 2) |
|
584 return 0; |
|
585 if (sizeof(FAST_FLOAT) != 4) |
|
586 return 0; |
|
587 |
|
588 return 1; |
|
589 } |
|
590 |
|
591 GLOBAL(void) |
|
592 jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, |
|
593 DCTELEM * workspace) |
|
594 { |
|
595 jsimd_quantize_sse2(coef_block, divisors, workspace); |
|
596 } |
|
597 |
|
598 GLOBAL(void) |
|
599 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, |
|
600 FAST_FLOAT * workspace) |
|
601 { |
|
602 jsimd_quantize_float_sse2(coef_block, divisors, workspace); |
|
603 } |
|
604 |
|
605 GLOBAL(int) |
|
606 jsimd_can_idct_2x2 (void) |
|
607 { |
|
608 /* The code is optimised for these values only */ |
|
609 if (DCTSIZE != 8) |
|
610 return 0; |
|
611 if (sizeof(JCOEF) != 2) |
|
612 return 0; |
|
613 if (BITS_IN_JSAMPLE != 8) |
|
614 return 0; |
|
615 if (sizeof(JDIMENSION) != 4) |
|
616 return 0; |
|
617 if (sizeof(ISLOW_MULT_TYPE) != 2) |
|
618 return 0; |
|
619 |
|
620 if (!IS_ALIGNED_SSE(jconst_idct_red_sse2)) |
|
621 return 0; |
|
622 |
|
623 return 1; |
|
624 } |
|
625 |
|
626 GLOBAL(int) |
|
627 jsimd_can_idct_4x4 (void) |
|
628 { |
|
629 /* The code is optimised for these values only */ |
|
630 if (DCTSIZE != 8) |
|
631 return 0; |
|
632 if (sizeof(JCOEF) != 2) |
|
633 return 0; |
|
634 if (BITS_IN_JSAMPLE != 8) |
|
635 return 0; |
|
636 if (sizeof(JDIMENSION) != 4) |
|
637 return 0; |
|
638 if (sizeof(ISLOW_MULT_TYPE) != 2) |
|
639 return 0; |
|
640 |
|
641 if (!IS_ALIGNED_SSE(jconst_idct_red_sse2)) |
|
642 return 0; |
|
643 |
|
644 return 1; |
|
645 } |
|
646 |
|
647 GLOBAL(void) |
|
648 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
|
649 JCOEFPTR coef_block, JSAMPARRAY output_buf, |
|
650 JDIMENSION output_col) |
|
651 { |
|
652 jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); |
|
653 } |
|
654 |
|
655 GLOBAL(void) |
|
656 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
|
657 JCOEFPTR coef_block, JSAMPARRAY output_buf, |
|
658 JDIMENSION output_col) |
|
659 { |
|
660 jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); |
|
661 } |
|
662 |
|
663 GLOBAL(int) |
|
664 jsimd_can_idct_islow (void) |
|
665 { |
|
666 /* The code is optimised for these values only */ |
|
667 if (DCTSIZE != 8) |
|
668 return 0; |
|
669 if (sizeof(JCOEF) != 2) |
|
670 return 0; |
|
671 if (BITS_IN_JSAMPLE != 8) |
|
672 return 0; |
|
673 if (sizeof(JDIMENSION) != 4) |
|
674 return 0; |
|
675 if (sizeof(ISLOW_MULT_TYPE) != 2) |
|
676 return 0; |
|
677 |
|
678 if (!IS_ALIGNED_SSE(jconst_idct_islow_sse2)) |
|
679 return 0; |
|
680 |
|
681 return 1; |
|
682 } |
|
683 |
|
684 GLOBAL(int) |
|
685 jsimd_can_idct_ifast (void) |
|
686 { |
|
687 /* The code is optimised for these values only */ |
|
688 if (DCTSIZE != 8) |
|
689 return 0; |
|
690 if (sizeof(JCOEF) != 2) |
|
691 return 0; |
|
692 if (BITS_IN_JSAMPLE != 8) |
|
693 return 0; |
|
694 if (sizeof(JDIMENSION) != 4) |
|
695 return 0; |
|
696 if (sizeof(IFAST_MULT_TYPE) != 2) |
|
697 return 0; |
|
698 if (IFAST_SCALE_BITS != 2) |
|
699 return 0; |
|
700 |
|
701 if (!IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) |
|
702 return 0; |
|
703 |
|
704 return 1; |
|
705 } |
|
706 |
|
707 GLOBAL(int) |
|
708 jsimd_can_idct_float (void) |
|
709 { |
|
710 if (DCTSIZE != 8) |
|
711 return 0; |
|
712 if (sizeof(JCOEF) != 2) |
|
713 return 0; |
|
714 if (BITS_IN_JSAMPLE != 8) |
|
715 return 0; |
|
716 if (sizeof(JDIMENSION) != 4) |
|
717 return 0; |
|
718 if (sizeof(FAST_FLOAT) != 4) |
|
719 return 0; |
|
720 if (sizeof(FLOAT_MULT_TYPE) != 4) |
|
721 return 0; |
|
722 |
|
723 if (!IS_ALIGNED_SSE(jconst_idct_float_sse2)) |
|
724 return 0; |
|
725 |
|
726 return 1; |
|
727 } |
|
728 |
|
729 GLOBAL(void) |
|
730 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
|
731 JCOEFPTR coef_block, JSAMPARRAY output_buf, |
|
732 JDIMENSION output_col) |
|
733 { |
|
734 jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); |
|
735 } |
|
736 |
|
737 GLOBAL(void) |
|
738 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
|
739 JCOEFPTR coef_block, JSAMPARRAY output_buf, |
|
740 JDIMENSION output_col) |
|
741 { |
|
742 jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); |
|
743 } |
|
744 |
|
745 GLOBAL(void) |
|
746 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
|
747 JCOEFPTR coef_block, JSAMPARRAY output_buf, |
|
748 JDIMENSION output_col) |
|
749 { |
|
750 jsimd_idct_float_sse2(compptr->dct_table, coef_block, |
|
751 output_buf, output_col); |
|
752 } |
|
753 |