shun-iwasawa 82a8f5
/*
shun-iwasawa 82a8f5
 * jsimd_arm.c
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB</ossman@cendio.se>
shun-iwasawa 82a8f5
 * Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies).
shun-iwasawa 82a8f5
 * Copyright (C) 2009-2011, 2013-2014, 2016, 2018, D. R. Commander.
shun-iwasawa 82a8f5
 * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
shun-iwasawa 82a8f5
 * Copyright (C) 2019, Google LLC.
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * Based on the x86 SIMD extension for IJG JPEG library,
shun-iwasawa 82a8f5
 * Copyright (C) 1999-2006, MIYASAKA Masaru.
shun-iwasawa 82a8f5
 * For conditions of distribution and use, see copyright notice in jsimdext.inc
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * This file contains the interface between the "normal" portions
shun-iwasawa 82a8f5
 * of the library and the SIMD implementations when running on a
shun-iwasawa 82a8f5
 * 32-bit Arm architecture.
shun-iwasawa 82a8f5
 */
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#define JPEG_INTERNALS
shun-iwasawa 82a8f5
#include "../../jinclude.h"
shun-iwasawa 82a8f5
#include "../../jpeglib.h"
shun-iwasawa 82a8f5
#include "../../jsimd.h"
shun-iwasawa 82a8f5
#include "../../jdct.h"
shun-iwasawa 82a8f5
#include "../../jsimddct.h"
shun-iwasawa 82a8f5
#include "../jsimd.h"
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#include <stdio.h></stdio.h>
shun-iwasawa 82a8f5
#include <string.h></string.h>
shun-iwasawa 82a8f5
#include <ctype.h></ctype.h>
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
static unsigned int simd_support = ~0;
shun-iwasawa 82a8f5
static unsigned int simd_huffman = 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__))
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT  (1024 * 1024)
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
LOCAL(int)
shun-iwasawa 82a8f5
check_feature(char *buffer, char *feature)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  char *p;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (*feature == 0)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (strncmp(buffer, "Features", 8) != 0)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  buffer += 8;
shun-iwasawa 82a8f5
  while (isspace(*buffer))
shun-iwasawa 82a8f5
    buffer++;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* Check if 'feature' is present in the buffer as a separate word */
shun-iwasawa 82a8f5
  while ((p = strstr(buffer, feature))) {
shun-iwasawa 82a8f5
    if (p > buffer && !isspace(*(p - 1))) {
shun-iwasawa 82a8f5
      buffer++;
shun-iwasawa 82a8f5
      continue;
shun-iwasawa 82a8f5
    }
shun-iwasawa 82a8f5
    p += strlen(feature);
shun-iwasawa 82a8f5
    if (*p != 0 && !isspace(*p)) {
shun-iwasawa 82a8f5
      buffer++;
shun-iwasawa 82a8f5
      continue;
shun-iwasawa 82a8f5
    }
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
  }
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
LOCAL(int)
shun-iwasawa 82a8f5
parse_proc_cpuinfo(int bufsize)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  char *buffer = (char *)malloc(bufsize);
shun-iwasawa 82a8f5
  FILE *fd;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  simd_support = 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (!buffer)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  fd = fopen("/proc/cpuinfo", "r");
shun-iwasawa 82a8f5
  if (fd) {
shun-iwasawa 82a8f5
    while (fgets(buffer, bufsize, fd)) {
shun-iwasawa 82a8f5
      if (!strchr(buffer, '\n') && !feof(fd)) {
shun-iwasawa 82a8f5
        /* "impossible" happened - insufficient size of the buffer! */
shun-iwasawa 82a8f5
        fclose(fd);
shun-iwasawa 82a8f5
        free(buffer);
shun-iwasawa 82a8f5
        return 0;
shun-iwasawa 82a8f5
      }
shun-iwasawa 82a8f5
      if (check_feature(buffer, "neon"))
shun-iwasawa 82a8f5
        simd_support |= JSIMD_NEON;
shun-iwasawa 82a8f5
    }
shun-iwasawa 82a8f5
    fclose(fd);
shun-iwasawa 82a8f5
  }
shun-iwasawa 82a8f5
  free(buffer);
shun-iwasawa 82a8f5
  return 1;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#endif
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
/*
shun-iwasawa 82a8f5
 * Check what SIMD accelerations are supported.
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * FIXME: This code is racy under a multi-threaded environment.
shun-iwasawa 82a8f5
 */
