mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 04:05:09 +02:00
Add DevIL 1.7.8.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
all_include = $(srcdir)/../include
|
||||
AM_CPPFLAGS = -I $(all_include)
|
||||
|
||||
check_PROGRAMS = testil
|
||||
check_SCRIPTS = format_test/format_checks.sh
|
||||
|
||||
testil_SOURCES = format_test/testil.c
|
||||
testil_LDADD =
|
||||
if BUILD_ILU
|
||||
testil_LDADD += ../lib/libILU.la
|
||||
else
|
||||
testil_LDADD += ../lib/libIL.la
|
||||
endif
|
||||
|
||||
TESTS_ENVIRONMENT = /bin/bash
|
||||
TESTS = $(check_SCRIPTS)
|
||||
@@ -0,0 +1,581 @@
|
||||
# Makefile.in generated by automake 1.10.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
check_PROGRAMS = testil$(EXEEXT)
|
||||
@BUILD_ILU_TRUE@am__append_1 = ../lib/libILU.la
|
||||
@BUILD_ILU_FALSE@am__append_2 = ../lib/libIL.la
|
||||
subdir = test
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
|
||||
$(top_srcdir)/m4/allegro.m4 $(top_srcdir)/m4/ax_check_gl.m4 \
|
||||
$(top_srcdir)/m4/ax_check_glu.m4 \
|
||||
$(top_srcdir)/m4/ax_check_glut.m4 \
|
||||
$(top_srcdir)/m4/ax_lang_compiler_ms.m4 \
|
||||
$(top_srcdir)/m4/devil-api_checks.m4 \
|
||||
$(top_srcdir)/m4/devil-definitions.m4 \
|
||||
$(top_srcdir)/m4/devil-report.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/sdl.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/include/IL/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
am_testil_OBJECTS = testil.$(OBJEXT)
|
||||
testil_OBJECTS = $(am_testil_OBJECTS)
|
||||
testil_DEPENDENCIES = $(am__append_1) $(am__append_2)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/IL
|
||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(testil_SOURCES)
|
||||
DIST_SOURCES = $(testil_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLEGRO_CONFIG = @ALLEGRO_CONFIG@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DEVIL_LTVERSION = @DEVIL_LTVERSION@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GENERAL_CFLAGS = @GENERAL_CFLAGS@
|
||||
GLUT_CFLAGS = @GLUT_CFLAGS@
|
||||
GLUT_LIBS = @GLUT_LIBS@
|
||||
GLU_CFLAGS = @GLU_CFLAGS@
|
||||
GLU_LIBS = @GLU_LIBS@
|
||||
GL_CFLAGS = @GL_CFLAGS@
|
||||
GL_LIBS = @GL_LIBS@
|
||||
GREP = @GREP@
|
||||
ILUT_CFLAGS = @ILUT_CFLAGS@
|
||||
ILUT_LIBS = @ILUT_LIBS@
|
||||
ILU_CFLAGS = @ILU_CFLAGS@
|
||||
ILU_LIBS = @ILU_LIBS@
|
||||
IL_CFLAGS = @IL_CFLAGS@
|
||||
IL_LIBS = @IL_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBILUT_WIN32LIBPATH = @LIBILUT_WIN32LIBPATH@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
|
||||
OPENEXR_LIBS = @OPENEXR_LIBS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PLATFORM = @PLATFORM@
|
||||
PTHREAD_CC = @PTHREAD_CC@
|
||||
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
|
||||
PTHREAD_LIBS = @PTHREAD_LIBS@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
SUPPORTED_FORMATS = @SUPPORTED_FORMATS@
|
||||
VERSION = @VERSION@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
acx_pthread_config = @acx_pthread_config@
|
||||
allegro_CFLAGS = @allegro_CFLAGS@
|
||||
allegro_LIBS = @allegro_LIBS@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
all_include = $(srcdir)/../include
|
||||
AM_CPPFLAGS = -I $(all_include)
|
||||
check_SCRIPTS = format_test/format_checks.sh
|
||||
testil_SOURCES = format_test/testil.c
|
||||
testil_LDADD = $(am__append_1) $(am__append_2)
|
||||
TESTS_ENVIRONMENT = /bin/bash
|
||||
TESTS = $(check_SCRIPTS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu test/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
@list='$(check_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
testil$(EXEEXT): $(testil_OBJECTS) $(testil_DEPENDENCIES)
|
||||
@rm -f testil$(EXEEXT)
|
||||
$(LINK) $(testil_OBJECTS) $(testil_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testil.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
testil.o: format_test/testil.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testil.o -MD -MP -MF $(DEPDIR)/testil.Tpo -c -o testil.o `test -f 'format_test/testil.c' || echo '$(srcdir)/'`format_test/testil.c
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testil.Tpo $(DEPDIR)/testil.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='format_test/testil.c' object='testil.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testil.o `test -f 'format_test/testil.c' || echo '$(srcdir)/'`format_test/testil.c
|
||||
|
||||
testil.obj: format_test/testil.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testil.obj -MD -MP -MF $(DEPDIR)/testil.Tpo -c -o testil.obj `if test -f 'format_test/testil.c'; then $(CYGPATH_W) 'format_test/testil.c'; else $(CYGPATH_W) '$(srcdir)/format_test/testil.c'; fi`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testil.Tpo $(DEPDIR)/testil.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='format_test/testil.c' object='testil.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testil.obj `if test -f 'format_test/testil.c'; then $(CYGPATH_W) 'format_test/testil.c'; else $(CYGPATH_W) '$(srcdir)/format_test/testil.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
list=' $(TESTS) '; \
|
||||
if test -n "$$list"; then \
|
||||
for tst in $$list; do \
|
||||
if test -f ./$$tst; then dir=./; \
|
||||
elif test -f $$tst; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*$$ws$$tst$$ws*) \
|
||||
xpass=`expr $$xpass + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "XPASS: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
echo "PASS: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*$$ws$$tst$$ws*) \
|
||||
xfail=`expr $$xfail + 1`; \
|
||||
echo "XFAIL: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
else \
|
||||
skip=`expr $$skip + 1`; \
|
||||
echo "SKIP: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
if test "$$xfail" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
|
||||
fi; \
|
||||
else \
|
||||
if test "$$xpass" -eq 0; then \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dashes="$$banner"; \
|
||||
skipped=""; \
|
||||
if test "$$skip" -ne 0; then \
|
||||
skipped="($$skip tests were not run)"; \
|
||||
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
|
||||
dashes="$$skipped"; \
|
||||
fi; \
|
||||
report=""; \
|
||||
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
|
||||
report="Please report to $(PACKAGE_BUGREPORT)"; \
|
||||
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
|
||||
dashes="$$report"; \
|
||||
fi; \
|
||||
dashes=`echo "$$dashes" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
test -z "$$skipped" || echo "$$skipped"; \
|
||||
test -z "$$report" || echo "$$report"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0; \
|
||||
else :; fi
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
|
||||
clean-checkPROGRAMS clean-generic clean-libtool ctags \
|
||||
distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERBOSE="" # set VERBOSE="v" for verbose mode
|
||||
# that @expression@ will be substituted by the 'confgure' script
|
||||
EXTENSIONS="@SUPPORTED_FORMATS@"
|
||||
# Here are the extensions that should support saving according to docs
|
||||
#CAN_SAVE=" BMP DDS HDR ICO JPG PCX PNG PPM PSD RAW SGI TGA TIF XPM " RAW and XPM are problematic...
|
||||
CAN_SAVE="BMP DDS EXR HDR ICO JP2 JPG PCX PNG PPM PSD SGI TGA TIF"
|
||||
# List of formats that we don't test since they are problematic
|
||||
PROBLEMATIC="RAW WBMP XPM"
|
||||
|
||||
echo "Running saving and loading consistency test..."
|
||||
FAILED_FORMATS=""
|
||||
PASSED_FORMATS=""
|
||||
|
||||
# if using Wine makes sense, use it...
|
||||
if [ "x@BUILD_OS@" != "x@HOST_OS@" ]
|
||||
then
|
||||
if [ "x@PLATFORM@" = "xMINGW32" -o "x@PLATFORM@" = "xCYGWIN" ]
|
||||
then
|
||||
test $(which wine 2> /dev/null) && WINE="wine"
|
||||
echo "Warning: Using wine to test executables (not 100% reliable)"
|
||||
fi
|
||||
fi
|
||||
|
||||
for EXTENSION in $EXTENSIONS
|
||||
do
|
||||
#echo expr match "' $CAN_SAVE '" '.*\s'$EXTENSION'\s.*'
|
||||
if [ $(expr match "' $CAN_SAVE '" '.*\s'$EXTENSION'\s.*') -eq 0 -o $(expr match "' $PROBLEMATIC '" '.*\s'$EXTENSION'\s.*') -ne 0 ]
|
||||
then # This extension is not considered as supported...
|
||||
continue;
|
||||
fi
|
||||
test -n "$VERBOSE" && echo $WINE ./testil@EXEEXT@ -e $EXTENSION
|
||||
# EXEEXT comes in when one compiles on platforms that append extensions to executables (testil.exe)
|
||||
$WINE ./testil@EXEEXT@ -e$VERBOSE $EXTENSION
|
||||
|
||||
# We have to capture whether the test has failed or not
|
||||
if [ ! $? -eq 0 ]
|
||||
then # we have an error here...
|
||||
FAILED_FORMATS="$FAILED_FORMATS $EXTENSION"
|
||||
FAILED="$?"
|
||||
else #no error...
|
||||
PASSED_FORMATS="$PASSED_FORMATS $EXTENSION"
|
||||
fi
|
||||
done
|
||||
|
||||
#let's tell something to the user as well:
|
||||
if [ "x$FAILED" = "x" ]
|
||||
then #everything went fine
|
||||
echo "All examined formats were OK:$PASSED_FORMATS"
|
||||
else #something went wrong
|
||||
echo "Errors were encountered during the test :-("
|
||||
echo "Formats that were OK:$PASSED_FORMATS"
|
||||
echo "Failed formats: $FAILED_FORMATS"
|
||||
FAILED="1"
|
||||
fi # end of something went wrong
|
||||
echo "Problematic (untested) formats: $PROBLEMATIC"
|
||||
|
||||
echo
|
||||
|
||||
# And we have to tell the result to the shell, too...
|
||||
exit $FAILED
|
||||
@@ -0,0 +1,629 @@
|
||||
#include <IL/il.h>
|
||||
|
||||
/* This program (testil) is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#define _USE_MATH_DEFINES // Have to add for MSVC++ to use M_PI properly.
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
enum colors {ALPHA, BLUE, GREEN, RED};
|
||||
#else /* not WORDS_BIGENDIAN */
|
||||
enum colors {RED, GREEN, BLUE, ALPHA};
|
||||
#endif /* not WORDS_BIGENDIAN */
|
||||
|
||||
/* We would need ILU just because of iluErrorString() function... */
|
||||
/* So make it possible for both with and without ILU! */
|
||||
#ifdef ILU_ENABLED
|
||||
#include <IL/ilu.h>
|
||||
#define ERROR_LOADING_FILE_MACRO(filename, code) fprintf(stderr, "Error loading file '%s'\nReason: %s\n", (filename), iluErrorString((code)))
|
||||
#define ERROR_SAVING_FILE_MACRO(filename, code) fprintf(stderr, "Error saving file '%s'\nReason: %s\n", (filename), iluErrorString((code)))
|
||||
#else /* not ILU_ENABLED */
|
||||
#define ERROR_LOADING_FILE_MACRO(filename, code) fprintf(stderr, "Error loading file '%s'\nError code: 0x%X\n", (filename), (unsigned int)(code))
|
||||
#define ERROR_SAVING_FILE_MACRO(filename, code) fprintf(stderr, "Error saving file '%s'\nError code: 0x%X\n", (filename), (unsigned int)(code))
|
||||
#endif /* not ILU_ENABLED */
|
||||
|
||||
/** How did the tests ended? */
|
||||
enum test_results {TEST_OK = 0, TEST_FAIL = 0x1, TEST_FAIL_QUANTIL = 0x2, TEST_FAIL_INTEGRAL = 0x4 };
|
||||
|
||||
/** Parsing and parsing results (Parameters.flags) related: What options were passed? */
|
||||
enum {ACTION_HELP = 0x1, ACTION_VERBOSE = 0x2, ACTION_PRESERVE_TESTFILE = 0x4, ACTION_ROUGH_MODE = 0x8, ACTION_TEST_ALPHA = 0x10 };
|
||||
/** Parsing only: What sort of options to expect? */
|
||||
enum {EXPECT_EXTENSION = 0x1, EXPECT_QUANTILE = 0x2, EXPECT_FILENAME = 0x4, EXPECT_RESOLUTION = 0x8, EXPECT_IMAGES = 0x10};
|
||||
/** What to test for? */
|
||||
enum {TEST_NOTHING, TEST_EXTENSION, TEST_IS_TEST_IMAGE, TEST_IMAGES_ARE_SAME};
|
||||
|
||||
int compare_ILubyte (const void * a, const void * b)
|
||||
{ return ( *(ILubyte * )a - *(ILubyte * )b ); }
|
||||
|
||||
/*
|
||||
struct PIXEL
|
||||
{
|
||||
ILubyte color[4];
|
||||
};
|
||||
typedef struct PIXEL pixel;*/
|
||||
|
||||
/** What we collect from the comand line...
|
||||
*/
|
||||
struct parameters
|
||||
{
|
||||
/* ** Input parameters ** */
|
||||
/** In the case we want to test filename */
|
||||
char first_filename[64];
|
||||
/** In the case we want to compare two filenames */
|
||||
char second_filename[64];
|
||||
/** or test extension... */
|
||||
char * extension;
|
||||
|
||||
/*** Tests parameters ***/
|
||||
/** how talkative should we be? */
|
||||
int verbose;
|
||||
/** what about preserve-testfile, rough mode? */
|
||||
int flags;
|
||||
/* How many bytes per pixel? */
|
||||
int bpp;
|
||||
/** If we want to tweak test image sizes... */
|
||||
int resolution[2];
|
||||
/** Quantile test specs */
|
||||
double quantile_spec;
|
||||
int quantile_treshold;
|
||||
/** Integral test specs */
|
||||
double integral_treshold;
|
||||
};
|
||||
typedef struct parameters Parameters;
|
||||
|
||||
/** Function generates test pattern when given data and dimensions
|
||||
* \param data Image data. 32bits per pixel
|
||||
* \param w, h Width and height of the image
|
||||
*/
|
||||
void generate_test_image(ILubyte * data, int w, int h, Parameters params)
|
||||
{
|
||||
int test_alpha = params.flags & ACTION_TEST_ALPHA;
|
||||
int bpp = params.bpp;
|
||||
|
||||
int i, j, index, j_index;
|
||||
double red, green, blue, sum;
|
||||
/* For easier notations */
|
||||
int h_5 = h / 5;
|
||||
for (j = 0, index = 0; j < h_5 * 3; j++)
|
||||
for (i = 0; i < w * bpp; i += bpp) /* We jump bpp bytes ahead with each pixel */
|
||||
{/* Making 27 samples from the RGB cube. */
|
||||
index = 9 * (j / h_5) + (i * 9) / w / bpp;
|
||||
j_index = j * w * bpp; /* just to make stuff look nice */
|
||||
data[j_index + i + RED] = 255 / 6 + (255 / 3) * (index % 3) ;
|
||||
data[j_index + i + GREEN] = 255 / 6 + (255 / 3) * ((index % 9) / 3 );
|
||||
data[j_index + i + BLUE] = 255 / 6 + (255 / 3) * (index / 9);
|
||||
if (test_alpha)
|
||||
data[j_index + i + ALPHA] = 255 - 63 * ((j * 4 / h_5) % 4);
|
||||
}
|
||||
for (j = 3 * h_5; j < 4 * h_5; j++)
|
||||
for (i = 0; i < w * bpp; i += bpp)
|
||||
{/* Making color gradient */
|
||||
red = cos(2 * M_PI / (double)w * i / bpp) / 2.0 + 0.5;
|
||||
green = cos(2 * M_PI / (double)w * i / bpp + M_PI * 1.0 / 3.0) / 2.0 + 0.5;
|
||||
blue = cos(2 * M_PI / (double)w * i / bpp + M_PI * 2.0 / 3.0) / 2.0 + 0.5;
|
||||
sum = sqrt(red * red + green * green + blue * blue);
|
||||
j_index = j * w * bpp;
|
||||
data[j_index + i + RED] = 255 * red / sum;
|
||||
data[j_index + i + GREEN] = 255 * green / sum;
|
||||
data[j_index + i + BLUE] = 255 * blue / sum;
|
||||
if (test_alpha)
|
||||
data[j_index + i + ALPHA] = 255;
|
||||
}
|
||||
for (j = 4 * h_5; j < 5 * h_5; j++)
|
||||
for (i = 0; i < w * bpp; i += bpp)
|
||||
{/* Making smooth B&W gradient */
|
||||
j_index = j * w * bpp;
|
||||
data[j_index + i + RED] = (i / bpp * 255) / w;
|
||||
data[j_index + i + GREEN] = (i / bpp * 255) / w;
|
||||
data[j_index + i + BLUE] = (i / bpp * 255) / w;
|
||||
if (test_alpha)
|
||||
data[j_index + i + ALPHA] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
/** Functions saves the test image of given dimensions and given name
|
||||
* \param name Filename
|
||||
* \param w, h Image dimensions
|
||||
*
|
||||
* The image is defined in the generate_test_image function and this function just calls it...
|
||||
*/
|
||||
int save_test_image(const char * name, int w, int h, Parameters params)
|
||||
{
|
||||
/* Set constants so that there are no div rounding errors */
|
||||
ILuint handle;
|
||||
/* Generate the paperwork for our test image... */
|
||||
ilGenImages(1, & handle);
|
||||
ilBindImage(handle);
|
||||
/* how much memory will we need? */
|
||||
int memory_needed = w * h * params.bpp;
|
||||
ILubyte * data = (ILubyte * )malloc(memory_needed);
|
||||
if (data == NULL)
|
||||
{
|
||||
fprintf(stderr, "Out of memory, %s:%d\n", __FILE__, __LINE__);
|
||||
return IL_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
generate_test_image(data, w, h, params);
|
||||
|
||||
/* finally set the image data */
|
||||
ilTexImage(w, h, 1, params.bpp, ( (params.flags & ACTION_TEST_ALPHA) == 0 ? IL_RGB : IL_RGBA), IL_UNSIGNED_BYTE, data);
|
||||
/* and dump them to the disc... */
|
||||
ILboolean saved = ilSaveImage(name);
|
||||
int return_value = IL_NO_ERROR;
|
||||
if (saved == IL_FALSE)
|
||||
{
|
||||
return_value = ilGetError();
|
||||
ERROR_SAVING_FILE_MACRO(name,return_value);
|
||||
}
|
||||
/* Finally, clean the mess! */
|
||||
ilDeleteImages(1, & handle);
|
||||
free(data);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Returns the sum value of quantile of absolute differences among subpixels.
|
||||
* \param reference Left hand side image (LHS == RHS ?)
|
||||
* \param sample Right hand side image
|
||||
* \param num_subpixels BPP of image, usually 4 (RGBA)
|
||||
* \param quantile What quantile value are we interested in
|
||||
* \return Value of the quantile
|
||||
*
|
||||
* First of all, absolute differences are computed.
|
||||
* Then they are stored in an array and sorted using quicksort.
|
||||
* Finally, the quantile is determined and returned.
|
||||
*/
|
||||
int calculate_median_pixel_distance_abs(ILubyte * reference, ILubyte * sample, int num_subpixels, double quantile)
|
||||
{
|
||||
ILubyte * differences = (ILubyte *)malloc(sizeof(ILubyte) * num_subpixels);
|
||||
if (differences == NULL)
|
||||
{
|
||||
fprintf(stderr, "Out of memory, %s:%d\n", __FILE__, __LINE__);
|
||||
return IL_OUT_OF_MEMORY;
|
||||
}
|
||||
int ii, difference;
|
||||
for (ii = 0; ii < num_subpixels; ii++)
|
||||
{/* Going through all pixel components and assigning the absolute difference to differences array */
|
||||
difference = (int)sample[ii] - reference[ii]; /* avoiding: overflow + need to have abs() */
|
||||
differences[ii] = (difference >= 0) ? difference : - difference;
|
||||
}
|
||||
/* We need the quantile, so we have to sort the array */
|
||||
qsort (differences, num_subpixels, sizeof(ILubyte), compare_ILubyte);
|
||||
if (quantile > 1.0 || quantile < 0.0) /* The quantile has totally wrong value... */
|
||||
{
|
||||
fprintf(stderr, "Come on... Quantile should be between 0.0 and 1.0 (you wanted %.3f)\n", quantile);
|
||||
return -1;
|
||||
}
|
||||
int index = (int)(quantile * num_subpixels); /* Which member of the sorted array is the quantile? */
|
||||
int result = differences[index];
|
||||
free(differences); /* Clean the mess */
|
||||
differences = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Returns the sum of squared differences between component color values, normed.
|
||||
*
|
||||
*/
|
||||
double calculate_averaged_distance_sqr_integral(ILubyte * reference, ILubyte * sample, int num_subpixels)
|
||||
{
|
||||
long long differences = 0;
|
||||
int ii, difference;
|
||||
for (ii = 0; ii < num_subpixels; ii++)
|
||||
{/* Going through all pixel components and assigning the absolute difference to differences array */
|
||||
difference = sample[ii] - reference[ii]; /* avoiding overflow + need to have abs() */
|
||||
differences += difference * difference;
|
||||
}
|
||||
return sqrt(differences / (double)num_subpixels);
|
||||
}
|
||||
|
||||
/** Do the comparison and return results through parameters.
|
||||
*/
|
||||
void compare_fields(int w, int h, ILubyte * sample, ILubyte * reference, Parameters params, int * quantile, double * integral)
|
||||
{
|
||||
* quantile = calculate_median_pixel_distance_abs(reference, sample, w * h * params.bpp, params.quantile_spec);
|
||||
* integral = calculate_averaged_distance_sqr_integral(reference, sample, w * h * params.bpp);
|
||||
}
|
||||
|
||||
/** We have some results of test of similarity of two images. Are they the same?
|
||||
* \param filename What filename are we actually testing? (Needed gor report purposes only.)
|
||||
* \param quantile What is the value of the quantile we have acquired earlier?
|
||||
* \param integral And what is the value of normed integral distance?
|
||||
* \return 0 on success or TEST_FAIL or'd with the cause.
|
||||
*/
|
||||
int interpret_results(const char * filename, Parameters params, int quantile, double integral)
|
||||
{
|
||||
int return_value = 0;
|
||||
if (quantile > params.quantile_treshold)
|
||||
{
|
||||
printf("Quantile test failed: More than %d%% of subpixels have greater error than %d (should be less than %d)\n", (int)(100 - 100 * params.quantile_spec), quantile, params.quantile_treshold);
|
||||
return_value |= TEST_FAIL_QUANTIL | TEST_FAIL;
|
||||
}
|
||||
|
||||
if (integral > params.integral_treshold)
|
||||
{
|
||||
printf("Integral test failed: Deviation is %.3f, should be below %.3f\n", integral, params.integral_treshold);
|
||||
return_value |= TEST_FAIL_INTEGRAL | TEST_FAIL;
|
||||
}
|
||||
|
||||
if (params.verbose > 0)
|
||||
printf("Testing file '%s'. \nQuantile[%.3f]: %d (max %d)\nIngegral: %f (max %f)\n", filename, params.quantile_spec, quantile, params.quantile_treshold, integral, params.integral_treshold);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Is the passed params.first_filename a test image?
|
||||
* Useful for testing whether the various format load functions alre OK
|
||||
* if we can't save the test image in DevIL.
|
||||
* So we take some test image, convert it to another format in some exernal editor
|
||||
* and then we try to load it. Smart, isn't it? :-)
|
||||
*/
|
||||
int test_is_testimage(Parameters params)
|
||||
{
|
||||
/* First, we load the generated and saved image */
|
||||
ILuint handle;
|
||||
ilGenImages(1, & handle);
|
||||
ilBindImage(handle);
|
||||
int loaded = ilLoadImage(params.first_filename);
|
||||
if (loaded == IL_FALSE)
|
||||
{/* something went wrong */
|
||||
ERROR_LOADING_FILE_MACRO(params.first_filename, loaded);
|
||||
return loaded;
|
||||
}
|
||||
/* getting image width and height */
|
||||
int w, h;
|
||||
w = ilGetInteger(IL_IMAGE_WIDTH);
|
||||
h = ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
/* Then we save image data into arrays that we allocate now */
|
||||
ILubyte * reference, * sample;
|
||||
reference = malloc(w * h * params.bpp * sizeof(ILubyte));
|
||||
sample = malloc(w * h * params.bpp * sizeof(ILubyte));
|
||||
if (reference == NULL || sample == NULL)
|
||||
{
|
||||
if ((params.flags & ACTION_PRESERVE_TESTFILE) == 0)
|
||||
remove(params.first_filename);
|
||||
fprintf(stderr, "Out of memory, %s:%d\n", __FILE__, __LINE__);
|
||||
return IL_OUT_OF_MEMORY;
|
||||
}
|
||||
/* Allocation went fine and now we get what SHOULD BE on the loaded image... */
|
||||
generate_test_image((ILubyte *)reference, w, h, params);
|
||||
ilCopyPixels(0, 0, 0, w, h, 1, ((params.flags & ACTION_TEST_ALPHA) == 0 ? IL_RGB : IL_RGBA), IL_UNSIGNED_BYTE, sample);
|
||||
|
||||
int quantile;
|
||||
double integral;
|
||||
compare_fields(w, h, sample, reference, params, & quantile, & integral);
|
||||
int return_value = interpret_results(params.first_filename, params, quantile, integral);
|
||||
|
||||
free(sample);
|
||||
free(reference);
|
||||
/* We do not want to keep the saved test image by default... */
|
||||
if ((params.flags & ACTION_PRESERVE_TESTFILE) == 0)
|
||||
remove(params.first_filename);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Tests whether we can save and load the test data to a specified extension
|
||||
* \param params Test options in a nice box
|
||||
* \return 0 if all is OK, or an error code (see interpret_results)
|
||||
*/
|
||||
int test_format(Parameters params)
|
||||
{
|
||||
/* First, let's generate and save a test image */
|
||||
const char * base_name = "test.";
|
||||
char filename [64];
|
||||
if (strlen(params.extension) + strlen(base_name) >= sizeof(filename))
|
||||
return -1; /* buffer overflow */
|
||||
sprintf(filename, "%s%s", base_name, params.extension);
|
||||
int saved = save_test_image(filename, params.resolution[0], params.resolution[1], params);
|
||||
if (saved != 0) /* something went wrong, no point in continuing, the user already knows */
|
||||
return saved;
|
||||
strncpy(params.first_filename, filename, sizeof(params.first_filename));
|
||||
/* Will we be able to load that very test image? */
|
||||
return test_is_testimage(params);
|
||||
}
|
||||
|
||||
int test_are_same(Parameters params)
|
||||
{
|
||||
const int images_count = 2;
|
||||
ILuint handle[images_count];
|
||||
int i;
|
||||
ILubyte * image_data[images_count];
|
||||
for (i = 0; i < images_count; i++)
|
||||
image_data[i] = NULL;
|
||||
ilGenImages(images_count, & handle[0]);
|
||||
const char * filenames [] = {params.first_filename, params.second_filename};
|
||||
int w, h;
|
||||
for (i = 0; i < images_count; i++)
|
||||
{
|
||||
ilBindImage(handle[i]);
|
||||
int loaded = ilLoadImage(filenames[i]);
|
||||
if (loaded == IL_FALSE)
|
||||
{/* something went wrong */
|
||||
ERROR_LOADING_FILE_MACRO(filenames[i], loaded);
|
||||
for (i--; i >= 0; i--)
|
||||
{/* We might allocated something, so let's clean it up :)) */
|
||||
free(image_data[i]);
|
||||
image_data[i] = NULL;
|
||||
}
|
||||
return loaded;
|
||||
}
|
||||
/* getting image width and height */
|
||||
if (i == 0)
|
||||
{
|
||||
w = ilGetInteger(IL_IMAGE_WIDTH);
|
||||
h = ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (w != ilGetInteger(IL_IMAGE_WIDTH)
|
||||
|| h != ilGetInteger(IL_IMAGE_HEIGHT))
|
||||
{
|
||||
printf("Of course that images '%s' and '%s' are not the same. How could they be as they have different dimensions?\n", filenames[0], filenames[i]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* Then we save image data into arrays that we allocate now */
|
||||
image_data[i] = malloc(w * h * params.bpp * sizeof(ILubyte));
|
||||
if (image_data[i] == NULL)
|
||||
{
|
||||
fprintf(stderr, "Out of memory, %s:%d\n", __FILE__, __LINE__);
|
||||
return IL_OUT_OF_MEMORY;
|
||||
}
|
||||
ilCopyPixels(0, 0, 0, w, h, 1, ((params.flags & ACTION_TEST_ALPHA) == 0 ? IL_RGB : IL_RGBA), IL_UNSIGNED_BYTE, image_data[i]);
|
||||
}
|
||||
int return_value = 0, result;
|
||||
int quantile;
|
||||
double integral;
|
||||
if (params.verbose > 0)
|
||||
printf("Testing against '%s'\n", filenames[0]);
|
||||
for (i = 1; i < images_count; i++)
|
||||
{
|
||||
compare_fields(w, h, image_data[0], image_data[i], params, & quantile, & integral);
|
||||
result = interpret_results(filenames[i], params, quantile, integral);
|
||||
return_value = (result > return_value) ? result : return_value;
|
||||
free(image_data[i]);
|
||||
image_data[i] = 0;
|
||||
}
|
||||
free(image_data[0]);
|
||||
image_data[0] = 0;
|
||||
ilDeleteImages(images_count, & handle[0]);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Examines the command line like no tomorrow :-)
|
||||
*
|
||||
* Huge code, I am sorry for that.
|
||||
* On the other hand, cross-platformness of popt is catastrophical
|
||||
* and usage of boost is also too much for this simple purpose.
|
||||
*/
|
||||
int parse_commandline(int argc, char ** argv, Parameters * params)
|
||||
{
|
||||
int actions = 0, expectations = 0;
|
||||
const int long_str = 63;
|
||||
int return_value = TEST_NOTHING;
|
||||
|
||||
int i;
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
actions = 0;
|
||||
/* Find out what to do and what to expect */
|
||||
if (argv[i][0] == '-')
|
||||
{/* Ho, an option was passed... */
|
||||
if (argv[i][1] == '-')
|
||||
{/* Deal with long options */
|
||||
if(strncmp(argv[i], "--extension", long_str))
|
||||
{
|
||||
expectations |= EXPECT_EXTENSION;
|
||||
}
|
||||
else if (strncmp(argv[i], "--quantile", long_str))
|
||||
{
|
||||
expectations |= EXPECT_QUANTILE;
|
||||
}
|
||||
else if (strncmp(argv[i], "--help", long_str))
|
||||
{
|
||||
actions |= ACTION_HELP;
|
||||
}
|
||||
else if (strncmp(argv[i], "--verbose", long_str))
|
||||
{
|
||||
actions |= ACTION_VERBOSE;
|
||||
}
|
||||
else if (strncmp(argv[i], "--test-alpha", long_str))
|
||||
{
|
||||
actions |= ACTION_TEST_ALPHA;
|
||||
}
|
||||
else if (strncmp(argv[i], "--preserve", long_str))
|
||||
{
|
||||
actions |= ACTION_PRESERVE_TESTFILE;
|
||||
}
|
||||
else if (strncmp(argv[i], "--use-resolution", long_str))
|
||||
{
|
||||
expectations |= EXPECT_RESOLUTION;
|
||||
}
|
||||
else if (strncmp(argv[i], "--are-same", long_str))
|
||||
{
|
||||
expectations |= EXPECT_IMAGES;
|
||||
}
|
||||
else if (strncmp(argv[i], "--image-complies", long_str))
|
||||
{
|
||||
expectations |= EXPECT_FILENAME;
|
||||
}
|
||||
|
||||
}
|
||||
else /* if not (argv[i][1] == '-') */
|
||||
{/* Deal with short options */
|
||||
int j;
|
||||
for (j = 1; j < strlen(argv[i]); j++)
|
||||
switch(argv[i][j])
|
||||
{
|
||||
case 'h':
|
||||
case '?':
|
||||
actions |= ACTION_HELP;
|
||||
break;
|
||||
case 'v':
|
||||
actions |= ACTION_VERBOSE;
|
||||
break;
|
||||
case 'a':
|
||||
actions |= ACTION_TEST_ALPHA;
|
||||
break;
|
||||
case 'e':
|
||||
expectations |= EXPECT_EXTENSION;
|
||||
break;
|
||||
case 'q':
|
||||
expectations |= EXPECT_QUANTILE;
|
||||
break;
|
||||
case 'p':
|
||||
actions |= ACTION_PRESERVE_TESTFILE;
|
||||
break;
|
||||
case 'r':
|
||||
expectations |= EXPECT_RESOLUTION;
|
||||
break;
|
||||
case 's':
|
||||
expectations |= EXPECT_IMAGES;
|
||||
break;
|
||||
case 'c':
|
||||
expectations |= EXPECT_FILENAME;
|
||||
break;
|
||||
}/* end switch(argv[i][j]) */
|
||||
}/* if not (argv[i][1] == '-') */
|
||||
}
|
||||
else /* (! argv[i][0] == '-') */
|
||||
{/* Now handle expectations... */
|
||||
if (expectations & EXPECT_EXTENSION)
|
||||
{/* point extension to the extension string so we will be able to read it afterwards */
|
||||
params->extension = argv[i];
|
||||
return_value = TEST_EXTENSION;
|
||||
}
|
||||
else if (expectations & EXPECT_QUANTILE)
|
||||
{/* This parameter SHOULD BE the quantile we wanted... */
|
||||
sscanf(argv[i], "%lf", & params->quantile_spec);
|
||||
}
|
||||
else if (expectations & EXPECT_RESOLUTION)
|
||||
{/* This parameter SHOULD specify the geometry... */
|
||||
sscanf(argv[i], "%dx%d", & params->resolution[0], & params->resolution[1]);
|
||||
}
|
||||
else if (expectations & EXPECT_FILENAME)
|
||||
{/* This parameter SHOULD specify one filename... */
|
||||
strncpy(params->first_filename, argv[i], sizeof(params->first_filename));
|
||||
if ((params->flags & ACTION_PRESERVE_TESTFILE) == 0)
|
||||
{
|
||||
params->flags |= ACTION_PRESERVE_TESTFILE;
|
||||
printf("Issued a command to preserve the input file :-)\n");
|
||||
}
|
||||
return_value = TEST_IS_TEST_IMAGE;
|
||||
}
|
||||
else if (expectations & EXPECT_IMAGES)
|
||||
{/* Masterpiece, this parameter SHOULD specify two comma separated filenames... */
|
||||
sscanf(argv[i], "%30[^,],%30s", params->first_filename, params->second_filename);
|
||||
if ((params->flags & ACTION_PRESERVE_TESTFILE) == 0)
|
||||
{
|
||||
params->flags |= ACTION_PRESERVE_TESTFILE;
|
||||
printf("Issued a command to preserve the input file :-)\n");
|
||||
}
|
||||
return_value = TEST_IMAGES_ARE_SAME;
|
||||
/* just debug: * printf ("Acquired strings: %s %s\n", params->first_filename, params->second_filename); **/
|
||||
}
|
||||
expectations = 0;
|
||||
}/* (! argv[i][0] == '-') */
|
||||
/* now handle actions... */
|
||||
if (actions & ACTION_VERBOSE)
|
||||
{
|
||||
params->verbose++;
|
||||
}
|
||||
if (actions & ACTION_HELP)
|
||||
{
|
||||
printf(" *** Beware, manually generated help (=> may not be 100%% up-to-date :-) ***\n");
|
||||
printf(" If you miss something, examine the source code\n");
|
||||
printf("Run %s with this arguments:\n", argv[0]);
|
||||
printf("\t-h, -? | --help: This help message\n");
|
||||
printf("\t-v | --verbose: Verbose run\n");
|
||||
printf("\t-a | --test-alpha: Make and test image alpha channel as well\n");
|
||||
printf("\t-e | --extension <extension, like BMP, PNG etc.>: Test saving and loading of this extension\n");
|
||||
printf("\t-p | --preserve: Don't remove any generated files\n");
|
||||
printf("\t-c | --image-complies <filename, like image.jpg>: Test whether the filename is the image of our test pattern (useful for testing opening capabilities)\n");
|
||||
printf("\t-r | --use-resolution <widthxheight, like 400x300>: If this makes sense, use this resolution), default 603x300\n");
|
||||
printf("\t-s | --are-same <first,second filename, like test.png,something.jpg>: Tests whether the first and second images are the same. Pass two filenames separated by comma.\n");
|
||||
|
||||
printf("This will be helpful one day...\n");
|
||||
}
|
||||
if (actions & ACTION_PRESERVE_TESTFILE)
|
||||
{
|
||||
params->flags |= ACTION_PRESERVE_TESTFILE;
|
||||
}
|
||||
if (actions & ACTION_TEST_ALPHA)
|
||||
{
|
||||
params->flags |= ACTION_TEST_ALPHA;
|
||||
params->bpp = 4;
|
||||
}
|
||||
}/* endfor <going through argv> */
|
||||
return return_value;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
/* has to be done */
|
||||
ilInit();
|
||||
#ifdef ILU_ENABLED
|
||||
iluInit();
|
||||
#endif
|
||||
/* Consistent loading stuff... */
|
||||
ilEnable(IL_ORIGIN_SET);
|
||||
|
||||
Parameters params = { /* ***SHOULD BE*** first_filename*/ "",
|
||||
/* second filename */ "",
|
||||
/* extension */ (char *)NULL,
|
||||
/* verbose */ (int)0,
|
||||
/* flags */(int)0,
|
||||
/* bpp */(int)3,
|
||||
/* resolution */ {603, 300},
|
||||
/* quantile spec */ (double)0.80,
|
||||
/* quantile tresh */ (int)5,
|
||||
/* integral tresh */ (double)5};
|
||||
|
||||
int to_do = parse_commandline(argc, argv, & params);
|
||||
int return_value = 0;
|
||||
if (to_do & TEST_EXTENSION && params.extension != NULL)
|
||||
{
|
||||
return_value = test_format(params);
|
||||
if (return_value != 0)
|
||||
fprintf(stderr, "Format test: FAIL (.%s)\n", params.extension);
|
||||
}
|
||||
else if (to_do & TEST_IS_TEST_IMAGE
|
||||
&& strlen(params.first_filename) > 0
|
||||
&& strlen(params.second_filename) == 0)
|
||||
{
|
||||
if (params.verbose > 0)
|
||||
printf ("Testing whether %s is the test image\n", params.first_filename);
|
||||
return_value = test_is_testimage(params);
|
||||
if (return_value != 0)
|
||||
fprintf(stderr, "Is test image test: FAIL (%s)\n", params.first_filename);
|
||||
}
|
||||
else if (to_do & TEST_IMAGES_ARE_SAME
|
||||
&& strlen(params.first_filename) > 0
|
||||
&& strlen(params.second_filename) > 0 )
|
||||
{
|
||||
if (params.verbose > 0)
|
||||
printf ("Testing whether %s and %s are +- the same\n", params.first_filename, params.second_filename);
|
||||
return_value = test_are_same(params);
|
||||
if (return_value != 0)
|
||||
fprintf(stderr, "Images are the same test: FAIL ('%s' != '%s')\n", params.first_filename, params.second_filename);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user