blob: d9bb774352a5319229dfe5ee75c4ccdebf361ba2 [file] [log] [blame]
Pierre Ossman9ad52342009-03-09 13:15:56 +00001/*
Pierre Ossman0b7301e2009-06-29 11:20:42 +00002 * jsimd_i386.c
Pierre Ossman9ad52342009-03-09 13:15:56 +00003 *
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.
DRCa6da9f32011-02-02 05:45:43 +00009 * For conditions of distribution and use, see copyright notice in jsimdext.inc
Pierre Ossman9ad52342009-03-09 13:15:56 +000010 *
11 * This file contains the interface between the "normal" portions
Pierre Ossman0b7301e2009-06-29 11:20:42 +000012 * of the library and the SIMD implementations when running on a
13 * 32-bit x86 architecture.
Pierre Ossman9ad52342009-03-09 13:15:56 +000014 */
15
16#define JPEG_INTERNALS
Pierre Ossman0b7301e2009-06-29 11:20:42 +000017#include "../jinclude.h"
18#include "../jpeglib.h"
19#include "../jsimd.h"
20#include "../jdct.h"
21#include "../jsimddct.h"
Peter Åstrand086f2a02009-08-19 13:53:48 +000022#include "jsimd.h"
Pierre Ossman9ad52342009-03-09 13:15:56 +000023
Pierre Ossman0d37c572009-03-09 13:31:56 +000024/*
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 */
Pierre Ossman0d37c572009-03-09 13:31:56 +000028#define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0)
Pierre Ossman0d37c572009-03-09 13:31:56 +000029
30#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
31
Pierre Ossman9ad52342009-03-09 13:15:56 +000032static unsigned int simd_support = ~0;
33
34/*
35 * Check what SIMD accelerations are supported.
36 *
37 * FIXME: This code is racy under a multi-threaded environment.
38 */
39LOCAL(void)
40init_simd (void)
41{
DRCbec58d82009-04-03 11:27:17 +000042 char *env = NULL;
Pierre Ossman0b7301e2009-06-29 11:20:42 +000043
Pierre Ossman9ad52342009-03-09 13:15:56 +000044 if (simd_support != ~0)
45 return;
46
Pierre Ossman82c7f312009-03-09 13:21:27 +000047 simd_support = jpeg_simd_cpu_support();
Pierre Ossman0b7301e2009-06-29 11:20:42 +000048
49 /* Force different settings through environment variables */
50 env = getenv("JSIMD_FORCEMMX");
51 if ((env != NULL) && (strcmp(env, "1") == 0))
DRCf8ad8ff2010-03-03 08:48:44 +000052 simd_support &= JSIMD_MMX;
Pierre Ossman0b7301e2009-06-29 11:20:42 +000053 env = getenv("JSIMD_FORCE3DNOW");
54 if ((env != NULL) && (strcmp(env, "1") == 0))
DRCf8ad8ff2010-03-03 08:48:44 +000055 simd_support &= JSIMD_3DNOW|JSIMD_MMX;
Pierre Ossman0b7301e2009-06-29 11:20:42 +000056 env = getenv("JSIMD_FORCESSE");
57 if ((env != NULL) && (strcmp(env, "1") == 0))
DRCf8ad8ff2010-03-03 08:48:44 +000058 simd_support &= JSIMD_SSE|JSIMD_MMX;
Pierre Ossman0b7301e2009-06-29 11:20:42 +000059 env = getenv("JSIMD_FORCESSE2");
60 if ((env != NULL) && (strcmp(env, "1") == 0))
DRCf8ad8ff2010-03-03 08:48:44 +000061 simd_support &= JSIMD_SSE2;
Pierre Ossman9ad52342009-03-09 13:15:56 +000062}
63
64GLOBAL(int)
65jsimd_can_rgb_ycc (void)
66{
67 init_simd();
68
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000069 /* 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
Pierre Ossman74693862009-03-09 13:34:17 +000077 if ((simd_support & JSIMD_SSE2) &&
78 IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
79 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000080 if (simd_support & JSIMD_MMX)
81 return 1;
82
Pierre Ossman9ad52342009-03-09 13:15:56 +000083 return 0;
84}
85
86GLOBAL(int)
87jsimd_can_ycc_rgb (void)
88{
89 init_simd();
90
Pierre Ossman3e0e2de2009-03-09 13:25:30 +000091 /* The code is optimised for these values only */
92 if (BITS_IN_JSAMPLE != 8)
93 return 0;
94 if (sizeof(JDIMENSION) != 4)
95 return 0;
96 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
97 return 0;
98
Pierre Ossman74693862009-03-09 13:34:17 +000099 if ((simd_support & JSIMD_SSE2) &&
100 IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
101 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000102 if (simd_support & JSIMD_MMX)
103 return 1;
104
Pierre Ossman9ad52342009-03-09 13:15:56 +0000105 return 0;
106}
107
108GLOBAL(void)
109jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
110 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
111 JDIMENSION output_row, int num_rows)
112{
DRC8ca81ec2009-04-03 12:00:51 +0000113 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
114 void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000115
DRC8ca81ec2009-04-03 12:00:51 +0000116 switch(cinfo->in_color_space)
117 {
118 case JCS_EXT_RGB:
119 sse2fct=jsimd_extrgb_ycc_convert_sse2;
120 mmxfct=jsimd_extrgb_ycc_convert_mmx;
121 break;
122 case JCS_EXT_RGBX:
123 sse2fct=jsimd_extrgbx_ycc_convert_sse2;
124 mmxfct=jsimd_extrgbx_ycc_convert_mmx;
125 break;
126 case JCS_EXT_BGR:
127 sse2fct=jsimd_extbgr_ycc_convert_sse2;
128 mmxfct=jsimd_extbgr_ycc_convert_mmx;
129 break;
130 case JCS_EXT_BGRX:
131 sse2fct=jsimd_extbgrx_ycc_convert_sse2;
132 mmxfct=jsimd_extbgrx_ycc_convert_mmx;
133 break;
134 case JCS_EXT_XBGR:
135 sse2fct=jsimd_extxbgr_ycc_convert_sse2;
136 mmxfct=jsimd_extxbgr_ycc_convert_mmx;
137 break;
138 case JCS_EXT_XRGB:
139 sse2fct=jsimd_extxrgb_ycc_convert_sse2;
140 mmxfct=jsimd_extxrgb_ycc_convert_mmx;
141 break;
142 default:
143 sse2fct=jsimd_rgb_ycc_convert_sse2;
144 mmxfct=jsimd_rgb_ycc_convert_mmx;
145 break;
146 }
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000147
Pierre Ossman74693862009-03-09 13:34:17 +0000148 if ((simd_support & JSIMD_SSE2) &&
149 IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
DRC8ca81ec2009-04-03 12:00:51 +0000150 sse2fct(cinfo->image_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000151 output_buf, output_row, num_rows);
152 else if (simd_support & JSIMD_MMX)
DRC8ca81ec2009-04-03 12:00:51 +0000153 mmxfct(cinfo->image_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000154 output_buf, output_row, num_rows);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000155}
156
157GLOBAL(void)
158jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
159 JSAMPIMAGE input_buf, JDIMENSION input_row,
160 JSAMPARRAY output_buf, int num_rows)
161{
DRC8ca81ec2009-04-03 12:00:51 +0000162 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
163 void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000164
DRC8ca81ec2009-04-03 12:00:51 +0000165 switch(cinfo->out_color_space)
166 {
167 case JCS_EXT_RGB:
168 sse2fct=jsimd_ycc_extrgb_convert_sse2;
169 mmxfct=jsimd_ycc_extrgb_convert_mmx;
170 break;
171 case JCS_EXT_RGBX:
172 sse2fct=jsimd_ycc_extrgbx_convert_sse2;
173 mmxfct=jsimd_ycc_extrgbx_convert_mmx;
174 break;
175 case JCS_EXT_BGR:
176 sse2fct=jsimd_ycc_extbgr_convert_sse2;
177 mmxfct=jsimd_ycc_extbgr_convert_mmx;
178 break;
179 case JCS_EXT_BGRX:
180 sse2fct=jsimd_ycc_extbgrx_convert_sse2;
181 mmxfct=jsimd_ycc_extbgrx_convert_mmx;
182 break;
183 case JCS_EXT_XBGR:
184 sse2fct=jsimd_ycc_extxbgr_convert_sse2;
185 mmxfct=jsimd_ycc_extxbgr_convert_mmx;
186 break;
187 case JCS_EXT_XRGB:
188 sse2fct=jsimd_ycc_extxrgb_convert_sse2;
189 mmxfct=jsimd_ycc_extxrgb_convert_mmx;
190 break;
191 default:
192 sse2fct=jsimd_ycc_rgb_convert_sse2;
193 mmxfct=jsimd_ycc_rgb_convert_mmx;
194 break;
195 }
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000196
Pierre Ossman74693862009-03-09 13:34:17 +0000197 if ((simd_support & JSIMD_SSE2) &&
198 IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
DRC8ca81ec2009-04-03 12:00:51 +0000199 sse2fct(cinfo->output_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000200 input_row, output_buf, num_rows);
201 else if (simd_support & JSIMD_MMX)
DRC8ca81ec2009-04-03 12:00:51 +0000202 mmxfct(cinfo->output_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000203 input_row, output_buf, num_rows);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000204}
205
206GLOBAL(int)
207jsimd_can_h2v2_downsample (void)
208{
209 init_simd();
210
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000211 /* The code is optimised for these values only */
212 if (BITS_IN_JSAMPLE != 8)
213 return 0;
214 if (sizeof(JDIMENSION) != 4)
215 return 0;
216
Pierre Ossman74693862009-03-09 13:34:17 +0000217 if (simd_support & JSIMD_SSE2)
218 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000219 if (simd_support & JSIMD_MMX)
220 return 1;
221
Pierre Ossman9ad52342009-03-09 13:15:56 +0000222 return 0;
223}
224
225GLOBAL(int)
226jsimd_can_h2v1_downsample (void)
227{
228 init_simd();
229
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000230 /* The code is optimised for these values only */
231 if (BITS_IN_JSAMPLE != 8)
232 return 0;
233 if (sizeof(JDIMENSION) != 4)
234 return 0;
235
Pierre Ossman74693862009-03-09 13:34:17 +0000236 if (simd_support & JSIMD_SSE2)
237 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000238 if (simd_support & JSIMD_MMX)
239 return 1;
240
Pierre Ossman9ad52342009-03-09 13:15:56 +0000241 return 0;
242}
243
244GLOBAL(void)
245jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
246 JSAMPARRAY input_data, JSAMPARRAY output_data)
247{
Pierre Ossman74693862009-03-09 13:34:17 +0000248 if (simd_support & JSIMD_SSE2)
249 jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
250 compptr->v_samp_factor, compptr->width_in_blocks,
251 input_data, output_data);
252 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000253 jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
254 compptr->v_samp_factor, compptr->width_in_blocks,
255 input_data, output_data);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000256}
257
258GLOBAL(void)
259jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
260 JSAMPARRAY input_data, JSAMPARRAY output_data)
261{
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);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000270}
271
272GLOBAL(int)
273jsimd_can_h2v2_upsample (void)
274{
275 init_simd();
276
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000277 /* The code is optimised for these values only */
278 if (BITS_IN_JSAMPLE != 8)
279 return 0;
280 if (sizeof(JDIMENSION) != 4)
281 return 0;
282
Pierre Ossman74693862009-03-09 13:34:17 +0000283 if (simd_support & JSIMD_SSE2)
284 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000285 if (simd_support & JSIMD_MMX)
286 return 1;
287
Pierre Ossman9ad52342009-03-09 13:15:56 +0000288 return 0;
289}
290
291GLOBAL(int)
292jsimd_can_h2v1_upsample (void)
293{
294 init_simd();
295
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000296 /* The code is optimised for these values only */
297 if (BITS_IN_JSAMPLE != 8)
298 return 0;
299 if (sizeof(JDIMENSION) != 4)
300 return 0;
301
Pierre Ossman74693862009-03-09 13:34:17 +0000302 if (simd_support & JSIMD_SSE2)
303 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000304 if (simd_support & JSIMD_MMX)
305 return 1;
306
Pierre Ossman9ad52342009-03-09 13:15:56 +0000307 return 0;
308}
309
310GLOBAL(void)
311jsimd_h2v2_upsample (j_decompress_ptr cinfo,
312 jpeg_component_info * compptr,
313 JSAMPARRAY input_data,
314 JSAMPARRAY * output_data_ptr)
315{
Pierre Ossman74693862009-03-09 13:34:17 +0000316 if (simd_support & JSIMD_SSE2)
317 jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor,
318 cinfo->output_width, input_data, output_data_ptr);
319 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000320 jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor,
321 cinfo->output_width, input_data, output_data_ptr);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000322}
323
324GLOBAL(void)
325jsimd_h2v1_upsample (j_decompress_ptr cinfo,
326 jpeg_component_info * compptr,
327 JSAMPARRAY input_data,
328 JSAMPARRAY * output_data_ptr)
329{
Pierre Ossman74693862009-03-09 13:34:17 +0000330 if (simd_support & JSIMD_SSE2)
331 jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor,
332 cinfo->output_width, input_data, output_data_ptr);
333 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000334 jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor,
335 cinfo->output_width, input_data, output_data_ptr);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000336}
337
338GLOBAL(int)
339jsimd_can_h2v2_fancy_upsample (void)
340{
341 init_simd();
342
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000343 /* The code is optimised for these values only */
344 if (BITS_IN_JSAMPLE != 8)
345 return 0;
346 if (sizeof(JDIMENSION) != 4)
347 return 0;
348
Pierre Ossman74693862009-03-09 13:34:17 +0000349 if ((simd_support & JSIMD_SSE2) &&
350 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
351 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000352 if (simd_support & JSIMD_MMX)
353 return 1;
354
Pierre Ossman9ad52342009-03-09 13:15:56 +0000355 return 0;
356}
357
358GLOBAL(int)
359jsimd_can_h2v1_fancy_upsample (void)
360{
361 init_simd();
362
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000363 /* The code is optimised for these values only */
364 if (BITS_IN_JSAMPLE != 8)
365 return 0;
366 if (sizeof(JDIMENSION) != 4)
367 return 0;
368
Pierre Ossman74693862009-03-09 13:34:17 +0000369 if ((simd_support & JSIMD_SSE2) &&
370 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
371 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000372 if (simd_support & JSIMD_MMX)
373 return 1;
374
Pierre Ossman9ad52342009-03-09 13:15:56 +0000375 return 0;
376}
377
378GLOBAL(void)
379jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
380 jpeg_component_info * compptr,
381 JSAMPARRAY input_data,
382 JSAMPARRAY * output_data_ptr)
383{
Pierre Ossman74693862009-03-09 13:34:17 +0000384 if ((simd_support & JSIMD_SSE2) &&
385 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
DRCbacbbaa2010-08-07 16:12:08 +0000386 jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
Pierre Ossman74693862009-03-09 13:34:17 +0000387 compptr->downsampled_width, input_data, output_data_ptr);
388 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000389 jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor,
390 compptr->downsampled_width, input_data, output_data_ptr);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000391}
392
393GLOBAL(void)
394jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
395 jpeg_component_info * compptr,
396 JSAMPARRAY input_data,
397 JSAMPARRAY * output_data_ptr)
398{
Pierre Ossman74693862009-03-09 13:34:17 +0000399 if ((simd_support & JSIMD_SSE2) &&
400 IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
401 jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
402 compptr->downsampled_width, input_data, output_data_ptr);
403 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000404 jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor,
405 compptr->downsampled_width, input_data, output_data_ptr);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000406}
407
408GLOBAL(int)
409jsimd_can_h2v2_merged_upsample (void)
410{
411 init_simd();
412
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000413 /* The code is optimised for these values only */
414 if (BITS_IN_JSAMPLE != 8)
415 return 0;
416 if (sizeof(JDIMENSION) != 4)
417 return 0;
418
Pierre Ossman74693862009-03-09 13:34:17 +0000419 if ((simd_support & JSIMD_SSE2) &&
420 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
421 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000422 if (simd_support & JSIMD_MMX)
423 return 1;
424
Pierre Ossman9ad52342009-03-09 13:15:56 +0000425 return 0;
426}
427
428GLOBAL(int)
429jsimd_can_h2v1_merged_upsample (void)
430{
431 init_simd();
432
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000433 /* The code is optimised for these values only */
434 if (BITS_IN_JSAMPLE != 8)
435 return 0;
436 if (sizeof(JDIMENSION) != 4)
437 return 0;
438
Pierre Ossman74693862009-03-09 13:34:17 +0000439 if ((simd_support & JSIMD_SSE2) &&
440 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
441 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000442 if (simd_support & JSIMD_MMX)
443 return 1;
444
Pierre Ossman9ad52342009-03-09 13:15:56 +0000445 return 0;
446}
447
448GLOBAL(void)
449jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
450 JSAMPIMAGE input_buf,
451 JDIMENSION in_row_group_ctr,
452 JSAMPARRAY output_buf)
453{
DRC80bc60b2009-04-05 21:51:25 +0000454 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
455 void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000456
DRC80bc60b2009-04-05 21:51:25 +0000457 switch(cinfo->out_color_space)
458 {
459 case JCS_EXT_RGB:
460 sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
461 mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx;
462 break;
463 case JCS_EXT_RGBX:
464 sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2;
465 mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx;
466 break;
467 case JCS_EXT_BGR:
468 sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2;
469 mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx;
470 break;
471 case JCS_EXT_BGRX:
472 sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2;
473 mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx;
474 break;
475 case JCS_EXT_XBGR:
476 sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2;
477 mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx;
478 break;
479 case JCS_EXT_XRGB:
480 sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2;
481 mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx;
482 break;
483 default:
484 sse2fct=jsimd_h2v2_merged_upsample_sse2;
485 mmxfct=jsimd_h2v2_merged_upsample_mmx;
486 break;
487 }
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000488
Pierre Ossman74693862009-03-09 13:34:17 +0000489 if ((simd_support & JSIMD_SSE2) &&
490 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
DRC80bc60b2009-04-05 21:51:25 +0000491 sse2fct(cinfo->output_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000492 in_row_group_ctr, output_buf);
493 else if (simd_support & JSIMD_MMX)
DRC80bc60b2009-04-05 21:51:25 +0000494 mmxfct(cinfo->output_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000495 in_row_group_ctr, output_buf);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000496}
497
498GLOBAL(void)
499jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
500 JSAMPIMAGE input_buf,
501 JDIMENSION in_row_group_ctr,
502 JSAMPARRAY output_buf)
503{
DRC80bc60b2009-04-05 21:51:25 +0000504 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
505 void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000506
DRC80bc60b2009-04-05 21:51:25 +0000507 switch(cinfo->out_color_space)
508 {
509 case JCS_EXT_RGB:
510 sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
511 mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx;
512 break;
513 case JCS_EXT_RGBX:
514 sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2;
515 mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx;
516 break;
517 case JCS_EXT_BGR:
518 sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2;
519 mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx;
520 break;
521 case JCS_EXT_BGRX:
522 sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2;
523 mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx;
524 break;
525 case JCS_EXT_XBGR:
526 sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2;
527 mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx;
528 break;
529 case JCS_EXT_XRGB:
530 sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2;
531 mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx;
532 break;
533 default:
534 sse2fct=jsimd_h2v1_merged_upsample_sse2;
535 mmxfct=jsimd_h2v1_merged_upsample_mmx;
536 break;
537 }
Pierre Ossman0b7301e2009-06-29 11:20:42 +0000538
Pierre Ossman74693862009-03-09 13:34:17 +0000539 if ((simd_support & JSIMD_SSE2) &&
540 IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
DRC80bc60b2009-04-05 21:51:25 +0000541 sse2fct(cinfo->output_width, input_buf,
Pierre Ossman74693862009-03-09 13:34:17 +0000542 in_row_group_ctr, output_buf);
543 else if (simd_support & JSIMD_MMX)
DRC80bc60b2009-04-05 21:51:25 +0000544 mmxfct(cinfo->output_width, input_buf,
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000545 in_row_group_ctr, output_buf);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000546}
547
548GLOBAL(int)
549jsimd_can_convsamp (void)
550{
551 init_simd();
552
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000553 /* The code is optimised for these values only */
554 if (DCTSIZE != 8)
555 return 0;
556 if (BITS_IN_JSAMPLE != 8)
557 return 0;
558 if (sizeof(JDIMENSION) != 4)
559 return 0;
560 if (sizeof(DCTELEM) != 2)
561 return 0;
562
Pierre Ossman74693862009-03-09 13:34:17 +0000563 if (simd_support & JSIMD_SSE2)
564 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000565 if (simd_support & JSIMD_MMX)
566 return 1;
567
Pierre Ossman9ad52342009-03-09 13:15:56 +0000568 return 0;
569}
570
571GLOBAL(int)
572jsimd_can_convsamp_float (void)
573{
574 init_simd();
575
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000576 /* The code is optimised for these values only */
577 if (DCTSIZE != 8)
578 return 0;
579 if (BITS_IN_JSAMPLE != 8)
580 return 0;
581 if (sizeof(JDIMENSION) != 4)
582 return 0;
583 if (sizeof(FAST_FLOAT) != 4)
584 return 0;
585
Pierre Ossman74693862009-03-09 13:34:17 +0000586 if (simd_support & JSIMD_SSE2)
587 return 1;
Pierre Ossman0d37c572009-03-09 13:31:56 +0000588 if (simd_support & JSIMD_SSE)
589 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000590 if (simd_support & JSIMD_3DNOW)
591 return 1;
592
Pierre Ossman9ad52342009-03-09 13:15:56 +0000593 return 0;
594}
595
596GLOBAL(void)
597jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
598 DCTELEM * workspace)
599{
Pierre Ossman74693862009-03-09 13:34:17 +0000600 if (simd_support & JSIMD_SSE2)
601 jsimd_convsamp_sse2(sample_data, start_col, workspace);
602 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000603 jsimd_convsamp_mmx(sample_data, start_col, workspace);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000604}
605
606GLOBAL(void)
607jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
608 FAST_FLOAT * workspace)
609{
Pierre Ossman74693862009-03-09 13:34:17 +0000610 if (simd_support & JSIMD_SSE2)
611 jsimd_convsamp_float_sse2(sample_data, start_col, workspace);
612 else if (simd_support & JSIMD_SSE)
Pierre Ossman0d37c572009-03-09 13:31:56 +0000613 jsimd_convsamp_float_sse(sample_data, start_col, workspace);
614 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000615 jsimd_convsamp_float_3dnow(sample_data, start_col, workspace);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000616}
617
618GLOBAL(int)
619jsimd_can_fdct_islow (void)
620{
621 init_simd();
622
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000623 /* The code is optimised for these values only */
624 if (DCTSIZE != 8)
625 return 0;
626 if (sizeof(DCTELEM) != 2)
627 return 0;
628
Pierre Ossman74693862009-03-09 13:34:17 +0000629 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
630 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000631 if (simd_support & JSIMD_MMX)
632 return 1;
633
Pierre Ossman9ad52342009-03-09 13:15:56 +0000634 return 0;
635}
636
637GLOBAL(int)
638jsimd_can_fdct_ifast (void)
639{
640 init_simd();
641
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000642 /* The code is optimised for these values only */
643 if (DCTSIZE != 8)
644 return 0;
645 if (sizeof(DCTELEM) != 2)
646 return 0;
647
Pierre Ossman74693862009-03-09 13:34:17 +0000648 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2))
649 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000650 if (simd_support & JSIMD_MMX)
651 return 1;
652
Pierre Ossman9ad52342009-03-09 13:15:56 +0000653 return 0;
654}
655
656GLOBAL(int)
657jsimd_can_fdct_float (void)
658{
659 init_simd();
660
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000661 /* The code is optimised for these values only */
662 if (DCTSIZE != 8)
663 return 0;
664 if (sizeof(FAST_FLOAT) != 4)
665 return 0;
666
Pierre Ossman0d37c572009-03-09 13:31:56 +0000667 if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
668 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000669 if (simd_support & JSIMD_3DNOW)
670 return 1;
671
Pierre Ossman9ad52342009-03-09 13:15:56 +0000672 return 0;
673}
674
675GLOBAL(void)
676jsimd_fdct_islow (DCTELEM * data)
677{
Pierre Ossman74693862009-03-09 13:34:17 +0000678 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
679 jsimd_fdct_islow_sse2(data);
680 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000681 jsimd_fdct_islow_mmx(data);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000682}
683
684GLOBAL(void)
685jsimd_fdct_ifast (DCTELEM * data)
686{
Pierre Ossman74693862009-03-09 13:34:17 +0000687 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
688 jsimd_fdct_ifast_sse2(data);
689 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000690 jsimd_fdct_ifast_mmx(data);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000691}
692
693GLOBAL(void)
694jsimd_fdct_float (FAST_FLOAT * data)
695{
Pierre Ossman0d37c572009-03-09 13:31:56 +0000696 if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
697 jsimd_fdct_float_sse(data);
698 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000699 jsimd_fdct_float_3dnow(data);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000700}
701
702GLOBAL(int)
703jsimd_can_quantize (void)
704{
705 init_simd();
706
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000707 /* The code is optimised for these values only */
708 if (DCTSIZE != 8)
709 return 0;
710 if (sizeof(JCOEF) != 2)
711 return 0;
712 if (sizeof(DCTELEM) != 2)
713 return 0;
714
Pierre Ossman74693862009-03-09 13:34:17 +0000715 if (simd_support & JSIMD_SSE2)
716 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000717 if (simd_support & JSIMD_MMX)
718 return 1;
719
Pierre Ossman9ad52342009-03-09 13:15:56 +0000720 return 0;
721}
722
723GLOBAL(int)
724jsimd_can_quantize_float (void)
725{
726 init_simd();
727
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000728 /* The code is optimised for these values only */
729 if (DCTSIZE != 8)
730 return 0;
731 if (sizeof(JCOEF) != 2)
732 return 0;
733 if (sizeof(FAST_FLOAT) != 4)
734 return 0;
735
Pierre Ossman74693862009-03-09 13:34:17 +0000736 if (simd_support & JSIMD_SSE2)
737 return 1;
Pierre Ossman0d37c572009-03-09 13:31:56 +0000738 if (simd_support & JSIMD_SSE)
739 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000740 if (simd_support & JSIMD_3DNOW)
741 return 1;
742
Pierre Ossman9ad52342009-03-09 13:15:56 +0000743 return 0;
744}
745
746GLOBAL(void)
747jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
748 DCTELEM * workspace)
749{
Pierre Ossman74693862009-03-09 13:34:17 +0000750 if (simd_support & JSIMD_SSE2)
751 jsimd_quantize_sse2(coef_block, divisors, workspace);
752 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000753 jsimd_quantize_mmx(coef_block, divisors, workspace);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000754}
755
756GLOBAL(void)
757jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
758 FAST_FLOAT * workspace)
759{
Pierre Ossman74693862009-03-09 13:34:17 +0000760 if (simd_support & JSIMD_SSE2)
761 jsimd_quantize_float_sse2(coef_block, divisors, workspace);
762 else if (simd_support & JSIMD_SSE)
Pierre Ossman0d37c572009-03-09 13:31:56 +0000763 jsimd_quantize_float_sse(coef_block, divisors, workspace);
764 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000765 jsimd_quantize_float_3dnow(coef_block, divisors, workspace);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000766}
767
768GLOBAL(int)
769jsimd_can_idct_2x2 (void)
770{
771 init_simd();
772
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000773 /* The code is optimised for these values only */
774 if (DCTSIZE != 8)
775 return 0;
776 if (sizeof(JCOEF) != 2)
777 return 0;
778 if (BITS_IN_JSAMPLE != 8)
779 return 0;
780 if (sizeof(JDIMENSION) != 4)
781 return 0;
782 if (sizeof(ISLOW_MULT_TYPE) != 2)
783 return 0;
784
Pierre Ossman74693862009-03-09 13:34:17 +0000785 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
786 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000787 if (simd_support & JSIMD_MMX)
788 return 1;
789
Pierre Ossman9ad52342009-03-09 13:15:56 +0000790 return 0;
791}
792
793GLOBAL(int)
794jsimd_can_idct_4x4 (void)
795{
796 init_simd();
797
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000798 /* The code is optimised for these values only */
799 if (DCTSIZE != 8)
800 return 0;
801 if (sizeof(JCOEF) != 2)
802 return 0;
803 if (BITS_IN_JSAMPLE != 8)
804 return 0;
805 if (sizeof(JDIMENSION) != 4)
806 return 0;
807 if (sizeof(ISLOW_MULT_TYPE) != 2)
808 return 0;
809
Pierre Ossman74693862009-03-09 13:34:17 +0000810 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
811 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000812 if (simd_support & JSIMD_MMX)
813 return 1;
814
Pierre Ossman9ad52342009-03-09 13:15:56 +0000815 return 0;
816}
817
818GLOBAL(void)
819jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
820 JCOEFPTR coef_block, JSAMPARRAY output_buf,
821 JDIMENSION output_col)
822{
Pierre Ossman74693862009-03-09 13:34:17 +0000823 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
824 jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col);
825 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000826 jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000827}
828
829GLOBAL(void)
830jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
831 JCOEFPTR coef_block, JSAMPARRAY output_buf,
832 JDIMENSION output_col)
833{
Pierre Ossman74693862009-03-09 13:34:17 +0000834 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
835 jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col);
836 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000837 jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000838}
839
840GLOBAL(int)
841jsimd_can_idct_islow (void)
842{
843 init_simd();
844
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000845 /* The code is optimised for these values only */
846 if (DCTSIZE != 8)
847 return 0;
848 if (sizeof(JCOEF) != 2)
849 return 0;
850 if (BITS_IN_JSAMPLE != 8)
851 return 0;
852 if (sizeof(JDIMENSION) != 4)
853 return 0;
854 if (sizeof(ISLOW_MULT_TYPE) != 2)
855 return 0;
856
Pierre Ossman74693862009-03-09 13:34:17 +0000857 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
858 return 1;
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000859 if (simd_support & JSIMD_MMX)
860 return 1;
861
Pierre Ossman9ad52342009-03-09 13:15:56 +0000862 return 0;
863}
864
865GLOBAL(int)
866jsimd_can_idct_ifast (void)
867{
868 init_simd();
869
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000870 /* The code is optimised for these values only */
871 if (DCTSIZE != 8)
872 return 0;
873 if (sizeof(JCOEF) != 2)
874 return 0;
875 if (BITS_IN_JSAMPLE != 8)
876 return 0;
877 if (sizeof(JDIMENSION) != 4)
878 return 0;
879 if (sizeof(IFAST_MULT_TYPE) != 2)
880 return 0;
881 if (IFAST_SCALE_BITS != 2)
882 return 0;
883
Pierre Ossman74693862009-03-09 13:34:17 +0000884 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_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_float (void)
894{
895 init_simd();
896
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000897 if (DCTSIZE != 8)
898 return 0;
899 if (sizeof(JCOEF) != 2)
900 return 0;
901 if (BITS_IN_JSAMPLE != 8)
902 return 0;
903 if (sizeof(JDIMENSION) != 4)
904 return 0;
905 if (sizeof(FAST_FLOAT) != 4)
906 return 0;
907 if (sizeof(FLOAT_MULT_TYPE) != 4)
908 return 0;
909
Pierre Ossman74693862009-03-09 13:34:17 +0000910 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
911 return 1;
Pierre Ossman0d37c572009-03-09 13:31:56 +0000912 if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
913 return 1;
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000914 if (simd_support & JSIMD_3DNOW)
915 return 1;
916
Pierre Ossman9ad52342009-03-09 13:15:56 +0000917 return 0;
918}
919
920GLOBAL(void)
921jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
922 JCOEFPTR coef_block, JSAMPARRAY output_buf,
923 JDIMENSION output_col)
924{
Pierre Ossman74693862009-03-09 13:34:17 +0000925 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
926 jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col);
927 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000928 jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000929}
930
931GLOBAL(void)
932jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
933 JCOEFPTR coef_block, JSAMPARRAY output_buf,
934 JDIMENSION output_col)
935{
Pierre Ossman74693862009-03-09 13:34:17 +0000936 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
937 jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col);
938 else if (simd_support & JSIMD_MMX)
Pierre Ossman3e0e2de2009-03-09 13:25:30 +0000939 jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000940}
941
942GLOBAL(void)
943jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
944 JCOEFPTR coef_block, JSAMPARRAY output_buf,
945 JDIMENSION output_col)
946{
Pierre Ossman74693862009-03-09 13:34:17 +0000947 if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
948 jsimd_idct_float_sse2(compptr->dct_table, coef_block,
949 output_buf, output_col);
950 else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
Pierre Ossman0d37c572009-03-09 13:31:56 +0000951 jsimd_idct_float_sse(compptr->dct_table, coef_block,
952 output_buf, output_col);
953 else if (simd_support & JSIMD_3DNOW)
Pierre Ossman2c2e54b2009-03-09 13:28:10 +0000954 jsimd_idct_float_3dnow(compptr->dct_table, coef_block,
955 output_buf, output_col);
Pierre Ossman9ad52342009-03-09 13:15:56 +0000956}
957