/* * jsimd_arm.c * * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright (C) 2011, Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2009-2011, 2013-2014, 2016, 2018, 2022, D. R. Commander. * Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois. * Copyright (C) 2019, Google LLC. * Copyright (C) 2020, Arm Limited. * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. * For conditions of distribution and use, see copyright notice in jsimdext.inc * * This file contains the interface between the "normal" portions * of the library and the SIMD implementations when running on a * 32-bit Arm architecture.
*/
if (*feature == 0) return 0; if (strncmp(buffer, "Features", 8) != 0) return 0;
buffer += 8; while (isspace(*buffer))
buffer++;
/* Check if 'feature' is present in the buffer as a separate word */ while ((p = strstr(buffer, feature))) { if (p > buffer && !isspace(*(p - 1))) {
buffer++; continue;
}
p += strlen(feature); if (*p != 0 && !isspace(*p)) {
buffer++; continue;
} return 1;
} return 0;
}
fd = fopen("/proc/cpuinfo", "r"); if (fd) { while (fgets(buffer, bufsize, fd)) { if (!strchr(buffer, '\n') && !feof(fd)) { /* "impossible" happened - insufficient size of the buffer! */
fclose(fd);
free(buffer); return 0;
} if (check_feature(buffer, "neon"))
simd_support |= JSIMD_NEON;
}
fclose(fd);
}
free(buffer); return 1;
}
#endif
/* * Check what SIMD accelerations are supported.
*/
LOCAL(void)
init_simd(void)
{ #ifndef NO_GETENV char env[2] = { 0 }; #endif #if !defined(__ARM_NEON__) && (defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)) int bufsize = 1024; /* an initial guess for the line buffer size limit */ #endif
if (simd_support != ~0U) return;
simd_support = 0;
#ifdefined(__ARM_NEON__)
simd_support |= JSIMD_NEON; #elifdefined(__linux__) || defined(ANDROID) || defined(__ANDROID__) /* We still have a chance to use Neon regardless of globally used * -mcpu/-mfpu options passed to gcc by performing runtime detection via
* /proc/cpuinfo parsing on linux/android */ while (!parse_proc_cpuinfo(bufsize)) {
bufsize *= 2; if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT) break;
} #endif
#ifndef NO_GETENV /* Force different settings through environment variables */ if (!GETENV_S(env, 2, "JSIMD_FORCENEON") && !strcmp(env, "1"))
simd_support = JSIMD_NEON; if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
simd_support = 0; if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
simd_huffman = 0; #endif
}
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0;
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0;
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0;
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (DCTSIZE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0;
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (DCTSIZE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0;
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (simd_support & JSIMD_NEON) return 1;
/* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(DCTELEM) != 2) return 0;
/* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(ISLOW_MULT_TYPE) != 2) return 0;
/* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(ISLOW_MULT_TYPE) != 2) return 0;
/* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(ISLOW_MULT_TYPE) != 2) return 0;
/* The code is optimised for these values only */ if (DCTSIZE != 8) return 0; if (sizeof(JCOEF) != 2) return 0; if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (sizeof(IFAST_MULT_TYPE) != 2) return 0; if (IFAST_SCALE_BITS != 2) return 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.