blob: e3807bb94f98a4ef8ded94bb3b13eda075107ba8 [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
5 * Copyright 2009-2011, 2014 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 * 64-bit x86 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
24static unsigned int simd_support = ~0;
25
26LOCAL(void)
27init_simd (void)
28{
29 char *env = NULL;
30
31 if (simd_support != ~0U)
32 return;
33
34 simd_support = JSIMD_ALTIVEC;
35
36 /* Force different settings through environment variables */
37 env = getenv("JSIMD_FORCENONE");
38 if ((env != NULL) && (strcmp(env, "1") == 0))
39 simd_support = 0;
40}
41
42GLOBAL(int)
43jsimd_can_rgb_ycc (void)
44{
45 return 0;
46}
47
48GLOBAL(int)
49jsimd_can_rgb_gray (void)
50{
51 return 0;
52}
53
54GLOBAL(int)
55jsimd_can_ycc_rgb (void)
56{
57 return 0;
58}
59
60GLOBAL(int)
61jsimd_can_ycc_rgb565 (void)
62{
63 return 0;
64}
65
66GLOBAL(void)
67jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
68 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
69 JDIMENSION output_row, int num_rows)
70{
71}
72
73GLOBAL(void)
74jsimd_rgb_gray_convert (j_compress_ptr cinfo,
75 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
76 JDIMENSION output_row, int num_rows)
77{
78}
79
80GLOBAL(void)
81jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
82 JSAMPIMAGE input_buf, JDIMENSION input_row,
83 JSAMPARRAY output_buf, int num_rows)
84{
85}
86
87GLOBAL(void)
88jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
89 JSAMPIMAGE input_buf, JDIMENSION input_row,
90 JSAMPARRAY output_buf, int num_rows)
91{
92}
93
94GLOBAL(int)
95jsimd_can_h2v2_downsample (void)
96{
97 return 0;
98}
99
100GLOBAL(int)
101jsimd_can_h2v1_downsample (void)
102{
103 return 0;
104}
105
106GLOBAL(void)
107jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
108 JSAMPARRAY input_data, JSAMPARRAY output_data)
109{
110}
111
112GLOBAL(void)
113jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
114 JSAMPARRAY input_data, JSAMPARRAY output_data)
115{
116}
117
118GLOBAL(int)
119jsimd_can_h2v2_upsample (void)
120{
121 return 0;
122}
123
124GLOBAL(int)
125jsimd_can_h2v1_upsample (void)
126{
127 return 0;
128}
129
130GLOBAL(void)
131jsimd_h2v2_upsample (j_decompress_ptr cinfo,
132 jpeg_component_info * compptr,
133 JSAMPARRAY input_data,
134 JSAMPARRAY * output_data_ptr)
135{
136}
137
138GLOBAL(void)
139jsimd_h2v1_upsample (j_decompress_ptr cinfo,
140 jpeg_component_info * compptr,
141 JSAMPARRAY input_data,
142 JSAMPARRAY * output_data_ptr)
143{
144}
145
146GLOBAL(int)
147jsimd_can_h2v2_fancy_upsample (void)
148{
149 return 0;
150}
151
152GLOBAL(int)
153jsimd_can_h2v1_fancy_upsample (void)
154{
155 return 0;
156}
157
158GLOBAL(void)
159jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
160 jpeg_component_info * compptr,
161 JSAMPARRAY input_data,
162 JSAMPARRAY * output_data_ptr)
163{
164}
165
166GLOBAL(void)
167jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
168 jpeg_component_info * compptr,
169 JSAMPARRAY input_data,
170 JSAMPARRAY * output_data_ptr)
171{
172}
173
174GLOBAL(int)
175jsimd_can_h2v2_merged_upsample (void)
176{
177 return 0;
178}
179
180GLOBAL(int)
181jsimd_can_h2v1_merged_upsample (void)
182{
183 return 0;
184}
185
186GLOBAL(void)
187jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
188 JSAMPIMAGE input_buf,
189 JDIMENSION in_row_group_ctr,
190 JSAMPARRAY output_buf)
191{
192}
193
194GLOBAL(void)
195jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
196 JSAMPIMAGE input_buf,
197 JDIMENSION in_row_group_ctr,
198 JSAMPARRAY output_buf)
199{
200}
201
202GLOBAL(int)
203jsimd_can_convsamp (void)
204{
205 return 0;
206}
207
208GLOBAL(int)
209jsimd_can_convsamp_float (void)
210{
211 return 0;
212}
213
214GLOBAL(void)
215jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
216 DCTELEM * workspace)
217{
218}
219
220GLOBAL(void)
221jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
222 FAST_FLOAT * workspace)
223{
224}
225
226GLOBAL(int)
227jsimd_can_fdct_islow (void)
228{
DRCfb0c3942014-12-17 08:04:39 +0000229 init_simd();
230
231 /* The code is optimised for these values only */
232 if (DCTSIZE != 8)
233 return 0;
234 if (sizeof(DCTELEM) != 2)
235 return 0;
236
237 if (simd_support & JSIMD_ALTIVEC)
238 return 1;
239
DRCcd2d8e12014-09-05 06:33:42 +0000240 return 0;
241}
242
243GLOBAL(int)
244jsimd_can_fdct_ifast (void)
245{
246 init_simd();
247
248 /* The code is optimised for these values only */
249 if (DCTSIZE != 8)
250 return 0;
251 if (sizeof(DCTELEM) != 2)
252 return 0;
253
254 if (simd_support & JSIMD_ALTIVEC)
255 return 1;
256
257 return 0;
258}
259
260GLOBAL(int)
261jsimd_can_fdct_float (void)
262{
263 return 0;
264}
265
266GLOBAL(void)
267jsimd_fdct_islow (DCTELEM * data)
268{
DRCfb0c3942014-12-17 08:04:39 +0000269 jsimd_fdct_islow_altivec(data);
DRCcd2d8e12014-09-05 06:33:42 +0000270}
271
272GLOBAL(void)
273jsimd_fdct_ifast (DCTELEM * data)
274{
275 jsimd_fdct_ifast_altivec(data);
276}
277
278GLOBAL(void)
279jsimd_fdct_float (FAST_FLOAT * data)
280{
281}
282
283GLOBAL(int)
284jsimd_can_quantize (void)
285{
286 return 0;
287}
288
289GLOBAL(int)
290jsimd_can_quantize_float (void)
291{
292 return 0;
293}
294
295GLOBAL(void)
296jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
297 DCTELEM * workspace)
298{
299}
300
301GLOBAL(void)
302jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
303 FAST_FLOAT * workspace)
304{
305}
306
307GLOBAL(int)
308jsimd_can_idct_2x2 (void)
309{
310 return 0;
311}
312
313GLOBAL(int)
314jsimd_can_idct_4x4 (void)
315{
316 return 0;
317}
318
319GLOBAL(void)
320jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
321 JCOEFPTR coef_block, JSAMPARRAY output_buf,
322 JDIMENSION output_col)
323{
324}
325
326GLOBAL(void)
327jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
328 JCOEFPTR coef_block, JSAMPARRAY output_buf,
329 JDIMENSION output_col)
330{
331}
332
333GLOBAL(int)
334jsimd_can_idct_islow (void)
335{
DRC06911622014-12-20 01:17:39 +0000336 init_simd();
337
338 /* The code is optimised for these values only */
339 if (DCTSIZE != 8)
340 return 0;
DRCbf8a5fe2014-12-22 01:10:11 +0000341 if (sizeof(JCOEF) != 2)
DRC06911622014-12-20 01:17:39 +0000342 return 0;
343
344 if (simd_support & JSIMD_ALTIVEC)
345 return 1;
346
DRCcd2d8e12014-09-05 06:33:42 +0000347 return 0;
348}
349
350GLOBAL(int)
351jsimd_can_idct_ifast (void)
352{
DRC6cb7f402014-12-18 10:12:29 +0000353 init_simd();
354
355 /* The code is optimised for these values only */
356 if (DCTSIZE != 8)
357 return 0;
DRCbf8a5fe2014-12-22 01:10:11 +0000358 if (sizeof(JCOEF) != 2)
DRC6cb7f402014-12-18 10:12:29 +0000359 return 0;
360
361 if (simd_support & JSIMD_ALTIVEC)
362 return 1;
363
DRCcd2d8e12014-09-05 06:33:42 +0000364 return 0;
365}
366
367GLOBAL(int)
368jsimd_can_idct_float (void)
369{
370 return 0;
371}
372
373GLOBAL(void)
374jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
375 JCOEFPTR coef_block, JSAMPARRAY output_buf,
376 JDIMENSION output_col)
377{
DRC06911622014-12-20 01:17:39 +0000378 jsimd_idct_islow_altivec(compptr->dct_table, coef_block, output_buf,
379 output_col);
DRCcd2d8e12014-09-05 06:33:42 +0000380}
381
382GLOBAL(void)
383jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
384 JCOEFPTR coef_block, JSAMPARRAY output_buf,
385 JDIMENSION output_col)
386{
DRC6cb7f402014-12-18 10:12:29 +0000387 jsimd_idct_ifast_altivec(compptr->dct_table, coef_block, output_buf,
388 output_col);
DRCcd2d8e12014-09-05 06:33:42 +0000389}
390
391GLOBAL(void)
392jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
393 JCOEFPTR coef_block, JSAMPARRAY output_buf,
394 JDIMENSION output_col)
395{
396}