• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * jsimd_arm.c
3  *
4  * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
5  * Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander.
6  * Copyright (C) 2015-2016, Matthieu Darbois.
7  *
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
14  * 32-bit ARM architecture.
15  */
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 
25 #include <stdio.h>
26 #include <string.h>
27 #include <ctype.h>
28 
29 static unsigned int simd_support = ~0;
30 static unsigned int simd_huffman = 1;
31 
32 #if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
33 
34 #define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024)
35 
36 LOCAL(int)
check_feature(char * buffer,char * feature)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)
parse_proc_cpuinfo(int bufsize)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 /*
95  * Check what SIMD accelerations are supported.
96  *
97  * FIXME: This code is racy under a multi-threaded environment.
98  */
99 LOCAL(void)
init_simd(void)100 init_simd (void)
101 {
102   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 
107   if (simd_support != ~0U)
108     return;
109 
110   simd_support = 0;
111 
112 #if defined(__ARM_NEON__)
113   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 
125   /* Force different settings through environment variables */
126   env = getenv("JSIMD_FORCENEON");
127   if ((env != NULL) && (strcmp(env, "1") == 0))
128     simd_support = JSIMD_ARM_NEON;
129   env = getenv("JSIMD_FORCENONE");
130   if ((env != NULL) && (strcmp(env, "1") == 0))
131     simd_support = 0;
132   env = getenv("JSIMD_NOHUFFENC");
133   if ((env != NULL) && (strcmp(env, "1") == 0))
134     simd_huffman = 0;
135 }
136 
137 GLOBAL(int)
jsimd_can_rgb_ycc(void)138 jsimd_can_rgb_ycc (void)
139 {
140   init_simd();
141 
142   /* The code is optimised for these values only */
143   if (BITS_IN_JSAMPLE != 8)
144     return 0;
145   if (sizeof(JDIMENSION) != 4)
146     return 0;
147   if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
148     return 0;
149 
150   if (simd_support & JSIMD_ARM_NEON)
151     return 1;
152 
153   return 0;
154 }
155 
156 GLOBAL(int)
jsimd_can_rgb_gray(void)157 jsimd_can_rgb_gray (void)
158 {
159   init_simd();
160 
161   return 0;
162 }
163 
164 GLOBAL(int)
jsimd_can_ycc_rgb(void)165 jsimd_can_ycc_rgb (void)
166 {
167   init_simd();
168 
169   /* The code is optimised for these values only */
170   if (BITS_IN_JSAMPLE != 8)
171     return 0;
172   if (sizeof(JDIMENSION) != 4)
173     return 0;
174   if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
175     return 0;
176 
177   if (simd_support & JSIMD_ARM_NEON)
178     return 1;
179 
180   return 0;
181 }
182 
183 GLOBAL(int)
jsimd_can_ycc_rgb565(void)184 jsimd_can_ycc_rgb565 (void)
185 {
186   init_simd();
187 
188   /* The code is optimised for these values only */
189   if (BITS_IN_JSAMPLE != 8)
190     return 0;
191   if (sizeof(JDIMENSION) != 4)
192     return 0;
193 
194   if (simd_support & JSIMD_ARM_NEON)
195     return 1;
196 
197   return 0;
198 }
199 
200 GLOBAL(void)
jsimd_rgb_ycc_convert(j_compress_ptr cinfo,JSAMPARRAY input_buf,JSAMPIMAGE output_buf,JDIMENSION output_row,int num_rows)201 jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
202                        JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
203                        JDIMENSION output_row, int num_rows)
204 {
205   void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
206 
207   switch(cinfo->in_color_space) {
208     case JCS_EXT_RGB:
209       neonfct=jsimd_extrgb_ycc_convert_neon;
210       break;
211     case JCS_EXT_RGBX:
212     case JCS_EXT_RGBA:
213       neonfct=jsimd_extrgbx_ycc_convert_neon;
214       break;
215     case JCS_EXT_BGR:
216       neonfct=jsimd_extbgr_ycc_convert_neon;
217       break;
218     case JCS_EXT_BGRX:
219     case JCS_EXT_BGRA:
220       neonfct=jsimd_extbgrx_ycc_convert_neon;
221       break;
222     case JCS_EXT_XBGR:
223     case JCS_EXT_ABGR:
224       neonfct=jsimd_extxbgr_ycc_convert_neon;
225       break;
226     case JCS_EXT_XRGB:
227     case JCS_EXT_ARGB:
228       neonfct=jsimd_extxrgb_ycc_convert_neon;
229       break;
230     default:
231       neonfct=jsimd_extrgb_ycc_convert_neon;
232       break;
233   }
234 
235   neonfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
236 }
237 
238 GLOBAL(void)
jsimd_rgb_gray_convert(j_compress_ptr cinfo,JSAMPARRAY input_buf,JSAMPIMAGE output_buf,JDIMENSION output_row,int num_rows)239 jsimd_rgb_gray_convert (j_compress_ptr cinfo,
240                         JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
241                         JDIMENSION output_row, int num_rows)
242 {
243 }
244 
245 GLOBAL(void)
jsimd_ycc_rgb_convert(j_decompress_ptr cinfo,JSAMPIMAGE input_buf,JDIMENSION input_row,JSAMPARRAY output_buf,int num_rows)246 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
247                        JSAMPIMAGE input_buf, JDIMENSION input_row,
248                        JSAMPARRAY output_buf, int num_rows)
249 {
250   void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
251 
252   switch(cinfo->out_color_space) {
253     case JCS_EXT_RGB:
254       neonfct=jsimd_ycc_extrgb_convert_neon;
255       break;
256     case JCS_EXT_RGBX:
257     case JCS_EXT_RGBA:
258       neonfct=jsimd_ycc_extrgbx_convert_neon;
259       break;
260     case JCS_EXT_BGR:
261       neonfct=jsimd_ycc_extbgr_convert_neon;
262       break;
263     case JCS_EXT_BGRX:
264     case JCS_EXT_BGRA:
265       neonfct=jsimd_ycc_extbgrx_convert_neon;
266       break;
267     case JCS_EXT_XBGR:
268     case JCS_EXT_ABGR:
269       neonfct=jsimd_ycc_extxbgr_convert_neon;
270       break;
271     case JCS_EXT_XRGB:
272     case JCS_EXT_ARGB:
273       neonfct=jsimd_ycc_extxrgb_convert_neon;
274       break;
275     default:
276       neonfct=jsimd_ycc_extrgb_convert_neon;
277       break;
278   }
279 
280   neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
281 }
282 
283 GLOBAL(void)
jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo,JSAMPIMAGE input_buf,JDIMENSION input_row,JSAMPARRAY output_buf,int num_rows)284 jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
285                           JSAMPIMAGE input_buf, JDIMENSION input_row,
286                           JSAMPARRAY output_buf, int num_rows)
287 {
288   jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row,
289                                 output_buf, num_rows);
290 }
291 
292 GLOBAL(int)
jsimd_can_h2v2_downsample(void)293 jsimd_can_h2v2_downsample (void)
294 {
295   init_simd();
296 
297   return 0;
298 }
299 
300 GLOBAL(int)
jsimd_can_h2v1_downsample(void)301 jsimd_can_h2v1_downsample (void)
302 {
303   init_simd();
304 
305   return 0;
306 }
307 
308 GLOBAL(void)
jsimd_h2v2_downsample(j_compress_ptr cinfo,jpeg_component_info * compptr,JSAMPARRAY input_data,JSAMPARRAY output_data)309 jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
310                        JSAMPARRAY input_data, JSAMPARRAY output_data)
311 {
312 }
313 
314 GLOBAL(void)
jsimd_h2v1_downsample(j_compress_ptr cinfo,jpeg_component_info * compptr,JSAMPARRAY input_data,JSAMPARRAY output_data)315 jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
316                        JSAMPARRAY input_data, JSAMPARRAY output_data)
317 {
318 }
319 
320 GLOBAL(int)
jsimd_can_h2v2_upsample(void)321 jsimd_can_h2v2_upsample (void)
322 {
323   init_simd();
324 
325   return 0;
326 }
327 
328 GLOBAL(int)
jsimd_can_h2v1_upsample(void)329 jsimd_can_h2v1_upsample (void)
330 {
331   init_simd();
332 
333   return 0;
334 }
335 
336 GLOBAL(void)
jsimd_h2v2_upsample(j_decompress_ptr cinfo,jpeg_component_info * compptr,JSAMPARRAY input_data,JSAMPARRAY * output_data_ptr)337 jsimd_h2v2_upsample (j_decompress_ptr cinfo,
338                      jpeg_component_info *compptr,
339                      JSAMPARRAY input_data,
340                      JSAMPARRAY *output_data_ptr)
341 {
342 }
343 
344 GLOBAL(void)
jsimd_h2v1_upsample(j_decompress_ptr cinfo,jpeg_component_info * compptr,JSAMPARRAY input_data,JSAMPARRAY * output_data_ptr)345 jsimd_h2v1_upsample (j_decompress_ptr cinfo,
346                      jpeg_component_info *compptr,
347                      JSAMPARRAY input_data,
348                      JSAMPARRAY *output_data_ptr)
349 {
350 }
351 
352 GLOBAL(int)
jsimd_can_h2v2_fancy_upsample(void)353 jsimd_can_h2v2_fancy_upsample (void)
354 {
355   init_simd();
356 
357   return 0;
358 }
359 
360 GLOBAL(int)
jsimd_can_h2v1_fancy_upsample(void)361 jsimd_can_h2v1_fancy_upsample (void)
362 {
363   init_simd();
364 
365   /* The code is optimised for these values only */
366   if (BITS_IN_JSAMPLE != 8)
367     return 0;
368   if (sizeof(JDIMENSION) != 4)
369     return 0;
370 
371   if (simd_support & JSIMD_ARM_NEON)
372     return 1;
373 
374   return 0;
375 }
376 
377 GLOBAL(void)
jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo,jpeg_component_info * compptr,JSAMPARRAY input_data,JSAMPARRAY * output_data_ptr)378 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
379                            jpeg_component_info *compptr,
380                            JSAMPARRAY input_data,
381                            JSAMPARRAY *output_data_ptr)
382 {
383 }
384 
385 GLOBAL(void)
jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo,jpeg_component_info * compptr,JSAMPARRAY input_data,JSAMPARRAY * output_data_ptr)386 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
387                            jpeg_component_info *compptr,
388                            JSAMPARRAY input_data,
389                            JSAMPARRAY *output_data_ptr)
390 {
391   jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
392                                  compptr->downsampled_width, input_data,
393                                  output_data_ptr);
394 }
395 
396 GLOBAL(int)
jsimd_can_h2v2_merged_upsample(void)397 jsimd_can_h2v2_merged_upsample (void)
398 {
399   init_simd();
400 
401   return 0;
402 }
403 
404 GLOBAL(int)
jsimd_can_h2v1_merged_upsample(void)405 jsimd_can_h2v1_merged_upsample (void)
406 {
407   init_simd();
408 
409   return 0;
410 }
411 
412 GLOBAL(void)
jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo,JSAMPIMAGE input_buf,JDIMENSION in_row_group_ctr,JSAMPARRAY output_buf)413 jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
414                             JSAMPIMAGE input_buf,
415                             JDIMENSION in_row_group_ctr,
416                             JSAMPARRAY output_buf)
417 {
418 }
419 
420 GLOBAL(void)
jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo,JSAMPIMAGE input_buf,JDIMENSION in_row_group_ctr,JSAMPARRAY output_buf)421 jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
422                             JSAMPIMAGE input_buf,
423                             JDIMENSION in_row_group_ctr,
424                             JSAMPARRAY output_buf)
425 {
426 }
427 
428 GLOBAL(int)
jsimd_can_convsamp(void)429 jsimd_can_convsamp (void)
430 {
431   init_simd();
432 
433   /* The code is optimised for these values only */
434   if (DCTSIZE != 8)
435     return 0;
436   if (BITS_IN_JSAMPLE != 8)
437     return 0;
438   if (sizeof(JDIMENSION) != 4)
439     return 0;
440   if (sizeof(DCTELEM) != 2)
441     return 0;
442 
443   if (simd_support & JSIMD_ARM_NEON)
444     return 1;
445 
446   return 0;
447 }
448 
449 GLOBAL(int)
jsimd_can_convsamp_float(void)450 jsimd_can_convsamp_float (void)
451 {
452   init_simd();
453 
454   return 0;
455 }
456 
457 GLOBAL(void)
jsimd_convsamp(JSAMPARRAY sample_data,JDIMENSION start_col,DCTELEM * workspace)458 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
459                 DCTELEM *workspace)
460 {
461   jsimd_convsamp_neon(sample_data, start_col, workspace);
462 }
463 
464 GLOBAL(void)
jsimd_convsamp_float(JSAMPARRAY sample_data,JDIMENSION start_col,FAST_FLOAT * workspace)465 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
466                       FAST_FLOAT *workspace)
467 {
468 }
469 
470 GLOBAL(int)
jsimd_can_fdct_islow(void)471 jsimd_can_fdct_islow (void)
472 {
473   init_simd();
474 
475   return 0;
476 }
477 
478 GLOBAL(int)
jsimd_can_fdct_ifast(void)479 jsimd_can_fdct_ifast (void)
480 {
481   init_simd();
482 
483   /* The code is optimised for these values only */
484   if (DCTSIZE != 8)
485     return 0;
486   if (sizeof(DCTELEM) != 2)
487     return 0;
488 
489   if (simd_support & JSIMD_ARM_NEON)
490     return 1;
491 
492   return 0;
493 }
494 
495 GLOBAL(int)
jsimd_can_fdct_float(void)496 jsimd_can_fdct_float (void)
497 {
498   init_simd();
499 
500   return 0;
501 }
502 
503 GLOBAL(void)
jsimd_fdct_islow(DCTELEM * data)504 jsimd_fdct_islow (DCTELEM *data)
505 {
506 }
507 
508 GLOBAL(void)
jsimd_fdct_ifast(DCTELEM * data)509 jsimd_fdct_ifast (DCTELEM *data)
510 {
511   jsimd_fdct_ifast_neon(data);
512 }
513 
514 GLOBAL(void)
jsimd_fdct_float(FAST_FLOAT * data)515 jsimd_fdct_float (FAST_FLOAT *data)
516 {
517 }
518 
519 GLOBAL(int)
jsimd_can_quantize(void)520 jsimd_can_quantize (void)
521 {
522   init_simd();
523 
524   /* The code is optimised for these values only */
525   if (DCTSIZE != 8)
526     return 0;
527   if (sizeof(JCOEF) != 2)
528     return 0;
529   if (sizeof(DCTELEM) != 2)
530     return 0;
531 
532   if (simd_support & JSIMD_ARM_NEON)
533     return 1;
534 
535   return 0;
536 }
537 
538 GLOBAL(int)
jsimd_can_quantize_float(void)539 jsimd_can_quantize_float (void)
540 {
541   init_simd();
542 
543   return 0;
544 }
545 
546 GLOBAL(void)
jsimd_quantize(JCOEFPTR coef_block,DCTELEM * divisors,DCTELEM * workspace)547 jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors,
548                 DCTELEM *workspace)
549 {
550   jsimd_quantize_neon(coef_block, divisors, workspace);
551 }
552 
553 GLOBAL(void)
jsimd_quantize_float(JCOEFPTR coef_block,FAST_FLOAT * divisors,FAST_FLOAT * workspace)554 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors,
555                       FAST_FLOAT *workspace)
556 {
557 }
558 
559 GLOBAL(int)
jsimd_can_idct_2x2(void)560 jsimd_can_idct_2x2 (void)
561 {
562   init_simd();
563 
564   /* The code is optimised for these values only */
565   if (DCTSIZE != 8)
566     return 0;
567   if (sizeof(JCOEF) != 2)
568     return 0;
569   if (BITS_IN_JSAMPLE != 8)
570     return 0;
571   if (sizeof(JDIMENSION) != 4)
572     return 0;
573   if (sizeof(ISLOW_MULT_TYPE) != 2)
574     return 0;
575 
576   if (simd_support & JSIMD_ARM_NEON)
577     return 1;
578 
579   return 0;
580 }
581 
582 GLOBAL(int)
jsimd_can_idct_4x4(void)583 jsimd_can_idct_4x4 (void)
584 {
585   init_simd();
586 
587   /* The code is optimised for these values only */
588   if (DCTSIZE != 8)
589     return 0;
590   if (sizeof(JCOEF) != 2)
591     return 0;
592   if (BITS_IN_JSAMPLE != 8)
593     return 0;
594   if (sizeof(JDIMENSION) != 4)
595     return 0;
596   if (sizeof(ISLOW_MULT_TYPE) != 2)
597     return 0;
598 
599   if (simd_support & JSIMD_ARM_NEON)
600     return 1;
601 
602   return 0;
603 }
604 
605 GLOBAL(void)
jsimd_idct_2x2(j_decompress_ptr cinfo,jpeg_component_info * compptr,JCOEFPTR coef_block,JSAMPARRAY output_buf,JDIMENSION output_col)606 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
607                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
608                 JDIMENSION output_col)
609 {
610   jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf,
611                       output_col);
612 }
613 
614 GLOBAL(void)
jsimd_idct_4x4(j_decompress_ptr cinfo,jpeg_component_info * compptr,JCOEFPTR coef_block,JSAMPARRAY output_buf,JDIMENSION output_col)615 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
616                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
617                 JDIMENSION output_col)
618 {
619   jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf,
620                       output_col);
621 }
622 
623 GLOBAL(int)
jsimd_can_idct_islow(void)624 jsimd_can_idct_islow (void)
625 {
626   init_simd();
627 
628   /* The code is optimised for these values only */
629   if (DCTSIZE != 8)
630     return 0;
631   if (sizeof(JCOEF) != 2)
632     return 0;
633   if (BITS_IN_JSAMPLE != 8)
634     return 0;
635   if (sizeof(JDIMENSION) != 4)
636     return 0;
637   if (sizeof(ISLOW_MULT_TYPE) != 2)
638     return 0;
639 
640   if (simd_support & JSIMD_ARM_NEON)
641     return 1;
642 
643   return 0;
644 }
645 
646 GLOBAL(int)
jsimd_can_idct_ifast(void)647 jsimd_can_idct_ifast (void)
648 {
649   init_simd();
650 
651   /* The code is optimised for these values only */
652   if (DCTSIZE != 8)
653     return 0;
654   if (sizeof(JCOEF) != 2)
655     return 0;
656   if (BITS_IN_JSAMPLE != 8)
657     return 0;
658   if (sizeof(JDIMENSION) != 4)
659     return 0;
660   if (sizeof(IFAST_MULT_TYPE) != 2)
661     return 0;
662   if (IFAST_SCALE_BITS != 2)
663     return 0;
664 
665   if (simd_support & JSIMD_ARM_NEON)
666     return 1;
667 
668   return 0;
669 }
670 
671 GLOBAL(int)
jsimd_can_idct_float(void)672 jsimd_can_idct_float (void)
673 {
674   init_simd();
675 
676   return 0;
677 }
678 
679 GLOBAL(void)
jsimd_idct_islow(j_decompress_ptr cinfo,jpeg_component_info * compptr,JCOEFPTR coef_block,JSAMPARRAY output_buf,JDIMENSION output_col)680 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
681                   JCOEFPTR coef_block, JSAMPARRAY output_buf,
682                   JDIMENSION output_col)
683 {
684   jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf,
685                         output_col);
686 }
687 
688 GLOBAL(void)
jsimd_idct_ifast(j_decompress_ptr cinfo,jpeg_component_info * compptr,JCOEFPTR coef_block,JSAMPARRAY output_buf,JDIMENSION output_col)689 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
690                   JCOEFPTR coef_block, JSAMPARRAY output_buf,
691                   JDIMENSION output_col)
692 {
693   jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf,
694                         output_col);
695 }
696 
697 GLOBAL(void)
jsimd_idct_float(j_decompress_ptr cinfo,jpeg_component_info * compptr,JCOEFPTR coef_block,JSAMPARRAY output_buf,JDIMENSION output_col)698 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
699                   JCOEFPTR coef_block, JSAMPARRAY output_buf,
700                   JDIMENSION output_col)
701 {
702 }
703 
704 GLOBAL(int)
jsimd_can_huff_encode_one_block(void)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*)
jsimd_huff_encode_one_block(void * state,JOCTET * buffer,JCOEFPTR block,int last_dc_val,c_derived_tbl * dctbl,c_derived_tbl * actbl)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 }
728