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

Side by Side Diff: simd/jsimd_arm.c

Issue 1953443002: Update to libjpeg_turbo 1.4.90 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « simd/jsimd_altivec.h ('k') | simd/jsimd_arm64.c » ('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_arm.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, 2013-2014D. R. Commander 5 * Copyright 2009-2011, 2013-2014, 2016 D. R. Commander
6 * Copyright 2015-2016 Matthieu Darbois
6 * 7 *
7 * Based on the x86 SIMD extension for IJG JPEG library, 8 * Based on the x86 SIMD extension for IJG JPEG library,
8 * Copyright (C) 1999-2006, MIYASAKA Masaru. 9 * Copyright (C) 1999-2006, MIYASAKA Masaru.
9 * For conditions of distribution and use, see copyright notice in jsimdext.inc 10 * For conditions of distribution and use, see copyright notice in jsimdext.inc
10 * 11 *
11 * This file contains the interface between the "normal" portions 12 * This file contains the interface between the "normal" portions
12 * of the library and the SIMD implementations when running on 13 * of the library and the SIMD implementations when running on a
13 * ARM architecture. 14 * 32-bit ARM architecture.
14 *
15 * Based on the stubs from 'jsimd_none.c'
16 */ 15 */
17 16
18 #define JPEG_INTERNALS 17 #define JPEG_INTERNALS
19 #include "../jinclude.h" 18 #include "../jinclude.h"
20 #include "../jpeglib.h" 19 #include "../jpeglib.h"
21 #include "../jsimd.h" 20 #include "../jsimd.h"
22 #include "../jdct.h" 21 #include "../jdct.h"
23 #include "../jsimddct.h" 22 #include "../jsimddct.h"
24 #include "jsimd.h" 23 #include "jsimd.h"
25 24
26 #include <stdio.h> 25 #include <stdio.h>
27 #include <string.h> 26 #include <string.h>
28 #include <ctype.h> 27 #include <ctype.h>
29 28
30 static unsigned int simd_support = ~0; 29 static unsigned int simd_support = ~0;
30 static unsigned int simd_huffman = 1;
31 31
32 #if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined (__ANDROID__)) 32 #if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined (__ANDROID__))
33 33
34 #define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024) 34 #define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024)
35 35
36 LOCAL(int) 36 LOCAL(int)
37 check_feature (char *buffer, char *feature) 37 check_feature (char *buffer, char *feature)
38 { 38 {
39 char *p; 39 char *p;
40 if (*feature == 0) 40 if (*feature == 0)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 * -mcpu/-mfpu options passed to gcc by performing runtime detection via 116 * -mcpu/-mfpu options passed to gcc by performing runtime detection via
117 * /proc/cpuinfo parsing on linux/android */ 117 * /proc/cpuinfo parsing on linux/android */
118 while (!parse_proc_cpuinfo(bufsize)) { 118 while (!parse_proc_cpuinfo(bufsize)) {
119 bufsize *= 2; 119 bufsize *= 2;
120 if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT) 120 if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
121 break; 121 break;
122 } 122 }
123 #endif 123 #endif
124 124
125 /* Force different settings through environment variables */ 125 /* Force different settings through environment variables */
126 env = getenv("JSIMD_FORCE_ARM_NEON"); 126 env = getenv("JSIMD_FORCENEON");
127 if ((env != NULL) && (strcmp(env, "1") == 0)) 127 if ((env != NULL) && (strcmp(env, "1") == 0))
128 simd_support &= JSIMD_ARM_NEON; 128 simd_support &= JSIMD_ARM_NEON;
129 env = getenv("JSIMD_FORCE_NO_SIMD"); 129 env = getenv("JSIMD_FORCENONE");
130 if ((env != NULL) && (strcmp(env, "1") == 0)) 130 if ((env != NULL) && (strcmp(env, "1") == 0))
131 simd_support = 0; 131 simd_support = 0;
132 env = getenv("JSIMD_NOHUFFENC");
133 if ((env != NULL) && (strcmp(env, "1") == 0))
134 simd_huffman = 0;
132 } 135 }
133 136
134 GLOBAL(int) 137 GLOBAL(int)
135 jsimd_can_rgb_ycc (void) 138 jsimd_can_rgb_ycc (void)
136 { 139 {
137 init_simd(); 140 init_simd();
138 141
139 /* The code is optimised for these values only */ 142 /* The code is optimised for these values only */
140 if (BITS_IN_JSAMPLE != 8) 143 if (BITS_IN_JSAMPLE != 8)
141 return 0; 144 return 0;
(...skipping 21 matching lines...) Expand all
163 { 166 {
164 init_simd(); 167 init_simd();
165 168
166 /* The code is optimised for these values only */ 169 /* The code is optimised for these values only */
167 if (BITS_IN_JSAMPLE != 8) 170 if (BITS_IN_JSAMPLE != 8)
168 return 0; 171 return 0;
169 if (sizeof(JDIMENSION) != 4) 172 if (sizeof(JDIMENSION) != 4)
170 return 0; 173 return 0;
171 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) 174 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
172 return 0; 175 return 0;
176
173 if (simd_support & JSIMD_ARM_NEON) 177 if (simd_support & JSIMD_ARM_NEON)
174 return 1; 178 return 1;
175 179
176 return 0; 180 return 0;
177 } 181 }
178 182
179 GLOBAL(int) 183 GLOBAL(int)
180 jsimd_can_ycc_rgb565 (void) 184 jsimd_can_ycc_rgb565 (void)
181 { 185 {
182 init_simd(); 186 init_simd();
(...skipping 10 matching lines...) Expand all
193 return 0; 197 return 0;
194 } 198 }
195 199
196 GLOBAL(void) 200 GLOBAL(void)
197 jsimd_rgb_ycc_convert (j_compress_ptr cinfo, 201 jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
198 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, 202 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
199 JDIMENSION output_row, int num_rows) 203 JDIMENSION output_row, int num_rows)
200 { 204 {
201 void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); 205 void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
202 206
203 switch(cinfo->in_color_space) 207 switch(cinfo->in_color_space) {
204 {
205 case JCS_EXT_RGB: 208 case JCS_EXT_RGB:
206 neonfct=jsimd_extrgb_ycc_convert_neon; 209 neonfct=jsimd_extrgb_ycc_convert_neon;
207 break; 210 break;
208 case JCS_EXT_RGBX: 211 case JCS_EXT_RGBX:
209 case JCS_EXT_RGBA: 212 case JCS_EXT_RGBA:
210 neonfct=jsimd_extrgbx_ycc_convert_neon; 213 neonfct=jsimd_extrgbx_ycc_convert_neon;
211 break; 214 break;
212 case JCS_EXT_BGR: 215 case JCS_EXT_BGR:
213 neonfct=jsimd_extbgr_ycc_convert_neon; 216 neonfct=jsimd_extbgr_ycc_convert_neon;
214 break; 217 break;
215 case JCS_EXT_BGRX: 218 case JCS_EXT_BGRX:
216 case JCS_EXT_BGRA: 219 case JCS_EXT_BGRA:
217 neonfct=jsimd_extbgrx_ycc_convert_neon; 220 neonfct=jsimd_extbgrx_ycc_convert_neon;
218 break; 221 break;
219 case JCS_EXT_XBGR: 222 case JCS_EXT_XBGR:
220 case JCS_EXT_ABGR: 223 case JCS_EXT_ABGR:
221 neonfct=jsimd_extxbgr_ycc_convert_neon; 224 neonfct=jsimd_extxbgr_ycc_convert_neon;
222 break; 225 break;
223 case JCS_EXT_XRGB: 226 case JCS_EXT_XRGB:
224 case JCS_EXT_ARGB: 227 case JCS_EXT_ARGB:
225 neonfct=jsimd_extxrgb_ycc_convert_neon; 228 neonfct=jsimd_extxrgb_ycc_convert_neon;
226 break; 229 break;
227 default: 230 default:
228 neonfct=jsimd_extrgb_ycc_convert_neon; 231 neonfct=jsimd_extrgb_ycc_convert_neon;
229 break; 232 break;
230 } 233 }
231 234
232 if (simd_support & JSIMD_ARM_NEON) 235 neonfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
233 neonfct(cinfo->image_width, input_buf,
234 output_buf, output_row, num_rows);
235 } 236 }
236 237
237 GLOBAL(void) 238 GLOBAL(void)
238 jsimd_rgb_gray_convert (j_compress_ptr cinfo, 239 jsimd_rgb_gray_convert (j_compress_ptr cinfo,
239 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, 240 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
240 JDIMENSION output_row, int num_rows) 241 JDIMENSION output_row, int num_rows)
241 { 242 {
242 } 243 }
243 244
244 GLOBAL(void) 245 GLOBAL(void)
245 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, 246 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
246 JSAMPIMAGE input_buf, JDIMENSION input_row, 247 JSAMPIMAGE input_buf, JDIMENSION input_row,
247 JSAMPARRAY output_buf, int num_rows) 248 JSAMPARRAY output_buf, int num_rows)
248 { 249 {
249 void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); 250 void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
250 251
251 switch(cinfo->out_color_space) 252 switch(cinfo->out_color_space) {
252 {
253 case JCS_EXT_RGB: 253 case JCS_EXT_RGB:
254 neonfct=jsimd_ycc_extrgb_convert_neon; 254 neonfct=jsimd_ycc_extrgb_convert_neon;
255 break; 255 break;
256 case JCS_EXT_RGBX: 256 case JCS_EXT_RGBX:
257 case JCS_EXT_RGBA: 257 case JCS_EXT_RGBA:
258 neonfct=jsimd_ycc_extrgbx_convert_neon; 258 neonfct=jsimd_ycc_extrgbx_convert_neon;
259 break; 259 break;
260 case JCS_EXT_BGR: 260 case JCS_EXT_BGR:
261 neonfct=jsimd_ycc_extbgr_convert_neon; 261 neonfct=jsimd_ycc_extbgr_convert_neon;
262 break; 262 break;
263 case JCS_EXT_BGRX: 263 case JCS_EXT_BGRX:
264 case JCS_EXT_BGRA: 264 case JCS_EXT_BGRA:
265 neonfct=jsimd_ycc_extbgrx_convert_neon; 265 neonfct=jsimd_ycc_extbgrx_convert_neon;
266 break; 266 break;
267 case JCS_EXT_XBGR: 267 case JCS_EXT_XBGR:
268 case JCS_EXT_ABGR: 268 case JCS_EXT_ABGR:
269 neonfct=jsimd_ycc_extxbgr_convert_neon; 269 neonfct=jsimd_ycc_extxbgr_convert_neon;
270 break; 270 break;
271 case JCS_EXT_XRGB: 271 case JCS_EXT_XRGB:
272 case JCS_EXT_ARGB: 272 case JCS_EXT_ARGB:
273 neonfct=jsimd_ycc_extxrgb_convert_neon; 273 neonfct=jsimd_ycc_extxrgb_convert_neon;
274 break; 274 break;
275 default: 275 default:
276 neonfct=jsimd_ycc_extrgb_convert_neon; 276 neonfct=jsimd_ycc_extrgb_convert_neon;
277 break; 277 break;
278 } 278 }
279 279
280 if (simd_support & JSIMD_ARM_NEON) 280 neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
281 neonfct(cinfo->output_width, input_buf,
282 input_row, output_buf, num_rows);
283 } 281 }
284 282
285 GLOBAL(void) 283 GLOBAL(void)
286 jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, 284 jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
287 JSAMPIMAGE input_buf, JDIMENSION input_row, 285 JSAMPIMAGE input_buf, JDIMENSION input_row,
288 JSAMPARRAY output_buf, int num_rows) 286 JSAMPARRAY output_buf, int num_rows)
289 { 287 {
290 if (simd_support & JSIMD_ARM_NEON) 288 jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row,
291 jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row, 289 output_buf, num_rows);
292 output_buf, num_rows);
293 } 290 }
294 291
295 GLOBAL(int) 292 GLOBAL(int)
296 jsimd_can_h2v2_downsample (void) 293 jsimd_can_h2v2_downsample (void)
297 { 294 {
298 init_simd(); 295 init_simd();
299 296
300 return 0; 297 return 0;
301 } 298 }
302 299
303 GLOBAL(int) 300 GLOBAL(int)
304 jsimd_can_h2v1_downsample (void) 301 jsimd_can_h2v1_downsample (void)
305 { 302 {
306 init_simd(); 303 init_simd();
307 304
308 return 0; 305 return 0;
309 } 306 }
310 307
311 GLOBAL(void) 308 GLOBAL(void)
312 jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 309 jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
313 JSAMPARRAY input_data, JSAMPARRAY output_data) 310 JSAMPARRAY input_data, JSAMPARRAY output_data)
314 { 311 {
315 } 312 }
316 313
317 GLOBAL(void) 314 GLOBAL(void)
318 jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 315 jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
319 JSAMPARRAY input_data, JSAMPARRAY output_data) 316 JSAMPARRAY input_data, JSAMPARRAY output_data)
320 { 317 {
321 } 318 }
322 319
323 GLOBAL(int) 320 GLOBAL(int)
324 jsimd_can_h2v2_upsample (void) 321 jsimd_can_h2v2_upsample (void)
325 { 322 {
326 init_simd(); 323 init_simd();
327 324
328 return 0; 325 return 0;
329 } 326 }
330 327
331 GLOBAL(int) 328 GLOBAL(int)
332 jsimd_can_h2v1_upsample (void) 329 jsimd_can_h2v1_upsample (void)
333 { 330 {
334 init_simd(); 331 init_simd();
335 332
336 return 0; 333 return 0;
337 } 334 }
338 335
339 GLOBAL(void) 336 GLOBAL(void)
340 jsimd_h2v2_upsample (j_decompress_ptr cinfo, 337 jsimd_h2v2_upsample (j_decompress_ptr cinfo,
341 jpeg_component_info * compptr, 338 jpeg_component_info *compptr,
342 JSAMPARRAY input_data, 339 JSAMPARRAY input_data,
343 JSAMPARRAY * output_data_ptr) 340 JSAMPARRAY *output_data_ptr)
344 { 341 {
345 } 342 }
346 343
347 GLOBAL(void) 344 GLOBAL(void)
348 jsimd_h2v1_upsample (j_decompress_ptr cinfo, 345 jsimd_h2v1_upsample (j_decompress_ptr cinfo,
349 jpeg_component_info * compptr, 346 jpeg_component_info *compptr,
350 JSAMPARRAY input_data, 347 JSAMPARRAY input_data,
351 JSAMPARRAY * output_data_ptr) 348 JSAMPARRAY *output_data_ptr)
352 { 349 {
353 } 350 }
354 351
355 GLOBAL(int) 352 GLOBAL(int)
356 jsimd_can_h2v2_fancy_upsample (void) 353 jsimd_can_h2v2_fancy_upsample (void)
357 { 354 {
358 init_simd(); 355 init_simd();
359 356
360 return 0; 357 return 0;
361 } 358 }
(...skipping 10 matching lines...) Expand all
372 return 0; 369 return 0;
373 370
374 if (simd_support & JSIMD_ARM_NEON) 371 if (simd_support & JSIMD_ARM_NEON)
375 return 1; 372 return 1;
376 373
377 return 0; 374 return 0;
378 } 375 }
379 376
380 GLOBAL(void) 377 GLOBAL(void)
381 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, 378 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
382 jpeg_component_info * compptr, 379 jpeg_component_info *compptr,
383 JSAMPARRAY input_data, 380 JSAMPARRAY input_data,
384 JSAMPARRAY * output_data_ptr) 381 JSAMPARRAY *output_data_ptr)
385 { 382 {
386 } 383 }
387 384
388 GLOBAL(void) 385 GLOBAL(void)
389 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, 386 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
390 jpeg_component_info * compptr, 387 jpeg_component_info *compptr,
391 JSAMPARRAY input_data, 388 JSAMPARRAY input_data,
392 JSAMPARRAY * output_data_ptr) 389 JSAMPARRAY *output_data_ptr)
393 { 390 {
394 if (simd_support & JSIMD_ARM_NEON) 391 jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
395 jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor, 392 compptr->downsampled_width, input_data,
396 compptr->downsampled_width, input_data, output_data_ptr); 393 output_data_ptr);
397 } 394 }
398 395
399 GLOBAL(int) 396 GLOBAL(int)
400 jsimd_can_h2v2_merged_upsample (void) 397 jsimd_can_h2v2_merged_upsample (void)
401 { 398 {
402 init_simd(); 399 init_simd();
403 400
404 return 0; 401 return 0;
405 } 402 }
406 403
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 GLOBAL(int) 449 GLOBAL(int)
453 jsimd_can_convsamp_float (void) 450 jsimd_can_convsamp_float (void)
454 { 451 {
455 init_simd(); 452 init_simd();
456 453
457 return 0; 454 return 0;
458 } 455 }
459 456
460 GLOBAL(void) 457 GLOBAL(void)
461 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, 458 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
462 DCTELEM * workspace) 459 DCTELEM *workspace)
463 { 460 {
464 if (simd_support & JSIMD_ARM_NEON) 461 jsimd_convsamp_neon(sample_data, start_col, workspace);
465 jsimd_convsamp_neon(sample_data, start_col, workspace);
466 } 462 }
467 463
468 GLOBAL(void) 464 GLOBAL(void)
469 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, 465 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
470 FAST_FLOAT * workspace) 466 FAST_FLOAT *workspace)
471 { 467 {
472 } 468 }
473 469
474 GLOBAL(int) 470 GLOBAL(int)
475 jsimd_can_fdct_islow (void) 471 jsimd_can_fdct_islow (void)
476 { 472 {
477 init_simd(); 473 init_simd();
478 474
479 return 0; 475 return 0;
480 } 476 }
(...skipping 17 matching lines...) Expand all
498 494
499 GLOBAL(int) 495 GLOBAL(int)
500 jsimd_can_fdct_float (void) 496 jsimd_can_fdct_float (void)
501 { 497 {
502 init_simd(); 498 init_simd();
503 499
504 return 0; 500 return 0;
505 } 501 }
506 502
507 GLOBAL(void) 503 GLOBAL(void)
508 jsimd_fdct_islow (DCTELEM * data) 504 jsimd_fdct_islow (DCTELEM *data)
509 { 505 {
510 } 506 }
511 507
512 GLOBAL(void) 508 GLOBAL(void)
513 jsimd_fdct_ifast (DCTELEM * data) 509 jsimd_fdct_ifast (DCTELEM *data)
514 { 510 {
515 if (simd_support & JSIMD_ARM_NEON) 511 jsimd_fdct_ifast_neon(data);
516 jsimd_fdct_ifast_neon(data);
517 } 512 }
518 513
519 GLOBAL(void) 514 GLOBAL(void)
520 jsimd_fdct_float (FAST_FLOAT * data) 515 jsimd_fdct_float (FAST_FLOAT *data)
521 { 516 {
522 } 517 }
523 518
524 GLOBAL(int) 519 GLOBAL(int)
525 jsimd_can_quantize (void) 520 jsimd_can_quantize (void)
526 { 521 {
527 init_simd(); 522 init_simd();
528 523
529 /* The code is optimised for these values only */ 524 /* The code is optimised for these values only */
530 if (DCTSIZE != 8) 525 if (DCTSIZE != 8)
(...skipping 11 matching lines...) Expand all
542 537
543 GLOBAL(int) 538 GLOBAL(int)
544 jsimd_can_quantize_float (void) 539 jsimd_can_quantize_float (void)
545 { 540 {
546 init_simd(); 541 init_simd();
547 542
548 return 0; 543 return 0;
549 } 544 }
550 545
551 GLOBAL(void) 546 GLOBAL(void)
552 jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, 547 jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors,
553 DCTELEM * workspace) 548 DCTELEM *workspace)
554 { 549 {
555 if (simd_support & JSIMD_ARM_NEON) 550 jsimd_quantize_neon(coef_block, divisors, workspace);
556 jsimd_quantize_neon(coef_block, divisors, workspace);
557 } 551 }
558 552
559 GLOBAL(void) 553 GLOBAL(void)
560 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, 554 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors,
561 FAST_FLOAT * workspace) 555 FAST_FLOAT *workspace)
562 { 556 {
563 } 557 }
564 558
565 GLOBAL(int) 559 GLOBAL(int)
566 jsimd_can_idct_2x2 (void) 560 jsimd_can_idct_2x2 (void)
567 { 561 {
568 init_simd(); 562 init_simd();
569 563
570 /* The code is optimised for these values only */ 564 /* The code is optimised for these values only */
571 if (DCTSIZE != 8) 565 if (DCTSIZE != 8)
572 return 0; 566 return 0;
573 if (sizeof(JCOEF) != 2) 567 if (sizeof(JCOEF) != 2)
574 return 0; 568 return 0;
575 if (BITS_IN_JSAMPLE != 8) 569 if (BITS_IN_JSAMPLE != 8)
576 return 0; 570 return 0;
577 if (sizeof(JDIMENSION) != 4) 571 if (sizeof(JDIMENSION) != 4)
578 return 0; 572 return 0;
579 if (sizeof(ISLOW_MULT_TYPE) != 2) 573 if (sizeof(ISLOW_MULT_TYPE) != 2)
580 return 0; 574 return 0;
581 575
582 if ((simd_support & JSIMD_ARM_NEON)) 576 if (simd_support & JSIMD_ARM_NEON)
583 return 1; 577 return 1;
584 578
585 return 0; 579 return 0;
586 } 580 }
587 581
588 GLOBAL(int) 582 GLOBAL(int)
589 jsimd_can_idct_4x4 (void) 583 jsimd_can_idct_4x4 (void)
590 { 584 {
591 init_simd(); 585 init_simd();
592 586
593 /* The code is optimised for these values only */ 587 /* The code is optimised for these values only */
594 if (DCTSIZE != 8) 588 if (DCTSIZE != 8)
595 return 0; 589 return 0;
596 if (sizeof(JCOEF) != 2) 590 if (sizeof(JCOEF) != 2)
597 return 0; 591 return 0;
598 if (BITS_IN_JSAMPLE != 8) 592 if (BITS_IN_JSAMPLE != 8)
599 return 0; 593 return 0;
600 if (sizeof(JDIMENSION) != 4) 594 if (sizeof(JDIMENSION) != 4)
601 return 0; 595 return 0;
602 if (sizeof(ISLOW_MULT_TYPE) != 2) 596 if (sizeof(ISLOW_MULT_TYPE) != 2)
603 return 0; 597 return 0;
604 598
605 if ((simd_support & JSIMD_ARM_NEON)) 599 if (simd_support & JSIMD_ARM_NEON)
606 return 1; 600 return 1;
607 601
608 return 0; 602 return 0;
609 } 603 }
610 604
611 GLOBAL(void) 605 GLOBAL(void)
612 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 606 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
613 JCOEFPTR coef_block, JSAMPARRAY output_buf, 607 JCOEFPTR coef_block, JSAMPARRAY output_buf,
614 JDIMENSION output_col) 608 JDIMENSION output_col)
615 { 609 {
616 if ((simd_support & JSIMD_ARM_NEON)) 610 jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf,
617 jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); 611 output_col);
618 } 612 }
619 613
620 GLOBAL(void) 614 GLOBAL(void)
621 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 615 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
622 JCOEFPTR coef_block, JSAMPARRAY output_buf, 616 JCOEFPTR coef_block, JSAMPARRAY output_buf,
623 JDIMENSION output_col) 617 JDIMENSION output_col)
624 { 618 {
625 if ((simd_support & JSIMD_ARM_NEON)) 619 jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf,
626 jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); 620 output_col);
627 } 621 }
628 622
629 GLOBAL(int) 623 GLOBAL(int)
630 jsimd_can_idct_islow (void) 624 jsimd_can_idct_islow (void)
631 { 625 {
632 init_simd(); 626 init_simd();
633 627
634 /* The code is optimised for these values only */ 628 /* The code is optimised for these values only */
635 if (DCTSIZE != 8) 629 if (DCTSIZE != 8)
636 return 0; 630 return 0;
(...skipping 24 matching lines...) Expand all
661 return 0; 655 return 0;
662 if (BITS_IN_JSAMPLE != 8) 656 if (BITS_IN_JSAMPLE != 8)
663 return 0; 657 return 0;
664 if (sizeof(JDIMENSION) != 4) 658 if (sizeof(JDIMENSION) != 4)
665 return 0; 659 return 0;
666 if (sizeof(IFAST_MULT_TYPE) != 2) 660 if (sizeof(IFAST_MULT_TYPE) != 2)
667 return 0; 661 return 0;
668 if (IFAST_SCALE_BITS != 2) 662 if (IFAST_SCALE_BITS != 2)
669 return 0; 663 return 0;
670 664
671 if ((simd_support & JSIMD_ARM_NEON)) 665 if (simd_support & JSIMD_ARM_NEON)
672 return 1; 666 return 1;
673 667
674 return 0; 668 return 0;
675 } 669 }
676 670
677 GLOBAL(int) 671 GLOBAL(int)
678 jsimd_can_idct_float (void) 672 jsimd_can_idct_float (void)
679 { 673 {
680 init_simd(); 674 init_simd();
681 675
682 return 0; 676 return 0;
683 } 677 }
684 678
685 GLOBAL(void) 679 GLOBAL(void)
686 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, 680 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
687 JCOEFPTR coef_block, JSAMPARRAY output_buf, 681 JCOEFPTR coef_block, JSAMPARRAY output_buf,
688 JDIMENSION output_col) 682 JDIMENSION output_col)
689 { 683 {
690 if ((simd_support & JSIMD_ARM_NEON)) 684 jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf,
691 jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col ); 685 output_col);
692 } 686 }
693 687
694 GLOBAL(void) 688 GLOBAL(void)
695 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, 689 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
696 JCOEFPTR coef_block, JSAMPARRAY output_buf, 690 JCOEFPTR coef_block, JSAMPARRAY output_buf,
697 JDIMENSION output_col) 691 JDIMENSION output_col)
698 { 692 {
699 if ((simd_support & JSIMD_ARM_NEON)) 693 jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf,
700 jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col ); 694 output_col);
701 } 695 }
702 696
703 GLOBAL(void) 697 GLOBAL(void)
704 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, 698 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
705 JCOEFPTR coef_block, JSAMPARRAY output_buf, 699 JCOEFPTR coef_block, JSAMPARRAY output_buf,
706 JDIMENSION output_col) 700 JDIMENSION output_col)
707 { 701 {
708 } 702 }
709 703
704 GLOBAL(int)
705 jsimd_can_huff_encode_one_block (void)
706 {
707 init_simd();
708
709 if (DCTSIZE != 8)
710 return 0;
711 if (sizeof(JCOEF) != 2)
712 return 0;
713
714 if (simd_support & JSIMD_ARM_NEON && simd_huffman)
715 return 1;
716
717 return 0;
718 }
719
720 GLOBAL(JOCTET*)
721 jsimd_huff_encode_one_block (void *state, JOCTET *buffer, JCOEFPTR block,
722 int last_dc_val, c_derived_tbl *dctbl,
723 c_derived_tbl *actbl)
724 {
725 return jsimd_huff_encode_one_block_neon(state, buffer, block, last_dc_val,
726 dctbl, actbl);
727 }
OLDNEW
« no previous file with comments | « simd/jsimd_altivec.h ('k') | simd/jsimd_arm64.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698