media/libjpeg/simd/jsimd_arm.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libjpeg/simd/jsimd_arm.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,682 @@
     1.4 +/*
     1.5 + * jsimd_arm.c
     1.6 + *
     1.7 + * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
     1.8 + * Copyright 2009-2011 D. R. Commander
     1.9 + * 
    1.10 + * Based on the x86 SIMD extension for IJG JPEG library,
    1.11 + * Copyright (C) 1999-2006, MIYASAKA Masaru.
    1.12 + * For conditions of distribution and use, see copyright notice in jsimdext.inc
    1.13 + *
    1.14 + * This file contains the interface between the "normal" portions
    1.15 + * of the library and the SIMD implementations when running on
    1.16 + * ARM architecture.
    1.17 + *
    1.18 + * Based on the stubs from 'jsimd_none.c'
    1.19 + */
    1.20 +
    1.21 +#define JPEG_INTERNALS
    1.22 +#include "../jinclude.h"
    1.23 +#include "../jpeglib.h"
    1.24 +#include "../jsimd.h"
    1.25 +#include "../jdct.h"
    1.26 +#include "../jsimddct.h"
    1.27 +#include "jsimd.h"
    1.28 +
    1.29 +#include <stdio.h>
    1.30 +#include <string.h>
    1.31 +#include <ctype.h>
    1.32 +
    1.33 +static unsigned int simd_support = ~0;
    1.34 +
    1.35 +#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
    1.36 +
    1.37 +#define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024)
    1.38 +
    1.39 +LOCAL(int)
    1.40 +check_feature (char *buffer, char *feature)
    1.41 +{
    1.42 +  char *p;
    1.43 +  if (*feature == 0)
    1.44 +    return 0;
    1.45 +  if (strncmp(buffer, "Features", 8) != 0)
    1.46 +    return 0;
    1.47 +  buffer += 8;
    1.48 +  while (isspace(*buffer))
    1.49 +    buffer++;
    1.50 +
    1.51 +  /* Check if 'feature' is present in the buffer as a separate word */
    1.52 +  while ((p = strstr(buffer, feature))) {
    1.53 +    if (p > buffer && !isspace(*(p - 1))) {
    1.54 +      buffer++;
    1.55 +      continue;
    1.56 +    }
    1.57 +    p += strlen(feature);
    1.58 +    if (*p != 0 && !isspace(*p)) {
    1.59 +      buffer++;
    1.60 +      continue;
    1.61 +    }
    1.62 +    return 1;
    1.63 +  }
    1.64 +  return 0;
    1.65 +}
    1.66 +
    1.67 +LOCAL(int)
    1.68 +parse_proc_cpuinfo (int bufsize)
    1.69 +{
    1.70 +  char *buffer = (char *)malloc(bufsize);
    1.71 +  FILE *fd;
    1.72 +  simd_support = 0;
    1.73 +
    1.74 +  if (!buffer)
    1.75 +    return 0;
    1.76 +
    1.77 +  fd = fopen("/proc/cpuinfo", "r");
    1.78 +  if (fd) {
    1.79 +    while (fgets(buffer, bufsize, fd)) {
    1.80 +      if (!strchr(buffer, '\n') && !feof(fd)) {
    1.81 +        /* "impossible" happened - insufficient size of the buffer! */
    1.82 +        fclose(fd);
    1.83 +        free(buffer);
    1.84 +        return 0;
    1.85 +      }
    1.86 +      if (check_feature(buffer, "neon"))
    1.87 +        simd_support |= JSIMD_ARM_NEON;
    1.88 +    }
    1.89 +    fclose(fd);
    1.90 +  }
    1.91 +  free(buffer);
    1.92 +  return 1;
    1.93 +}
    1.94 +
    1.95 +#endif
    1.96 +
    1.97 +/*
    1.98 + * Check what SIMD accelerations are supported.
    1.99 + *
   1.100 + * FIXME: This code is racy under a multi-threaded environment.
   1.101 + */
   1.102 +LOCAL(void)
   1.103 +init_simd (void)
   1.104 +{
   1.105 +  char *env = NULL;
   1.106 +#if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
   1.107 +  int bufsize = 1024; /* an initial guess for the line buffer size limit */
   1.108 +#endif
   1.109 +
   1.110 +  if (simd_support != ~0U)
   1.111 +    return;
   1.112 +
   1.113 +  simd_support = 0;
   1.114 +
   1.115 +#if defined(__ARM_NEON__)
   1.116 +  simd_support |= JSIMD_ARM_NEON;
   1.117 +#elif defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
   1.118 +  /* We still have a chance to use NEON regardless of globally used
   1.119 +   * -mcpu/-mfpu options passed to gcc by performing runtime detection via
   1.120 +   * /proc/cpuinfo parsing on linux/android */
   1.121 +  while (!parse_proc_cpuinfo(bufsize)) {
   1.122 +    bufsize *= 2;
   1.123 +    if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
   1.124 +      break;
   1.125 +  }
   1.126 +#endif
   1.127 +
   1.128 +  /* Force different settings through environment variables */
   1.129 +  env = getenv("JSIMD_FORCE_ARM_NEON");
   1.130 +  if ((env != NULL) && (strcmp(env, "1") == 0))
   1.131 +    simd_support &= JSIMD_ARM_NEON;
   1.132 +  env = getenv("JSIMD_FORCE_NO_SIMD");
   1.133 +  if ((env != NULL) && (strcmp(env, "1") == 0))
   1.134 +    simd_support = 0;
   1.135 +}
   1.136 +
   1.137 +GLOBAL(int)
   1.138 +jsimd_can_rgb_ycc (void)
   1.139 +{
   1.140 +  init_simd();
   1.141 +
   1.142 +  /* The code is optimised for these values only */
   1.143 +  if (BITS_IN_JSAMPLE != 8)
   1.144 +    return 0;
   1.145 +  if (sizeof(JDIMENSION) != 4)
   1.146 +    return 0;
   1.147 +  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
   1.148 +    return 0;
   1.149 +
   1.150 +  if (simd_support & JSIMD_ARM_NEON)
   1.151 +    return 1;
   1.152 +
   1.153 +  return 0;
   1.154 +}
   1.155 +
   1.156 +GLOBAL(int)
   1.157 +jsimd_can_rgb_gray (void)
   1.158 +{
   1.159 +  init_simd();
   1.160 +
   1.161 +  return 0;
   1.162 +}
   1.163 +
   1.164 +GLOBAL(int)
   1.165 +jsimd_can_ycc_rgb (void)
   1.166 +{
   1.167 +  init_simd();
   1.168 +
   1.169 +  /* The code is optimised for these values only */
   1.170 +  if (BITS_IN_JSAMPLE != 8)
   1.171 +    return 0;
   1.172 +  if (sizeof(JDIMENSION) != 4)
   1.173 +    return 0;
   1.174 +  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
   1.175 +    return 0;
   1.176 +  if (simd_support & JSIMD_ARM_NEON)
   1.177 +    return 1;
   1.178 +
   1.179 +  return 0;
   1.180 +}
   1.181 +
   1.182 +GLOBAL(void)
   1.183 +jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
   1.184 +                       JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
   1.185 +                       JDIMENSION output_row, int num_rows)
   1.186 +{
   1.187 +  void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
   1.188 +
   1.189 +  switch(cinfo->in_color_space)
   1.190 +  {
   1.191 +    case JCS_EXT_RGB:
   1.192 +      neonfct=jsimd_extrgb_ycc_convert_neon;
   1.193 +      break;
   1.194 +    case JCS_EXT_RGBX:
   1.195 +    case JCS_EXT_RGBA:
   1.196 +      neonfct=jsimd_extrgbx_ycc_convert_neon;
   1.197 +      break;
   1.198 +    case JCS_EXT_BGR:
   1.199 +      neonfct=jsimd_extbgr_ycc_convert_neon;
   1.200 +      break;
   1.201 +    case JCS_EXT_BGRX:
   1.202 +    case JCS_EXT_BGRA:
   1.203 +      neonfct=jsimd_extbgrx_ycc_convert_neon;
   1.204 +      break;
   1.205 +    case JCS_EXT_XBGR:
   1.206 +    case JCS_EXT_ABGR:
   1.207 +      neonfct=jsimd_extxbgr_ycc_convert_neon;
   1.208 +      break;
   1.209 +    case JCS_EXT_XRGB:
   1.210 +    case JCS_EXT_ARGB:
   1.211 +      neonfct=jsimd_extxrgb_ycc_convert_neon;
   1.212 +      break;
   1.213 +    default:
   1.214 +      neonfct=jsimd_extrgb_ycc_convert_neon;
   1.215 +      break;
   1.216 +  }
   1.217 +
   1.218 +  if (simd_support & JSIMD_ARM_NEON)
   1.219 +    neonfct(cinfo->image_width, input_buf,
   1.220 +        output_buf, output_row, num_rows);
   1.221 +}
   1.222 +
   1.223 +GLOBAL(void)
   1.224 +jsimd_rgb_gray_convert (j_compress_ptr cinfo,
   1.225 +                        JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
   1.226 +                        JDIMENSION output_row, int num_rows)
   1.227 +{
   1.228 +}
   1.229 +
   1.230 +GLOBAL(void)
   1.231 +jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
   1.232 +                       JSAMPIMAGE input_buf, JDIMENSION input_row,
   1.233 +                       JSAMPARRAY output_buf, int num_rows)
   1.234 +{
   1.235 +  void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
   1.236 +
   1.237 +  switch(cinfo->out_color_space)
   1.238 +  {
   1.239 +    case JCS_EXT_RGB:
   1.240 +      neonfct=jsimd_ycc_extrgb_convert_neon;
   1.241 +      break;
   1.242 +    case JCS_EXT_RGBX:
   1.243 +    case JCS_EXT_RGBA:
   1.244 +      neonfct=jsimd_ycc_extrgbx_convert_neon;
   1.245 +      break;
   1.246 +    case JCS_EXT_BGR:
   1.247 +      neonfct=jsimd_ycc_extbgr_convert_neon;
   1.248 +      break;
   1.249 +    case JCS_EXT_BGRX:
   1.250 +    case JCS_EXT_BGRA:
   1.251 +      neonfct=jsimd_ycc_extbgrx_convert_neon;
   1.252 +      break;
   1.253 +    case JCS_EXT_XBGR:
   1.254 +    case JCS_EXT_ABGR:
   1.255 +      neonfct=jsimd_ycc_extxbgr_convert_neon;
   1.256 +      break;
   1.257 +    case JCS_EXT_XRGB:
   1.258 +    case JCS_EXT_ARGB:
   1.259 +      neonfct=jsimd_ycc_extxrgb_convert_neon;
   1.260 +      break;
   1.261 +  default:
   1.262 +      neonfct=jsimd_ycc_extrgb_convert_neon;
   1.263 +      break;
   1.264 +  }
   1.265 +
   1.266 +  if (simd_support & JSIMD_ARM_NEON)
   1.267 +    neonfct(cinfo->output_width, input_buf,
   1.268 +        input_row, output_buf, num_rows);
   1.269 +}
   1.270 +
   1.271 +GLOBAL(int)
   1.272 +jsimd_can_h2v2_downsample (void)
   1.273 +{
   1.274 +  init_simd();
   1.275 +
   1.276 +  return 0;
   1.277 +}
   1.278 +
   1.279 +GLOBAL(int)
   1.280 +jsimd_can_h2v1_downsample (void)
   1.281 +{
   1.282 +  init_simd();
   1.283 +
   1.284 +  return 0;
   1.285 +}
   1.286 +
   1.287 +GLOBAL(void)
   1.288 +jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
   1.289 +                       JSAMPARRAY input_data, JSAMPARRAY output_data)
   1.290 +{
   1.291 +}
   1.292 +
   1.293 +GLOBAL(void)
   1.294 +jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
   1.295 +                       JSAMPARRAY input_data, JSAMPARRAY output_data)
   1.296 +{
   1.297 +}
   1.298 +
   1.299 +GLOBAL(int)
   1.300 +jsimd_can_h2v2_upsample (void)
   1.301 +{
   1.302 +  init_simd();
   1.303 +
   1.304 +  return 0;
   1.305 +}
   1.306 +
   1.307 +GLOBAL(int)
   1.308 +jsimd_can_h2v1_upsample (void)
   1.309 +{
   1.310 +  init_simd();
   1.311 +
   1.312 +  return 0;
   1.313 +}
   1.314 +
   1.315 +GLOBAL(void)
   1.316 +jsimd_h2v2_upsample (j_decompress_ptr cinfo,
   1.317 +                     jpeg_component_info * compptr, 
   1.318 +                     JSAMPARRAY input_data,
   1.319 +                     JSAMPARRAY * output_data_ptr)
   1.320 +{
   1.321 +}
   1.322 +
   1.323 +GLOBAL(void)
   1.324 +jsimd_h2v1_upsample (j_decompress_ptr cinfo,
   1.325 +                     jpeg_component_info * compptr, 
   1.326 +                     JSAMPARRAY input_data,
   1.327 +                     JSAMPARRAY * output_data_ptr)
   1.328 +{
   1.329 +}
   1.330 +
   1.331 +GLOBAL(int)
   1.332 +jsimd_can_h2v2_fancy_upsample (void)
   1.333 +{
   1.334 +  init_simd();
   1.335 +
   1.336 +  return 0;
   1.337 +}
   1.338 +
   1.339 +GLOBAL(int)
   1.340 +jsimd_can_h2v1_fancy_upsample (void)
   1.341 +{
   1.342 +  init_simd();
   1.343 +
   1.344 +  /* The code is optimised for these values only */
   1.345 +  if (BITS_IN_JSAMPLE != 8)
   1.346 +    return 0;
   1.347 +  if (sizeof(JDIMENSION) != 4)
   1.348 +    return 0;
   1.349 +
   1.350 +  if (simd_support & JSIMD_ARM_NEON)
   1.351 +    return 1;
   1.352 +
   1.353 +  return 0;
   1.354 +}
   1.355 +
   1.356 +GLOBAL(void)
   1.357 +jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
   1.358 +                           jpeg_component_info * compptr, 
   1.359 +                           JSAMPARRAY input_data,
   1.360 +                           JSAMPARRAY * output_data_ptr)
   1.361 +{
   1.362 +}
   1.363 +
   1.364 +GLOBAL(void)
   1.365 +jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
   1.366 +                           jpeg_component_info * compptr, 
   1.367 +                           JSAMPARRAY input_data,
   1.368 +                           JSAMPARRAY * output_data_ptr)
   1.369 +{
   1.370 +  if (simd_support & JSIMD_ARM_NEON)
   1.371 +    jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
   1.372 +        compptr->downsampled_width, input_data, output_data_ptr);
   1.373 +}
   1.374 +
   1.375 +GLOBAL(int)
   1.376 +jsimd_can_h2v2_merged_upsample (void)
   1.377 +{
   1.378 +  init_simd();
   1.379 +
   1.380 +  return 0;
   1.381 +}
   1.382 +
   1.383 +GLOBAL(int)
   1.384 +jsimd_can_h2v1_merged_upsample (void)
   1.385 +{
   1.386 +  init_simd();
   1.387 +
   1.388 +  return 0;
   1.389 +}
   1.390 +
   1.391 +GLOBAL(void)
   1.392 +jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
   1.393 +                            JSAMPIMAGE input_buf,
   1.394 +                            JDIMENSION in_row_group_ctr,
   1.395 +                            JSAMPARRAY output_buf)
   1.396 +{
   1.397 +}
   1.398 +
   1.399 +GLOBAL(void)
   1.400 +jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
   1.401 +                            JSAMPIMAGE input_buf,
   1.402 +                            JDIMENSION in_row_group_ctr,
   1.403 +                            JSAMPARRAY output_buf)
   1.404 +{
   1.405 +}
   1.406 +
   1.407 +GLOBAL(int)
   1.408 +jsimd_can_convsamp (void)
   1.409 +{
   1.410 +  init_simd();
   1.411 +
   1.412 +  /* The code is optimised for these values only */
   1.413 +  if (DCTSIZE != 8)
   1.414 +    return 0;
   1.415 +  if (BITS_IN_JSAMPLE != 8)
   1.416 +    return 0;
   1.417 +  if (sizeof(JDIMENSION) != 4)
   1.418 +    return 0;
   1.419 +  if (sizeof(DCTELEM) != 2)
   1.420 +    return 0;
   1.421 +
   1.422 +  if (simd_support & JSIMD_ARM_NEON)
   1.423 +    return 1;
   1.424 +
   1.425 +  return 0;
   1.426 +}
   1.427 +
   1.428 +GLOBAL(int)
   1.429 +jsimd_can_convsamp_float (void)
   1.430 +{
   1.431 +  init_simd();
   1.432 +
   1.433 +  return 0;
   1.434 +}
   1.435 +
   1.436 +GLOBAL(void)
   1.437 +jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
   1.438 +                DCTELEM * workspace)
   1.439 +{
   1.440 +  if (simd_support & JSIMD_ARM_NEON)
   1.441 +    jsimd_convsamp_neon(sample_data, start_col, workspace);
   1.442 +}
   1.443 +
   1.444 +GLOBAL(void)
   1.445 +jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
   1.446 +                      FAST_FLOAT * workspace)
   1.447 +{
   1.448 +}
   1.449 +
   1.450 +GLOBAL(int)
   1.451 +jsimd_can_fdct_islow (void)
   1.452 +{
   1.453 +  init_simd();
   1.454 +
   1.455 +  return 0;
   1.456 +}
   1.457 +
   1.458 +GLOBAL(int)
   1.459 +jsimd_can_fdct_ifast (void)
   1.460 +{
   1.461 +  init_simd();
   1.462 +
   1.463 +  /* The code is optimised for these values only */
   1.464 +  if (DCTSIZE != 8)
   1.465 +    return 0;
   1.466 +  if (sizeof(DCTELEM) != 2)
   1.467 +    return 0;
   1.468 +
   1.469 +  if (simd_support & JSIMD_ARM_NEON)
   1.470 +    return 1;
   1.471 +
   1.472 +  return 0;
   1.473 +}
   1.474 +
   1.475 +GLOBAL(int)
   1.476 +jsimd_can_fdct_float (void)
   1.477 +{
   1.478 +  init_simd();
   1.479 +
   1.480 +  return 0;
   1.481 +}
   1.482 +
   1.483 +GLOBAL(void)
   1.484 +jsimd_fdct_islow (DCTELEM * data)
   1.485 +{
   1.486 +}
   1.487 +
   1.488 +GLOBAL(void)
   1.489 +jsimd_fdct_ifast (DCTELEM * data)
   1.490 +{
   1.491 +  if (simd_support & JSIMD_ARM_NEON)
   1.492 +    jsimd_fdct_ifast_neon(data);
   1.493 +}
   1.494 +
   1.495 +GLOBAL(void)
   1.496 +jsimd_fdct_float (FAST_FLOAT * data)
   1.497 +{
   1.498 +}
   1.499 +
   1.500 +GLOBAL(int)
   1.501 +jsimd_can_quantize (void)
   1.502 +{
   1.503 +  init_simd();
   1.504 +
   1.505 +  /* The code is optimised for these values only */
   1.506 +  if (DCTSIZE != 8)
   1.507 +    return 0;
   1.508 +  if (sizeof(JCOEF) != 2)
   1.509 +    return 0;
   1.510 +  if (sizeof(DCTELEM) != 2)
   1.511 +    return 0;
   1.512 +
   1.513 +  if (simd_support & JSIMD_ARM_NEON)
   1.514 +    return 1;
   1.515 +
   1.516 +  return 0;
   1.517 +}
   1.518 +
   1.519 +GLOBAL(int)
   1.520 +jsimd_can_quantize_float (void)
   1.521 +{
   1.522 +  init_simd();
   1.523 +
   1.524 +  return 0;
   1.525 +}
   1.526 +
   1.527 +GLOBAL(void)
   1.528 +jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
   1.529 +                DCTELEM * workspace)
   1.530 +{
   1.531 +  if (simd_support & JSIMD_ARM_NEON)
   1.532 +    jsimd_quantize_neon(coef_block, divisors, workspace);
   1.533 +}
   1.534 +
   1.535 +GLOBAL(void)
   1.536 +jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
   1.537 +                      FAST_FLOAT * workspace)
   1.538 +{
   1.539 +}
   1.540 +
   1.541 +GLOBAL(int)
   1.542 +jsimd_can_idct_2x2 (void)
   1.543 +{
   1.544 +  init_simd();
   1.545 +
   1.546 +  /* The code is optimised for these values only */
   1.547 +  if (DCTSIZE != 8)
   1.548 +    return 0;
   1.549 +  if (sizeof(JCOEF) != 2)
   1.550 +    return 0;
   1.551 +  if (BITS_IN_JSAMPLE != 8)
   1.552 +    return 0;
   1.553 +  if (sizeof(JDIMENSION) != 4)
   1.554 +    return 0;
   1.555 +  if (sizeof(ISLOW_MULT_TYPE) != 2)
   1.556 +    return 0;
   1.557 +
   1.558 +  if ((simd_support & JSIMD_ARM_NEON))
   1.559 +    return 1;
   1.560 +
   1.561 +  return 0;
   1.562 +}
   1.563 +
   1.564 +GLOBAL(int)
   1.565 +jsimd_can_idct_4x4 (void)
   1.566 +{
   1.567 +  init_simd();
   1.568 +
   1.569 +  /* The code is optimised for these values only */
   1.570 +  if (DCTSIZE != 8)
   1.571 +    return 0;
   1.572 +  if (sizeof(JCOEF) != 2)
   1.573 +    return 0;
   1.574 +  if (BITS_IN_JSAMPLE != 8)
   1.575 +    return 0;
   1.576 +  if (sizeof(JDIMENSION) != 4)
   1.577 +    return 0;
   1.578 +  if (sizeof(ISLOW_MULT_TYPE) != 2)
   1.579 +    return 0;
   1.580 +
   1.581 +  if ((simd_support & JSIMD_ARM_NEON))
   1.582 +    return 1;
   1.583 +
   1.584 +  return 0;
   1.585 +}
   1.586 +
   1.587 +GLOBAL(void)
   1.588 +jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
   1.589 +                JCOEFPTR coef_block, JSAMPARRAY output_buf,
   1.590 +                JDIMENSION output_col)
   1.591 +{
   1.592 +  if ((simd_support & JSIMD_ARM_NEON))
   1.593 +    jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col);
   1.594 +}
   1.595 +
   1.596 +GLOBAL(void)
   1.597 +jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
   1.598 +                JCOEFPTR coef_block, JSAMPARRAY output_buf,
   1.599 +                JDIMENSION output_col)
   1.600 +{
   1.601 +  if ((simd_support & JSIMD_ARM_NEON))
   1.602 +    jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col);
   1.603 +}
   1.604 +
   1.605 +GLOBAL(int)
   1.606 +jsimd_can_idct_islow (void)
   1.607 +{
   1.608 +  init_simd();
   1.609 +
   1.610 +  /* The code is optimised for these values only */
   1.611 +  if (DCTSIZE != 8)
   1.612 +    return 0;
   1.613 +  if (sizeof(JCOEF) != 2)
   1.614 +    return 0;
   1.615 +  if (BITS_IN_JSAMPLE != 8)
   1.616 +    return 0;
   1.617 +  if (sizeof(JDIMENSION) != 4)
   1.618 +    return 0;
   1.619 +  if (sizeof(ISLOW_MULT_TYPE) != 2)
   1.620 +    return 0;
   1.621 +
   1.622 +  if (simd_support & JSIMD_ARM_NEON)
   1.623 +    return 1;
   1.624 +
   1.625 +  return 0;
   1.626 +}
   1.627 +
   1.628 +GLOBAL(int)
   1.629 +jsimd_can_idct_ifast (void)
   1.630 +{
   1.631 +  init_simd();
   1.632 +
   1.633 +  /* The code is optimised for these values only */
   1.634 +  if (DCTSIZE != 8)
   1.635 +    return 0;
   1.636 +  if (sizeof(JCOEF) != 2)
   1.637 +    return 0;
   1.638 +  if (BITS_IN_JSAMPLE != 8)
   1.639 +    return 0;
   1.640 +  if (sizeof(JDIMENSION) != 4)
   1.641 +    return 0;
   1.642 +  if (sizeof(IFAST_MULT_TYPE) != 2)
   1.643 +    return 0;
   1.644 +  if (IFAST_SCALE_BITS != 2)
   1.645 +    return 0;
   1.646 +
   1.647 +  if ((simd_support & JSIMD_ARM_NEON))
   1.648 +    return 1;
   1.649 +
   1.650 +  return 0;
   1.651 +}
   1.652 +
   1.653 +GLOBAL(int)
   1.654 +jsimd_can_idct_float (void)
   1.655 +{
   1.656 +  init_simd();
   1.657 +
   1.658 +  return 0;
   1.659 +}
   1.660 +
   1.661 +GLOBAL(void)
   1.662 +jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
   1.663 +                JCOEFPTR coef_block, JSAMPARRAY output_buf,
   1.664 +                JDIMENSION output_col)
   1.665 +{
   1.666 +  if ((simd_support & JSIMD_ARM_NEON))
   1.667 +    jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col);
   1.668 +}
   1.669 +
   1.670 +GLOBAL(void)
   1.671 +jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
   1.672 +                JCOEFPTR coef_block, JSAMPARRAY output_buf,
   1.673 +                JDIMENSION output_col)
   1.674 +{
   1.675 +  if ((simd_support & JSIMD_ARM_NEON))
   1.676 +    jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col);
   1.677 +}
   1.678 +
   1.679 +GLOBAL(void)
   1.680 +jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
   1.681 +                JCOEFPTR coef_block, JSAMPARRAY output_buf,
   1.682 +                JDIMENSION output_col)
   1.683 +{
   1.684 +}
   1.685 +

mercurial