76 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ 77 (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \ 78 defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) 89 fprintf(stderr,
" Compiled with libpng %s; using libpng %s " 96 fprintf(stderr,
" Compiled with libpng %s; using libpng %s " 99 (compilerID == 2?
"GNU C" :
"unknown"));
100 fprintf(stderr,
" Processor (x86%s) %s MMX instructions.\n",
101 #
if defined(__x86_64__)
106 mmxsupport?
"supports" :
"does not support");
107 if (mmxsupport > 0) {
111 " Potential MMX optimizations supported by libpng:\n");
122 " decoding %s row filters (reading)\n",
123 (num_optims == 4)?
"all non-trivial" :
"some");
125 fprintf(stderr,
" combining rows (reading)\n");
130 " expanding interlacing (reading)\n");
133 mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
134 | PNG_ASM_FLAG_MMX_READ_INTERLACE \
135 | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
136 | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
137 | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
140 fprintf(stderr,
" other (unknown)\n");
144 fprintf(stderr,
" (none)\n");
149 fprintf(stderr,
" Compiled with libpng %s; using libpng %s " 153 fprintf(stderr,
" Compiled with zlib %s; using zlib %s.\n",
179 readpng2_error_handler,
NULL);
200 if (setjmp(mainprog_ptr->
jmpbuf)) {
206 #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED 215 static const png_byte chunks_to_ignore[] = {
216 99, 72, 82, 77,
'\0',
217 104, 73, 83, 84,
'\0',
218 105, 67, 67, 80,
'\0',
219 105, 84, 88, 116,
'\0',
220 111, 70, 70, 115,
'\0',
221 112, 67, 65, 76,
'\0',
222 112, 72, 89, 115,
'\0',
223 115, 66, 73, 84,
'\0',
224 115, 67, 65, 76,
'\0',
225 115, 80, 76, 84,
'\0',
226 115, 84, 69, 82,
'\0',
227 116, 69, 88, 116,
'\0',
228 116, 73, 77, 69,
'\0',
229 122, 84, 88, 116,
'\0' 233 chunks_to_ignore,
sizeof(chunks_to_ignore)/5);
242 readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
261 #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \ 262 defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) 271 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED 276 if (mainprog_ptr->nommxfilters)
281 if (mainprog_ptr->nommxcombine)
283 if (mainprog_ptr->nommxinterlace)
298 " MMX support (%s version) is compiled into libpng\n",
299 compilerID == 1?
"MSVC++" :
300 (compilerID == 2?
"GNU C" :
"unknown"));
302 fprintf(stderr,
" MMX support is not compiled into libpng\n");
303 fprintf(stderr,
" MMX instructions are %ssupported by CPU\n",
305 fprintf(stderr,
" MMX read support for combining rows is %sabled\n",
308 " MMX read support for expanding interlacing is %sabled\n",
310 fprintf(stderr,
" MMX read support for \"sub\" filter is %sabled\n",
312 fprintf(stderr,
" MMX read support for \"up\" filter is %sabled\n",
314 fprintf(stderr,
" MMX read support for \"avg\" filter is %sabled\n",
316 fprintf(stderr,
" MMX read support for \"Paeth\" filter is %sabled\n",
318 asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
319 | PNG_ASM_FLAG_MMX_READ_INTERLACE \
320 | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
321 | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
322 | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
326 " additional MMX support is also enabled (0x%02lx)\n",
329 fprintf(stderr,
" MMX querying is disabled in libpng.\n");
337 mainprog_ptr->
png_ptr = png_ptr;
360 if (setjmp(mainprog_ptr->
jmpbuf)) {
401 if (mainprog_ptr ==
NULL) {
403 "readpng2 error: main struct not recoverable in info_callback.\n");
418 png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
439 if (bit_depth == 16) {
440 mainprog_ptr->
bg_red = pBackground->red >> 8;
441 mainprog_ptr->
bg_green = pBackground->green >> 8;
442 mainprog_ptr->
bg_blue = pBackground->blue >> 8;
446 mainprog_ptr->
bg_blue = pBackground->gray? 255 : 0;
447 else if (bit_depth == 2)
449 mainprog_ptr->
bg_blue = (255/3) * pBackground->gray;
452 mainprog_ptr->
bg_blue = (255/15) * pBackground->gray;
454 mainprog_ptr->
bg_red = (
uch)pBackground->red;
456 mainprog_ptr->
bg_blue = (
uch)pBackground->blue;
552 mainprog_ptr->
pass = pass;
636 fprintf(stderr,
"readpng2 libpng error: %s\n", msg);
640 if (mainprog_ptr ==
NULL) {
642 "readpng2 severe error: jmpbuf not recoverable; terminating.\n");
647 longjmp(mainprog_ptr->
jmpbuf, 1);
GLenum GLuint GLenum GLsizei length
GLint GLint GLsizei GLsizei height
PNG_CONST char png_libpng_ver[18]
png_bytep png_bytep new_row
void PNGAPI png_set_asm_flags(png_structp png_ptr, png_uint_32 asm_flags)
void PNGAPI png_process_data(png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)
png_infop PNGAPI png_create_info_struct(png_structp png_ptr)
void(* mainprog_init)(void)
int readpng2_check_sig(uch *sig, int num)
png_uint_32 PNGAPI png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
png_color_16 FAR * png_color_16p
png_voidp PNGAPI png_get_error_ptr(png_structp png_ptr)
#define PNG_COLOR_TYPE_GRAY_ALPHA
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
#define PNG_COLOR_TYPE_PALETTE
png_uint_32 PNGAPI png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
#define PNG_LIBPNG_VER_STRING
#define PNG_ASM_FLAG_MMX_READ_FILTER_UP
void PNGAPI png_progressive_combine_row(png_structp png_ptr, png_bytep old_row, png_bytep new_row)
GLint GLint GLsizei width
PNG_CONST char FAR * png_const_charp
void PNGAPI png_set_strip_16(png_structp png_ptr)
void readpng2_version_info(void)
png_voidp PNGAPI png_get_progressive_ptr(png_structp png_ptr)
png_uint_32 PNGAPI png_get_mmx_flagmask(int flag_select, int *compilerID)
png_struct FAR * png_structp
void readpng2_cleanup(mainprog_info *mainprog_ptr)
#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH
void(* mainprog_finish_display)(void)
png_uint_32 PNGAPI png_get_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_type, int *compression_type, int *filter_type)
#define PNG_COLOR_TYPE_GRAY
#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED
void PNGAPI png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
int PNGAPI png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
int readpng2_decode_data(mainprog_info *mainprog_ptr, uch *rawbuf, ulg length)
png_uint_32 PNGAPI png_get_asm_flags(png_structp png_ptr)
png_structp PNGAPI png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)
void PNGAPI png_set_expand(png_structp png_ptr)
png_uint_32 PNGAPI png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p *background)
int readpng2_init(mainprog_info *mainprog_ptr)
int PNGAPI png_set_interlace_handling(png_structp png_ptr)
#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
int PNGAPI png_mmx_support(void)
void(* mainprog_display_row)(ulg row_num)
void PNGAPI png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)
unsigned long png_uint_32
png_uint_32 PNGAPI png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
#define PNG_ASM_FLAG_MMX_READ_INTERLACE
void PNGAPI png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)
void PNGAPI png_read_update_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep chunk_list, int num_chunks)
png_byte PNGAPI png_get_channels(png_structp png_ptr, png_infop info_ptr)
void PNGAPI png_set_gray_to_rgb(png_structp png_ptr)