blob: afbaa821b65a33eec585dc30c61491384bc216dc [file] [log] [blame]
DRCcd2d8e12014-09-05 06:33:42 +00001/*
DRCbf8a5fe2014-12-22 01:10:11 +00002 * jsimd_powerpc.c
DRCcd2d8e12014-09-05 06:33:42 +00003 *
4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
DRC52a4ec62015-01-13 09:02:29 +00005 * Copyright 2009-2011, 2014-2015 D. R. Commander
DRCf3a86842016-01-07 00:19:43 -06006 * Copyright 2015 Matthieu Darbois
DRCcd2d8e12014-09-05 06:33:42 +00007 *
8 * Based on the x86 SIMD extension for IJG JPEG library,
9 * Copyright (C) 1999-2006, MIYASAKA Masaru.
10 * For conditions of distribution and use, see copyright notice in jsimdext.inc
11 *
12 * This file contains the interface between the "normal" portions
13 * of the library and the SIMD implementations when running on a
DRC22048202015-01-08 06:18:33 +000014 * PowerPC architecture.
DRCcd2d8e12014-09-05 06:33:42 +000015 */
16
17#define JPEG_INTERNALS
18#include "../jinclude.h"
19#include "../jpeglib.h"
20#include "../jsimd.h"
21#include "../jdct.h"
22#include "../jsimddct.h"
23#include "jsimd.h"
24
25static unsigned int simd_support = ~0;
26
27LOCAL(void)
28init_simd (void)
29{
30 char *env = NULL;
31
32 if (simd_support != ~0U)
33 return;
34
35 simd_support = JSIMD_ALTIVEC;
36
37 /* Force different settings through environment variables */
38 env = getenv("JSIMD_FORCENONE");
39 if ((env != NULL) && (strcmp(env, "1") == 0))
40 simd_support = 0;
41}
42
43GLOBAL(int)
44jsimd_can_rgb_ycc (void)
45{
DRC62bae202014-12-22 13:42:26 +000046 init_simd();
47
48 /* The code is optimised for these values only */
49 if (BITS_IN_JSAMPLE != 8)
50 return 0;
51 if (sizeof(JDIMENSION) != 4)
52 return 0;
53 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
54 return 0;
55
56 if (simd_support & JSIMD_ALTIVEC)
57 return 1;
58
DRCcd2d8e12014-09-05 06:33:42 +000059 return 0;
60}
61
62GLOBAL(int)
63jsimd_can_rgb_gray (void)
64{
DRCb1fec4f2014-12-22 14:10:33 +000065 init_simd();
66
67 /* The code is optimised for these values only */
68 if (BITS_IN_JSAMPLE != 8)
69 return 0;
70 if (sizeof(JDIMENSION) != 4)
71 return 0;
72 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
73 return 0;
74
75 if (simd_support & JSIMD_ALTIVEC)
76 return 1;
77
DRCcd2d8e12014-09-05 06:33:42 +000078 return 0;
79}
80
81GLOBAL(int)
82jsimd_can_ycc_rgb (void)
83{
DRCac4daa72015-01-10 22:56:26 +000084 init_simd();
85
86 /* The code is optimised for these values only */
87 if (BITS_IN_JSAMPLE != 8)
88 return 0;
89 if (sizeof(JDIMENSION) != 4)
90 return 0;
91 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
92 return 0;
93
94 if (simd_support & JSIMD_ALTIVEC)
95 return 1;
96
DRCcd2d8e12014-09-05 06:33:42 +000097 return 0;
98}
99
100GLOBAL(int)
101jsimd_can_ycc_rgb565 (void)
102{
103 return 0;
104}
105
106GLOBAL(void)
107jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
108 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
109 JDIMENSION output_row, int num_rows)
110{
DRC62bae202014-12-22 13:42:26 +0000111 void (*altivecfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
112
113 switch(cinfo->in_color_space) {
114 case JCS_EXT_RGB:
115 altivecfct=jsimd_extrgb_ycc_convert_altivec;
116 break;
117 case JCS_EXT_RGBX:
118 case JCS_EXT_RGBA:
119 altivecfct=jsimd_extrgbx_ycc_convert_altivec;
120 break;
121 case JCS_EXT_BGR:
122 altivecfct=jsimd_extbgr_ycc_convert_altivec;
123 break;
124 case JCS_EXT_BGRX:
125 case JCS_EXT_BGRA:
126 altivecfct=jsimd_extbgrx_ycc_convert_altivec;
127 break;
128 case JCS_EXT_XBGR:
129 case JCS_EXT_ABGR:
130 altivecfct=jsimd_extxbgr_ycc_convert_altivec;
131 break;
132 case JCS_EXT_XRGB:
133 case JCS_EXT_ARGB:
134 altivecfct=jsimd_extxrgb_ycc_convert_altivec;
135 break;
136 default:
137 altivecfct=jsimd_rgb_ycc_convert_altivec;
138 break;
139 }
140
141 altivecfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
DRCcd2d8e12014-09-05 06:33:42 +0000142}
143
144GLOBAL(void)
145jsimd_rgb_gray_convert (j_compress_ptr cinfo,
146 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
147 JDIMENSION output_row, int num_rows)
148{
DRCb1fec4f2014-12-22 14:10:33 +0000149 void (*altivecfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
150
151 switch(cinfo->in_color_space) {
152 case JCS_EXT_RGB:
153 altivecfct=jsimd_extrgb_gray_convert_altivec;
154 break;
155 case JCS_EXT_RGBX:
156 case JCS_EXT_RGBA:
157 altivecfct=jsimd_extrgbx_gray_convert_altivec;
158 break;
159 case JCS_EXT_BGR:
160 altivecfct=jsimd_extbgr_gray_convert_altivec;
161 break;
162 case JCS_EXT_BGRX:
163 case JCS_EXT_BGRA:
164 altivecfct=jsimd_extbgrx_gray_convert_altivec;
165 break;
166 case JCS_EXT_XBGR:
167 case JCS_EXT_ABGR:
168 altivecfct=jsimd_extxbgr_gray_convert_altivec;
169 break;
170 case JCS_EXT_XRGB:
171 case JCS_EXT_ARGB:
172 altivecfct=jsimd_extxrgb_gray_convert_altivec;
173 break;
174 default:
175 altivecfct=jsimd_rgb_gray_convert_altivec;
176 break;
177 }
178
179 altivecfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
DRCcd2d8e12014-09-05 06:33:42 +0000180}
181
182GLOBAL(void)
183jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
184 JSAMPIMAGE input_buf, JDIMENSION input_row,
185 JSAMPARRAY output_buf, int num_rows)
186{
DRCac4daa72015-01-10 22:56:26 +0000187 void (*altivecfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
188
189 switch(cinfo->out_color_space) {
190 case JCS_EXT_RGB:
191 altivecfct=jsimd_ycc_extrgb_convert_altivec;
192 break;
193 case JCS_EXT_RGBX:
194 case JCS_EXT_RGBA:
195 altivecfct=jsimd_ycc_extrgbx_convert_altivec;
196 break;
197 case JCS_EXT_BGR:
198 altivecfct=jsimd_ycc_extbgr_convert_altivec;
199 break;
200 case JCS_EXT_BGRX:
201 case JCS_EXT_BGRA:
202 altivecfct=jsimd_ycc_extbgrx_convert_altivec;
203 break;
204 case JCS_EXT_XBGR:
205 case JCS_EXT_ABGR:
206 altivecfct=jsimd_ycc_extxbgr_convert_altivec;
207 break;
208 case JCS_EXT_XRGB:
209 case JCS_EXT_ARGB:
210 altivecfct=jsimd_ycc_extxrgb_convert_altivec;
211 break;
212 default:
213 altivecfct=jsimd_ycc_rgb_convert_altivec;
214 break;
215 }
216
217 altivecfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
DRCcd2d8e12014-09-05 06:33:42 +0000218}
219
220GLOBAL(void)
221jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
222 JSAMPIMAGE input_buf, JDIMENSION input_row,
223 JSAMPARRAY output_buf, int num_rows)
224{
225}
226
227GLOBAL(int)
228jsimd_can_h2v2_downsample (void)
229{
DRC22048202015-01-08 06:18:33 +0000230 init_simd();
231
232 /* The code is optimised for these values only */
233 if (BITS_IN_JSAMPLE != 8)
234 return 0;
235 if (sizeof(JDIMENSION) != 4)
236 return 0;
237
238 if (simd_support & JSIMD_ALTIVEC)
239 return 1;
240
DRCcd2d8e12014-09-05 06:33:42 +0000241 return 0;
242}
243
244GLOBAL(int)
245jsimd_can_h2v1_downsample (void)
246{
DRC22048202015-01-08 06:18:33 +0000247 init_simd();
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 if (simd_support & JSIMD_ALTIVEC)
256 return 1;
257
DRCcd2d8e12014-09-05 06:33:42 +0000258 return 0;
259}
260
261GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600262jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000263 JSAMPARRAY input_data, JSAMPARRAY output_data)
264{
DRC22048202015-01-08 06:18:33 +0000265 jsimd_h2v2_downsample_altivec(cinfo->image_width, cinfo->max_v_samp_factor,
266 compptr->v_samp_factor,
267 compptr->width_in_blocks,
268 input_data, output_data);
DRCcd2d8e12014-09-05 06:33:42 +0000269}
270
271GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600272jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000273 JSAMPARRAY input_data, JSAMPARRAY output_data)
274{
DRC22048202015-01-08 06:18:33 +0000275 jsimd_h2v1_downsample_altivec(cinfo->image_width, cinfo->max_v_samp_factor,
276 compptr->v_samp_factor,
277 compptr->width_in_blocks,
278 input_data, output_data);
DRCcd2d8e12014-09-05 06:33:42 +0000279}
280
281GLOBAL(int)
282jsimd_can_h2v2_upsample (void)
283{
DRCc641cdd2015-01-14 15:41:11 +0000284 init_simd();
285
286 /* The code is optimised for these values only */
287 if (BITS_IN_JSAMPLE != 8)
288 return 0;
289 if (sizeof(JDIMENSION) != 4)
290 return 0;
291
292 if (simd_support & JSIMD_ALTIVEC)
293 return 1;
294
DRCcd2d8e12014-09-05 06:33:42 +0000295 return 0;
296}
297
298GLOBAL(int)
299jsimd_can_h2v1_upsample (void)
300{
DRCc641cdd2015-01-14 15:41:11 +0000301 init_simd();
302
303 /* The code is optimised for these values only */
304 if (BITS_IN_JSAMPLE != 8)
305 return 0;
306 if (sizeof(JDIMENSION) != 4)
307 return 0;
308
309 if (simd_support & JSIMD_ALTIVEC)
310 return 1;
311
DRCcd2d8e12014-09-05 06:33:42 +0000312 return 0;
313}
314
315GLOBAL(void)
316jsimd_h2v2_upsample (j_decompress_ptr cinfo,
DRCbd498032016-02-19 08:53:33 -0600317 jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000318 JSAMPARRAY input_data,
DRCbd498032016-02-19 08:53:33 -0600319 JSAMPARRAY *output_data_ptr)
DRCcd2d8e12014-09-05 06:33:42 +0000320{
DRCc641cdd2015-01-14 15:41:11 +0000321 jsimd_h2v2_upsample_altivec(cinfo->max_v_samp_factor, cinfo->output_width,
322 input_data, output_data_ptr);
DRCcd2d8e12014-09-05 06:33:42 +0000323}
324
325GLOBAL(void)
326jsimd_h2v1_upsample (j_decompress_ptr cinfo,
DRCbd498032016-02-19 08:53:33 -0600327 jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000328 JSAMPARRAY input_data,
DRCbd498032016-02-19 08:53:33 -0600329 JSAMPARRAY *output_data_ptr)
DRCcd2d8e12014-09-05 06:33:42 +0000330{
DRCc641cdd2015-01-14 15:41:11 +0000331 jsimd_h2v1_upsample_altivec(cinfo->max_v_samp_factor, cinfo->output_width,
332 input_data, output_data_ptr);
DRCcd2d8e12014-09-05 06:33:42 +0000333}
334
335GLOBAL(int)
336jsimd_can_h2v2_fancy_upsample (void)
337{
DRC52a4ec62015-01-13 09:02:29 +0000338 init_simd();
339
340 /* The code is optimised for these values only */
341 if (BITS_IN_JSAMPLE != 8)
342 return 0;
343 if (sizeof(JDIMENSION) != 4)
344 return 0;
345
346 if (simd_support & JSIMD_ALTIVEC)
347 return 1;
348
DRCcd2d8e12014-09-05 06:33:42 +0000349 return 0;
350}
351
352GLOBAL(int)
353jsimd_can_h2v1_fancy_upsample (void)
354{
DRC52a4ec62015-01-13 09:02:29 +0000355 init_simd();
356
357 /* The code is optimised for these values only */
358 if (BITS_IN_JSAMPLE != 8)
359 return 0;
360 if (sizeof(JDIMENSION) != 4)
361 return 0;
362
363 if (simd_support & JSIMD_ALTIVEC)
364 return 1;
365
DRCcd2d8e12014-09-05 06:33:42 +0000366 return 0;
367}
368
369GLOBAL(void)
370jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
DRCbd498032016-02-19 08:53:33 -0600371 jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000372 JSAMPARRAY input_data,
DRCbd498032016-02-19 08:53:33 -0600373 JSAMPARRAY *output_data_ptr)
DRCcd2d8e12014-09-05 06:33:42 +0000374{
DRC52a4ec62015-01-13 09:02:29 +0000375 jsimd_h2v2_fancy_upsample_altivec(cinfo->max_v_samp_factor,
376 compptr->downsampled_width, input_data,
377 output_data_ptr);
DRCcd2d8e12014-09-05 06:33:42 +0000378}
379
380GLOBAL(void)
381jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
DRCbd498032016-02-19 08:53:33 -0600382 jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000383 JSAMPARRAY input_data,
DRCbd498032016-02-19 08:53:33 -0600384 JSAMPARRAY *output_data_ptr)
DRCcd2d8e12014-09-05 06:33:42 +0000385{
DRC52a4ec62015-01-13 09:02:29 +0000386 jsimd_h2v1_fancy_upsample_altivec(cinfo->max_v_samp_factor,
387 compptr->downsampled_width, input_data,
388 output_data_ptr);
DRCcd2d8e12014-09-05 06:33:42 +0000389}
390
391GLOBAL(int)
392jsimd_can_h2v2_merged_upsample (void)
393{
DRC86af36a2015-01-14 13:27:32 +0000394 init_simd();
395
396 /* The code is optimised for these values only */
397 if (BITS_IN_JSAMPLE != 8)
398 return 0;
399 if (sizeof(JDIMENSION) != 4)
400 return 0;
401
402 if (simd_support & JSIMD_ALTIVEC)
403 return 1;
404
DRCcd2d8e12014-09-05 06:33:42 +0000405 return 0;
406}
407
408GLOBAL(int)
409jsimd_can_h2v1_merged_upsample (void)
410{
DRC86af36a2015-01-14 13:27:32 +0000411 init_simd();
412
413 /* 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
419 if (simd_support & JSIMD_ALTIVEC)
420 return 1;
421
DRCcd2d8e12014-09-05 06:33:42 +0000422 return 0;
423}
424
425GLOBAL(void)
426jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
427 JSAMPIMAGE input_buf,
428 JDIMENSION in_row_group_ctr,
429 JSAMPARRAY output_buf)
430{
DRC86af36a2015-01-14 13:27:32 +0000431 void (*altivecfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
432
433 switch(cinfo->out_color_space) {
434 case JCS_EXT_RGB:
435 altivecfct=jsimd_h2v2_extrgb_merged_upsample_altivec;
436 break;
437 case JCS_EXT_RGBX:
438 case JCS_EXT_RGBA:
439 altivecfct=jsimd_h2v2_extrgbx_merged_upsample_altivec;
440 break;
441 case JCS_EXT_BGR:
442 altivecfct=jsimd_h2v2_extbgr_merged_upsample_altivec;
443 break;
444 case JCS_EXT_BGRX:
445 case JCS_EXT_BGRA:
446 altivecfct=jsimd_h2v2_extbgrx_merged_upsample_altivec;
447 break;
448 case JCS_EXT_XBGR:
449 case JCS_EXT_ABGR:
450 altivecfct=jsimd_h2v2_extxbgr_merged_upsample_altivec;
451 break;
452 case JCS_EXT_XRGB:
453 case JCS_EXT_ARGB:
454 altivecfct=jsimd_h2v2_extxrgb_merged_upsample_altivec;
455 break;
456 default:
457 altivecfct=jsimd_h2v2_merged_upsample_altivec;
458 break;
459 }
460
461 altivecfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
DRCcd2d8e12014-09-05 06:33:42 +0000462}
463
464GLOBAL(void)
465jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
466 JSAMPIMAGE input_buf,
467 JDIMENSION in_row_group_ctr,
468 JSAMPARRAY output_buf)
469{
DRC86af36a2015-01-14 13:27:32 +0000470 void (*altivecfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
471
472 switch(cinfo->out_color_space) {
473 case JCS_EXT_RGB:
474 altivecfct=jsimd_h2v1_extrgb_merged_upsample_altivec;
475 break;
476 case JCS_EXT_RGBX:
477 case JCS_EXT_RGBA:
478 altivecfct=jsimd_h2v1_extrgbx_merged_upsample_altivec;
479 break;
480 case JCS_EXT_BGR:
481 altivecfct=jsimd_h2v1_extbgr_merged_upsample_altivec;
482 break;
483 case JCS_EXT_BGRX:
484 case JCS_EXT_BGRA:
485 altivecfct=jsimd_h2v1_extbgrx_merged_upsample_altivec;
486 break;
487 case JCS_EXT_XBGR:
488 case JCS_EXT_ABGR:
489 altivecfct=jsimd_h2v1_extxbgr_merged_upsample_altivec;
490 break;
491 case JCS_EXT_XRGB:
492 case JCS_EXT_ARGB:
493 altivecfct=jsimd_h2v1_extxrgb_merged_upsample_altivec;
494 break;
495 default:
496 altivecfct=jsimd_h2v1_merged_upsample_altivec;
497 break;
498 }
499
500 altivecfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
DRCcd2d8e12014-09-05 06:33:42 +0000501}
502
503GLOBAL(int)
504jsimd_can_convsamp (void)
505{
DRC577ecd92014-12-23 04:14:54 +0000506 init_simd();
507
508 /* The code is optimised for these values only */
509 if (DCTSIZE != 8)
510 return 0;
511 if (BITS_IN_JSAMPLE != 8)
512 return 0;
513 if (sizeof(JDIMENSION) != 4)
514 return 0;
515 if (sizeof(DCTELEM) != 2)
516 return 0;
517
518 if (simd_support & JSIMD_ALTIVEC)
519 return 1;
520
DRCcd2d8e12014-09-05 06:33:42 +0000521 return 0;
522}
523
524GLOBAL(int)
525jsimd_can_convsamp_float (void)
526{
527 return 0;
528}
529
530GLOBAL(void)
531jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
DRCbd498032016-02-19 08:53:33 -0600532 DCTELEM *workspace)
DRCcd2d8e12014-09-05 06:33:42 +0000533{
DRC577ecd92014-12-23 04:14:54 +0000534 jsimd_convsamp_altivec(sample_data, start_col, workspace);
DRCcd2d8e12014-09-05 06:33:42 +0000535}
536
537GLOBAL(void)
538jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
DRCbd498032016-02-19 08:53:33 -0600539 FAST_FLOAT *workspace)
DRCcd2d8e12014-09-05 06:33:42 +0000540{
541}
542
543GLOBAL(int)
544jsimd_can_fdct_islow (void)
545{
DRCfb0c3942014-12-17 08:04:39 +0000546 init_simd();
547
548 /* The code is optimised for these values only */
549 if (DCTSIZE != 8)
550 return 0;
551 if (sizeof(DCTELEM) != 2)
552 return 0;
553
554 if (simd_support & JSIMD_ALTIVEC)
555 return 1;
556
DRCcd2d8e12014-09-05 06:33:42 +0000557 return 0;
558}
559
560GLOBAL(int)
561jsimd_can_fdct_ifast (void)
562{
563 init_simd();
564
565 /* The code is optimised for these values only */
566 if (DCTSIZE != 8)
567 return 0;
568 if (sizeof(DCTELEM) != 2)
569 return 0;
570
571 if (simd_support & JSIMD_ALTIVEC)
572 return 1;
573
574 return 0;
575}
576
577GLOBAL(int)
578jsimd_can_fdct_float (void)
579{
580 return 0;
581}
582
583GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600584jsimd_fdct_islow (DCTELEM *data)
DRCcd2d8e12014-09-05 06:33:42 +0000585{
DRCfb0c3942014-12-17 08:04:39 +0000586 jsimd_fdct_islow_altivec(data);
DRCcd2d8e12014-09-05 06:33:42 +0000587}
588
589GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600590jsimd_fdct_ifast (DCTELEM *data)
DRCcd2d8e12014-09-05 06:33:42 +0000591{
592 jsimd_fdct_ifast_altivec(data);
593}
594
595GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600596jsimd_fdct_float (FAST_FLOAT *data)
DRCcd2d8e12014-09-05 06:33:42 +0000597{
598}
599
600GLOBAL(int)
601jsimd_can_quantize (void)
602{
DRC577ecd92014-12-23 04:14:54 +0000603 init_simd();
604
605 /* The code is optimised for these values only */
606 if (DCTSIZE != 8)
607 return 0;
608 if (sizeof(JCOEF) != 2)
609 return 0;
610 if (sizeof(DCTELEM) != 2)
611 return 0;
612
613 if (simd_support & JSIMD_ALTIVEC)
614 return 1;
615
DRCcd2d8e12014-09-05 06:33:42 +0000616 return 0;
617}
618
619GLOBAL(int)
620jsimd_can_quantize_float (void)
621{
622 return 0;
623}
624
625GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600626jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors,
627 DCTELEM *workspace)
DRCcd2d8e12014-09-05 06:33:42 +0000628{
DRC577ecd92014-12-23 04:14:54 +0000629 jsimd_quantize_altivec(coef_block, divisors, workspace);
DRCcd2d8e12014-09-05 06:33:42 +0000630}
631
632GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600633jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors,
634 FAST_FLOAT *workspace)
DRCcd2d8e12014-09-05 06:33:42 +0000635{
636}
637
638GLOBAL(int)
639jsimd_can_idct_2x2 (void)
640{
641 return 0;
642}
643
644GLOBAL(int)
645jsimd_can_idct_4x4 (void)
646{
647 return 0;
648}
649
650GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600651jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000652 JCOEFPTR coef_block, JSAMPARRAY output_buf,
653 JDIMENSION output_col)
654{
655}
656
657GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600658jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000659 JCOEFPTR coef_block, JSAMPARRAY output_buf,
660 JDIMENSION output_col)
661{
662}
663
664GLOBAL(int)
665jsimd_can_idct_islow (void)
666{
DRC06911622014-12-20 01:17:39 +0000667 init_simd();
668
669 /* The code is optimised for these values only */
670 if (DCTSIZE != 8)
671 return 0;
DRCbf8a5fe2014-12-22 01:10:11 +0000672 if (sizeof(JCOEF) != 2)
DRC06911622014-12-20 01:17:39 +0000673 return 0;
674
675 if (simd_support & JSIMD_ALTIVEC)
676 return 1;
677
DRCcd2d8e12014-09-05 06:33:42 +0000678 return 0;
679}
680
681GLOBAL(int)
682jsimd_can_idct_ifast (void)
683{
DRC6cb7f402014-12-18 10:12:29 +0000684 init_simd();
685
686 /* The code is optimised for these values only */
687 if (DCTSIZE != 8)
688 return 0;
DRCbf8a5fe2014-12-22 01:10:11 +0000689 if (sizeof(JCOEF) != 2)
DRC6cb7f402014-12-18 10:12:29 +0000690 return 0;
691
692 if (simd_support & JSIMD_ALTIVEC)
693 return 1;
694
DRCcd2d8e12014-09-05 06:33:42 +0000695 return 0;
696}
697
698GLOBAL(int)
699jsimd_can_idct_float (void)
700{
701 return 0;
702}
703
704GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600705jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000706 JCOEFPTR coef_block, JSAMPARRAY output_buf,
707 JDIMENSION output_col)
708{
DRC06911622014-12-20 01:17:39 +0000709 jsimd_idct_islow_altivec(compptr->dct_table, coef_block, output_buf,
710 output_col);
DRCcd2d8e12014-09-05 06:33:42 +0000711}
712
713GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600714jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000715 JCOEFPTR coef_block, JSAMPARRAY output_buf,
716 JDIMENSION output_col)
717{
DRC6cb7f402014-12-18 10:12:29 +0000718 jsimd_idct_ifast_altivec(compptr->dct_table, coef_block, output_buf,
719 output_col);
DRCcd2d8e12014-09-05 06:33:42 +0000720}
721
722GLOBAL(void)
DRCbd498032016-02-19 08:53:33 -0600723jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
DRCcd2d8e12014-09-05 06:33:42 +0000724 JCOEFPTR coef_block, JSAMPARRAY output_buf,
725 JDIMENSION output_col)
726{
727}
DRCf3a86842016-01-07 00:19:43 -0600728
729GLOBAL(int)
730jsimd_can_huff_encode_one_block (void)
731{
732 return 0;
733}
734
735GLOBAL(JOCTET*)
DRCbd498032016-02-19 08:53:33 -0600736jsimd_huff_encode_one_block (void *state, JOCTET *buffer, JCOEFPTR block,
DRCf3a86842016-01-07 00:19:43 -0600737 int last_dc_val, c_derived_tbl *dctbl,
738 c_derived_tbl *actbl)
739{
740 return NULL;
741}