shun-iwasawa 82a8f5
LOCAL(void)
shun-iwasawa 82a8f5
init_simd(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
#ifndef NO_GETENV
shun-iwasawa 82a8f5
  char *env = NULL;
shun-iwasawa 82a8f5
#endif
shun-iwasawa 82a8f5
#if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__))
shun-iwasawa 82a8f5
  int bufsize = 1024; /* an initial guess for the line buffer size limit */
shun-iwasawa 82a8f5
#endif
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support != ~0U)
shun-iwasawa 82a8f5
    return;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  simd_support = 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#if defined(__ARM_NEON__)
shun-iwasawa 82a8f5
  simd_support |= JSIMD_NEON;
shun-iwasawa 82a8f5
#elif defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
shun-iwasawa 82a8f5
  /* We still have a chance to use Neon regardless of globally used
shun-iwasawa 82a8f5
   * -mcpu/-mfpu options passed to gcc by performing runtime detection via
shun-iwasawa 82a8f5
   * /proc/cpuinfo parsing on linux/android */
shun-iwasawa 82a8f5
  while (!parse_proc_cpuinfo(bufsize)) {
shun-iwasawa 82a8f5
    bufsize *= 2;
shun-iwasawa 82a8f5
    if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
shun-iwasawa 82a8f5
      break;
shun-iwasawa 82a8f5
  }
shun-iwasawa 82a8f5
#endif
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#ifndef NO_GETENV
shun-iwasawa 82a8f5
  /* Force different settings through environment variables */
shun-iwasawa 82a8f5
  env = getenv("JSIMD_FORCENEON");
shun-iwasawa 82a8f5
  if ((env != NULL) && (strcmp(env, "1") == 0))
shun-iwasawa 82a8f5
    simd_support = JSIMD_NEON;
shun-iwasawa 82a8f5
  env = getenv("JSIMD_FORCENONE");
shun-iwasawa 82a8f5
  if ((env != NULL) && (strcmp(env, "1") == 0))
shun-iwasawa 82a8f5
    simd_support = 0;
shun-iwasawa 82a8f5
  env = getenv("JSIMD_NOHUFFENC");
shun-iwasawa 82a8f5
  if ((env != NULL) && (strcmp(env, "1") == 0))
shun-iwasawa 82a8f5
    simd_huffman = 0;
shun-iwasawa 82a8f5
#endif
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_rgb_ycc(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_rgb_gray(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_ycc_rgb(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_ycc_rgb565(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
shun-iwasawa 82a8f5
                      JSAMPIMAGE output_buf, JDIMENSION output_row,
shun-iwasawa 82a8f5
                      int num_rows)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  void (*neonfct) (JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  switch (cinfo->in_color_space) {
shun-iwasawa 82a8f5
  case JCS_EXT_RGB:
shun-iwasawa 82a8f5
    neonfct = jsimd_extrgb_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_RGBX:
shun-iwasawa 82a8f5
  case JCS_EXT_RGBA:
shun-iwasawa 82a8f5
    neonfct = jsimd_extrgbx_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_BGR:
shun-iwasawa 82a8f5
    neonfct = jsimd_extbgr_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_BGRX:
shun-iwasawa 82a8f5
  case JCS_EXT_BGRA:
shun-iwasawa 82a8f5
    neonfct = jsimd_extbgrx_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_XBGR:
shun-iwasawa 82a8f5
  case JCS_EXT_ABGR:
shun-iwasawa 82a8f5
    neonfct = jsimd_extxbgr_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_XRGB:
shun-iwasawa 82a8f5
  case JCS_EXT_ARGB:
shun-iwasawa 82a8f5
    neonfct = jsimd_extxrgb_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  default:
shun-iwasawa 82a8f5
    neonfct = jsimd_extrgb_ycc_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  }
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  neonfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
shun-iwasawa 82a8f5
                       JSAMPIMAGE output_buf, JDIMENSION output_row,
shun-iwasawa 82a8f5
                       int num_rows)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
shun-iwasawa 82a8f5
                      JDIMENSION input_row, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
                      int num_rows)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  void (*neonfct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  switch (cinfo->out_color_space) {
shun-iwasawa 82a8f5
  case JCS_EXT_RGB:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extrgb_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_RGBX:
shun-iwasawa 82a8f5
  case JCS_EXT_RGBA:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extrgbx_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_BGR:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extbgr_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_BGRX:
shun-iwasawa 82a8f5
  case JCS_EXT_BGRA:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extbgrx_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_XBGR:
shun-iwasawa 82a8f5
  case JCS_EXT_ABGR:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extxbgr_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  case JCS_EXT_XRGB:
shun-iwasawa 82a8f5
  case JCS_EXT_ARGB:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extxrgb_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  default:
shun-iwasawa 82a8f5
    neonfct = jsimd_ycc_extrgb_convert_neon;
shun-iwasawa 82a8f5
    break;
shun-iwasawa 82a8f5
  }
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
shun-iwasawa 82a8f5
                         JDIMENSION input_row, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
                         int num_rows)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row,
shun-iwasawa 82a8f5
                                output_buf, num_rows);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v2_downsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v1_downsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                      JSAMPARRAY input_data, JSAMPARRAY output_data)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                      JSAMPARRAY input_data, JSAMPARRAY output_data)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v2_upsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v1_upsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                    JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                    JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v2_fancy_upsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v1_fancy_upsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                          JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                          JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
