Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: simd/jsimd_arm64.c

Issue 434123003: Add ARM64 SIMD support to libjpeg_turbo (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/libjpeg_turbo
Patch Set: Add neon fixes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « libjpeg.gyp ('k') | simd/jsimd_arm64_neon.S » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * jsimd_arm.c 2 * jsimd_arm64.c
3 * 3 *
4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB 4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
5 * Copyright 2009-2011 D. R. Commander 5 * Copyright 2009-2011, 2013-2014 D. R. Commander
6 * 6 *
7 * Based on the x86 SIMD extension for IJG JPEG library, 7 * Based on the x86 SIMD extension for IJG JPEG library,
8 * Copyright (C) 1999-2006, MIYASAKA Masaru. 8 * Copyright (C) 1999-2006, MIYASAKA Masaru.
9 * For conditions of distribution and use, see copyright notice in jsimdext.inc 9 * For conditions of distribution and use, see copyright notice in jsimdext.inc
10 * 10 *
11 * This file contains the interface between the "normal" portions 11 * This file contains the interface between the "normal" portions
12 * of the library and the SIMD implementations when running on 12 * of the library and the SIMD implementations when running on a
13 * ARM architecture. 13 * 64-bit ARM architecture.
14 *
15 * Based on the stubs from 'jsimd_none.c'
16 */ 14 */
17 15
18 #define JPEG_INTERNALS 16 #define JPEG_INTERNALS
19 #include "../jinclude.h" 17 #include "../jinclude.h"
20 #include "../jpeglib.h" 18 #include "../jpeglib.h"
21 #include "../jsimd.h" 19 #include "../jsimd.h"
22 #include "../jdct.h" 20 #include "../jdct.h"
23 #include "../jsimddct.h" 21 #include "../jsimddct.h"
24 #include "jsimd.h" 22 #include "jsimd.h"
25 23
26 #include <stdio.h> 24 #include <stdio.h>
27 #include <string.h> 25 #include <string.h>
28 #include <ctype.h> 26 #include <ctype.h>
29 27
30 static unsigned int simd_support = ~0; 28 static unsigned int simd_support = ~0;
31 29
32 #if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
33
34 #define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024)
35
36 LOCAL(int)
37 check_feature (char *buffer, char *feature)
38 {
39 char *p;
40 if (*feature == 0)
41 return 0;
42 if (strncmp(buffer, "Features", 8) != 0)
43 return 0;
44 buffer += 8;
45 while (isspace(*buffer))
46 buffer++;
47
48 /* Check if 'feature' is present in the buffer as a separate word */
49 while ((p = strstr(buffer, feature))) {
50 if (p > buffer && !isspace(*(p - 1))) {
51 buffer++;
52 continue;
53 }
54 p += strlen(feature);
55 if (*p != 0 && !isspace(*p)) {
56 buffer++;
57 continue;
58 }
59 return 1;
60 }
61 return 0;
62 }
63
64 LOCAL(int)
65 parse_proc_cpuinfo (int bufsize)
66 {
67 char *buffer = (char *)malloc(bufsize);
68 FILE *fd;
69 simd_support = 0;
70
71 if (!buffer)
72 return 0;
73
74 fd = fopen("/proc/cpuinfo", "r");
75 if (fd) {
76 while (fgets(buffer, bufsize, fd)) {
77 if (!strchr(buffer, '\n') && !feof(fd)) {
78 /* "impossible" happened - insufficient size of the buffer! */
79 fclose(fd);
80 free(buffer);
81 return 0;
82 }
83 if (check_feature(buffer, "neon"))
84 simd_support |= JSIMD_ARM_NEON;
85 }
86 fclose(fd);
87 }
88 free(buffer);
89 return 1;
90 }
91
92 #endif
93
94 /* 30 /*
95 * Check what SIMD accelerations are supported. 31 * Check what SIMD accelerations are supported.
96 * 32 *
97 * FIXME: This code is racy under a multi-threaded environment. 33 * FIXME: This code is racy under a multi-threaded environment.
98 */ 34 */
35
36 /*
37 * ARMv8 architectures support NEON extensions by default.
38 * It is no longer optional as it was with ARMv7.
39 */
40
41
99 LOCAL(void) 42 LOCAL(void)
100 init_simd (void) 43 init_simd (void)
101 { 44 {
102 char *env = NULL; 45 char *env = NULL;
103 #if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined( __ANDROID__)
104 int bufsize = 1024; /* an initial guess for the line buffer size limit */
105 #endif
106 46
107 if (simd_support != ~0U) 47 if (simd_support != ~0U)
108 return; 48 return;
109 49
110 simd_support = 0; 50 simd_support = 0;
111 51
112 #if defined(__ARM_NEON__)
113 simd_support |= JSIMD_ARM_NEON; 52 simd_support |= JSIMD_ARM_NEON;
114 #elif defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
115 /* We still have a chance to use NEON regardless of globally used
116 * -mcpu/-mfpu options passed to gcc by performing runtime detection via
117 * /proc/cpuinfo parsing on linux/android */
118 while (!parse_proc_cpuinfo(bufsize)) {
119 bufsize *= 2;
120 if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
121 break;
122 }
123 #endif
124 53
125 /* Force different settings through environment variables */ 54 /* Force different settings through environment variables */
126 env = getenv("JSIMD_FORCE_ARM_NEON"); 55 env = getenv("JSIMD_FORCENEON");
127 if ((env != NULL) && (strcmp(env, "1") == 0)) 56 if ((env != NULL) && (strcmp(env, "1") == 0))
128 simd_support &= JSIMD_ARM_NEON; 57 simd_support &= JSIMD_ARM_NEON;
129 env = getenv("JSIMD_FORCE_NO_SIMD"); 58 env = getenv("JSIMD_FORCENONE");
130 if ((env != NULL) && (strcmp(env, "1") == 0)) 59 if ((env != NULL) && (strcmp(env, "1") == 0))
131 simd_support = 0; 60 simd_support = 0;
132 } 61 }
133 62
134 GLOBAL(int) 63 GLOBAL(int)
135 jsimd_can_rgb_ycc (void) 64 jsimd_can_rgb_ycc (void)
136 { 65 {
137 init_simd(); 66 init_simd();
138 67
139 /* The code is optimised for these values only */
140 if (BITS_IN_JSAMPLE != 8)
141 return 0;
142 if (sizeof(JDIMENSION) != 4)
143 return 0;
144 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
145 return 0;
146
147 if (simd_support & JSIMD_ARM_NEON)
148 return 1;
149
150 return 0; 68 return 0;
151 } 69 }
152 70
153 GLOBAL(int) 71 GLOBAL(int)
154 jsimd_can_rgb_gray (void) 72 jsimd_can_rgb_gray (void)
155 { 73 {
156 init_simd(); 74 init_simd();
157 75
158 return 0; 76 return 0;
159 } 77 }
160 78
161 GLOBAL(int) 79 GLOBAL(int)
162 jsimd_can_ycc_rgb (void) 80 jsimd_can_ycc_rgb (void)
163 { 81 {
164 init_simd(); 82 init_simd();
165 83
166 /* The code is optimised for these values only */ 84 /* The code is optimised for these values only */
167 if (BITS_IN_JSAMPLE != 8) 85 if (BITS_IN_JSAMPLE != 8)
168 return 0; 86 return 0;
169 if (sizeof(JDIMENSION) != 4) 87 if (sizeof(JDIMENSION) != 4)
170 return 0; 88 return 0;
171 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) 89 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
172 return 0; 90 return 0;
91
173 if (simd_support & JSIMD_ARM_NEON) 92 if (simd_support & JSIMD_ARM_NEON)
174 return 1; 93 return 1;
175 94
95 return 0;
96 }
97
98 GLOBAL(int)
99 jsimd_can_ycc_rgb565 (void)
100 {
101 init_simd();
102
103 /* The code is optimised for these values only */
104 if (BITS_IN_JSAMPLE != 8)
105 return 0;
106 if (sizeof(JDIMENSION) != 4)
107 return 0;
108
109 if (simd_support & JSIMD_ARM_NEON)
110 return 1;
111
176 return 0; 112 return 0;
177 } 113 }
178 114
179 GLOBAL(void) 115 GLOBAL(void)
180 jsimd_rgb_ycc_convert (j_compress_ptr cinfo, 116 jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
181 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, 117 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
182 JDIMENSION output_row, int num_rows) 118 JDIMENSION output_row, int num_rows)
183 { 119 {
184 void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
185
186 switch(cinfo->in_color_space)
187 {
188 case JCS_EXT_RGB:
189 neonfct=jsimd_extrgb_ycc_convert_neon;
190 break;
191 case JCS_EXT_RGBX:
192 case JCS_EXT_RGBA:
193 neonfct=jsimd_extrgbx_ycc_convert_neon;
194 break;
195 case JCS_EXT_BGR:
196 neonfct=jsimd_extbgr_ycc_convert_neon;
197 break;
198 case JCS_EXT_BGRX:
199 case JCS_EXT_BGRA:
200 neonfct=jsimd_extbgrx_ycc_convert_neon;
201 break;
202 case JCS_EXT_XBGR:
203 case JCS_EXT_ABGR:
204 neonfct=jsimd_extxbgr_ycc_convert_neon;
205 break;
206 case JCS_EXT_XRGB:
207 case JCS_EXT_ARGB:
208 neonfct=jsimd_extxrgb_ycc_convert_neon;
209 break;
210 default:
211 neonfct=jsimd_extrgb_ycc_convert_neon;
212 break;
213 }
214
215 if (simd_support & JSIMD_ARM_NEON)
216 neonfct(cinfo->image_width, input_buf,
217 output_buf, output_row, num_rows);
218 } 120 }
219 121
220 GLOBAL(void) 122 GLOBAL(void)
221 jsimd_rgb_gray_convert (j_compress_ptr cinfo, 123 jsimd_rgb_gray_convert (j_compress_ptr cinfo,
222 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, 124 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
223 JDIMENSION output_row, int num_rows) 125 JDIMENSION output_row, int num_rows)
224 { 126 {
225 } 127 }
226 128
227 GLOBAL(void) 129 GLOBAL(void)
228 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, 130 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
229 JSAMPIMAGE input_buf, JDIMENSION input_row, 131 JSAMPIMAGE input_buf, JDIMENSION input_row,
230 JSAMPARRAY output_buf, int num_rows) 132 JSAMPARRAY output_buf, int num_rows)
231 { 133 {
232 void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); 134 void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
233 135
234 switch(cinfo->out_color_space) 136 switch(cinfo->out_color_space) {
235 {
236 case JCS_EXT_RGB: 137 case JCS_EXT_RGB:
237 neonfct=jsimd_ycc_extrgb_convert_neon; 138 neonfct=jsimd_ycc_extrgb_convert_neon;
238 break; 139 break;
239 case JCS_EXT_RGBX: 140 case JCS_EXT_RGBX:
240 case JCS_EXT_RGBA: 141 case JCS_EXT_RGBA:
241 neonfct=jsimd_ycc_extrgbx_convert_neon; 142 neonfct=jsimd_ycc_extrgbx_convert_neon;
242 break; 143 break;
243 case JCS_EXT_BGR: 144 case JCS_EXT_BGR:
244 neonfct=jsimd_ycc_extbgr_convert_neon; 145 neonfct=jsimd_ycc_extbgr_convert_neon;
245 break; 146 break;
246 case JCS_EXT_BGRX: 147 case JCS_EXT_BGRX:
247 case JCS_EXT_BGRA: 148 case JCS_EXT_BGRA:
248 neonfct=jsimd_ycc_extbgrx_convert_neon; 149 neonfct=jsimd_ycc_extbgrx_convert_neon;
249 break; 150 break;
250 case JCS_EXT_XBGR: 151 case JCS_EXT_XBGR:
251 case JCS_EXT_ABGR: 152 case JCS_EXT_ABGR:
252 neonfct=jsimd_ycc_extxbgr_convert_neon; 153 neonfct=jsimd_ycc_extxbgr_convert_neon;
253 break; 154 break;
254 case JCS_EXT_XRGB: 155 case JCS_EXT_XRGB:
255 case JCS_EXT_ARGB: 156 case JCS_EXT_ARGB:
256 neonfct=jsimd_ycc_extxrgb_convert_neon; 157 neonfct=jsimd_ycc_extxrgb_convert_neon;
257 break; 158 break;
258 default: 159 default:
259 neonfct=jsimd_ycc_extrgb_convert_neon; 160 neonfct=jsimd_ycc_extrgb_convert_neon;
260 break; 161 break;
261 } 162 }
262 163
263 if (simd_support & JSIMD_ARM_NEON) 164 if (simd_support & JSIMD_ARM_NEON)
264 neonfct(cinfo->output_width, input_buf, 165 neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
265 input_row, output_buf, num_rows); 166 }
167
168 GLOBAL(void)
169 jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
170 JSAMPIMAGE input_buf, JDIMENSION input_row,
171 JSAMPARRAY output_buf, int num_rows)
172 {
173 if (simd_support & JSIMD_ARM_NEON)
174 jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row,
175 output_buf, num_rows);
266 } 176 }
267 177
268 GLOBAL(int) 178 GLOBAL(int)
269 jsimd_can_h2v2_downsample (void) 179 jsimd_can_h2v2_downsample (void)
270 { 180 {
271 init_simd(); 181 init_simd();
272 182
273 return 0; 183 return 0;
274 } 184 }
275 185
(...skipping 28 matching lines...) Expand all
304 GLOBAL(int) 214 GLOBAL(int)
305 jsimd_can_h2v1_upsample (void) 215 jsimd_can_h2v1_upsample (void)
306 { 216 {
307 init_simd(); 217 init_simd();
308 218
309 return 0; 219 return 0;
310 } 220 }
311 221
312 GLOBAL(void) 222 GLOBAL(void)
313 jsimd_h2v2_upsample (j_decompress_ptr cinfo, 223 jsimd_h2v2_upsample (j_decompress_ptr cinfo,
314 jpeg_component_info * compptr, 224 jpeg_component_info * compptr,
315 JSAMPARRAY input_data, 225 JSAMPARRAY input_data,
316 JSAMPARRAY * output_data_ptr) 226 JSAMPARRAY * output_data_ptr)
317 { 227 {
318 } 228 }
319 229
320 GLOBAL(void) 230 GLOBAL(void)
321 jsimd_h2v1_upsample (j_decompress_ptr cinfo, 231 jsimd_h2v1_upsample (j_decompress_ptr cinfo,
322 jpeg_component_info * compptr, 232 jpeg_component_info * compptr,
323 JSAMPARRAY input_data, 233 JSAMPARRAY input_data,
324 JSAMPARRAY * output_data_ptr) 234 JSAMPARRAY * output_data_ptr)
325 { 235 {
326 } 236 }
327 237
328 GLOBAL(int) 238 GLOBAL(int)
329 jsimd_can_h2v2_fancy_upsample (void) 239 jsimd_can_h2v2_fancy_upsample (void)
330 { 240 {
331 init_simd(); 241 init_simd();
332 242
333 return 0; 243 return 0;
334 } 244 }
335 245
336 GLOBAL(int) 246 GLOBAL(int)
337 jsimd_can_h2v1_fancy_upsample (void) 247 jsimd_can_h2v1_fancy_upsample (void)
338 { 248 {
339 init_simd(); 249 init_simd();
340 250
341 /* The code is optimised for these values only */
342 if (BITS_IN_JSAMPLE != 8)
343 return 0;
344 if (sizeof(JDIMENSION) != 4)
345 return 0;
346
347 if (simd_support & JSIMD_ARM_NEON)
348 return 1;
349
350 return 0; 251 return 0;
351 } 252 }
352 253
353 GLOBAL(void) 254 GLOBAL(void)
354 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, 255 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
355 jpeg_component_info * compptr, 256 jpeg_component_info * compptr,
356 JSAMPARRAY input_data, 257 JSAMPARRAY input_data,
357 JSAMPARRAY * output_data_ptr) 258 JSAMPARRAY * output_data_ptr)
358 { 259 {
359 } 260 }
360 261
361 GLOBAL(void) 262 GLOBAL(void)
362 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, 263 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
363 jpeg_component_info * compptr, 264 jpeg_component_info * compptr,
364 JSAMPARRAY input_data, 265 JSAMPARRAY input_data,
365 JSAMPARRAY * output_data_ptr) 266 JSAMPARRAY * output_data_ptr)
366 { 267 {
367 if (simd_support & JSIMD_ARM_NEON)
368 jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
369 compptr->downsampled_width, input_data, output_data_ptr);
370 } 268 }
371 269
372 GLOBAL(int) 270 GLOBAL(int)
373 jsimd_can_h2v2_merged_upsample (void) 271 jsimd_can_h2v2_merged_upsample (void)
374 { 272 {
375 init_simd(); 273 init_simd();
376 274
377 return 0; 275 return 0;
378 } 276 }
379 277
(...skipping 19 matching lines...) Expand all
399 JDIMENSION in_row_group_ctr, 297 JDIMENSION in_row_group_ctr,
400 JSAMPARRAY output_buf) 298 JSAMPARRAY output_buf)
401 { 299 {
402 } 300 }
403 301
404 GLOBAL(int) 302 GLOBAL(int)
405 jsimd_can_convsamp (void) 303 jsimd_can_convsamp (void)
406 { 304 {
407 init_simd(); 305 init_simd();
408 306
409 /* The code is optimised for these values only */
410 if (DCTSIZE != 8)
411 return 0;
412 if (BITS_IN_JSAMPLE != 8)
413 return 0;
414 if (sizeof(JDIMENSION) != 4)
415 return 0;
416 if (sizeof(DCTELEM) != 2)
417 return 0;
418
419 if (simd_support & JSIMD_ARM_NEON)
420 return 1;
421
422 return 0; 307 return 0;
423 } 308 }
424 309
425 GLOBAL(int) 310 GLOBAL(int)
426 jsimd_can_convsamp_float (void) 311 jsimd_can_convsamp_float (void)
427 { 312 {
428 init_simd(); 313 init_simd();
429 314
430 return 0; 315 return 0;
431 } 316 }
432 317
433 GLOBAL(void) 318 GLOBAL(void)
434 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, 319 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
435 DCTELEM * workspace) 320 DCTELEM * workspace)
436 { 321 {
437 if (simd_support & JSIMD_ARM_NEON)
438 jsimd_convsamp_neon(sample_data, start_col, workspace);
439 } 322 }
440 323
441 GLOBAL(void) 324 GLOBAL(void)
442 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, 325 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
443 FAST_FLOAT * workspace) 326 FAST_FLOAT * workspace)
444 { 327 {
445 } 328 }
446 329
447 GLOBAL(int) 330 GLOBAL(int)
448 jsimd_can_fdct_islow (void) 331 jsimd_can_fdct_islow (void)
449 { 332 {
450 init_simd(); 333 init_simd();
451 334
452 return 0; 335 return 0;
453 } 336 }
454 337
455 GLOBAL(int) 338 GLOBAL(int)
456 jsimd_can_fdct_ifast (void) 339 jsimd_can_fdct_ifast (void)
457 { 340 {
458 init_simd(); 341 init_simd();
459 342
460 /* The code is optimised for these values only */
461 if (DCTSIZE != 8)
462 return 0;
463 if (sizeof(DCTELEM) != 2)
464 return 0;
465
466 if (simd_support & JSIMD_ARM_NEON)
467 return 1;
468
469 return 0; 343 return 0;
470 } 344 }
471 345
472 GLOBAL(int) 346 GLOBAL(int)
473 jsimd_can_fdct_float (void) 347 jsimd_can_fdct_float (void)
474 { 348 {
475 init_simd(); 349 init_simd();
476 350
477 return 0; 351 return 0;
478 } 352 }
479 353
480 GLOBAL(void) 354 GLOBAL(void)
481 jsimd_fdct_islow (DCTELEM * data) 355 jsimd_fdct_islow (DCTELEM * data)
482 { 356 {
483 } 357 }
484 358
485 GLOBAL(void) 359 GLOBAL(void)
486 jsimd_fdct_ifast (DCTELEM * data) 360 jsimd_fdct_ifast (DCTELEM * data)
487 { 361 {
488 if (simd_support & JSIMD_ARM_NEON)
489 jsimd_fdct_ifast_neon(data);
490 } 362 }
491 363
492 GLOBAL(void) 364 GLOBAL(void)
493 jsimd_fdct_float (FAST_FLOAT * data) 365 jsimd_fdct_float (FAST_FLOAT * data)
494 { 366 {
495 } 367 }
496 368
497 GLOBAL(int) 369 GLOBAL(int)
498 jsimd_can_quantize (void) 370 jsimd_can_quantize (void)
499 { 371 {
500 init_simd(); 372 init_simd();
501 373
502 /* The code is optimised for these values only */
503 if (DCTSIZE != 8)
504 return 0;
505 if (sizeof(JCOEF) != 2)
506 return 0;
507 if (sizeof(DCTELEM) != 2)
508 return 0;
509
510 if (simd_support & JSIMD_ARM_NEON)
511 return 1;
512
513 return 0; 374 return 0;
514 } 375 }
515 376
516 GLOBAL(int) 377 GLOBAL(int)
517 jsimd_can_quantize_float (void) 378 jsimd_can_quantize_float (void)
518 { 379 {
519 init_simd(); 380 init_simd();
520 381
521 return 0; 382 return 0;
522 } 383 }
523 384
524 GLOBAL(void) 385 GLOBAL(void)
525 jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, 386 jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
526 DCTELEM * workspace) 387 DCTELEM * workspace)
527 { 388 {
528 if (simd_support & JSIMD_ARM_NEON)
529 jsimd_quantize_neon(coef_block, divisors, workspace);
530 } 389 }
531 390
532 GLOBAL(void) 391 GLOBAL(void)
533 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, 392 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
534 FAST_FLOAT * workspace) 393 FAST_FLOAT * workspace)
535 { 394 {
536 } 395 }
537 396
538 GLOBAL(int) 397 GLOBAL(int)
539 jsimd_can_idct_2x2 (void) 398 jsimd_can_idct_2x2 (void)
540 { 399 {
541 init_simd(); 400 init_simd();
542 401
543 /* The code is optimised for these values only */ 402 /* The code is optimised for these values only */
544 if (DCTSIZE != 8) 403 if (DCTSIZE != 8)
545 return 0; 404 return 0;
546 if (sizeof(JCOEF) != 2) 405 if (sizeof(JCOEF) != 2)
547 return 0; 406 return 0;
548 if (BITS_IN_JSAMPLE != 8) 407 if (BITS_IN_JSAMPLE != 8)
549 return 0; 408 return 0;
550 if (sizeof(JDIMENSION) != 4) 409 if (sizeof(JDIMENSION) != 4)
551 return 0; 410 return 0;
552 if (sizeof(ISLOW_MULT_TYPE) != 2) 411 if (sizeof(ISLOW_MULT_TYPE) != 2)
553 return 0; 412 return 0;
554 413
555 if ((simd_support & JSIMD_ARM_NEON)) 414 if (simd_support & JSIMD_ARM_NEON)
556 return 1; 415 return 1;
557 416
558 return 0; 417 return 0;
559 } 418 }
560 419
561 GLOBAL(int) 420 GLOBAL(int)
562 jsimd_can_idct_4x4 (void) 421 jsimd_can_idct_4x4 (void)
563 { 422 {
564 init_simd(); 423 init_simd();
565 424
566 /* The code is optimised for these values only */ 425 /* The code is optimised for these values only */
567 if (DCTSIZE != 8) 426 if (DCTSIZE != 8)
568 return 0; 427 return 0;
569 if (sizeof(JCOEF) != 2) 428 if (sizeof(JCOEF) != 2)
570 return 0; 429 return 0;
571 if (BITS_IN_JSAMPLE != 8) 430 if (BITS_IN_JSAMPLE != 8)
572 return 0; 431 return 0;
573 if (sizeof(JDIMENSION) != 4) 432 if (sizeof(JDIMENSION) != 4)
574 return 0; 433 return 0;
575 if (sizeof(ISLOW_MULT_TYPE) != 2) 434 if (sizeof(ISLOW_MULT_TYPE) != 2)
576 return 0; 435 return 0;
577 436
578 if ((simd_support & JSIMD_ARM_NEON)) 437 if (simd_support & JSIMD_ARM_NEON)
579 return 1; 438 return 1;
580 439
581 return 0; 440 return 0;
582 } 441 }
583 442
584 GLOBAL(void) 443 GLOBAL(void)
585 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 444 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
586 JCOEFPTR coef_block, JSAMPARRAY output_buf, 445 JCOEFPTR coef_block, JSAMPARRAY output_buf,
587 JDIMENSION output_col) 446 JDIMENSION output_col)
588 { 447 {
589 if ((simd_support & JSIMD_ARM_NEON)) 448 if (simd_support & JSIMD_ARM_NEON)
590 jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); 449 jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf,
450 output_col);
591 } 451 }
592 452
593 GLOBAL(void) 453 GLOBAL(void)
594 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 454 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
595 JCOEFPTR coef_block, JSAMPARRAY output_buf, 455 JCOEFPTR coef_block, JSAMPARRAY output_buf,
596 JDIMENSION output_col) 456 JDIMENSION output_col)
597 { 457 {
598 if ((simd_support & JSIMD_ARM_NEON)) 458 if (simd_support & JSIMD_ARM_NEON)
599 jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); 459 jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf,
460 output_col);
600 } 461 }
601 462
602 GLOBAL(int) 463 GLOBAL(int)
603 jsimd_can_idct_islow (void) 464 jsimd_can_idct_islow (void)
604 { 465 {
605 init_simd(); 466 init_simd();
606 467
607 /* The code is optimised for these values only */ 468 /* The code is optimised for these values only */
608 if (DCTSIZE != 8) 469 if (DCTSIZE != 8)
609 return 0; 470 return 0;
(...skipping 24 matching lines...) Expand all
634 return 0; 495 return 0;
635 if (BITS_IN_JSAMPLE != 8) 496 if (BITS_IN_JSAMPLE != 8)
636 return 0; 497 return 0;
637 if (sizeof(JDIMENSION) != 4) 498 if (sizeof(JDIMENSION) != 4)
638 return 0; 499 return 0;
639 if (sizeof(IFAST_MULT_TYPE) != 2) 500 if (sizeof(IFAST_MULT_TYPE) != 2)
640 return 0; 501 return 0;
641 if (IFAST_SCALE_BITS != 2) 502 if (IFAST_SCALE_BITS != 2)
642 return 0; 503 return 0;
643 504
644 if ((simd_support & JSIMD_ARM_NEON)) 505 if (simd_support & JSIMD_ARM_NEON)
645 return 1; 506 return 1;
646 507
647 return 0; 508 return 0;
648 } 509 }
649 510
650 GLOBAL(int) 511 GLOBAL(int)
651 jsimd_can_idct_float (void) 512 jsimd_can_idct_float (void)
652 { 513 {
653 init_simd(); 514 init_simd();
654 515
655 return 0; 516 return 0;
656 } 517 }
657 518
658 GLOBAL(void) 519 GLOBAL(void)
659 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, 520 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
660 JCOEFPTR coef_block, JSAMPARRAY output_buf, 521 JCOEFPTR coef_block, JSAMPARRAY output_buf,
661 JDIMENSION output_col) 522 JDIMENSION output_col)
662 { 523 {
663 if ((simd_support & JSIMD_ARM_NEON)) 524 if (simd_support & JSIMD_ARM_NEON)
664 jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col ); 525 jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf,
526 output_col);
665 } 527 }
666 528
667 GLOBAL(void) 529 GLOBAL(void)
668 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, 530 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
669 JCOEFPTR coef_block, JSAMPARRAY output_buf, 531 JCOEFPTR coef_block, JSAMPARRAY output_buf,
670 JDIMENSION output_col) 532 JDIMENSION output_col)
671 { 533 {
672 if ((simd_support & JSIMD_ARM_NEON)) 534 if (simd_support & JSIMD_ARM_NEON)
673 jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col ); 535 jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf,
536 output_col);
674 } 537 }
675 538
676 GLOBAL(void) 539 GLOBAL(void)
677 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, 540 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
678 JCOEFPTR coef_block, JSAMPARRAY output_buf, 541 JCOEFPTR coef_block, JSAMPARRAY output_buf,
679 JDIMENSION output_col) 542 JDIMENSION output_col)
680 { 543 {
681 } 544 }
682
OLDNEW
« no previous file with comments | « libjpeg.gyp ('k') | simd/jsimd_arm64_neon.S » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698