CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/ext/libpng17/arm/neon.h
Views: 1401
/* Compile time options.1* =====================2* In a multi-arch build the compiler may compile the code several times for the3* same object module, producing different binaries for different architectures.4* When this happens configure-time setting of the target host options cannot be5* done. An example is iOS vs Android compilation of ARM NEON support.6*7* NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because8* this is not possible with certain compilers (Oracle SUN OS CC), as a result9* it is necessary to ensure that all extern functions that *might* be used10* regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON11* below is one example of this behavior because it is controlled by the12* presence or not of -mfpu=neon on the GCC command line, it is possible to do13* this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely14* do this.15*/16#ifndef PNG_ARM_NEON_OPT17/* ARM NEON optimizations are being controlled by the compiler settings,18* typically the target FPU. If the FPU supports NEON instructions then the19* compiler will define __ARM_NEON and we can rely unconditionally on NEON20* instructions not crashing, otherwise we must disable use of NEON21* instructions.22*23* NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they24* can only be turned on automatically if that is supported too. If25* PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail26* to compile with an appropriate #error if ALIGNED_MEMORY has been turned27* off.28*29* Note that older versions of GCC defined __ARM_NEON__; this is no longer30* supported. Also 32-bit ARM versions of GCC required the NEON FPU mode to31* be turned on explicitly on the command line. If this is not done (on32* 32-bit ARM) NEON code will not be included.33*34* To disable ARM_NEON optimizations entirely, and skip compiling the35* associated assembler code, pass --enable-arm-neon=no to configure36* or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS.37*/38# if defined(__ARM_NEON) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)39# define PNG_ARM_NEON_OPT 240# else41# define PNG_ARM_NEON_OPT 042# endif43#endif4445#if PNG_ARM_NEON_OPT > 046/* NEON optimizations are to be at least considered by libpng, so enable the47* callbacks to do this.48*/49# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon5051/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used52* if possible - if __ARM_NEON is set and the compiler version is not known53* to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can54* be:55*56* 1 The intrinsics code (the default with __ARM_NEON)57* 2 The hand coded assembler (the default without __ARM_NEON)58*59* It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however60* this is *NOT* supported and may cease to work even after a minor revision61* to libpng. It *is* valid to do this for testing purposes, e.g. speed62* testing or a new compiler, but the results should be communicated to the63* libpng implementation list for incorporation in the next minor release.64*/65# ifndef PNG_ARM_NEON_IMPLEMENTATION66# ifdef __ARM_NEON67# if defined(__clang__)68/* At present it is unknown by the libpng developers which versions69* of clang support the intrinsics, however some or perhaps all70* versions do not work with the assembler so this may be71* irrelevant, so just use the default (do nothing here.)72*/73# elif defined(__GNUC__)74/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to75* work, so if this *is* GCC, or G++, look for a version >4.576*/77# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)78# define PNG_ARM_NEON_IMPLEMENTATION 279# endif /* no GNUC support */80# endif /* __GNUC__ */81# else /* !defined __ARM_NEON */82/* The 'intrinsics' code simply won't compile without compiler support83* and that support switches on __ARM_NEON, so use the assembler:84*/85# define PNG_ARM_NEON_IMPLEMENTATION 286# endif /* __ARM_NEON */87# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */8889# ifndef PNG_ARM_NEON_IMPLEMENTATION90/* Use the intrinsics code by default. */91# define PNG_ARM_NEON_IMPLEMENTATION 192# endif93#endif /* PNG_ARM_NEON_OPT > 0 */9495#ifdef PNG_SET_OPTION_SUPPORTED96#ifdef PNG_ARM_NEON_API_SUPPORTED97# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */98#endif99#endif /* SET_OPTION */100101#if PNG_ARM_NEON_OPT > 0102PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,103(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,104png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);105PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,106(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,107png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);108PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_neon,109(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,110png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);111PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_neon,112(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,113png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);114PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,115(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,116png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);117PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,118(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,119png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);120PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,121(png_alloc_size_t row_bytes, unsigned int bpp, png_bytep row,122png_const_bytep prev_row, png_const_bytep prev_pixels),PNG_EMPTY);123#endif124125126