mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[master] Removed obsolete unused MMX-querying support from contrib/gregbook
This commit is contained in:
parent
df6f3f404a
commit
d207e6a6ad
@ -73,84 +73,10 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
|
|||||||
|
|
||||||
void readpng2_version_info(void)
|
void readpng2_version_info(void)
|
||||||
{
|
{
|
||||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
|
||||||
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||||
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
/*
|
|
||||||
* WARNING: This preprocessor approach means that the following code
|
|
||||||
* cannot be used with a libpng DLL older than 1.2.0--the
|
|
||||||
* compiled-in symbols for the new functions will not exist.
|
|
||||||
* (Could use dlopen() and dlsym() on Unix and corresponding
|
|
||||||
* calls for Windows, but not portable...)
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
int mmxsupport = png_mmx_support();
|
|
||||||
if (mmxsupport < 0)
|
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
|
||||||
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
|
||||||
else {
|
|
||||||
int compilerID;
|
|
||||||
png_uint_32 mmx_mask = png_get_mmx_flagmask(
|
|
||||||
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
|
||||||
|
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
fprintf(stderr, " and with zlib %s; using zlib %s.\n",
|
||||||
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
|
|
||||||
png_libpng_ver, compilerID == 1? "MSVC++" :
|
|
||||||
(compilerID == 2? "GNU C" : "unknown"));
|
|
||||||
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
|
|
||||||
#if defined(__x86_64__)
|
|
||||||
"_64",
|
|
||||||
#else
|
|
||||||
"",
|
|
||||||
#endif
|
|
||||||
mmxsupport? "supports" : "does not support");
|
|
||||||
if (mmxsupport > 0) {
|
|
||||||
int num_optims = 0;
|
|
||||||
|
|
||||||
fprintf(stderr,
|
|
||||||
" Potential MMX optimizations supported by libpng:\n");
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
|
|
||||||
++num_optims;
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
|
|
||||||
++num_optims;
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
|
|
||||||
++num_optims;
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
|
|
||||||
++num_optims;
|
|
||||||
if (num_optims)
|
|
||||||
fprintf(stderr,
|
|
||||||
" decoding %s row filters (reading)\n",
|
|
||||||
(num_optims == 4)? "all non-trivial" : "some");
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
|
|
||||||
fprintf(stderr, " combining rows (reading)\n");
|
|
||||||
++num_optims;
|
|
||||||
}
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
|
|
||||||
fprintf(stderr,
|
|
||||||
" expanding interlacing (reading)\n");
|
|
||||||
++num_optims;
|
|
||||||
}
|
|
||||||
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
|
||||||
if (mmx_mask) {
|
|
||||||
fprintf(stderr, " other (unknown)\n");
|
|
||||||
++num_optims;
|
|
||||||
}
|
|
||||||
if (num_optims == 0)
|
|
||||||
fprintf(stderr, " (none)\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
|
||||||
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
|
||||||
ZLIB_VERSION, zlib_version);
|
ZLIB_VERSION, zlib_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,96 +168,6 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* may as well enable or disable MMX routines here, if supported;
|
|
||||||
*
|
|
||||||
* to enable all: mask = png_get_mmx_flagmask (
|
|
||||||
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
|
||||||
* flags = png_get_asm_flags (png_ptr);
|
|
||||||
* flags |= mask;
|
|
||||||
* png_set_asm_flags (png_ptr, flags);
|
|
||||||
*
|
|
||||||
* to disable all: mask = png_get_mmx_flagmask (
|
|
||||||
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
|
||||||
* flags = png_get_asm_flags (png_ptr);
|
|
||||||
* flags &= ~mask;
|
|
||||||
* png_set_asm_flags (png_ptr, flags);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
|
||||||
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
/*
|
|
||||||
* WARNING: This preprocessor approach means that the following code
|
|
||||||
* cannot be used with a libpng DLL older than 1.2.0--the
|
|
||||||
* compiled-in symbols for the new functions will not exist.
|
|
||||||
* (Could use dlopen() and dlsym() on Unix and corresponding
|
|
||||||
* calls for Windows, but not portable...)
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
png_uint_32 mmx_disable_mask = 0;
|
|
||||||
png_uint_32 asm_flags, mmx_mask;
|
|
||||||
int compilerID;
|
|
||||||
|
|
||||||
if (mainprog_ptr->nommxfilters)
|
|
||||||
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
|
||||||
if (mainprog_ptr->nommxcombine)
|
|
||||||
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
|
|
||||||
if (mainprog_ptr->nommxinterlace)
|
|
||||||
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
|
|
||||||
asm_flags = png_get_asm_flags(png_ptr);
|
|
||||||
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
|
||||||
|
|
||||||
|
|
||||||
/* Now query libpng's asm settings, just for yuks. Note that this
|
|
||||||
* differs from the querying of its *potential* MMX capabilities
|
|
||||||
* in readpng2_version_info(); this is true runtime verification. */
|
|
||||||
|
|
||||||
asm_flags = png_get_asm_flags(png_ptr);
|
|
||||||
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
|
|
||||||
&compilerID);
|
|
||||||
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
|
|
||||||
fprintf(stderr,
|
|
||||||
" MMX support (%s version) is compiled into libpng\n",
|
|
||||||
compilerID == 1? "MSVC++" :
|
|
||||||
(compilerID == 2? "GNU C" : "unknown"));
|
|
||||||
else
|
|
||||||
fprintf(stderr, " MMX support is not compiled into libpng\n");
|
|
||||||
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
|
|
||||||
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
|
|
||||||
fprintf(stderr,
|
|
||||||
" MMX read support for expanding interlacing is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
|
|
||||||
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
|
|
||||||
if (asm_flags)
|
|
||||||
fprintf(stderr,
|
|
||||||
" additional MMX support is also enabled (0x%02lx)\n",
|
|
||||||
asm_flags);
|
|
||||||
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
||||||
fprintf(stderr, " MMX querying is disabled in libpng.\n");
|
|
||||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* make sure we save our pointers for use in readpng2_decode_data() */
|
/* make sure we save our pointers for use in readpng2_decode_data() */
|
||||||
|
|
||||||
mainprog_ptr->png_ptr = png_ptr;
|
mainprog_ptr->png_ptr = png_ptr;
|
||||||
|
@ -96,11 +96,6 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
int nommxfilters;
|
|
||||||
int nommxcombine;
|
|
||||||
int nommxinterlace;
|
|
||||||
#endif
|
|
||||||
int state;
|
int state;
|
||||||
uch bg_red;
|
uch bg_red;
|
||||||
uch bg_green;
|
uch bg_green;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
- 2.01: fixed 64-bit typo in readpng2.c
|
- 2.01: fixed 64-bit typo in readpng2.c
|
||||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||||
unexpected-EOF and file-read-error cases
|
unexpected-EOF and file-read-error cases
|
||||||
|
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -395,18 +396,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
} else if (!strncmp(*argv, "-timing", 2)) {
|
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||||
timing = TRUE;
|
timing = TRUE;
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
} else if (!strcmp(*argv, "-nommx")) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
filename = *argv;
|
filename = *argv;
|
||||||
@ -430,9 +419,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
|
||||||
#endif
|
|
||||||
" %*s file.png\n\n"
|
" %*s file.png\n\n"
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
@ -445,10 +431,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
"\t\t transparent images; overrides -bgcolor option\n"
|
"\t\t transparent images; overrides -bgcolor option\n"
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
"\t\t download of image (~36 Kbps)\n"
|
"\t\t download of image (~36 Kbps)\n"
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
|
||||||
"\t\t combining rows, and expanding interlacing, respectively\n"
|
|
||||||
#endif
|
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
"Press Q or Esc to quit this usage screen. ",
|
"Press Q or Esc to quit this usage screen. ",
|
||||||
PROGNAME,
|
PROGNAME,
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||||
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
||||||
paste bugs
|
paste bugs
|
||||||
|
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -94,7 +95,7 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-x"
|
#define PROGNAME "rpng2-x"
|
||||||
#define LONGNAME "Progressive PNG Viewer for X"
|
#define LONGNAME "Progressive PNG Viewer for X"
|
||||||
#define VERSION "2.02 of 16 March 2008"
|
#define VERSION "2.03 of 25 February 2010"
|
||||||
#define RESNAME "rpng2" /* our X resource application name */
|
#define RESNAME "rpng2" /* our X resource application name */
|
||||||
#define RESCLASS "Rpng" /* our X resource class name */
|
#define RESCLASS "Rpng" /* our X resource class name */
|
||||||
|
|
||||||
@ -434,18 +435,6 @@ int main(int argc, char **argv)
|
|||||||
else if (loop_interval > 100000) /* bit more than one day */
|
else if (loop_interval > 100000) /* bit more than one day */
|
||||||
loop_interval = 100000;
|
loop_interval = 100000;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
} else if (!strcmp(*argv, "-nommx")) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
@ -468,9 +457,6 @@ int main(int argc, char **argv)
|
|||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
|
||||||
#endif
|
|
||||||
#ifdef FEATURE_LOOP
|
#ifdef FEATURE_LOOP
|
||||||
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
||||||
#else
|
#else
|
||||||
@ -490,10 +476,6 @@ int main(int argc, char **argv)
|
|||||||
" -loop\tloops through background images after initial display\n"
|
" -loop\tloops through background images after initial display\n"
|
||||||
"\t\t is complete (depends on -bgpat)\n"
|
"\t\t is complete (depends on -bgpat)\n"
|
||||||
" sec \tseconds to display each background image (default = 2)\n"
|
" sec \tseconds to display each background image (default = 2)\n"
|
||||||
#endif
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
|
||||||
"\t\t combining rows, and expanding interlacing, respectively\n"
|
|
||||||
#endif
|
#endif
|
||||||
" dur \tduration in microseconds to wait after displaying each\n"
|
" dur \tduration in microseconds to wait after displaying each\n"
|
||||||
"\t\t row (for demo purposes)\n"
|
"\t\t row (for demo purposes)\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user