4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
5 * Copyright 2009-2011, 2014 D. R. Commander
6 * Copyright (C) 2013-2014, MIPS Technologies, Inc., California
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
12 * This file contains the interface between the "normal" portions
13 * of the library and the SIMD implementations when running on a
17 #define JPEG_INTERNALS
18 #include "../jinclude.h"
19 #include "../jpeglib.h"
22 #include "../jsimddct.h"
29 static unsigned int simd_support = ~0;
31 #if defined(__linux__)
34 parse_proc_cpuinfo(const char* search_string)
36 const char* file_name = "/proc/cpuinfo";
37 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_MIPS_DSPR2;
51 /* Did not find string in the proc file, or not Linux ELF. */
58 * Check what SIMD accelerations are supported.
60 * FIXME: This code is racy under a multi-threaded environment.
65 if (simd_support != ~0U)
70 #if defined(__MIPSEL__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2)
71 simd_support |= JSIMD_MIPS_DSPR2;
72 #elif defined(__linux__)
73 /* We still have a chance to use MIPS DSPR2 regardless of globally used
74 * -mdspr2 options passed to gcc by performing runtime detection via
75 * /proc/cpuinfo parsing on linux */
76 if (!parse_proc_cpuinfo("MIPS 74K"))
81 static const int mips_idct_ifast_coefs[4] = {
82 0x45404540, // FIX( 1.082392200 / 2) = 17734 = 0x4546
83 0x5A805A80, // FIX( 1.414213562 / 2) = 23170 = 0x5A82
84 0x76407640, // FIX( 1.847759065 / 2) = 30274 = 0x7642
85 0xAC60AC60 // FIX(-2.613125930 / 4) = -21407 = 0xAC61
88 /* The following struct is borrowed from jdsample.c */
89 typedef void (*upsample1_ptr) (j_decompress_ptr cinfo,
90 jpeg_component_info * compptr,
91 JSAMPARRAY input_data,
92 JSAMPARRAY * output_data_ptr);
95 struct jpeg_upsampler pub;
96 JSAMPARRAY color_buf[MAX_COMPONENTS];
97 upsample1_ptr methods[MAX_COMPONENTS];
99 JDIMENSION rows_to_go;
100 int rowgroup_height[MAX_COMPONENTS];
101 UINT8 h_expand[MAX_COMPONENTS];
102 UINT8 v_expand[MAX_COMPONENTS];
105 typedef my_upsampler * my_upsample_ptr;
108 jsimd_can_rgb_ycc (void)
112 /* The code is optimised for these values only */
113 if (BITS_IN_JSAMPLE != 8)
115 if (sizeof(JDIMENSION) != 4)
117 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
120 if (simd_support & JSIMD_MIPS_DSPR2)
127 jsimd_can_rgb_gray (void)
131 /* The code is optimised for these values only */
132 if (BITS_IN_JSAMPLE != 8)
134 if (sizeof(JDIMENSION) != 4)
136 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
139 if (simd_support & JSIMD_MIPS_DSPR2)
146 jsimd_can_ycc_rgb (void)
150 /* The code is optimised for these values only */
151 if (BITS_IN_JSAMPLE != 8)
153 if (sizeof(JDIMENSION) != 4)
155 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
158 if (simd_support & JSIMD_MIPS_DSPR2)
165 jsimd_can_ycc_rgb565 (void)
171 jsimd_c_can_null_convert (void)
175 /* The code is optimised for these values only */
176 if (BITS_IN_JSAMPLE != 8)
178 if (sizeof(JDIMENSION) != 4)
181 if (simd_support & JSIMD_MIPS_DSPR2)
188 jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
189 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
190 JDIMENSION output_row, int num_rows)
192 void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
194 switch(cinfo->in_color_space) {
196 mipsdspr2fct=jsimd_extrgb_ycc_convert_mips_dspr2;
200 mipsdspr2fct=jsimd_extrgbx_ycc_convert_mips_dspr2;
203 mipsdspr2fct=jsimd_extbgr_ycc_convert_mips_dspr2;
207 mipsdspr2fct=jsimd_extbgrx_ycc_convert_mips_dspr2;
211 mipsdspr2fct=jsimd_extxbgr_ycc_convert_mips_dspr2;
216 mipsdspr2fct=jsimd_extxrgb_ycc_convert_mips_dspr2;
219 mipsdspr2fct=jsimd_extrgb_ycc_convert_mips_dspr2;
223 if (simd_support & JSIMD_MIPS_DSPR2)
224 mipsdspr2fct(cinfo->image_width, input_buf, output_buf, output_row,
229 jsimd_rgb_gray_convert (j_compress_ptr cinfo,
230 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
231 JDIMENSION output_row, int num_rows)
233 void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
235 switch(cinfo->in_color_space) {
237 mipsdspr2fct=jsimd_extrgb_gray_convert_mips_dspr2;
241 mipsdspr2fct=jsimd_extrgbx_gray_convert_mips_dspr2;
244 mipsdspr2fct=jsimd_extbgr_gray_convert_mips_dspr2;
248 mipsdspr2fct=jsimd_extbgrx_gray_convert_mips_dspr2;
252 mipsdspr2fct=jsimd_extxbgr_gray_convert_mips_dspr2;
256 mipsdspr2fct=jsimd_extxrgb_gray_convert_mips_dspr2;
259 mipsdspr2fct=jsimd_extrgb_gray_convert_mips_dspr2;
263 if (simd_support & JSIMD_MIPS_DSPR2)
264 mipsdspr2fct(cinfo->image_width, input_buf, output_buf, output_row,
269 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
270 JSAMPIMAGE input_buf, JDIMENSION input_row,
271 JSAMPARRAY output_buf, int num_rows)
273 void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
275 switch(cinfo->out_color_space) {
277 mipsdspr2fct=jsimd_ycc_extrgb_convert_mips_dspr2;
281 mipsdspr2fct=jsimd_ycc_extrgbx_convert_mips_dspr2;
284 mipsdspr2fct=jsimd_ycc_extbgr_convert_mips_dspr2;
288 mipsdspr2fct=jsimd_ycc_extbgrx_convert_mips_dspr2;
292 mipsdspr2fct=jsimd_ycc_extxbgr_convert_mips_dspr2;
296 mipsdspr2fct=jsimd_ycc_extxrgb_convert_mips_dspr2;
299 mipsdspr2fct=jsimd_ycc_extrgb_convert_mips_dspr2;
303 if (simd_support & JSIMD_MIPS_DSPR2)
304 mipsdspr2fct(cinfo->output_width, input_buf, input_row, output_buf,
309 jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
310 JSAMPIMAGE input_buf, JDIMENSION input_row,
311 JSAMPARRAY output_buf, int num_rows)
316 jsimd_c_null_convert (j_compress_ptr cinfo,
317 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
318 JDIMENSION output_row, int num_rows)
320 if (simd_support & JSIMD_MIPS_DSPR2)
321 jsimd_c_null_convert_mips_dspr2(cinfo->image_width, input_buf,
322 output_buf, output_row, num_rows,
323 cinfo->num_components);
327 jsimd_can_h2v2_downsample (void)
331 /* The code is optimised for these values only */
332 if (BITS_IN_JSAMPLE != 8)
334 if (sizeof(JDIMENSION) != 4)
337 if (simd_support & JSIMD_MIPS_DSPR2)
344 jsimd_can_h2v2_smooth_downsample (void)
348 /* The code is optimised for these values only */
349 if (BITS_IN_JSAMPLE != 8)
351 if (sizeof(JDIMENSION) != 4)
356 if (simd_support & JSIMD_MIPS_DSPR2)
363 jsimd_can_h2v1_downsample (void)
367 /* The code is optimised for these values only */
368 if (BITS_IN_JSAMPLE != 8)
370 if (sizeof(JDIMENSION) != 4)
373 if (simd_support & JSIMD_MIPS_DSPR2)
380 jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
381 JSAMPARRAY input_data, JSAMPARRAY output_data)
383 if (simd_support & JSIMD_MIPS_DSPR2)
384 jsimd_h2v2_downsample_mips_dspr2(cinfo->image_width,
385 cinfo->max_v_samp_factor,
386 compptr->v_samp_factor,
387 compptr->width_in_blocks, input_data,
392 jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo,
393 jpeg_component_info * compptr,
394 JSAMPARRAY input_data, JSAMPARRAY output_data)
396 jsimd_h2v2_smooth_downsample_mips_dspr2(input_data, output_data,
397 compptr->v_samp_factor,
398 cinfo->max_v_samp_factor,
399 cinfo->smoothing_factor,
400 compptr->width_in_blocks,
405 jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
406 JSAMPARRAY input_data, JSAMPARRAY output_data)
408 if (simd_support & JSIMD_MIPS_DSPR2)
409 jsimd_h2v1_downsample_mips_dspr2(cinfo->image_width,
410 cinfo->max_v_samp_factor,
411 compptr->v_samp_factor,
412 compptr->width_in_blocks,
413 input_data, output_data);
417 jsimd_can_h2v2_upsample (void)
421 /* The code is optimised for these values only */
422 if (BITS_IN_JSAMPLE != 8)
424 if (sizeof(JDIMENSION) != 4)
427 if (simd_support & JSIMD_MIPS_DSPR2)
434 jsimd_can_h2v1_upsample (void)
438 /* The code is optimised for these values only */
439 if (BITS_IN_JSAMPLE != 8)
441 if (sizeof(JDIMENSION) != 4)
444 if (simd_support & JSIMD_MIPS_DSPR2)
451 jsimd_can_int_upsample (void)
455 /* The code is optimised for these values only */
456 if (BITS_IN_JSAMPLE != 8)
458 if (sizeof(JDIMENSION) != 4)
461 if (simd_support & JSIMD_MIPS_DSPR2)
468 jsimd_h2v2_upsample (j_decompress_ptr cinfo,
469 jpeg_component_info * compptr,
470 JSAMPARRAY input_data,
471 JSAMPARRAY * output_data_ptr)
473 if (simd_support & JSIMD_MIPS_DSPR2)
474 jsimd_h2v2_upsample_mips_dspr2(cinfo->max_v_samp_factor,
475 cinfo->output_width, input_data,
480 jsimd_h2v1_upsample (j_decompress_ptr cinfo,
481 jpeg_component_info * compptr,
482 JSAMPARRAY input_data,
483 JSAMPARRAY * output_data_ptr)
485 if (simd_support & JSIMD_MIPS_DSPR2)
486 jsimd_h2v1_upsample_mips_dspr2(cinfo->max_v_samp_factor,
487 cinfo->output_width, input_data,
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_mips_dspr2(upsample->h_expand[compptr->component_index],
498 upsample->v_expand[compptr->component_index],
499 input_data, output_data_ptr,
501 cinfo->max_v_samp_factor);
505 jsimd_can_h2v2_fancy_upsample (void)
509 /* The code is optimised for these values only */
510 if (BITS_IN_JSAMPLE != 8)
512 if (sizeof(JDIMENSION) != 4)
515 if (simd_support & JSIMD_MIPS_DSPR2)
522 jsimd_can_h2v1_fancy_upsample (void)
526 /* The code is optimised for these values only */
527 if (BITS_IN_JSAMPLE != 8)
529 if (sizeof(JDIMENSION) != 4)
532 if (simd_support & JSIMD_MIPS_DSPR2)
539 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
540 jpeg_component_info * compptr,
541 JSAMPARRAY input_data,
542 JSAMPARRAY * output_data_ptr)
544 if (simd_support & JSIMD_MIPS_DSPR2)
545 jsimd_h2v2_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor,
546 compptr->downsampled_width,
547 input_data, output_data_ptr);
551 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
552 jpeg_component_info * compptr,
553 JSAMPARRAY input_data,
554 JSAMPARRAY * output_data_ptr)
556 if (simd_support & JSIMD_MIPS_DSPR2)
557 jsimd_h2v1_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor,
558 compptr->downsampled_width,
559 input_data, output_data_ptr);
563 jsimd_can_h2v2_merged_upsample (void)
567 if (BITS_IN_JSAMPLE != 8)
569 if (sizeof(JDIMENSION) != 4)
572 if (simd_support & JSIMD_MIPS_DSPR2)
579 jsimd_can_h2v1_merged_upsample (void)
583 if (BITS_IN_JSAMPLE != 8)
585 if (sizeof(JDIMENSION) != 4)
588 if (simd_support & JSIMD_MIPS_DSPR2)
595 jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
596 JSAMPIMAGE input_buf,
597 JDIMENSION in_row_group_ctr,
598 JSAMPARRAY output_buf)
600 void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY,
603 switch(cinfo->out_color_space) {
605 mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2;
609 mipsdspr2fct=jsimd_h2v2_extrgbx_merged_upsample_mips_dspr2;
612 mipsdspr2fct=jsimd_h2v2_extbgr_merged_upsample_mips_dspr2;
616 mipsdspr2fct=jsimd_h2v2_extbgrx_merged_upsample_mips_dspr2;
620 mipsdspr2fct=jsimd_h2v2_extxbgr_merged_upsample_mips_dspr2;
624 mipsdspr2fct=jsimd_h2v2_extxrgb_merged_upsample_mips_dspr2;
627 mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2;
631 mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf,
632 cinfo->sample_range_limit);
636 jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
637 JSAMPIMAGE input_buf,
638 JDIMENSION in_row_group_ctr,
639 JSAMPARRAY output_buf)
641 void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY,
644 switch(cinfo->out_color_space) {
646 mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2;
650 mipsdspr2fct=jsimd_h2v1_extrgbx_merged_upsample_mips_dspr2;
653 mipsdspr2fct=jsimd_h2v1_extbgr_merged_upsample_mips_dspr2;
657 mipsdspr2fct=jsimd_h2v1_extbgrx_merged_upsample_mips_dspr2;
661 mipsdspr2fct=jsimd_h2v1_extxbgr_merged_upsample_mips_dspr2;
665 mipsdspr2fct=jsimd_h2v1_extxrgb_merged_upsample_mips_dspr2;
668 mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2;
672 mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf,
673 cinfo->sample_range_limit);
677 jsimd_can_convsamp (void)
681 /* The code is optimised for these values only */
684 if (BITS_IN_JSAMPLE != 8)
686 if (sizeof(JDIMENSION) != 4)
688 if (sizeof(DCTELEM) != 2)
691 if (simd_support & JSIMD_MIPS_DSPR2)
698 jsimd_can_convsamp_float (void)
702 /* The code is optimised for these values only */
705 if (sizeof(JCOEF) != 2)
707 if (BITS_IN_JSAMPLE != 8)
709 if (sizeof(JDIMENSION) != 4)
711 if (sizeof(ISLOW_MULT_TYPE) != 2)
714 if (simd_support & JSIMD_MIPS_DSPR2)
721 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
724 if (simd_support & JSIMD_MIPS_DSPR2)
725 jsimd_convsamp_mips_dspr2(sample_data, start_col, workspace);
729 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
730 FAST_FLOAT * workspace)
732 if ((simd_support & JSIMD_MIPS_DSPR2))
733 jsimd_convsamp_float_mips_dspr2(sample_data, start_col, workspace);
737 jsimd_can_fdct_islow (void)
741 /* The code is optimised for these values only */
744 if (sizeof(DCTELEM) != 2)
747 if (simd_support & JSIMD_MIPS_DSPR2)
754 jsimd_can_fdct_ifast (void)
758 /* The code is optimised for these values only */
761 if (sizeof(DCTELEM) != 2)
764 if (simd_support & JSIMD_MIPS_DSPR2)
771 jsimd_can_fdct_float (void)
779 jsimd_fdct_islow (DCTELEM * data)
781 if (simd_support & JSIMD_MIPS_DSPR2)
782 jsimd_fdct_islow_mips_dspr2(data);
786 jsimd_fdct_ifast (DCTELEM * data)
788 if (simd_support & JSIMD_MIPS_DSPR2)
789 jsimd_fdct_ifast_mips_dspr2(data);
793 jsimd_fdct_float (FAST_FLOAT * data)
798 jsimd_can_quantize (void)
802 /* The code is optimised for these values only */
805 if (sizeof(JCOEF) != 2)
807 if (sizeof(DCTELEM) != 2)
810 if (simd_support & JSIMD_MIPS_DSPR2)
817 jsimd_can_quantize_float (void)
821 /* The code is optimised for these values only */
824 if (sizeof(JCOEF) != 2)
826 if (BITS_IN_JSAMPLE != 8)
828 if (sizeof(JDIMENSION) != 4)
830 if (sizeof(ISLOW_MULT_TYPE) != 2)
833 if (simd_support & JSIMD_MIPS_DSPR2)
840 jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
843 if (simd_support & JSIMD_MIPS_DSPR2)
844 jsimd_quantize_mips_dspr2(coef_block, divisors, workspace);
848 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
849 FAST_FLOAT * workspace)
851 if (simd_support & JSIMD_MIPS_DSPR2)
852 jsimd_quantize_float_mips_dspr2(coef_block, divisors, workspace);
856 jsimd_can_idct_2x2 (void)
860 /* The code is optimised for these values only */
863 if (sizeof(JCOEF) != 2)
865 if (BITS_IN_JSAMPLE != 8)
867 if (sizeof(JDIMENSION) != 4)
869 if (sizeof(ISLOW_MULT_TYPE) != 2)
872 if (simd_support & JSIMD_MIPS_DSPR2)
879 jsimd_can_idct_4x4 (void)
883 /* The code is optimised for these values only */
886 if (sizeof(JCOEF) != 2)
888 if (BITS_IN_JSAMPLE != 8)
890 if (sizeof(JDIMENSION) != 4)
892 if (sizeof(ISLOW_MULT_TYPE) != 2)
895 if (simd_support & JSIMD_MIPS_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_MIPS_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_MIPS_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 if (simd_support & JSIMD_MIPS_DSPR2)
952 jsimd_idct_2x2_mips_dspr2(compptr->dct_table, coef_block, output_buf,
957 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
958 JCOEFPTR coef_block, JSAMPARRAY output_buf,
959 JDIMENSION output_col)
961 if (simd_support & JSIMD_MIPS_DSPR2) {
962 int workspace[DCTSIZE*4]; /* buffers data between passes */
963 jsimd_idct_4x4_mips_dspr2(compptr->dct_table, coef_block, output_buf,
964 output_col, workspace);
969 jsimd_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
970 JCOEFPTR coef_block, JSAMPARRAY output_buf,
971 JDIMENSION output_col)
973 if (simd_support & JSIMD_MIPS_DSPR2)
974 jsimd_idct_6x6_mips_dspr2(compptr->dct_table, coef_block, output_buf,
979 jsimd_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
981 JSAMPARRAY output_buf, JDIMENSION output_col)
983 if (simd_support & JSIMD_MIPS_DSPR2) {
986 (int)(output_buf[0] + output_col),
987 (int)(output_buf[1] + output_col),
988 (int)(output_buf[2] + output_col),
989 (int)(output_buf[3] + output_col),
990 (int)(output_buf[4] + output_col),
991 (int)(output_buf[5] + output_col),
992 (int)(output_buf[6] + output_col),
993 (int)(output_buf[7] + output_col),
994 (int)(output_buf[8] + output_col),
995 (int)(output_buf[9] + output_col),
996 (int)(output_buf[10] + output_col),
997 (int)(output_buf[11] + output_col),
999 jsimd_idct_12x12_pass1_mips_dspr2(coef_block, compptr->dct_table,
1001 jsimd_idct_12x12_pass2_mips_dspr2(workspace, output);
1006 jsimd_can_idct_islow (void)
1010 /* The code is optimised for these values only */
1013 if (sizeof(JCOEF) != 2)
1015 if (BITS_IN_JSAMPLE != 8)
1017 if (sizeof(JDIMENSION) != 4)
1019 if (sizeof(ISLOW_MULT_TYPE) != 2)
1022 if (simd_support & JSIMD_MIPS_DSPR2)
1029 jsimd_can_idct_ifast (void)
1033 /* The code is optimised for these values only */
1036 if (sizeof(JCOEF) != 2)
1038 if (BITS_IN_JSAMPLE != 8)
1040 if (sizeof(JDIMENSION) != 4)
1042 if (sizeof(IFAST_MULT_TYPE) != 2)
1044 if (IFAST_SCALE_BITS != 2)
1047 if (simd_support & JSIMD_MIPS_DSPR2)
1054 jsimd_can_idct_float (void)
1062 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
1063 JCOEFPTR coef_block, JSAMPARRAY output_buf,
1064 JDIMENSION output_col)
1066 if (simd_support & JSIMD_MIPS_DSPR2) {
1068 (int)(output_buf[0] + output_col),
1069 (int)(output_buf[1] + output_col),
1070 (int)(output_buf[2] + output_col),
1071 (int)(output_buf[3] + output_col),
1072 (int)(output_buf[4] + output_col),
1073 (int)(output_buf[5] + output_col),
1074 (int)(output_buf[6] + output_col),
1075 (int)(output_buf[7] + output_col),
1078 jsimd_idct_islow_mips_dspr2(coef_block, compptr->dct_table,
1079 output, IDCT_range_limit(cinfo));
1084 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
1085 JCOEFPTR coef_block, JSAMPARRAY output_buf,
1086 JDIMENSION output_col)
1088 if (simd_support & JSIMD_MIPS_DSPR2) {
1090 IFAST_MULT_TYPE * quantptr;
1091 DCTELEM workspace[DCTSIZE2]; /* buffers data between passes */
1093 /* Pass 1: process columns from input, store into work array. */
1096 quantptr = (IFAST_MULT_TYPE *) compptr->dct_table;
1098 jsimd_idct_ifast_cols_mips_dspr2(inptr, quantptr,
1099 workspace, mips_idct_ifast_coefs);
1101 /* Pass 2: process rows from work array, store into output array. */
1102 /* Note that we must descale the results by a factor of 8 == 2**3, */
1103 /* and also undo the PASS1_BITS scaling. */
1105 jsimd_idct_ifast_rows_mips_dspr2(workspace, output_buf,
1106 output_col, mips_idct_ifast_coefs);
1111 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
1112 JCOEFPTR coef_block, JSAMPARRAY output_buf,
1113 JDIMENSION output_col)