shun-iwasawa 82a8f5
                                 compptr->downsampled_width, input_data,
shun-iwasawa 82a8f5
                                 output_data_ptr);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v2_merged_upsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_h2v1_merged_upsample(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
shun-iwasawa 82a8f5
                           JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
shun-iwasawa 82a8f5
                           JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_convsamp(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(DCTELEM) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_convsamp_float(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
shun-iwasawa 82a8f5
               DCTELEM *workspace)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_convsamp_neon(sample_data, start_col, workspace);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
shun-iwasawa 82a8f5
                     FAST_FLOAT *workspace)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_fdct_islow(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_fdct_ifast(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(DCTELEM) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_fdct_float(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_fdct_islow(DCTELEM *data)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_fdct_ifast(DCTELEM *data)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_fdct_ifast_neon(data);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_fdct_float(FAST_FLOAT *data)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_quantize(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JCOEF) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(DCTELEM) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_quantize_float(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_quantize_neon(coef_block, divisors, workspace);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
shun-iwasawa 82a8f5
                     FAST_FLOAT *workspace)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_idct_2x2(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JCOEF) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(ISLOW_MULT_TYPE) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_idct_4x4(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JCOEF) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(ISLOW_MULT_TYPE) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
               JCOEFPTR coef_block, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
               JDIMENSION output_col)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
               JCOEFPTR coef_block, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
               JDIMENSION output_col)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_idct_islow(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JCOEF) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(ISLOW_MULT_TYPE) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_idct_ifast(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  /* The code is optimised for these values only */
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JCOEF) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (BITS_IN_JSAMPLE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JDIMENSION) != 4)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(IFAST_MULT_TYPE) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (IFAST_SCALE_BITS != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_idct_float(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
                 JDIMENSION output_col)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf,
shun-iwasawa 82a8f5
                        output_col);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
                 JDIMENSION output_col)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf,
shun-iwasawa 82a8f5
                        output_col);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
shun-iwasawa 82a8f5
                 JCOEFPTR coef_block, JSAMPARRAY output_buf,
shun-iwasawa 82a8f5
                 JDIMENSION output_col)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_huff_encode_one_block(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  init_simd();
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (DCTSIZE != 8)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
  if (sizeof(JCOEF) != 2)
shun-iwasawa 82a8f5
    return 0;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  if (simd_support & JSIMD_NEON && simd_huffman)
shun-iwasawa 82a8f5
    return 1;
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(JOCTET *)
shun-iwasawa 82a8f5
jsimd_huff_encode_one_block(void *state, JOCTET *buffer, JCOEFPTR block,
shun-iwasawa 82a8f5
                            int last_dc_val, c_derived_tbl *dctbl,
shun-iwasawa 82a8f5
                            c_derived_tbl *actbl)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return jsimd_huff_encode_one_block_neon(state, buffer, block, last_dc_val,
shun-iwasawa 82a8f5
                                          dctbl, actbl);
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_encode_mcu_AC_first_prepare(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(void)
shun-iwasawa 82a8f5
jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
shun-iwasawa 82a8f5
                                  const int *jpeg_natural_order_start, int Sl,
shun-iwasawa 82a8f5
                                  int Al, JCOEF *values, size_t *zerobits)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_can_encode_mcu_AC_refine_prepare(void)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
GLOBAL(int)
shun-iwasawa 82a8f5
jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
shun-iwasawa 82a8f5
                                   const int *jpeg_natural_order_start, int Sl,
shun-iwasawa 82a8f5
                                   int Al, JCOEF *absvalues, size_t *bits)
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
  return 0;
shun-iwasawa 82a8f5
}