Skip to content
Myr

cleanup merge of ARM NEON support

Before adoption: this commit came in with the history the project adopted, so no landing records it.

tweak docs

authored by Sean Barrett · committed by Sean Barrett · parent de385bb · Browse files · 1 file+49 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+49 added−15 removed

  • other:+49 added−15 removed

1 file+49 added−15 removed

modified:stb_image.h+49 added-15 removed
37 unmodified lines
3839 - PPM and PGM binary formats are now supported, thanks to Ken Miller.4041 - x86 platforms now make use of SSE2 SIMD instructions for42 JPEG decoding, and ARM platforms use NEON SIMD. This release is43 2x faster on our test JPEGs on x86 (except progressive JPEGs,44 which see much less speedup), mostly due to the addition of SIMD.45 This work was done by Fabian "ryg" Giesen.42 JPEG decoding, and ARM platforms can use NEON SIMD if requested.43 This work was done by Fabian "ryg" Giesen. SSE2 is used by44 default, but NEON must be enabled explicitly; see docs.4546 With other JPEG optimizations included in this version, we see47 2x speedup on a JPEGs on an x86 machine, and a 1.5x speedup48 on a JPEG on an ARM machine, relative to previous versions of this49 library. The same results will not obtain for all JPGs and for all50 X86/ARM machines. (Note that progressive JPEGs are significantly51 slower to decode than regular JPEGs.) This doesn't mean that this52 is the fastest JPEG decoder in the land; rather, it brings it53 closer to parity with standard libraries. If you want the fastest54 decode, look elsewhere. (See "Philosophy" section of docs below.)5547 - Compilation of SIMD code can be suppressed with56 - Compilation of all SIMD code can be suppressed with57 #define STBI_NO_SIMD58 It should not be necessary to disable it unless you have issues59 compiling (e.g. using an x86 compiler which doesn't support SSE60 intrinsics or that doesn't support the method used to detect
23 unmodified lines
84 significant JPEG speedup from the other changes).8586 Please note that STBI_JPEG_OLD is a temporary feature; it will be87 removed in future versions of the library. It is only intended for79 back-compatibility use.88 near-term back-compatibility use.8990 - Added STBI_MALLOC, STBI_REALLOC, and STBI_FREE macros for replacing91 the memory allocator. Unlike other STBI libraries, these macros don't92 support a context parameter, so if you need to pass a context in to
1 unmodified line
94 variable.959697 Latest revision history:89 2.00 (2014-12-25) optimize JPEG, incl. x86 & NEON SIMD98 2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD99 progressive JPEG100 PGM/PPM support101 STBI_MALLOC,STBI_REALLOC,STBI_FREE102 GIF bugfix
41 unmodified lines
144145License:146 This software is in the public domain. Where that dedication is not147 recognized, you are granted a perpetual, irrevocable license to copy139 and modify this file as you see fit.148 and modify this file however you want.149150*/151152#ifndef STBI_INCLUDE_STB_IMAGE_H
54 unmodified lines
207// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.208//209// ===========================================================================210//211// Philosophy212//213// stb libraries are designed with the following priorities:214//215// 1. easy to use216// 2. easy to maintain217// 3. good performance218//219// Sometimes I let "good performance" creep up in priority over "easy to maintain",220// and for best performance I may provide less-easy-to-use APIs that give higher221// performance, in addition to the easy to use ones. Nevertheless, it's important222// to keep in mind that from the standpoint of you, a client of this library,223// all you care about is #1 and #3, and stb libraries do not emphasize #3 above all.224//225// Some secondary priorities arise directly from the first two, some of which226// make more explicit reasons why performance can't be emphasized.227//228// - Portable ("ease of use")229// - Small footprint ("easy to maintain")230// - No dependencies ("ease of use")231//232// ===========================================================================233//234// I/O callbacks235//236// I/O callbacks allow you to read from arbitrary sources, like packaged237// files or some other source. Data read from callbacks are processed
6 unmodified lines
244// ===========================================================================245//246// SIMD support247//216// The JPEG decoder will try to automatically use SIMD kernels on when217// supported by the compiler.248// The JPEG decoder will try to automatically use SIMD kernels on x86 when249// supported by the compiler. For ARM Neon support, you must explicitly250// request it.251//252// (The old do-it-yourself SIMD API is no longer supported in the current253// code.)254//222// On x86, SSE2 will automatically be used when available; if not, the223// generic C versions are used as a fall-back. On ARM targets, the typical224// path is to have separate builds for NEON and non-NEON devices (at least225// this is true for iOS and Android). Therefore, the NEON support is255// On x86, SSE2 will automatically be used when available based on a run-time256// test; if not, the generic C versions are used as a fall-back. On ARM targets,257// the typical path is to have separate builds for NEON and non-NEON devices258// (at least this is true for iOS and Android). Therefore, the NEON support is259// toggled by a build flag: define STBI_NEON to get NEON loops.260//261// The output of the JPEG decoder is slightly different from versions where262// SIMD support was introduced (that is, for versions before 1.49). The
1491 unmodified lines
1754 }1755}17561757#ifdef STBI_SSE217251758// sse2 integer IDCT. not the fastest possible implementation but it1759// produces bit-identical results to the generic C version so it's1760// fully "transparent".1761static void stbi__idct_sse2(stbi_uc *out, int out_stride, short data[64])
1235 unmodified lines
2997#endif29982999#ifdef STBI_NEON3000 j->idct_block_kernel = stbi__idct_neon;3001 #ifndef STBI_JPEG_OLD3002 j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd;3003 #endif3004 j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd;3005#endif3006}3007
3124 unmodified lines