tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

jsimd.c (18311B)


      1 /*
      2 * jsimd_mips64.c
      3 *
      4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
      5 * Copyright (C) 2009-2011, 2014, 2016, 2018, 2022, D. R. Commander.
      6 * Copyright (C) 2013-2014, MIPS Technologies, Inc., California.
      7 * Copyright (C) 2015, 2018, 2022, Matthieu Darbois.
      8 * Copyright (C) 2016-2018, Loongson Technology Corporation Limited, BeiJing.
      9 *
     10 * Based on the x86 SIMD extension for IJG JPEG library,
     11 * Copyright (C) 1999-2006, MIYASAKA Masaru.
     12 * For conditions of distribution and use, see copyright notice in jsimdext.inc
     13 *
     14 * This file contains the interface between the "normal" portions
     15 * of the library and the SIMD implementations when running on a
     16 * 64-bit MIPS architecture.
     17 */
     18 
     19 #define JPEG_INTERNALS
     20 #include "../../jinclude.h"
     21 #include "../../jpeglib.h"
     22 #include "../../jsimd.h"
     23 #include "../../jdct.h"
     24 #include "../../jsimddct.h"
     25 #include "../jsimd.h"
     26 
     27 #include <ctype.h>
     28 
     29 static THREAD_LOCAL unsigned int simd_support = ~0;
     30 
     31 #if defined(__linux__)
     32 
     33 #define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT  (1024 * 1024)
     34 
     35 LOCAL(int)
     36 check_feature(char *buffer, char *feature)
     37 {
     38  char *p;
     39 
     40  if (*feature == 0)
     41    return 0;
     42  if (strncmp(buffer, "ASEs implemented", 16) != 0)
     43    return 0;
     44  buffer += 16;
     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 
     70  simd_support = 0;
     71 
     72  if (!buffer)
     73    return 0;
     74 
     75  fd = fopen("/proc/cpuinfo", "r");
     76  if (fd) {
     77    while (fgets(buffer, bufsize, fd)) {
     78      if (!strchr(buffer, '\n') && !feof(fd)) {
     79        /* "impossible" happened - insufficient size of the buffer! */
     80        fclose(fd);
     81        free(buffer);
     82        return 0;
     83      }
     84      if (check_feature(buffer, "loongson-mmi"))
     85        simd_support |= JSIMD_MMI;
     86    }
     87    fclose(fd);
     88  }
     89  free(buffer);
     90  return 1;
     91 }
     92 
     93 #endif
     94 
     95 /*
     96 * Check what SIMD accelerations are supported.
     97 */
     98 LOCAL(void)
     99 init_simd(void)
    100 {
    101 #ifndef NO_GETENV
    102  char *env = NULL;
    103 #endif
    104 #if defined(__linux__)
    105  int bufsize = 1024; /* an initial guess for the line buffer size limit */
    106 #endif
    107 
    108  if (simd_support != ~0U)
    109    return;
    110 
    111  simd_support = 0;
    112 
    113 #if defined(__linux__)
    114  while (!parse_proc_cpuinfo(bufsize)) {
    115    bufsize *= 2;
    116    if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
    117      break;
    118  }
    119 #elif defined(__mips_loongson_vector_rev)
    120  /* Only enable MMI by default on non-Linux platforms when the compiler flags
    121   * support it. */
    122  simd_support |= JSIMD_MMI;
    123 #endif
    124 
    125 #ifndef NO_GETENV
    126  /* Force different settings through environment variables */
    127  env = getenv("JSIMD_FORCEMMI");
    128  if ((env != NULL) && (strcmp(env, "1") == 0))
    129    simd_support = JSIMD_MMI;
    130  env = getenv("JSIMD_FORCENONE");
    131  if ((env != NULL) && (strcmp(env, "1") == 0))
    132    simd_support = 0;
    133 #endif
    134 }
    135 
    136 GLOBAL(int)
    137 jsimd_can_rgb_ycc(void)
    138 {
    139  init_simd();
    140 
    141  /* The code is optimised for these values only */
    142  if (BITS_IN_JSAMPLE != 8)
    143    return 0;
    144  if (sizeof(JDIMENSION) != 4)
    145    return 0;
    146  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
    147    return 0;
    148 
    149  if (simd_support & JSIMD_MMI)
    150    return 1;
    151 
    152  return 0;
    153 }
    154 
    155 GLOBAL(int)
    156 jsimd_can_rgb_gray(void)
    157 {
    158  init_simd();
    159 
    160  /* The code is optimised for these values only */
    161  if (BITS_IN_JSAMPLE != 8)
    162    return 0;
    163  if (sizeof(JDIMENSION) != 4)
    164    return 0;
    165  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
    166    return 0;
    167 
    168  if (simd_support & JSIMD_MMI)
    169    return 1;
    170 
    171  return 0;
    172 }
    173 
    174 GLOBAL(int)
    175 jsimd_can_ycc_rgb(void)
    176 {
    177  init_simd();
    178 
    179  /* The code is optimised for these values only */
    180  if (BITS_IN_JSAMPLE != 8)
    181    return 0;
    182  if (sizeof(JDIMENSION) != 4)
    183    return 0;
    184  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
    185    return 0;
    186 
    187  if (simd_support & JSIMD_MMI)
    188    return 1;
    189 
    190  return 0;
    191 }
    192 
    193 GLOBAL(int)
    194 jsimd_can_ycc_rgb565(void)
    195 {
    196  return 0;
    197 }
    198 
    199 GLOBAL(int)
    200 jsimd_c_can_null_convert(void)
    201 {
    202  return 0;
    203 }
    204 
    205 GLOBAL(void)
    206 jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
    207                      JSAMPIMAGE output_buf, JDIMENSION output_row,
    208                      int num_rows)
    209 {
    210  void (*mmifct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
    211 
    212  switch (cinfo->in_color_space) {
    213  case JCS_EXT_RGB:
    214    mmifct = jsimd_extrgb_ycc_convert_mmi;
    215    break;
    216  case JCS_EXT_RGBX:
    217  case JCS_EXT_RGBA:
    218    mmifct = jsimd_extrgbx_ycc_convert_mmi;
    219    break;
    220  case JCS_EXT_BGR:
    221    mmifct = jsimd_extbgr_ycc_convert_mmi;
    222    break;
    223  case JCS_EXT_BGRX:
    224  case JCS_EXT_BGRA:
    225    mmifct = jsimd_extbgrx_ycc_convert_mmi;
    226    break;
    227  case JCS_EXT_XBGR:
    228  case JCS_EXT_ABGR:
    229    mmifct = jsimd_extxbgr_ycc_convert_mmi;
    230    break;
    231  case JCS_EXT_XRGB:
    232  case JCS_EXT_ARGB:
    233    mmifct = jsimd_extxrgb_ycc_convert_mmi;
    234    break;
    235  default:
    236    mmifct = jsimd_rgb_ycc_convert_mmi;
    237    break;
    238  }
    239 
    240  mmifct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
    241 }
    242 
    243 GLOBAL(void)
    244 jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
    245                       JSAMPIMAGE output_buf, JDIMENSION output_row,
    246                       int num_rows)
    247 {
    248  void (*mmifct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
    249 
    250  switch (cinfo->in_color_space) {
    251  case JCS_EXT_RGB:
    252    mmifct = jsimd_extrgb_gray_convert_mmi;
    253    break;
    254  case JCS_EXT_RGBX:
    255  case JCS_EXT_RGBA:
    256    mmifct = jsimd_extrgbx_gray_convert_mmi;
    257    break;
    258  case JCS_EXT_BGR:
    259    mmifct = jsimd_extbgr_gray_convert_mmi;
    260    break;
    261  case JCS_EXT_BGRX:
    262  case JCS_EXT_BGRA:
    263    mmifct = jsimd_extbgrx_gray_convert_mmi;
    264    break;
    265  case JCS_EXT_XBGR:
    266  case JCS_EXT_ABGR:
    267    mmifct = jsimd_extxbgr_gray_convert_mmi;
    268    break;
    269  case JCS_EXT_XRGB:
    270  case JCS_EXT_ARGB:
    271    mmifct = jsimd_extxrgb_gray_convert_mmi;
    272    break;
    273  default:
    274    mmifct = jsimd_rgb_gray_convert_mmi;
    275    break;
    276  }
    277 
    278  mmifct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
    279 }
    280 
    281 GLOBAL(void)
    282 jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
    283                      JDIMENSION input_row, JSAMPARRAY output_buf,
    284                      int num_rows)
    285 {
    286  void (*mmifct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
    287 
    288  switch (cinfo->out_color_space) {
    289  case JCS_EXT_RGB:
    290    mmifct = jsimd_ycc_extrgb_convert_mmi;
    291    break;
    292  case JCS_EXT_RGBX:
    293  case JCS_EXT_RGBA:
    294    mmifct = jsimd_ycc_extrgbx_convert_mmi;
    295    break;
    296  case JCS_EXT_BGR:
    297    mmifct = jsimd_ycc_extbgr_convert_mmi;
    298    break;
    299  case JCS_EXT_BGRX:
    300  case JCS_EXT_BGRA:
    301    mmifct = jsimd_ycc_extbgrx_convert_mmi;
    302    break;
    303  case JCS_EXT_XBGR:
    304  case JCS_EXT_ABGR:
    305    mmifct = jsimd_ycc_extxbgr_convert_mmi;
    306    break;
    307  case JCS_EXT_XRGB:
    308  case JCS_EXT_ARGB:
    309    mmifct = jsimd_ycc_extxrgb_convert_mmi;
    310    break;
    311  default:
    312    mmifct = jsimd_ycc_rgb_convert_mmi;
    313    break;
    314  }
    315 
    316  mmifct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
    317 }
    318 
    319 GLOBAL(void)
    320 jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
    321                         JDIMENSION input_row, JSAMPARRAY output_buf,
    322                         int num_rows)
    323 {
    324 }
    325 
    326 GLOBAL(void)
    327 jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
    328                     JSAMPIMAGE output_buf, JDIMENSION output_row,
    329                     int num_rows)
    330 {
    331 }
    332 
    333 GLOBAL(int)
    334 jsimd_can_h2v2_downsample(void)
    335 {
    336  init_simd();
    337 
    338  /* The code is optimised for these values only */
    339  if (BITS_IN_JSAMPLE != 8)
    340    return 0;
    341  if (sizeof(JDIMENSION) != 4)
    342    return 0;
    343 
    344  if (simd_support & JSIMD_MMI)
    345    return 1;
    346 
    347  return 0;
    348 }
    349 
    350 GLOBAL(int)
    351 jsimd_can_h2v2_smooth_downsample(void)
    352 {
    353  return 0;
    354 }
    355 
    356 GLOBAL(int)
    357 jsimd_can_h2v1_downsample(void)
    358 {
    359  return 0;
    360 }
    361 
    362 GLOBAL(void)
    363 jsimd_h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
    364                      JSAMPARRAY input_data, JSAMPARRAY output_data)
    365 {
    366  jsimd_h2v2_downsample_mmi(cinfo->image_width, cinfo->max_v_samp_factor,
    367                            compptr->v_samp_factor, compptr->width_in_blocks,
    368                            input_data, output_data);
    369 }
    370 
    371 GLOBAL(void)
    372 jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo,
    373                             jpeg_component_info *compptr,
    374                             JSAMPARRAY input_data, JSAMPARRAY output_data)
    375 {
    376 }
    377 
    378 GLOBAL(void)
    379 jsimd_h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
    380                      JSAMPARRAY input_data, JSAMPARRAY output_data)
    381 {
    382 }
    383 
    384 GLOBAL(int)
    385 jsimd_can_h2v2_upsample(void)
    386 {
    387  return 0;
    388 }
    389 
    390 GLOBAL(int)
    391 jsimd_can_h2v1_upsample(void)
    392 {
    393  return 0;
    394 }
    395 
    396 GLOBAL(int)
    397 jsimd_can_int_upsample(void)
    398 {
    399  return 0;
    400 }
    401 
    402 GLOBAL(void)
    403 jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    404                    JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
    405 {
    406 }
    407 
    408 GLOBAL(void)
    409 jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    410                    JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
    411 {
    412 }
    413 
    414 GLOBAL(void)
    415 jsimd_int_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    416                   JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
    417 {
    418 }
    419 
    420 GLOBAL(int)
    421 jsimd_can_h2v2_fancy_upsample(void)
    422 {
    423  init_simd();
    424 
    425  /* The code is optimised for these values only */
    426  if (BITS_IN_JSAMPLE != 8)
    427    return 0;
    428  if (sizeof(JDIMENSION) != 4)
    429    return 0;
    430 
    431  if (simd_support & JSIMD_MMI)
    432    return 1;
    433 
    434  return 0;
    435 }
    436 
    437 GLOBAL(int)
    438 jsimd_can_h2v1_fancy_upsample(void)
    439 {
    440  init_simd();
    441 
    442  /* The code is optimised for these values only */
    443  if (BITS_IN_JSAMPLE != 8)
    444    return 0;
    445  if (sizeof(JDIMENSION) != 4)
    446    return 0;
    447 
    448  if (simd_support & JSIMD_MMI)
    449    return 1;
    450 
    451  return 0;
    452 }
    453 
    454 GLOBAL(void)
    455 jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    456                          JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
    457 {
    458  jsimd_h2v2_fancy_upsample_mmi(cinfo->max_v_samp_factor,
    459                                compptr->downsampled_width, input_data,
    460                                output_data_ptr);
    461 }
    462 
    463 GLOBAL(void)
    464 jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    465                          JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
    466 {
    467  jsimd_h2v1_fancy_upsample_mmi(cinfo->max_v_samp_factor,
    468                                compptr->downsampled_width, input_data,
    469                                output_data_ptr);
    470 }
    471 
    472 GLOBAL(int)
    473 jsimd_can_h2v2_merged_upsample(void)
    474 {
    475  init_simd();
    476 
    477  /* The code is optimised for these values only */
    478  if (BITS_IN_JSAMPLE != 8)
    479    return 0;
    480  if (sizeof(JDIMENSION) != 4)
    481    return 0;
    482 
    483  if (simd_support & JSIMD_MMI)
    484    return 1;
    485 
    486  return 0;
    487 }
    488 
    489 GLOBAL(int)
    490 jsimd_can_h2v1_merged_upsample(void)
    491 {
    492  init_simd();
    493 
    494  /* The code is optimised for these values only */
    495  if (BITS_IN_JSAMPLE != 8)
    496    return 0;
    497  if (sizeof(JDIMENSION) != 4)
    498    return 0;
    499 
    500  if (simd_support & JSIMD_MMI)
    501    return 1;
    502 
    503  return 0;
    504 }
    505 
    506 GLOBAL(void)
    507 jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
    508                           JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
    509 {
    510  void (*mmifct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
    511 
    512  switch (cinfo->out_color_space) {
    513  case JCS_EXT_RGB:
    514    mmifct = jsimd_h2v2_extrgb_merged_upsample_mmi;
    515    break;
    516  case JCS_EXT_RGBX:
    517  case JCS_EXT_RGBA:
    518    mmifct = jsimd_h2v2_extrgbx_merged_upsample_mmi;
    519    break;
    520  case JCS_EXT_BGR:
    521    mmifct = jsimd_h2v2_extbgr_merged_upsample_mmi;
    522    break;
    523  case JCS_EXT_BGRX:
    524  case JCS_EXT_BGRA:
    525    mmifct = jsimd_h2v2_extbgrx_merged_upsample_mmi;
    526    break;
    527  case JCS_EXT_XBGR:
    528  case JCS_EXT_ABGR:
    529    mmifct = jsimd_h2v2_extxbgr_merged_upsample_mmi;
    530    break;
    531  case JCS_EXT_XRGB:
    532  case JCS_EXT_ARGB:
    533    mmifct = jsimd_h2v2_extxrgb_merged_upsample_mmi;
    534    break;
    535  default:
    536    mmifct = jsimd_h2v2_merged_upsample_mmi;
    537    break;
    538  }
    539 
    540  mmifct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
    541 }
    542 
    543 GLOBAL(void)
    544 jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
    545                           JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
    546 {
    547  void (*mmifct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
    548 
    549  switch (cinfo->out_color_space) {
    550  case JCS_EXT_RGB:
    551    mmifct = jsimd_h2v1_extrgb_merged_upsample_mmi;
    552    break;
    553  case JCS_EXT_RGBX:
    554  case JCS_EXT_RGBA:
    555    mmifct = jsimd_h2v1_extrgbx_merged_upsample_mmi;
    556    break;
    557  case JCS_EXT_BGR:
    558    mmifct = jsimd_h2v1_extbgr_merged_upsample_mmi;
    559    break;
    560  case JCS_EXT_BGRX:
    561  case JCS_EXT_BGRA:
    562    mmifct = jsimd_h2v1_extbgrx_merged_upsample_mmi;
    563    break;
    564  case JCS_EXT_XBGR:
    565  case JCS_EXT_ABGR:
    566    mmifct = jsimd_h2v1_extxbgr_merged_upsample_mmi;
    567    break;
    568  case JCS_EXT_XRGB:
    569  case JCS_EXT_ARGB:
    570    mmifct = jsimd_h2v1_extxrgb_merged_upsample_mmi;
    571    break;
    572  default:
    573    mmifct = jsimd_h2v1_merged_upsample_mmi;
    574    break;
    575  }
    576 
    577  mmifct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
    578 }
    579 
    580 GLOBAL(int)
    581 jsimd_can_convsamp(void)
    582 {
    583  return 0;
    584 }
    585 
    586 GLOBAL(int)
    587 jsimd_can_convsamp_float(void)
    588 {
    589  return 0;
    590 }
    591 
    592 GLOBAL(void)
    593 jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
    594               DCTELEM *workspace)
    595 {
    596 }
    597 
    598 GLOBAL(void)
    599 jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
    600                     FAST_FLOAT *workspace)
    601 {
    602 }
    603 
    604 GLOBAL(int)
    605 jsimd_can_fdct_islow(void)
    606 {
    607  init_simd();
    608 
    609  /* The code is optimised for these values only */
    610  if (DCTSIZE != 8)
    611    return 0;
    612  if (sizeof(DCTELEM) != 2)
    613    return 0;
    614 
    615  if (simd_support & JSIMD_MMI)
    616    return 1;
    617 
    618  return 0;
    619 }
    620 
    621 GLOBAL(int)
    622 jsimd_can_fdct_ifast(void)
    623 {
    624  init_simd();
    625 
    626  /* The code is optimised for these values only */
    627  if (DCTSIZE != 8)
    628    return 0;
    629  if (sizeof(DCTELEM) != 2)
    630    return 0;
    631 
    632  if (simd_support & JSIMD_MMI)
    633    return 1;
    634 
    635  return 0;
    636 }
    637 
    638 GLOBAL(int)
    639 jsimd_can_fdct_float(void)
    640 {
    641  return 0;
    642 }
    643 
    644 GLOBAL(void)
    645 jsimd_fdct_islow(DCTELEM *data)
    646 {
    647  jsimd_fdct_islow_mmi(data);
    648 }
    649 
    650 GLOBAL(void)
    651 jsimd_fdct_ifast(DCTELEM *data)
    652 {
    653  jsimd_fdct_ifast_mmi(data);
    654 }
    655 
    656 GLOBAL(void)
    657 jsimd_fdct_float(FAST_FLOAT *data)
    658 {
    659 }
    660 
    661 GLOBAL(int)
    662 jsimd_can_quantize(void)
    663 {
    664  init_simd();
    665 
    666  /* The code is optimised for these values only */
    667  if (DCTSIZE != 8)
    668    return 0;
    669  if (sizeof(JCOEF) != 2)
    670    return 0;
    671  if (sizeof(DCTELEM) != 2)
    672    return 0;
    673 
    674  if (simd_support & JSIMD_MMI)
    675    return 1;
    676 
    677  return 0;
    678 }
    679 
    680 GLOBAL(int)
    681 jsimd_can_quantize_float(void)
    682 {
    683  return 0;
    684 }
    685 
    686 GLOBAL(void)
    687 jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
    688 {
    689  jsimd_quantize_mmi(coef_block, divisors, workspace);
    690 }
    691 
    692 GLOBAL(void)
    693 jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
    694                     FAST_FLOAT *workspace)
    695 {
    696 }
    697 
    698 GLOBAL(int)
    699 jsimd_can_idct_2x2(void)
    700 {
    701  return 0;
    702 }
    703 
    704 GLOBAL(int)
    705 jsimd_can_idct_4x4(void)
    706 {
    707  return 0;
    708 }
    709 
    710 GLOBAL(int)
    711 jsimd_can_idct_6x6(void)
    712 {
    713  return 0;
    714 }
    715 
    716 GLOBAL(int)
    717 jsimd_can_idct_12x12(void)
    718 {
    719  return 0;
    720 }
    721 
    722 GLOBAL(void)
    723 jsimd_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    724               JCOEFPTR coef_block, JSAMPARRAY output_buf,
    725               JDIMENSION output_col)
    726 {
    727 }
    728 
    729 GLOBAL(void)
    730 jsimd_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    731               JCOEFPTR coef_block, JSAMPARRAY output_buf,
    732               JDIMENSION output_col)
    733 {
    734 }
    735 
    736 GLOBAL(void)
    737 jsimd_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    738               JCOEFPTR coef_block, JSAMPARRAY output_buf,
    739               JDIMENSION output_col)
    740 {
    741 }
    742 
    743 GLOBAL(void)
    744 jsimd_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    745                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
    746                 JDIMENSION output_col)
    747 {
    748 }
    749 
    750 GLOBAL(int)
    751 jsimd_can_idct_islow(void)
    752 {
    753  init_simd();
    754 
    755  /* The code is optimised for these values only */
    756  if (DCTSIZE != 8)
    757    return 0;
    758  if (sizeof(JCOEF) != 2)
    759    return 0;
    760  if (BITS_IN_JSAMPLE != 8)
    761    return 0;
    762  if (sizeof(JDIMENSION) != 4)
    763    return 0;
    764  if (sizeof(ISLOW_MULT_TYPE) != 2)
    765    return 0;
    766 
    767  if (simd_support & JSIMD_MMI)
    768    return 1;
    769 
    770  return 0;
    771 }
    772 
    773 GLOBAL(int)
    774 jsimd_can_idct_ifast(void)
    775 {
    776  init_simd();
    777 
    778  /* The code is optimised for these values only */
    779  if (DCTSIZE != 8)
    780    return 0;
    781  if (sizeof(JCOEF) != 2)
    782    return 0;
    783  if (BITS_IN_JSAMPLE != 8)
    784    return 0;
    785  if (sizeof(JDIMENSION) != 4)
    786    return 0;
    787  if (sizeof(IFAST_MULT_TYPE) != 2)
    788    return 0;
    789  if (IFAST_SCALE_BITS != 2)
    790    return 0;
    791 
    792  if (simd_support & JSIMD_MMI)
    793    return 1;
    794 
    795  return 0;
    796 }
    797 
    798 GLOBAL(int)
    799 jsimd_can_idct_float(void)
    800 {
    801  return 0;
    802 }
    803 
    804 GLOBAL(void)
    805 jsimd_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    806                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
    807                 JDIMENSION output_col)
    808 {
    809  jsimd_idct_islow_mmi(compptr->dct_table, coef_block, output_buf, output_col);
    810 }
    811 
    812 GLOBAL(void)
    813 jsimd_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    814                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
    815                 JDIMENSION output_col)
    816 {
    817  jsimd_idct_ifast_mmi(compptr->dct_table, coef_block, output_buf, output_col);
    818 }
    819 
    820 GLOBAL(void)
    821 jsimd_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
    822                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
    823                 JDIMENSION output_col)
    824 {
    825 }
    826 
    827 GLOBAL(int)
    828 jsimd_can_huff_encode_one_block(void)
    829 {
    830  return 0;
    831 }
    832 
    833 GLOBAL(JOCTET *)
    834 jsimd_huff_encode_one_block(void *state, JOCTET *buffer, JCOEFPTR block,
    835                            int last_dc_val, c_derived_tbl *dctbl,
    836                            c_derived_tbl *actbl)
    837 {
    838  return NULL;
    839 }
    840 
    841 GLOBAL(int)
    842 jsimd_can_encode_mcu_AC_first_prepare(void)
    843 {
    844  return 0;
    845 }
    846 
    847 GLOBAL(void)
    848 jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
    849                                  const int *jpeg_natural_order_start, int Sl,
    850                                  int Al, UJCOEF *values, size_t *zerobits)
    851 {
    852 }
    853 
    854 GLOBAL(int)
    855 jsimd_can_encode_mcu_AC_refine_prepare(void)
    856 {
    857  return 0;
    858 }
    859 
    860 GLOBAL(int)
    861 jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
    862                                   const int *jpeg_natural_order_start, int Sl,
    863                                   int Al, UJCOEF *absvalues, size_t *bits)
    864 {
    865  return 0;
    866 }