/* * jsimd_mips.c * * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright (C) 2009-2011, 2014, 2016, 2018, 2020, 2022, D. R. Commander. * Copyright (C) 2013-2014, MIPS Technologies, Inc., California. * Copyright (C) 2015-2016, 2018, 2022, Matthieu Darbois. * * 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 * MIPS architecture.
*/
if ((f = fopen(file_name, "r")) != NULL) { while (fgets(cpuinfo_line, sizeof(cpuinfo_line), f) != NULL) { if (strstr(cpuinfo_line, search_string) != NULL) {
fclose(f);
simd_support |= JSIMD_DSPR2; return;
}
}
fclose(f);
} /* Did not find string in the proc file, or not Linux ELF. */
}
#endif
/* * Check what SIMD accelerations are supported.
*/
LOCAL(void)
init_simd(void)
{ #ifndef NO_GETENV char *env = NULL; #endif
if (simd_support != ~0U) return;
simd_support = 0;
#ifdefined(__mips_dsp) && (__mips_dsp_rev >= 2)
simd_support |= JSIMD_DSPR2; #elifdefined(__linux__) /* We still have a chance to use MIPS DSPR2 regardless of globally used * -mdspr2 options passed to gcc by performing runtime detection via
* /proc/cpuinfo parsing on linux */
parse_proc_cpuinfo("MIPS 74K"); #endif
#ifndef NO_GETENV /* Force different settings through environment variables */
env = getenv("JSIMD_FORCEDSPR2"); if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = JSIMD_DSPR2;
env = getenv("JSIMD_FORCENONE"); if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = 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 (sizeof(JDIMENSION) != 4) return 0;
/* FIXME: jsimd_h2v2_downsample_dspr2() fails some of the TJBench tiling * regression tests, probably because the DSPr2 SIMD implementation predates
* those tests. */ #if 0 if (simd_support & JSIMD_DSPR2) return 1; #endif
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0; if (DCTSIZE != 8) return 0;
/* The code is optimised for these values only */ if (BITS_IN_JSAMPLE != 8) return 0; if (sizeof(JDIMENSION) != 4) return 0;
/* FIXME: jsimd_h2v1_downsample_dspr2() fails some of the TJBench tiling * regression tests, probably because the DSPr2 SIMD implementation predates
* those tests. */ #if 0 if (simd_support & JSIMD_DSPR2) return 1; #endif
/* 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;
#ifdefined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; #endif
/* 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;
#ifndef __mips_soft_float if (simd_support & JSIMD_DSPR2) return 1; #endif
/* 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;
#ifndef __mips_soft_float if (simd_support & JSIMD_DSPR2) return 1; #endif
/* 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;
#ifdefined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; #endif
/* 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;
#ifdefined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; #endif
/* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */
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.