4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
5 * Copyright (C) 2009-2011, 2014, 2016, 2018, 2020, D. R. Commander.
6 * Copyright (C) 2013-2014, MIPS Technologies, Inc., California.
7 * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
9 * Based on the x86 SIMD extension for IJG JPEG library,
10 * Copyright (C) 1999-2006, MIYASAKA Masaru.
11 * For conditions of distribution and use, see copyright notice in jsimdext.inc
13 * This file contains the interface between the "normal" portions
14 * of the library and the SIMD implementations when running on a
18 #define JPEG_INTERNALS
19 #include "../../jinclude.h"
20 #include "../../jpeglib.h"
21 #include "../../jsimd.h"
22 #include "../../jdct.h"
23 #include "../../jsimddct.h"
28 static unsigned int simd_support = ~0;
30 #if !(defined(__mips_dsp) && (__mips_dsp_rev >= 2)) && defined(__linux__)
33 parse_proc_cpuinfo(const char *search_string)
35 const char *file_name = "/proc/cpuinfo";
36 char cpuinfo_line[256];
41 if ((f = fopen(file_name, "r")) != NULL) {
42 while (fgets(cpuinfo_line, sizeof(cpuinfo_line), f) != NULL) {
43 if (strstr(cpuinfo_line, search_string) != NULL) {
45 simd_support |= JSIMD_DSPR2;
51 /* Did not find string in the proc file, or not Linux ELF. */
57 * Check what SIMD accelerations are supported.
59 * FIXME: This code is racy under a multi-threaded environment.
68 if (simd_support != ~0U)
73 #if defined(__mips_dsp) && (__mips_dsp_rev >= 2)
74 simd_support |= JSIMD_DSPR2;
75 #elif defined(__linux__)
76 /* We still have a chance to use MIPS DSPR2 regardless of globally used
77 * -mdspr2 options passed to gcc by performing runtime detection via
78 * /proc/cpuinfo parsing on linux */
79 parse_proc_cpuinfo("MIPS 74K");
83 /* Force different settings through environment variables */
84 env = getenv("JSIMD_FORCEDSPR2");
85 if ((env != NULL) && (strcmp(env, "1") == 0))
86 simd_support = JSIMD_DSPR2;
87 env = getenv("JSIMD_FORCENONE");
88 if ((env != NULL) && (strcmp(env, "1") == 0))
93 static const int mips_idct_ifast_coefs[4] = {
94 0x45404540, /* FIX( 1.082392200 / 2) = 17734 = 0x4546 */
95 0x5A805A80, /* FIX( 1.414213562 / 2) = 23170 = 0x5A82 */
96 0x76407640, /* FIX( 1.847759065 / 2) = 30274 = 0x7642 */
97 0xAC60AC60 /* FIX(-2.613125930 / 4) = -21407 = 0xAC61 */
100 /* The following struct is borrowed from jdsample.c */
101 typedef void (*upsample1_ptr) (j_decompress_ptr cinfo,
102 jpeg_component_info *compptr,
103 JSAMPARRAY input_data,
104 JSAMPARRAY *output_data_ptr);
106 struct jpeg_upsampler pub;
107 JSAMPARRAY color_buf[MAX_COMPONENTS];
108 upsample1_ptr methods[MAX_COMPONENTS];
110 JDIMENSION rows_to_go;
111 int rowgroup_height[MAX_COMPONENTS];
112 UINT8 h_expand[MAX_COMPONENTS];
113 UINT8 v_expand[MAX_COMPONENTS];
116 typedef my_upsampler *my_upsample_ptr;
119 jsimd_can_rgb_ycc(void)
123 /* The code is optimised for these values only */
124 if (BITS_IN_JSAMPLE != 8)
126 if (sizeof(JDIMENSION) != 4)
128 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
131 if (simd_support & JSIMD_DSPR2)
138 jsimd_can_rgb_gray(void)
142 /* The code is optimised for these values only */
143 if (BITS_IN_JSAMPLE != 8)
145 if (sizeof(JDIMENSION) != 4)
147 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
150 if (simd_support & JSIMD_DSPR2)
157 jsimd_can_ycc_rgb(void)
161 /* The code is optimised for these values only */
162 if (BITS_IN_JSAMPLE != 8)
164 if (sizeof(JDIMENSION) != 4)
166 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
169 if (simd_support & JSIMD_DSPR2)
176 jsimd_can_ycc_rgb565(void)
182 jsimd_c_can_null_convert(void)
186 /* The code is optimised for these values only */
187 if (BITS_IN_JSAMPLE != 8)
189 if (sizeof(JDIMENSION) != 4)
192 if (simd_support & JSIMD_DSPR2)
199 jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
200 JSAMPIMAGE output_buf, JDIMENSION output_row,
203 void (*dspr2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
205 switch (cinfo->in_color_space) {
207 dspr2fct = jsimd_extrgb_ycc_convert_dspr2;
211 dspr2fct = jsimd_extrgbx_ycc_convert_dspr2;
214 dspr2fct = jsimd_extbgr_ycc_convert_dspr2;
218 dspr2fct = jsimd_extbgrx_ycc_convert_dspr2;
222 dspr2fct = jsimd_extxbgr_ycc_convert_dspr2;
226 dspr2fct = jsimd_extxrgb_ycc_convert_dspr2;
229 dspr2fct = jsimd_extrgb_ycc_convert_dspr2;
233 dspr2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
237 jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
238 JSAMPIMAGE output_buf, JDIMENSION output_row,
241 void (*dspr2fct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
243 switch (cinfo->in_color_space) {
245 dspr2fct = jsimd_extrgb_gray_convert_dspr2;
249 dspr2fct = jsimd_extrgbx_gray_convert_dspr2;
252 dspr2fct = jsimd_extbgr_gray_convert_dspr2;
256 dspr2fct = jsimd_extbgrx_gray_convert_dspr2;
260 dspr2fct = jsimd_extxbgr_gray_convert_dspr2;
264 dspr2fct = jsimd_extxrgb_gray_convert_dspr2;
267 dspr2fct = jsimd_extrgb_gray_convert_dspr2;
271 dspr2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
275 jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
276 JDIMENSION input_row, JSAMPARRAY output_buf,
279 void (*dspr2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
281 switch (cinfo->out_color_space) {
283 dspr2fct = jsimd_ycc_extrgb_convert_dspr2;
287 dspr2fct = jsimd_ycc_extrgbx_convert_dspr2;
290 dspr2fct = jsimd_ycc_extbgr_convert_dspr2;
294 dspr2fct = jsimd_ycc_extbgrx_convert_dspr2;
298 dspr2fct = jsimd_ycc_extxbgr_convert_dspr2;
302 dspr2fct = jsimd_ycc_extxrgb_convert_dspr2;
305 dspr2fct = jsimd_ycc_extrgb_convert_dspr2;
309 dspr2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
313 jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
314 JDIMENSION input_row, JSAMPARRAY output_buf,
320 jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
321 JSAMPIMAGE output_buf, JDIMENSION output_row,
324 jsimd_c_null_convert_dspr2(cinfo->image_width, input_buf, output_buf,
325 output_row, num_rows, cinfo->num_components);
329 jsimd_can_h2v2_downsample(void)
333 /* The code is optimised for these values only */
334 if (BITS_IN_JSAMPLE != 8)
336 if (sizeof(JDIMENSION) != 4)
339 /* FIXME: jsimd_h2v2_downsample_dspr2() fails some of the TJBench tiling
340 * regression tests, probably because the DSPr2 SIMD implementation predates
343 if (simd_support & JSIMD_DSPR2)
351 jsimd_can_h2v2_smooth_downsample(void)
355 /* The code is optimised for these values only */
356 if (BITS_IN_JSAMPLE != 8)
358 if (sizeof(JDIMENSION) != 4)
363 if (simd_support & JSIMD_DSPR2)
370 jsimd_can_h2v1_downsample(void)
374 /* The code is optimised for these values only */
375 if (BITS_IN_JSAMPLE != 8)
377 if (sizeof(JDIMENSION) != 4)
380 /* FIXME: jsimd_h2v1_downsample_dspr2() fails some of the TJBench tiling
381 * regression tests, probably because the DSPr2 SIMD implementation predates
384 if (simd_support & JSIMD_DSPR2)
392 jsimd_h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
393 JSAMPARRAY input_data, JSAMPARRAY output_data)
395 jsimd_h2v2_downsample_dspr2(cinfo->image_width, cinfo->max_v_samp_factor,
396 compptr->v_samp_factor, compptr->width_in_blocks,
397 input_data, output_data);
401 jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo,
402 jpeg_component_info *compptr,
403 JSAMPARRAY input_data, JSAMPARRAY output_data)
405 jsimd_h2v2_smooth_downsample_dspr2(input_data, output_data,
406 compptr->v_samp_factor,
407 cinfo->max_v_samp_factor,
408 cinfo->smoothing_factor,
409 compptr->width_in_blocks,
414 jsimd_h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
415 JSAMPARRAY input_data, JSAMPARRAY output_data)
417 jsimd_h2v1_downsample_dspr2(cinfo->image_width, cinfo->max_v_samp_factor,
418 compptr->v_samp_factor, compptr->width_in_blocks,
419 input_data, output_data);
423 jsimd_can_h2v2_upsample(void)
427 /* The code is optimised for these values only */
428 if (BITS_IN_JSAMPLE != 8)
430 if (sizeof(JDIMENSION) != 4)
433 if (simd_support & JSIMD_DSPR2)
440 jsimd_can_h2v1_upsample(void)
444 /* The code is optimised for these values only */
445 if (BITS_IN_JSAMPLE != 8)
447 if (sizeof(JDIMENSION) != 4)
450 #if defined(__MIPSEL__)
451 if (simd_support & JSIMD_DSPR2)
459 jsimd_can_int_upsample(void)
463 /* The code is optimised for these values only */
464 if (BITS_IN_JSAMPLE != 8)
466 if (sizeof(JDIMENSION) != 4)
469 if (simd_support & JSIMD_DSPR2)
476 jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
477 JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
479 jsimd_h2v2_upsample_dspr2(cinfo->max_v_samp_factor, cinfo->output_width,
480 input_data, output_data_ptr);
484 jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
485 JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
487 jsimd_h2v1_upsample_dspr2(cinfo->max_v_samp_factor, cinfo->output_width,
488 input_data, output_data_ptr);
492 jsimd_int_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
493 JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
495 my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
497 jsimd_int_upsample_dspr2(upsample->h_expand[compptr->component_index],
498 upsample->v_expand[compptr->component_index],
499 input_data, output_data_ptr, cinfo->output_width,
500 cinfo->max_v_samp_factor);
504 jsimd_can_h2v2_fancy_upsample(void)
508 /* The code is optimised for these values only */
509 if (BITS_IN_JSAMPLE != 8)
511 if (sizeof(JDIMENSION) != 4)
514 #if defined(__MIPSEL__)
515 if (simd_support & JSIMD_DSPR2)
523 jsimd_can_h2v1_fancy_upsample(void)
527 /* The code is optimised for these values only */
528 if (BITS_IN_JSAMPLE != 8)
530 if (sizeof(JDIMENSION) != 4)
533 #if defined(__MIPSEL__)
534 if (simd_support & JSIMD_DSPR2)
542 jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
543 JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
545 jsimd_h2v2_fancy_upsample_dspr2(cinfo->max_v_samp_factor,
546 compptr->downsampled_width, input_data,
551 jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
552 JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
554 jsimd_h2v1_fancy_upsample_dspr2(cinfo->max_v_samp_factor,
555 compptr->downsampled_width, input_data,
560 jsimd_can_h2v2_merged_upsample(void)
564 /* The code is optimised for these values only */
565 if (BITS_IN_JSAMPLE != 8)
567 if (sizeof(JDIMENSION) != 4)
570 if (simd_support & JSIMD_DSPR2)
577 jsimd_can_h2v1_merged_upsample(void)
581 /* The code is optimised for these values only */
582 if (BITS_IN_JSAMPLE != 8)
584 if (sizeof(JDIMENSION) != 4)
587 if (simd_support & JSIMD_DSPR2)
594 jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
595 JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
597 void (*dspr2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *);
599 switch (cinfo->out_color_space) {
601 dspr2fct = jsimd_h2v2_extrgb_merged_upsample_dspr2;
605 dspr2fct = jsimd_h2v2_extrgbx_merged_upsample_dspr2;
608 dspr2fct = jsimd_h2v2_extbgr_merged_upsample_dspr2;
612 dspr2fct = jsimd_h2v2_extbgrx_merged_upsample_dspr2;
616 dspr2fct = jsimd_h2v2_extxbgr_merged_upsample_dspr2;
620 dspr2fct = jsimd_h2v2_extxrgb_merged_upsample_dspr2;
623 dspr2fct = jsimd_h2v2_extrgb_merged_upsample_dspr2;
627 dspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf,
628 cinfo->sample_range_limit);
632 jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
633 JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
635 void (*dspr2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *);
637 switch (cinfo->out_color_space) {
639 dspr2fct = jsimd_h2v1_extrgb_merged_upsample_dspr2;
643 dspr2fct = jsimd_h2v1_extrgbx_merged_upsample_dspr2;
646 dspr2fct = jsimd_h2v1_extbgr_merged_upsample_dspr2;
650 dspr2fct = jsimd_h2v1_extbgrx_merged_upsample_dspr2;
654 dspr2fct = jsimd_h2v1_extxbgr_merged_upsample_dspr2;
658 dspr2fct = jsimd_h2v1_extxrgb_merged_upsample_dspr2;
661 dspr2fct = jsimd_h2v1_extrgb_merged_upsample_dspr2;
665 dspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf,
666 cinfo->sample_range_limit);
670 jsimd_can_convsamp(void)
674 /* The code is optimised for these values only */
677 if (BITS_IN_JSAMPLE != 8)
679 if (sizeof(JDIMENSION) != 4)
681 if (sizeof(DCTELEM) != 2)
684 #if defined(__MIPSEL__)
685 if (simd_support & JSIMD_DSPR2)
693 jsimd_can_convsamp_float(void)
697 /* The code is optimised for these values only */
700 if (sizeof(JCOEF) != 2)
702 if (BITS_IN_JSAMPLE != 8)
704 if (sizeof(JDIMENSION) != 4)
706 if (sizeof(ISLOW_MULT_TYPE) != 2)
709 #ifndef __mips_soft_float
710 if (simd_support & JSIMD_DSPR2)
718 jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
721 jsimd_convsamp_dspr2(sample_data, start_col, workspace);
725 jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
726 FAST_FLOAT *workspace)
728 #ifndef __mips_soft_float
729 jsimd_convsamp_float_dspr2(sample_data, start_col, workspace);
734 jsimd_can_fdct_islow(void)
738 /* The code is optimised for these values only */
741 if (sizeof(DCTELEM) != 2)
744 #if defined(__MIPSEL__)
745 if (simd_support & JSIMD_DSPR2)
753 jsimd_can_fdct_ifast(void)
757 /* The code is optimised for these values only */
760 if (sizeof(DCTELEM) != 2)
763 #if defined(__MIPSEL__)
764 if (simd_support & JSIMD_DSPR2)
772 jsimd_can_fdct_float(void)
778 jsimd_fdct_islow(DCTELEM *data)
780 jsimd_fdct_islow_dspr2(data);
784 jsimd_fdct_ifast(DCTELEM *data)
786 jsimd_fdct_ifast_dspr2(data);
790 jsimd_fdct_float(FAST_FLOAT *data)
795 jsimd_can_quantize(void)
799 /* The code is optimised for these values only */
802 if (sizeof(JCOEF) != 2)
804 if (sizeof(DCTELEM) != 2)
807 if (simd_support & JSIMD_DSPR2)
814 jsimd_can_quantize_float(void)
818 /* The code is optimised for these values only */
821 if (sizeof(JCOEF) != 2)
823 if (BITS_IN_JSAMPLE != 8)
825 if (sizeof(JDIMENSION) != 4)
827 if (sizeof(ISLOW_MULT_TYPE) != 2)
830 #ifndef __mips_soft_float
831 if (simd_support & JSIMD_DSPR2)
839 jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
841 jsimd_quantize_dspr2(coef_block, divisors, workspace);
845 jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
846 FAST_FLOAT *workspace)
848 #ifndef __mips_soft_float
849 jsimd_quantize_float_dspr2(coef_block, divisors, workspace);
854 jsimd_can_idct_2x2(void)
858 /* The code is optimised for these values only */
861 if (sizeof(JCOEF) != 2)
863 if (BITS_IN_JSAMPLE != 8)
865 if (sizeof(JDIMENSION) != 4)
867 if (sizeof(ISLOW_MULT_TYPE) != 2)
870 if (simd_support & JSIMD_DSPR2)
877 jsimd_can_idct_4x4(void)
881 /* The code is optimised for these values only */
884 if (sizeof(JCOEF) != 2)
886 if (BITS_IN_JSAMPLE != 8)
888 if (sizeof(JDIMENSION) != 4)
890 if (sizeof(ISLOW_MULT_TYPE) != 2)
893 #if defined(__MIPSEL__)
894 if (simd_support & JSIMD_DSPR2)
902 jsimd_can_idct_6x6(void)
906 /* The code is optimised for these values only */
909 if (sizeof(JCOEF) != 2)
911 if (BITS_IN_JSAMPLE != 8)
913 if (sizeof(JDIMENSION) != 4)
915 if (sizeof(ISLOW_MULT_TYPE) != 2)
918 if (simd_support & JSIMD_DSPR2)
925 jsimd_can_idct_12x12(void)
929 if (BITS_IN_JSAMPLE != 8)
933 if (sizeof(JCOEF) != 2)
935 if (sizeof(JDIMENSION) != 4)
937 if (sizeof(ISLOW_MULT_TYPE) != 2)
940 if (simd_support & JSIMD_DSPR2)
947 jsimd_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
948 JCOEFPTR coef_block, JSAMPARRAY output_buf,
949 JDIMENSION output_col)
951 jsimd_idct_2x2_dspr2(compptr->dct_table, coef_block, output_buf, output_col);
955 jsimd_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
956 JCOEFPTR coef_block, JSAMPARRAY output_buf,
957 JDIMENSION output_col)
959 int workspace[DCTSIZE * 4]; /* buffers data between passes */
961 jsimd_idct_4x4_dspr2(compptr->dct_table, coef_block, output_buf, output_col,
966 jsimd_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr,
967 JCOEFPTR coef_block, JSAMPARRAY output_buf,
968 JDIMENSION output_col)
970 jsimd_idct_6x6_dspr2(compptr->dct_table, coef_block, output_buf, output_col);
974 jsimd_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr,
975 JCOEFPTR coef_block, JSAMPARRAY output_buf,
976 JDIMENSION output_col)
980 (int)(output_buf[0] + output_col),
981 (int)(output_buf[1] + output_col),
982 (int)(output_buf[2] + output_col),
983 (int)(output_buf[3] + output_col),
984 (int)(output_buf[4] + output_col),
985 (int)(output_buf[5] + output_col),
986 (int)(output_buf[6] + output_col),
987 (int)(output_buf[7] + output_col),
988 (int)(output_buf[8] + output_col),
989 (int)(output_buf[9] + output_col),
990 (int)(output_buf[10] + output_col),
991 (int)(output_buf[11] + output_col)
994 jsimd_idct_12x12_pass1_dspr2(coef_block, compptr->dct_table, workspace);
995 jsimd_idct_12x12_pass2_dspr2(workspace, output);
999 jsimd_can_idct_islow(void)
1003 /* The code is optimised for these values only */
1006 if (sizeof(JCOEF) != 2)
1008 if (BITS_IN_JSAMPLE != 8)
1010 if (sizeof(JDIMENSION) != 4)
1012 if (sizeof(ISLOW_MULT_TYPE) != 2)
1015 if (simd_support & JSIMD_DSPR2)
1022 jsimd_can_idct_ifast(void)
1026 /* The code is optimised for these values only */
1029 if (sizeof(JCOEF) != 2)
1031 if (BITS_IN_JSAMPLE != 8)
1033 if (sizeof(JDIMENSION) != 4)
1035 if (sizeof(IFAST_MULT_TYPE) != 2)
1037 if (IFAST_SCALE_BITS != 2)
1040 #if defined(__MIPSEL__)
1041 if (simd_support & JSIMD_DSPR2)
1049 jsimd_can_idct_float(void)
1055 jsimd_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
1056 JCOEFPTR coef_block, JSAMPARRAY output_buf,
1057 JDIMENSION output_col)
1060 (int)(output_buf[0] + output_col),
1061 (int)(output_buf[1] + output_col),
1062 (int)(output_buf[2] + output_col),
1063 (int)(output_buf[3] + output_col),
1064 (int)(output_buf[4] + output_col),
1065 (int)(output_buf[5] + output_col),
1066 (int)(output_buf[6] + output_col),
1067 (int)(output_buf[7] + output_col)
1070 jsimd_idct_islow_dspr2(coef_block, compptr->dct_table, output,
1071 IDCT_range_limit(cinfo));
1075 jsimd_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
1076 JCOEFPTR coef_block, JSAMPARRAY output_buf,
1077 JDIMENSION output_col)
1080 IFAST_MULT_TYPE *quantptr;
1081 DCTELEM workspace[DCTSIZE2]; /* buffers data between passes */
1083 /* Pass 1: process columns from input, store into work array. */
1086 quantptr = (IFAST_MULT_TYPE *)compptr->dct_table;
1088 jsimd_idct_ifast_cols_dspr2(inptr, quantptr, workspace,
1089 mips_idct_ifast_coefs);
1091 /* Pass 2: process rows from work array, store into output array. */
1092 /* Note that we must descale the results by a factor of 8 == 2**3, */
1093 /* and also undo the PASS1_BITS scaling. */
1095 jsimd_idct_ifast_rows_dspr2(workspace, output_buf, output_col,
1096 mips_idct_ifast_coefs);
1100 jsimd_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
1101 JCOEFPTR coef_block, JSAMPARRAY output_buf,
1102 JDIMENSION output_col)
1107 jsimd_can_huff_encode_one_block(void)
1113 jsimd_huff_encode_one_block(void *state, JOCTET *buffer, JCOEFPTR block,
1114 int last_dc_val, c_derived_tbl *dctbl,
1115 c_derived_tbl *actbl)
1121 jsimd_can_encode_mcu_AC_first_prepare(void)
1127 jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
1128 const int *jpeg_natural_order_start, int Sl,
1129 int Al, JCOEF *values, size_t *zerobits)
1134 jsimd_can_encode_mcu_AC_refine_prepare(void)
1140 jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
1141 const int *jpeg_natural_order_start, int Sl,
1142 int Al, JCOEF *absvalues, size_t *bits)