add #defines to allow disabling decoders for unwanted formats
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parent 53ca163 · Browse files · 1 file·+219 added−45 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+219 added−45 removed
- other:+219 added−45 removed
Provenance
- Commit
7f94e7e- Tree
8a7e4d6- Author
Sean Barrett <sean2@nothings.org>- Committer
Sean Barrett <sean2@nothings.org>- Parent
53ca163
1 file changed+219 added−45 removed
modified:stb_image.h+219 added-45 removed
42 unmodified lines43 This work was done by Fabian "ryg" Giesen. SSE2 is used by44 default, but NEON must be enabled explicitly; see docs.45 46 With other JPEG optimizations included in this version, we see47- 2x speedup on a JPEGs on an x86 machine, and a 1.5x speedup47+ 2x speedup on a JPEG 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 significantly50+ 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.)55 56+ See final bullet items below for more info on SIMD.57+58+ - Added STBI_MALLOC, STBI_REALLOC, and STBI_FREE macros for replacing59+ the memory allocator. Unlike other STBI libraries, these macros don't60+ support a context parameter, so if you need to pass a context in to61+ the allocator, you'll have to store it in a global or a thread-local62+ variable.63+64+ - Split existing STBI_NO_HDR flag into two flags, STBI_NO_HDR and65+ STBI_NO_LINEAR.66+ STBI_NO_HDR: suppress implementation of .hdr reader format67+ STBI_NO_LINEAR: suppress high-dynamic-range light-linear float API68+69+ - You can suppress implementation of any of the decoders to reduce70+ your code footprint by #defining one or more of the following71+ symbols before creating the implementation.72+73+ STBI_NO_JPEG74+ STBI_NO_PNG75+ STBI_NO_BMP76+ STBI_NO_PSD77+ STBI_NO_TGA78+ STBI_NO_GIF79+ STBI_NO_HDR80+ STBI_NO_PIC81+ STBI_NO_PNM (.ppm and .pgm)82+83+ - You can request *only* certain decoders and suppress all other ones84+ (this will be more forward-compatible, as addition of new decoders85+ doesn't require you to disable them explicitly):86+87+ STBI_ONLY_JPEG88+ STBI_ONLY_PNG89+ STBI_ONLY_BMP90+ STBI_ONLY_PSD91+ STBI_ONLY_TGA92+ STBI_ONLY_GIF93+ STBI_ONLY_HDR94+ STBI_ONLY_PIC95+ STBI_ONLY_PNM (.ppm and .pgm)96+97+ Note that you can define multiples of these, and you will get all98+ of them ("only x" and "only y" is interpreted to mean "only x&y").99+100+ - If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still101+ want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB102+103 - Compilation of all SIMD code can be suppressed with104 #define STBI_NO_SIMD58- It should not be necessary to disable it unless you have issues105+ It should not be necessary to disable SIMD unless you have issues106 compiling (e.g. using an x86 compiler which doesn't support SSE107 intrinsics or that doesn't support the method used to detect108 SSE2 support at run-time), and even those can be reported as109 bugs so I can refine the built-in compile-time checking to be23 unmodified lines133 Please note that STBI_JPEG_OLD is a temporary feature; it will be134 removed in future versions of the library. It is only intended for135 near-term back-compatibility use.136 90- - 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 to93- the allocator, you'll have to store it in a global or a thread-local94- variable.137 96-138 Latest revision history:139 2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD140 progressive JPEG141 PGM/PPM support142 STBI_MALLOC,STBI_REALLOC,STBI_FREE143+ STBI_NO_*, STBI_ONLY_*144 GIF bugfix145 1.48 (2014-12-14) fix incorrectly-named assert()146 1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted)147 optimize PNG268 unmodified lines416 STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);417 // for stbi_load_from_file, file pointer is left pointing immediately after image418 #endif419 378-#ifndef STBI_NO_HDR420+#ifndef STBI_NO_LINEAR421 STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);422 STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);423 STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp);424 4 unmodified lines429 430 #ifndef STBI_NO_HDR431 STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);432 STBIDEF void stbi_hdr_to_ldr_scale(float scale);433+#endif434 435+#ifndef STBI_NO_LINEAR436 STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);437 STBIDEF void stbi_ldr_to_hdr_scale(float scale);438 #endif // STBI_NO_HDR439 56 unmodified lines496 #endif // STBI_INCLUDE_STB_IMAGE_H497 498 #ifdef STB_IMAGE_IMPLEMENTATION499 500+#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \501+ || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \502+ || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \503+ || defined(STBI_ONLY_ZLIB)504+ #ifndef STBI_ONLY_JPEG505+ #define STBI_NO_JPEG506+ #endif507+ #ifndef STBI_ONLY_PNG508+ #define STBI_NO_PNG509+ #endif510+ #ifndef STBI_ONLY_BMP511+ #define STBI_NO_BMP512+ #endif513+ #ifndef STBI_ONLY_PSD514+ #define STBI_NO_PSD515+ #endif516+ #ifndef STBI_ONLY_TGA517+ #define STBI_NO_TGA518+ #endif519+ #ifndef STBI_ONLY_GIF520+ #define STBI_NO_GIF521+ #endif522+ #ifndef STBI_ONLY_HDR523+ #define STBI_NO_HDR524+ #endif525+ #ifndef STBI_ONLY_PIC526+ #define STBI_NO_PIC527+ #endif528+ #ifndef STBI_ONLY_PNM529+ #define STBI_NO_PNM530+ #endif531+#endif532+533+#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB)534+#define STBI_NO_ZLIB535+#endif536+537+538 #include <stdarg.h>539 #include <stddef.h> // ptrdiff_t on osx540 #include <stdlib.h>541 #include <string.h>542 461-#ifndef STBI_NO_HDR543+#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)544 #include <math.h> // ldexp545 #endif546 547 #ifndef STBI_NO_STDIO213 unmodified lines761 // we only use it after doing 'test', which only ever looks at at most 92 bytes762 s->img_buffer = s->img_buffer_original;763 }764 765+#ifndef STBI_NO_JPEG766 static int stbi__jpeg_test(stbi__context *s);767 static stbi_uc *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);768 static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp);769+#endif770+771+#ifndef STBI_NO_PNG772 static int stbi__png_test(stbi__context *s);773 static stbi_uc *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);774 static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp);775+#endif776+777+#ifndef STBI_NO_BMP778 static int stbi__bmp_test(stbi__context *s);779 static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);780+static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp);781+#endif782+783+#ifndef STBI_NO_TGA784 static int stbi__tga_test(stbi__context *s);785 static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);786 static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp);787+#endif788+789+#ifndef STBI_NO_PSD790 static int stbi__psd_test(stbi__context *s);791 static stbi_uc *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);792+static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp);793+#endif794+795 #ifndef STBI_NO_HDR796 static int stbi__hdr_test(stbi__context *s);797 static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);798+static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp);799 #endif800+801+#ifndef STBI_NO_PIC802 static int stbi__pic_test(stbi__context *s);803 static stbi_uc *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);804+static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp);805+#endif806+807+#ifndef STBI_NO_GIF808 static int stbi__gif_test(stbi__context *s);809 static stbi_uc *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);810 static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp);811+#endif812+813+#ifndef STBI_NO_PNM814 static int stbi__pnm_test(stbi__context *s);815 static stbi_uc *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);816 static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp);817+#endif818 709-819 // this is not threadsafe820 static const char *stbi__g_failure_reason;821 822 STBIDEF const char *stbi_failure_reason(void)31 unmodified lines854 {855 STBI_FREE(retval_from_stbi_load);856 }857 749-#ifndef STBI_NO_HDR858+#ifndef STBI_NO_LINEAR859 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp);860+#endif861+862+#ifndef STBI_NO_HDR863 static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);864 #endif865 866 static unsigned char *stbi_load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)867 {868+ #ifndef STBI_NO_JPEG869 if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp);870+ #endif871+ #ifndef STBI_NO_PNG872 if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp);873+ #endif874+ #ifndef STBI_NO_BMP875 if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp);876+ #endif877+ #ifndef STBI_NO_GIF878 if (stbi__gif_test(s)) return stbi__gif_load(s,x,y,comp,req_comp);879+ #endif880+ #ifndef STBI_NO_PSD881 if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp);882+ #endif883+ #ifndef STBI_NO_PIC884 if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp);885+ #endif886+ #ifndef STBI_NO_PNM887 if (stbi__pnm_test(s)) return stbi__pnm_load(s,x,y,comp,req_comp);888+ #endif889 890 #ifndef STBI_NO_HDR891 if (stbi__hdr_test(s)) {892 float *hdr = stbi__hdr_load(s, x,y,comp,req_comp);893 return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);894 }895 #endif896 897+ #ifndef STBI_NO_TGA898 // test tga last because it's a crappy test!899 if (stbi__tga_test(s))900 return stbi__tga_load(s,x,y,comp,req_comp);901+ #endif902+903 return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt");904 }905 906 #ifndef STBI_NO_STDIO48 unmodified lines955 stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user);956 return stbi_load_main(&s,x,y,comp,req_comp);957 }958 830-#ifndef STBI_NO_HDR831-959+#ifndef STBI_NO_LINEAR960 static float *stbi_loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)961 {962 unsigned char *data;963 #ifndef STBI_NO_HDR38 unmodified lines1002 return stbi_loadf_main(&s,x,y,comp,req_comp);1003 }1004 #endif // !STBI_NO_STDIO1005 878-#endif // !STBI_NO_HDR1006+#endif // !STBI_NO_LINEAR1007 880-// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is881-// defined, for API simplicity; if STBI_NO_HDR is defined, it always1008+// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is1009+// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always1010 // reports false!1011 1012 STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)1013 {42 unmodified lines1056 return 0;1057 #endif1058 }1059 932-#ifndef STBI_NO_HDR1060 static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f;1061 static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f;1062 936-STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; }937-STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; }938-1063+#ifndef STBI_NO_LINEAR1064 STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; }1065 STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; }1066 #endif1067 1068+STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; }1069+STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; }1070 1071+1072 //////////////////////////////////////////////////////////////////////////////1073 //1074 // Common code used by all image loaders1075 //104 unmodified lines1180 stbi__uint32 z = stbi__get16le(s);1181 return z + (stbi__get16le(s) << 16);1182 }1183 1184+#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings1185+1186+1187 //////////////////////////////////////////////////////////////////////////////1188 //1189 // generic converter from built-in img_n to req_comp1190 // individual types do this automatically as much as possible (e.g. jpeg52 unmodified lines1243 STBI_FREE(data);1244 return good;1245 }1246 1116-#ifndef STBI_NO_HDR1247+#ifndef STBI_NO_LINEAR1248 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)1249 {1250 int i,k,n;1251 float *output = (float *) stbi__malloc(x * y * comp * sizeof(float));8 unmodified lines1260 }1261 STBI_FREE(data);1262 return output;1263 }1264+#endif1265 1266+#ifndef STBI_NO_HDR1267 #define stbi__float2int(x) ((int) (x))1268 static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)1269 {1270 int i,k,n;46 unmodified lines1317 // IJL11.dll: 1.08 seconds (compiled by intel)1318 // IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG)1319 // IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro)1320 1321+#ifndef STBI_NO_JPEG1322+1323 // huffman decoding acceleration1324 #define FAST_BITS 9 // larger handles more cases; smaller stomps less cache1325 1326 typedef struct1978 unmodified lines3305 stbi__jpeg j;3306 j.s = s;3307 return stbi__jpeg_info_raw(&j, x, y, comp);3308 }3309+#endif3310 3311 // public domain zlib decode v0.2 Sean Barrett 2006-11-183312 // simple implementation3313 // - all input must be provided in an upfront buffer3314 // - all output is written to a single output buffer (can malloc/realloc)3315 // performance3316 // - fast huffman3317 3318+#ifndef STBI_NO_ZLIB3319+3320 // fast-way is faster to check than jpeg huffman, but slow way is slower3321 #define STBI__ZFAST_BITS 9 // accelerate all cases in default tables3322 #define STBI__ZFAST_MASK ((1 << STBI__ZFAST_BITS) - 1)3323 436 unmodified lines3760 return (int) (a.zout - a.zout_start);3761 else3762 return -1;3763 }3764+#endif3765 3766 // public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-183767 // simple implementation3768 // - only 8-bit samples3 unmodified lines3772 // - avoids explicit window management3773 // performance3774 // - uses stb_zlib, a PD zlib implementation with fast huffman decoding3775 3637-3776+#ifndef STBI_NO_PNG3777 typedef struct3778 {3779 stbi__uint32 length;3780 stbi__uint32 type;53 unmodified lines3834 if (pb <= pc) return b;3835 return c;3836 }3837 3699-#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings3700-3838 static stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 };3839 3840 // create the png data from post-deflated data3841 static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color)545 unmodified lines4387 stbi__png p;4388 p.s = s;4389 return stbi__png_info_raw(&p, x, y, comp);4390 }4391+#endif4392 4393 // Microsoft/Windows BMP image4394+4395+#ifndef STBI_NO_BMP4396 static int stbi__bmp_test_raw(stbi__context *s)4397 {4398 int r;4399 int sz;256 unmodified lines4656 *y = s->img_y;4657 if (comp) *comp = s->img_n;4658 return out;4659 }4660+#endif4661 4662 // Targa Truevision - TGA4663 // by Jonathan Dummer4523-4664+#ifndef STBI_NO_TGA4665 static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)4666 {4667 int tga_w, tga_h, tga_comp;4668 int sz;247 unmodified lines4916 tga_x_origin = tga_y_origin = 0;4917 // OK, done4918 return tga_data;4919 }4920+#endif4921 4922 // *************************************************************************************************4923 // Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicolas Schulz, tweaked by STB4924 4925+#ifndef STBI_NO_PSD4926 static int stbi__psd_test(stbi__context *s)4927 {4928 int r = (stbi__get32be(s) == 0x38425053);4929 stbi__rewind(s);156 unmodified lines5086 *x = w;5087 5088 return out;5089 }5090+#endif5091 5092 // *************************************************************************************************5093 // Softimage PIC loader5094 // by Tom Seddon5095 //5096 // See http://softimage.wiki.softimage.com/index.php/INFO:_PIC_file_format5097 // See http://ozviz.wasp.uwa.edu.au/~pbourke/dataformats/softimagepic/5098 5099+#ifndef STBI_NO_PIC5100 static int stbi__pic_is4(stbi__context *s,const char *str)5101 {5102 int i;5103 for (i=0; i<4; ++i)196 unmodified lines5300 int r = stbi__pic_test_core(s);5301 stbi__rewind(s);5302 return r;5303 }5304+#endif5305 5306 // *************************************************************************************************5307 // GIF loader -- public domain by Jean-Marc Lienher -- simplified/shrunk by stb5308+5309+#ifndef STBI_NO_GIF5310 typedef struct5311 {5312 stbi__int16 prefix;5313 stbi_uc first;332 unmodified lines5646 static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)5647 {5648 return stbi__gif_info_raw(s,x,y,comp);5649 }5650+#endif5651 5503-5652 // *************************************************************************************************5653 // Radiance RGBE HDR loader5654 // originally by Nicolas Schulz5655 #ifndef STBI_NO_HDR214 unmodified lines5870 return 1;5871 }5872 #endif // STBI_NO_HDR5873 5874+#ifndef STBI_NO_BMP5875 static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)5876 {5877 int hsz;5878 if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') {19 unmodified lines5898 }5899 *comp = stbi__get16le(s) / 8;5900 return 1;5901 }5902+#endif5903 5904+#ifndef STBI_NO_PSD5905 static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)5906 {5907 int channelCount;5908 if (stbi__get32be(s) != 0x38425053) {22 unmodified lines5931 }5932 *comp = 4;5933 return 1;5934 }5935+#endif5936 5937+#ifndef STBI_NO_PIC5938 static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)5939 {5940 int act_comp=0,num_packets=0,chained;5941 stbi__pic_packet packets[10];36 unmodified lines5978 *comp = (act_comp & 0x10 ? 4 : 3);5979 5980 return 1;5981 }5982+#endif5983 5984 // *************************************************************************************************5985 // Portable Gray Map and Portable Pixel Map loader5986 // by Ken Miller5 unmodified lines5992 // Does not support comments in the header section5993 // Does not support ASCII image data (formats P2 and P3)5994 // Does not support 16-bit-per-channel5995 5996+#ifndef STBI_NO_PNM5997+5998 static int stbi__pnm_test(stbi__context *s)5999 {6000 char p, t;6001 p = (char) stbi__get8(s);85 unmodified lines6087 return stbi__err("max value > 255", "PPM image not 8-bit");6088 else6089 return 1;6090 }6091+#endif6092 6093 static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)6094 {5938- if (stbi__jpeg_info(s, x, y, comp))5939- return 1;5940- if (stbi__png_info(s, x, y, comp))5941- return 1;5942- if (stbi__gif_info(s, x, y, comp))5943- return 1;5944- if (stbi__bmp_info(s, x, y, comp))5945- return 1;5946- if (stbi__psd_info(s, x, y, comp))5947- return 1;5948- if (stbi__pic_info(s, x, y, comp))5949- return 1;5950- if (stbi__pnm_info(s, x, y, comp))5951- return 1;6095+ #ifndef STBI_NO_JPEG6096+ if (stbi__jpeg_info(s, x, y, comp)) return 1;6097+ #endif6098+6099+ #ifndef STBI_NO_PNG6100+ if (stbi__png_info(s, x, y, comp)) return 1;6101+ #endif6102+6103+ #ifndef STBI_NO_GIF6104+ if (stbi__gif_info(s, x, y, comp)) return 1;6105+ #endif6106+6107+ #ifndef STBI_NO_BMP6108+ if (stbi__bmp_info(s, x, y, comp)) return 1;6109+ #endif6110+6111+ #ifndef STBI_NO_PSD6112+ if (stbi__psd_info(s, x, y, comp)) return 1;6113+ #endif6114+ 6115+ #ifndef STBI_NO_PIC6116+ if (stbi__pic_info(s, x, y, comp)) return 1;6117+ #endif6118+6119+ #ifndef STBI_NO_PNM6120+ if (stbi__pnm_info(s, x, y, comp)) return 1;6121+ #endif6122+6123 #ifndef STBI_NO_HDR5953- if (stbi__hdr_info(s, x, y, comp))5954- return 1;6124+ if (stbi__hdr_info(s, x, y, comp)) return 1;6125 #endif6126+6127 // test tga last because it's a crappy test!6128+ #ifndef STBI_NO_TGA6129 if (stbi__tga_info(s, x, y, comp))6130 return 1;6131+ #endif6132 return stbi__err("unknown image type", "Image not of any known type, or corrupt");6133 }6134 6135 #ifndef STBI_NO_STDIO36 unmodified lines6172 #endif // STB_IMAGE_IMPLEMENTATION6173 6174 /*6175 revision history:6003- 2.00 (2014-12-25) optimize JPG, incl. x86 & NEON SIMD (ryg)6176+ 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg)6177 progressive JPEG (stb)6178 PGM/PPM support (Ken Miller)6179 STBI_MALLOC,STBI_REALLOC,STBI_FREE6180 GIF bugfix -- seemingly never worked6181+ STBI_NO_*, STBI_ONLY_*6182 1.48 (2014-12-14) fix incorrectly-named assert()6183 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb)6184 optimize PNG (ryg)6185 fix bug in interlaced PNG with user-specified channel count (stb)120 unmodified lines