blob: 861309ab71d5f8bfd8d4e5ae4d7da1ce99139dac [file] [log] [blame]
Pierre Ossman9ad52342009-03-09 13:15:56 +00001/*
2 * jsimd.c
3 *
4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
DRC8ca81ec2009-04-03 12:00:51 +00005 * Copyright 2009 D. R. Commander
Pierre Ossman9ad52342009-03-09 13:15:56 +00006 *
7 * Based on the x86 SIMD extension for IJG JPEG library,
8 * Copyright (C) 1999-2006, MIYASAKA Masaru.
9 *
10 * This file contains the interface between the "normal" portions
11 * of the library and the SIMD implementations.
12 */
13
14#define JPEG_INTERNALS
15#include "jinclude.h"
16#include "jpeglib.h"
Pierre Ossman82c7f312009-03-09 13:21:27 +000017#include "jsimd.h"
Pierre Ossman9ad52342009-03-09 13:15:56 +000018#include "jdct.h"
Pierre Ossman82c7f312009-03-09 13:21:27 +000019#include "jsimddct.h"
20#include "simd/jsimd.h"
Pierre Ossman9ad52342009-03-09 13:15:56 +000021
Pierre Ossman0d37c572009-03-09 13:31:56 +000022/*
23 * In the PIC cases, we have no guarantee that constants will keep
24 * their alignment. This macro allows us to verify it at runtime.
25 */
26#ifdef WITH_SIMD
27#define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0)
28#else
29#define IS_ALIGNED(ptr, order) (0)
30#endif
31
32#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
33
Pierre Ossman9ad52342009-03-09 13:15:56 +000034static unsigned int simd_support = ~0;
35
36/*
37 * Check what SIMD accelerations are supported.
38 *
39 * FIXME: This code is racy under a multi-threaded environment.
40 */
41LOCAL(void)
42init_simd (void)
43{
DRCbec58d82009-04-03 11:27:17 +000044#ifdef WITH_SIMD
45 char *env = NULL;
46#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +000047 if (simd_support != ~0)
48 return;
49
Pierre Ossman82c7f312009-03-09 13:21:27 +000050#ifdef WITH_SIMD
51 simd_support = jpeg_simd_cpu_support();
DRCbec58d82009-04-03 11:27:17 +000052 if((env=getenv("JSIMD_FORCEMMX"))!=NULL && !strcmp(env, "1"))
53 simd_support = JSIMD_MMX;
54 else if((env=getenv("JSIMD_FORCESSE2"))!=NULL && !strcmp(env, "1"))
55 simd_support = JSIMD_SSE2;
Pierre Ossman82c7f312009-03-09 13:21:27 +000056#else
Pierre Ossman9ad52342009-03-09 13:15:56 +000057 simd_support = JSIMD_NONE;
Pierre Ossman82c7f312009-03-09 13:21:27 +000058#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +000059}
60
61GLOBAL(int)
62jsimd_can_rgb_ycc (void)
63{
64 init_simd();
65
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000066 /* The code is optimised for these values only */
67 if (BITS_IN_JSAMPLE != 8)
68 return 0;
69 if (sizeof(JDIMENSION) != 4)
70 return 0;
71 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
72 return 0;
73
Pierre Ossman74693862009-03-09 13:34:17 +000074 if ((simd_support & JSIMD_SSE2) &&
75 IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
76 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000077 if (simd_support & JSIMD_MMX)
78 return 1;
79
Pierre Ossman9ad52342009-03-09 13:15:56 +000080 return 0;
81}
82
83GLOBAL(int)
84jsimd_can_ycc_rgb (void)
85{
86 init_simd();
87
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000088 /* The code is optimised for these values only */
89 if (BITS_IN_JSAMPLE != 8)
90 return 0;
91 if (sizeof(JDIMENSION) != 4)
92 return 0;
93 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
94 return 0;
95
Pierre Ossman74693862009-03-09 13:34:17 +000096 if ((simd_support & JSIMD_SSE2) &&
97 IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
98 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000099 if (simd_support & JSIMD_MMX)
100 return 1;
101
Pierre Ossman9ad52342009-03-09 13:15:56 +0000102 return 0;
103}
104
105GLOBAL(void)
106jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
107 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
108 JDIMENSION output_row, int num_rows)
109{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000110#ifdef WITH_SIMD
DRC8ca81ec2009-04-03 12:00:51 +0000111 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
112 void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
113 switch(cinfo->in_color_space)
114 {
115 case JCS_EXT_RGB:
116 sse2fct=jsimd_extrgb_ycc_convert_sse2;
117 mmxfct=jsimd_extrgb_ycc_convert_mmx;
118 break;
119 case JCS_EXT_RGBX:
120 sse2fct=jsimd_extrgbx_ycc_convert_sse2;
121 mmxfct=jsimd_extrgbx_ycc_convert_mmx;
122 break;
123 case JCS_EXT_BGR:
124 sse2fct=jsimd_extbgr_ycc_convert_sse2;
125 mmxfct=jsimd_extbgr_ycc_convert_mmx;
126 break;
127 case JCS_EXT_BGRX:
128 sse2fct=jsimd_extbgrx_ycc_convert_sse2;
129 mmxfct=jsimd_extbgrx_ycc_convert_mmx;
130 break;
131 case JCS_EXT_XBGR:
132 sse2fct=jsimd_extxbgr_ycc_convert_sse2;
133 mmxfct=jsimd_extxbgr_ycc_convert_mmx;
134 break;
135 case JCS_EXT_XRGB:
136 sse2fct=jsimd_extxrgb_ycc_convert_sse2;
137 mmxfct=jsimd_extxrgb_ycc_convert_mmx;
138 break;
139 default:
140 sse2fct=jsimd_rgb_ycc_convert_sse2;
141 mmxfct=jsimd_rgb_ycc_convert_mmx;
142 break;
143 }
Pierre Ossman74693862009-03-09 13:34:17 +0000144 if ((simd_support & JSIMD_SSE2) &&
145 IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
DRC8ca81ec2009-04-03 12:00:51 +0000146 sse2fct(cinfo->image_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000147 output_buf, output_row, num_rows);
148 else if (simd_support & JSIMD_MMX)
DRC8ca81ec2009-04-03 12:00:51 +0000149 mmxfct(cinfo->image_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000150 output_buf, output_row, num_rows);
151#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000152}
153
154GLOBAL(void)
155jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
156 JSAMPIMAGE input_buf, JDIMENSION input_row,
157 JSAMPARRAY output_buf, int num_rows)
158{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000159#ifdef WITH_SIMD
DRC8ca81ec2009-04-03 12:00:51 +0000160 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
161 void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
162 switch(cinfo->out_color_space)
163 {
164 case JCS_EXT_RGB:
165 sse2fct=jsimd_ycc_extrgb_convert_sse2;
166 mmxfct=jsimd_ycc_extrgb_convert_mmx;
167 break;
168 case JCS_EXT_RGBX:
169 sse2fct=jsimd_ycc_extrgbx_convert_sse2;
170 mmxfct=jsimd_ycc_extrgbx_convert_mmx;
171 break;
172 case JCS_EXT_BGR:
173 sse2fct=jsimd_ycc_extbgr_convert_sse2;
174 mmxfct=jsimd_ycc_extbgr_convert_mmx;
175 break;
176 case JCS_EXT_BGRX:
177 sse2fct=jsimd_ycc_extbgrx_convert_sse2;
178 mmxfct=jsimd_ycc_extbgrx_convert_mmx;
179 break;
180 case JCS_EXT_XBGR:
181 sse2fct=jsimd_ycc_extxbgr_convert_sse2;
182 mmxfct=jsimd_ycc_extxbgr_convert_mmx;
183 break;
184 case JCS_EXT_XRGB:
185 sse2fct=jsimd_ycc_extxrgb_convert_sse2;
186 mmxfct=jsimd_ycc_extxrgb_convert_mmx;
187 break;
188 default:
189 sse2fct=jsimd_ycc_rgb_convert_sse2;
190 mmxfct=jsimd_ycc_rgb_convert_mmx;
191 break;
192 }
Pierre Ossman74693862009-03-09 13:34:17 +0000193 if ((simd_support & JSIMD_SSE2) &&
194 IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
DRC8ca81ec2009-04-03 12:00:51 +0000195 sse2fct(cinfo->output_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000196 input_row, output_buf, num_rows);
197 else if (simd_support & JSIMD_MMX)
DRC8ca81ec2009-04-03 12:00:51 +0000198 mmxfct(cinfo->output_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000199 input_row, output_buf, num_rows);
200#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000201}
202
203GLOBAL(int)
204jsimd_can_h2v2_downsample (void)
205{
206 init_simd();
207
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000208 /* The code is optimised for these values only */
209 if (BITS_IN_JSAMPLE != 8)
210 return 0;
211 if (sizeof(JDIMENSION) != 4)
212 return 0;
213
Pierre Ossman74693862009-03-09 13:34:17 +0000214 if (simd_support & JSIMD_SSE2)
215 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000216 if (simd_support & JSIMD_MMX)
217 return 1;
218
Pierre Ossman9ad52342009-03-09 13:15:56 +0000219 return 0;
220}
221
222GLOBAL(int)
223jsimd_can_h2v1_downsample (void)
224{
225 init_simd();
226
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000227 /* The code is optimised for these values only */
228 if (BITS_IN_JSAMPLE != 8)
229 return 0;
230 if (sizeof(JDIMENSION) != 4)
231 return 0;
232
Pierre Ossman74693862009-03-09 13:34:17 +0000233 if (simd_support & JSIMD_SSE2)
234 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000235 if (simd_support & JSIMD_MMX)
236 return 1;
237
Pierre Ossman9ad52342009-03-09 13:15:56 +0000238 return 0;
239}
240
241GLOBAL(void)
242jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
243 JSAMPARRAY input_data, JSAMPARRAY output_data)
244{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000245#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000246 if (simd_support & JSIMD_SSE2)
247 jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
248 compptr->v_samp_factor, compptr->width_in_blocks,
249 input_data, output_data);
250 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000251 jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
252 compptr->v_samp_factor, compptr->width_in_blocks,
253 input_data, output_data);
254#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000255}
256
257GLOBAL(void)
258jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
259 JSAMPARRAY input_data, JSAMPARRAY output_data)
260{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000261#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000262 if (simd_support & JSIMD_SSE2)
263 jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
264 compptr->v_samp_factor, compptr->width_in_blocks,
265 input_data, output_data);
266 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000267 jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
268 compptr->v_samp_factor, compptr->width_in_blocks,
269 input_data, output_data);
270#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000271}
272
273GLOBAL(int)
274jsimd_can_h2v2_upsample (void)
275{
276 init_simd();
277
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000278 /* The code is optimised for these values only */
279 if (BITS_IN_JSAMPLE != 8)
280 return 0;
281 if (sizeof(JDIMENSION) != 4)
282 return 0;
283
Pierre Ossman74693862009-03-09 13:34:17 +0000284 if (simd_support & JSIMD_SSE2)
285 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000286 if (simd_support & JSIMD_MMX)
287 return 1;
288
Pierre Ossman9ad52342009-03-09 13:15:56 +0000289 return 0;
290}
291
292GLOBAL(int)
293jsimd_can_h2v1_upsample (void)
294{
295 init_simd();
296
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000297 /* The code is optimised for these values only */
298 if (BITS_IN_JSAMPLE != 8)
299 return 0;
300 if (sizeof(JDIMENSION) != 4)
301 return 0;
302
Pierre Ossman74693862009-03-09 13:34:17 +0000303 if (simd_support & JSIMD_SSE2)
304 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000305 if (simd_support & JSIMD_MMX)
306 return 1;
307
Pierre Ossman9ad52342009-03-09 13:15:56 +0000308 return 0;
309}
310
311GLOBAL(void)
312jsimd_h2v2_upsample (j_decompress_ptr cinfo,
313 jpeg_component_info * compptr,
314 JSAMPARRAY input_data,
315 JSAMPARRAY * output_data_ptr)
316{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000317#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000318 if (simd_support & JSIMD_SSE2)
319 jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor,
320 cinfo->output_width, input_data, output_data_ptr);
321 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000322 jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor,
323 cinfo->output_width, input_data, output_data_ptr);
324#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000325}
326
327GLOBAL(void)
328jsimd_h2v1_upsample (j_decompress_ptr cinfo,
329 jpeg_component_info * compptr,
330 JSAMPARRAY input_data,
331 JSAMPARRAY * output_data_ptr)
332{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000333#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000334 if (simd_support & JSIMD_SSE2)
335 jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor,
336 cinfo->output_width, input_data, output_data_ptr);
337 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000338 jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor,
339 cinfo->output_width, input_data, output_data_ptr);
340#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000341}
342
343GLOBAL(int)
344jsimd_can_h2v2_fancy_upsample (void)
345{
346 init_simd();
347
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000348 /* The code is optimised for these values only */
349 if (BITS_IN_JSAMPLE != 8)
350 return 0;
351 if (sizeof(JDIMENSION) != 4)
352 return 0;
353
Pierre Ossman74693862009-03-09 13:34:17 +0000354 if ((simd_support & JSIMD_SSE2) &&
355 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
356 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000357 if (simd_support & JSIMD_MMX)
358 return 1;
359
Pierre Ossman9ad52342009-03-09 13:15:56 +0000360 return 0;
361}
362
363GLOBAL(int)
364jsimd_can_h2v1_fancy_upsample (void)
365{
366 init_simd();
367
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000368 /* The code is optimised for these values only */
369 if (BITS_IN_JSAMPLE != 8)
370 return 0;
371 if (sizeof(JDIMENSION) != 4)
372 return 0;
373
Pierre Ossman74693862009-03-09 13:34:17 +0000374 if ((simd_support & JSIMD_SSE2) &&
375 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
376 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000377 if (simd_support & JSIMD_MMX)
378 return 1;
379
Pierre Ossman9ad52342009-03-09 13:15:56 +0000380 return 0;
381}
382
383GLOBAL(void)
384jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
385 jpeg_component_info * compptr,
386 JSAMPARRAY input_data,
387 JSAMPARRAY * output_data_ptr)
388{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000389#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000390 if ((simd_support & JSIMD_SSE2) &&
391 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
392 jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
393 compptr->downsampled_width, input_data, output_data_ptr);
394 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000395 jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor,
396 compptr->downsampled_width, input_data, output_data_ptr);
397#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000398}
399
400GLOBAL(void)
401jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
402 jpeg_component_info * compptr,
403 JSAMPARRAY input_data,
404 JSAMPARRAY * output_data_ptr)
405{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000406#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000407 if ((simd_support & JSIMD_SSE2) &&
408 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
409 jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
410 compptr->downsampled_width, input_data, output_data_ptr);
411 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000412 jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor,
413 compptr->downsampled_width, input_data, output_data_ptr);
414#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000415}
416
417GLOBAL(int)
418jsimd_can_h2v2_merged_upsample (void)
419{
420 init_simd();
421
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000422 /* The code is optimised for these values only */
423 if (BITS_IN_JSAMPLE != 8)
424 return 0;
425 if (sizeof(JDIMENSION) != 4)
426 return 0;
427
Pierre Ossman74693862009-03-09 13:34:17 +0000428 if ((simd_support & JSIMD_SSE2) &&
429 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
430 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000431 if (simd_support & JSIMD_MMX)
432 return 1;
433
Pierre Ossman9ad52342009-03-09 13:15:56 +0000434 return 0;
435}
436
437GLOBAL(int)
438jsimd_can_h2v1_merged_upsample (void)
439{
440 init_simd();
441
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000442 /* The code is optimised for these values only */
443 if (BITS_IN_JSAMPLE != 8)
444 return 0;
445 if (sizeof(JDIMENSION) != 4)
446 return 0;
447
Pierre Ossman74693862009-03-09 13:34:17 +0000448 if ((simd_support & JSIMD_SSE2) &&
449 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
450 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000451 if (simd_support & JSIMD_MMX)
452 return 1;
453
Pierre Ossman9ad52342009-03-09 13:15:56 +0000454 return 0;
455}
456
457GLOBAL(void)
458jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
459 JSAMPIMAGE input_buf,
460 JDIMENSION in_row_group_ctr,
461 JSAMPARRAY output_buf)
462{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000463#ifdef WITH_SIMD
DRC80bc60b2009-04-05 21:51:25 +0000464 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
465 void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
466 switch(cinfo->out_color_space)
467 {
468 case JCS_EXT_RGB:
469 sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
470 mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx;
471 break;
472 case JCS_EXT_RGBX:
473 sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2;
474 mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx;
475 break;
476 case JCS_EXT_BGR:
477 sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2;
478 mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx;
479 break;
480 case JCS_EXT_BGRX:
481 sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2;
482 mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx;
483 break;
484 case JCS_EXT_XBGR:
485 sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2;
486 mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx;
487 break;
488 case JCS_EXT_XRGB:
489 sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2;
490 mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx;
491 break;
492 default:
493 sse2fct=jsimd_h2v2_merged_upsample_sse2;
494 mmxfct=jsimd_h2v2_merged_upsample_mmx;
495 break;
496 }
Pierre Ossman74693862009-03-09 13:34:17 +0000497 if ((simd_support & JSIMD_SSE2) &&
498 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
DRC80bc60b2009-04-05 21:51:25 +0000499 sse2fct(cinfo->output_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000500 in_row_group_ctr, output_buf);
501 else if (simd_support & JSIMD_MMX)
DRC80bc60b2009-04-05 21:51:25 +0000502 mmxfct(cinfo->output_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000503 in_row_group_ctr, output_buf);
504#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000505}
506
507GLOBAL(void)
508jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
509 JSAMPIMAGE input_buf,
510 JDIMENSION in_row_group_ctr,
511 JSAMPARRAY output_buf)
512{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000513#ifdef WITH_SIMD
DRC80bc60b2009-04-05 21:51:25 +0000514 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
515 void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
516 switch(cinfo->out_color_space)
517 {
518 case JCS_EXT_RGB:
519 sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
520 mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx;
521 break;
522 case JCS_EXT_RGBX:
523 sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2;
524 mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx;
525 break;
526 case JCS_EXT_BGR:
527 sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2;
528 mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx;
529 break;
530 case JCS_EXT_BGRX:
531 sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2;
532 mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx;
533 break;
534 case JCS_EXT_XBGR:
535 sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2;
536 mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx;
537 break;
538 case JCS_EXT_XRGB:
539 sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2;
540 mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx;
541 break;
542 default:
543 sse2fct=jsimd_h2v1_merged_upsample_sse2;
544 mmxfct=jsimd_h2v1_merged_upsample_mmx;
545 break;
546 }
Pierre Ossman74693862009-03-09 13:34:17 +0000547 if ((simd_support & JSIMD_SSE2) &&
548 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
DRC80bc60b2009-04-05 21:51:25 +0000549 sse2fct(cinfo->output_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000550 in_row_group_ctr, output_buf);
551 else if (simd_support & JSIMD_MMX)
DRC80bc60b2009-04-05 21:51:25 +0000552 mmxfct(cinfo->output_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000553 in_row_group_ctr, output_buf);
554#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000555}
556
557GLOBAL(int)
558jsimd_can_convsamp (void)
559{
560 init_simd();
561
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000562 /* The code is optimised for these values only */
563 if (DCTSIZE != 8)
564 return 0;
565 if (BITS_IN_JSAMPLE != 8)
566 return 0;
567 if (sizeof(JDIMENSION) != 4)
568 return 0;
569 if (sizeof(DCTELEM) != 2)
570 return 0;
571
Pierre Ossman74693862009-03-09 13:34:17 +0000572 if (simd_support & JSIMD_SSE2)
573 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000574 if (simd_support & JSIMD_MMX)
575 return 1;
576
Pierre Ossman9ad52342009-03-09 13:15:56 +0000577 return 0;
578}
579
580GLOBAL(int)
581jsimd_can_convsamp_float (void)
582{
583 init_simd();
584
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000585 /* The code is optimised for these values only */
586 if (DCTSIZE != 8)
587 return 0;
588 if (BITS_IN_JSAMPLE != 8)
589 return 0;
590 if (sizeof(JDIMENSION) != 4)
591 return 0;
592 if (sizeof(FAST_FLOAT) != 4)
593 return 0;
594
Pierre Ossman74693862009-03-09 13:34:17 +0000595 if (simd_support & JSIMD_SSE2)
596 return 1;
Pierre Ossman0d37c572009-03-09 13:31:56 +0000597 if (simd_support & JSIMD_SSE)
598 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000599 if (simd_support & JSIMD_3DNOW)
600 return 1;
601
Pierre Ossman9ad52342009-03-09 13:15:56 +0000602 return 0;
603}
604
605GLOBAL(void)
606jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
607 DCTELEM * workspace)
608{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000609#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000610 if (simd_support & JSIMD_SSE2)
611 jsimd_convsamp_sse2(sample_data, start_col, workspace);
612 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000613 jsimd_convsamp_mmx(sample_data, start_col, workspace);
614#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000615}
616
617GLOBAL(void)
618jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
619 FAST_FLOAT * workspace)
620{
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000621#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000622 if (simd_support & JSIMD_SSE2)
623 jsimd_convsamp_float_sse2(sample_data, start_col, workspace);
624 else if (simd_support & JSIMD_SSE)
Pierre Ossman0d37c572009-03-09 13:31:56 +0000625 jsimd_convsamp_float_sse(sample_data, start_col, workspace);
626 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000627 jsimd_convsamp_float_3dnow(sample_data, start_col, workspace);
628#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000629}
630
631GLOBAL(int)
632jsimd_can_fdct_islow (void)
633{
634 init_simd();
635
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000636 /* The code is optimised for these values only */
637 if (DCTSIZE != 8)
638 return 0;
639 if (sizeof(DCTELEM) != 2)
640 return 0;
641
Pierre Ossman74693862009-03-09 13:34:17 +0000642 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
643 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000644 if (simd_support & JSIMD_MMX)
645 return 1;
646
Pierre Ossman9ad52342009-03-09 13:15:56 +0000647 return 0;
648}
649
650GLOBAL(int)
651jsimd_can_fdct_ifast (void)
652{
653 init_simd();
654
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000655 /* The code is optimised for these values only */
656 if (DCTSIZE != 8)
657 return 0;
658 if (sizeof(DCTELEM) != 2)
659 return 0;
660
Pierre Ossman74693862009-03-09 13:34:17 +0000661 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2))
662 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000663 if (simd_support & JSIMD_MMX)
664 return 1;
665
Pierre Ossman9ad52342009-03-09 13:15:56 +0000666 return 0;
667}
668
669GLOBAL(int)
670jsimd_can_fdct_float (void)
671{
672 init_simd();
673
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000674 /* The code is optimised for these values only */
675 if (DCTSIZE != 8)
676 return 0;
677 if (sizeof(FAST_FLOAT) != 4)
678 return 0;
679
Pierre Ossman0d37c572009-03-09 13:31:56 +0000680 if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
681 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000682 if (simd_support & JSIMD_3DNOW)
683 return 1;
684
Pierre Ossman9ad52342009-03-09 13:15:56 +0000685 return 0;
686}
687
688GLOBAL(void)
689jsimd_fdct_islow (DCTELEM * data)
690{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000691#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000692 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
693 jsimd_fdct_islow_sse2(data);
694 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000695 jsimd_fdct_islow_mmx(data);
696#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000697}
698
699GLOBAL(void)
700jsimd_fdct_ifast (DCTELEM * data)
701{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000702#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000703 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
704 jsimd_fdct_ifast_sse2(data);
705 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000706 jsimd_fdct_ifast_mmx(data);
707#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000708}
709
710GLOBAL(void)
711jsimd_fdct_float (FAST_FLOAT * data)
712{
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000713#ifdef WITH_SIMD
Pierre Ossman0d37c572009-03-09 13:31:56 +0000714 if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
715 jsimd_fdct_float_sse(data);
716 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000717 jsimd_fdct_float_3dnow(data);
718#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000719}
720
721GLOBAL(int)
722jsimd_can_quantize (void)
723{
724 init_simd();
725
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000726 /* The code is optimised for these values only */
727 if (DCTSIZE != 8)
728 return 0;
729 if (sizeof(JCOEF) != 2)
730 return 0;
731 if (sizeof(DCTELEM) != 2)
732 return 0;
733
Pierre Ossman74693862009-03-09 13:34:17 +0000734 if (simd_support & JSIMD_SSE2)
735 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000736 if (simd_support & JSIMD_MMX)
737 return 1;
738
Pierre Ossman9ad52342009-03-09 13:15:56 +0000739 return 0;
740}
741
742GLOBAL(int)
743jsimd_can_quantize_float (void)
744{
745 init_simd();
746
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000747 /* The code is optimised for these values only */
748 if (DCTSIZE != 8)
749 return 0;
750 if (sizeof(JCOEF) != 2)
751 return 0;
752 if (sizeof(FAST_FLOAT) != 4)
753 return 0;
754
Pierre Ossman74693862009-03-09 13:34:17 +0000755 if (simd_support & JSIMD_SSE2)
756 return 1;
Pierre Ossman0d37c572009-03-09 13:31:56 +0000757 if (simd_support & JSIMD_SSE)
758 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000759 if (simd_support & JSIMD_3DNOW)
760 return 1;
761
Pierre Ossman9ad52342009-03-09 13:15:56 +0000762 return 0;
763}
764
765GLOBAL(void)
766jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
767 DCTELEM * workspace)
768{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000769#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000770 if (simd_support & JSIMD_SSE2)
771 jsimd_quantize_sse2(coef_block, divisors, workspace);
772 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000773 jsimd_quantize_mmx(coef_block, divisors, workspace);
774#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000775}
776
777GLOBAL(void)
778jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
779 FAST_FLOAT * workspace)
780{
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000781#ifdef WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000782 if (simd_support & JSIMD_SSE2)
783 jsimd_quantize_float_sse2(coef_block, divisors, workspace);
784 else if (simd_support & JSIMD_SSE)
Pierre Ossman0d37c572009-03-09 13:31:56 +0000785 jsimd_quantize_float_sse(coef_block, divisors, workspace);
786 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000787 jsimd_quantize_float_3dnow(coef_block, divisors, workspace);
788#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000789}
790
791GLOBAL(int)
792jsimd_can_idct_2x2 (void)
793{
794 init_simd();
795
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000796 /* The code is optimised for these values only */
797 if (DCTSIZE != 8)
798 return 0;
799 if (sizeof(JCOEF) != 2)
800 return 0;
801 if (BITS_IN_JSAMPLE != 8)
802 return 0;
803 if (sizeof(JDIMENSION) != 4)
804 return 0;
805 if (sizeof(ISLOW_MULT_TYPE) != 2)
806 return 0;
807
Pierre Ossman74693862009-03-09 13:34:17 +0000808 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
809 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000810 if (simd_support & JSIMD_MMX)
811 return 1;
812
Pierre Ossman9ad52342009-03-09 13:15:56 +0000813 return 0;
814}
815
816GLOBAL(int)
817jsimd_can_idct_4x4 (void)
818{
819 init_simd();
820
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000821 /* The code is optimised for these values only */
822 if (DCTSIZE != 8)
823 return 0;
824 if (sizeof(JCOEF) != 2)
825 return 0;
826 if (BITS_IN_JSAMPLE != 8)
827 return 0;
828 if (sizeof(JDIMENSION) != 4)
829 return 0;
830 if (sizeof(ISLOW_MULT_TYPE) != 2)
831 return 0;
832
Pierre Ossman74693862009-03-09 13:34:17 +0000833 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
834 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000835 if (simd_support & JSIMD_MMX)
836 return 1;
837
Pierre Ossman9ad52342009-03-09 13:15:56 +0000838 return 0;
839}
840
841GLOBAL(void)
842jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
843 JCOEFPTR coef_block, JSAMPARRAY output_buf,
844 JDIMENSION output_col)
845{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000846#if WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000847 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
848 jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col);
849 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000850 jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col);
851#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000852}
853
854GLOBAL(void)
855jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
856 JCOEFPTR coef_block, JSAMPARRAY output_buf,
857 JDIMENSION output_col)
858{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000859#if WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000860 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
861 jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col);
862 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000863 jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col);
864#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000865}
866
867GLOBAL(int)
868jsimd_can_idct_islow (void)
869{
870 init_simd();
871
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000872 /* The code is optimised for these values only */
873 if (DCTSIZE != 8)
874 return 0;
875 if (sizeof(JCOEF) != 2)
876 return 0;
877 if (BITS_IN_JSAMPLE != 8)
878 return 0;
879 if (sizeof(JDIMENSION) != 4)
880 return 0;
881 if (sizeof(ISLOW_MULT_TYPE) != 2)
882 return 0;
883
Pierre Ossman74693862009-03-09 13:34:17 +0000884 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
885 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000886 if (simd_support & JSIMD_MMX)
887 return 1;
888
Pierre Ossman9ad52342009-03-09 13:15:56 +0000889 return 0;
890}
891
892GLOBAL(int)
893jsimd_can_idct_ifast (void)
894{
895 init_simd();
896
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000897 /* The code is optimised for these values only */
898 if (DCTSIZE != 8)
899 return 0;
900 if (sizeof(JCOEF) != 2)
901 return 0;
902 if (BITS_IN_JSAMPLE != 8)
903 return 0;
904 if (sizeof(JDIMENSION) != 4)
905 return 0;
906 if (sizeof(IFAST_MULT_TYPE) != 2)
907 return 0;
908 if (IFAST_SCALE_BITS != 2)
909 return 0;
910
Pierre Ossman74693862009-03-09 13:34:17 +0000911 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
912 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000913 if (simd_support & JSIMD_MMX)
914 return 1;
915
Pierre Ossman9ad52342009-03-09 13:15:56 +0000916 return 0;
917}
918
919GLOBAL(int)
920jsimd_can_idct_float (void)
921{
922 init_simd();
923
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000924 if (DCTSIZE != 8)
925 return 0;
926 if (sizeof(JCOEF) != 2)
927 return 0;
928 if (BITS_IN_JSAMPLE != 8)
929 return 0;
930 if (sizeof(JDIMENSION) != 4)
931 return 0;
932 if (sizeof(FAST_FLOAT) != 4)
933 return 0;
934 if (sizeof(FLOAT_MULT_TYPE) != 4)
935 return 0;
936
Pierre Ossman74693862009-03-09 13:34:17 +0000937 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
938 return 1;
Pierre Ossman0d37c572009-03-09 13:31:56 +0000939 if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
940 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000941 if (simd_support & JSIMD_3DNOW)
942 return 1;
943
Pierre Ossman9ad52342009-03-09 13:15:56 +0000944 return 0;
945}
946
947GLOBAL(void)
948jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
949 JCOEFPTR coef_block, JSAMPARRAY output_buf,
950 JDIMENSION output_col)
951{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000952#if WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000953 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
954 jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col);
955 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000956 jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col);
957#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000958}
959
960GLOBAL(void)
961jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
962 JCOEFPTR coef_block, JSAMPARRAY output_buf,
963 JDIMENSION output_col)
964{
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000965#if WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000966 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
967 jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col);
968 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000969 jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col);
970#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000971}
972
973GLOBAL(void)
974jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
975 JCOEFPTR coef_block, JSAMPARRAY output_buf,
976 JDIMENSION output_col)
977{
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000978#if WITH_SIMD
Pierre Ossman74693862009-03-09 13:34:17 +0000979 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
980 jsimd_idct_float_sse2(compptr->dct_table, coef_block,
981 output_buf, output_col);
982 else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
Pierre Ossman0d37c572009-03-09 13:31:56 +0000983 jsimd_idct_float_sse(compptr->dct_table, coef_block,
984 output_buf, output_col);
985 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000986 jsimd_idct_float_3dnow(compptr->dct_table, coef_block,
987 output_buf, output_col);
988#endif
Pierre Ossman9ad52342009-03-09 13:15:56 +0000989}
990