[Wavelet-commit] Wavelet MagickInter.cc, NONE, 1.1 ChangeLog, 1.24, 1.25 Image.cc, 1.27, 1.28 Image
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2008-04-17 07:27:43
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13454 Modified Files: ChangeLog Image.cc ImageArray.cc ImageInformation.cc Makefile.in Makefile.msc PixmapReader.cc PpmReader.cc PyramidTransform.cc WImage.hh Wavelet.cc configure configure.in tools.cc Added Files: MagickInter.cc Log Message: Optional support for using ImageMagick's Magick++ classes for reading and writing images, also some minor additions. Index: configure =================================================================== RCS file: /cvsroot/wavelet/Wavelet/configure,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** configure 15 Aug 2007 13:13:57 -0000 1.4 --- configure 17 Apr 2008 07:27:34 -0000 1.5 *************** *** 673,676 **** --- 673,679 ---- PFI_DEF PFI_LIB + CXXCPP + MAGICK_INTER_DEF + MAGICK_INTER_LIB CXXOPT CXXDEBUG *************** *** 711,715 **** CC CFLAGS ! CPP' --- 714,719 ---- CC CFLAGS ! CPP ! CXXCPP' *************** *** 1299,1302 **** --- 1303,1307 ---- CFLAGS C compiler flags CPP C preprocessor + CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help *************** *** 4556,4559 **** --- 4561,4941 ---- + ac_ext=cpp + ac_cpp='$CXXCPP $CPPFLAGS' + ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' + ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' + ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + ac_ext=cpp + ac_cpp='$CXXCPP $CPPFLAGS' + ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' + ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' + ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + { echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 + echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } + if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false + for ac_cxx_preproc_warn_flag in '' yes + do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #ifdef __STDC__ + # include <limits.h> + #else + # include <assert.h> + #endif + Syntax error + _ACEOF + if { (ac_try="$ac_cpp conftest.$ac_ext" + case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; + esac + eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + : + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. + continue + fi + + rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <ac_nonexistent.h> + _ACEOF + if { (ac_try="$ac_cpp conftest.$ac_ext" + case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; + esac + eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. + continue + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. + ac_preproc_ok=: + break + fi + + rm -f conftest.err conftest.$ac_ext + + done + # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. + rm -f conftest.err conftest.$ac_ext + if $ac_preproc_ok; then + break + fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + + fi + CXXCPP=$ac_cv_prog_CXXCPP + else + ac_cv_prog_CXXCPP=$CXXCPP + fi + { echo "$as_me:$LINENO: result: $CXXCPP" >&5 + echo "${ECHO_T}$CXXCPP" >&6; } + ac_preproc_ok=false + for ac_cxx_preproc_warn_flag in '' yes + do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #ifdef __STDC__ + # include <limits.h> + #else + # include <assert.h> + #endif + Syntax error + _ACEOF + if { (ac_try="$ac_cpp conftest.$ac_ext" + case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; + esac + eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + : + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. + continue + fi + + rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <ac_nonexistent.h> + _ACEOF + if { (ac_try="$ac_cpp conftest.$ac_ext" + case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; + esac + eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. + continue + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. + ac_preproc_ok=: + break + fi + + rm -f conftest.err conftest.$ac_ext + + done + # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. + rm -f conftest.err conftest.$ac_ext + if $ac_preproc_ok; then + : + else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check + See \`config.log' for more details." >&5 + echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check + See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + + ac_ext=cpp + ac_cpp='$CXXCPP $CPPFLAGS' + ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' + ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' + ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + if test "${ac_cv_header_Magickpp_Image_h+set}" = set; then + { echo "$as_me:$LINENO: checking for Magick++/Image.h" >&5 + echo $ECHO_N "checking for Magick++/Image.h... $ECHO_C" >&6; } + if test "${ac_cv_header_Magickpp_Image_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + fi + { echo "$as_me:$LINENO: result: $ac_cv_header_Magickpp_Image_h" >&5 + echo "${ECHO_T}$ac_cv_header_Magickpp_Image_h" >&6; } + else + # Is the header compilable? + { echo "$as_me:$LINENO: checking Magick++/Image.h usability" >&5 + echo $ECHO_N "checking Magick++/Image.h usability... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + $ac_includes_default + #include <Magick++/Image.h> + _ACEOF + rm -f conftest.$ac_objext + if { (ac_try="$ac_compile" + case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; + esac + eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no + fi + + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 + echo "${ECHO_T}$ac_header_compiler" >&6; } + + # Is the header present? + { echo "$as_me:$LINENO: checking Magick++/Image.h presence" >&5 + echo $ECHO_N "checking Magick++/Image.h presence... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <Magick++/Image.h> + _ACEOF + if { (ac_try="$ac_cpp conftest.$ac_ext" + case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; + esac + eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no + fi + + rm -f conftest.err conftest.$ac_ext + { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 + echo "${ECHO_T}$ac_header_preproc" >&6; } + + # So? What about this header? + case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: accepted by the compiler, rejected by the preprocessor!" >&5 + echo "$as_me: WARNING: Magick++/Image.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: proceeding with the compiler's result" >&5 + echo "$as_me: WARNING: Magick++/Image.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: present but cannot be compiled" >&5 + echo "$as_me: WARNING: Magick++/Image.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: check for missing prerequisite headers?" >&5 + echo "$as_me: WARNING: Magick++/Image.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: see the Autoconf documentation" >&5 + echo "$as_me: WARNING: Magick++/Image.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: section \"Present But Cannot Be Compiled\"" >&5 + echo "$as_me: WARNING: Magick++/Image.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: Magick++/Image.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: Magick++/Image.h: in the future, the compiler will take precedence" >&5 + echo "$as_me: WARNING: Magick++/Image.h: in the future, the compiler will take precedence" >&2;} + + ;; + esac + { echo "$as_me:$LINENO: checking for Magick++/Image.h" >&5 + echo $ECHO_N "checking for Magick++/Image.h... $ECHO_C" >&6; } + if test "${ac_cv_header_Magickpp_Image_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_cv_header_Magickpp_Image_h=$ac_header_preproc + fi + { echo "$as_me:$LINENO: result: $ac_cv_header_Magickpp_Image_h" >&5 + echo "${ECHO_T}$ac_cv_header_Magickpp_Image_h" >&6; } + + fi + if test $ac_cv_header_Magickpp_Image_h = yes; then + MAGICK_INTER_DEF="-DMAGICK_INTER" + MAGICK_INTER_LIB="-lMagick++" + else + MAGICK_INTER_DEF="" + MAGICK_INTER_LIB="" + + fi + + + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' + ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + DEBUG="no" # Check whether --enable-debug was given. *************** *** 5576,5579 **** --- 5958,5964 ---- PFI_DEF!$PFI_DEF$ac_delim PFI_LIB!$PFI_LIB$ac_delim + CXXCPP!$CXXCPP$ac_delim + MAGICK_INTER_DEF!$MAGICK_INTER_DEF$ac_delim + MAGICK_INTER_LIB!$MAGICK_INTER_LIB$ac_delim CXXOPT!$CXXOPT$ac_delim CXXDEBUG!$CXXDEBUG$ac_delim *************** *** 5604,5608 **** _ACEOF ! if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then break elif $ac_last_try; then --- 5989,5993 ---- _ACEOF ! if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then break elif $ac_last_try; then Index: configure.in =================================================================== RCS file: /cvsroot/wavelet/Wavelet/configure.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** configure.in 15 Aug 2007 13:13:57 -0000 1.4 --- configure.in 17 Apr 2008 07:27:34 -0000 1.5 *************** *** 123,126 **** --- 123,137 ---- AC_SUBST(PFI_LIB) + AC_LANG_PUSH(C++) + AC_CHECK_HEADER(Magick++/Image.h, + MAGICK_INTER_DEF="-DMAGICK_INTER" + MAGICK_INTER_LIB="-lMagick++", + MAGICK_INTER_DEF="" + MAGICK_INTER_LIB="" + ) + AC_LANG_POP + AC_SUBST(MAGICK_INTER_DEF) + AC_SUBST(MAGICK_INTER_LIB) + DEBUG="no" dnl Checks if we are going to enable debugging Index: Wavelet.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Wavelet.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Wavelet.cc 7 Aug 2007 17:00:59 -0000 1.5 --- Wavelet.cc 17 Apr 2008 07:27:34 -0000 1.6 *************** *** 28,32 **** #endif ! void Wavelet::init (FilterSet *pfset) { --- 28,32 ---- #endif ! void Wavelet::init (FilterSet *pfset) { *************** *** 37,45 **** m_synhigh = NEW (Filter (pfset->shigh ())); m_symmetric = pfset->issym (); - ! /* ! * amount of space to leave for padding ! * vectors for symmetric extensions */ m_npad = MAX (m_analow->fsize (), m_anahigh->fsize ()); --- 37,45 ---- m_synhigh = NEW (Filter (pfset->shigh ())); m_symmetric = pfset->issym (); ! ! /* ! * amount of space to leave for padding ! * vectors for symmetric extensions */ m_npad = MAX (m_analow->fsize (), m_anahigh->fsize ()); *************** *** 49,53 **** if (m_analow->fsize () % 2 != 0) { ! /* * Odd filter length, no extra mirror axis on low left * or high right --- 49,53 ---- if (m_analow->fsize () % 2 != 0) { ! /* * Odd filter length, no extra mirror axis on low left * or high right *************** *** 67,71 **** m_slpad = NEW (MirrorPosition (lleft, true)); m_shpad = NEW (MirrorPosition (true, hright)); ! /* always symmetric */ ((MirrorPosition*)m_slpad)->setsymm (true); --- 67,71 ---- m_slpad = NEW (MirrorPosition (lleft, true)); m_shpad = NEW (MirrorPosition (true, hright)); ! /* always symmetric */ ((MirrorPosition*)m_slpad)->setsymm (true); *************** *** 86,90 **** m_slpsize = 0; m_shpositions = NULL; ! m_shsigns = NULL; m_shpsize = 0; } --- 86,90 ---- m_slpsize = 0; m_shpositions = NULL; ! m_shsigns = NULL; m_shpsize = 0; } *************** *** 92,101 **** Wavelet::Wavelet (FilterSet &fset) ! { init (&fset); } Wavelet::~Wavelet (void) ! { DELETE (m_analow); DELETE (m_anahigh); --- 92,101 ---- Wavelet::Wavelet (FilterSet &fset) ! { init (&fset); } Wavelet::~Wavelet (void) ! { DELETE (m_analow); DELETE (m_anahigh); *************** *** 114,121 **** Wavelet::analysis (ReferenceVector &dest, ReferenceVector &src, int steps) { ! ReferenceVector *s = &src; ReferenceVector *d = &dest; ReferenceVector *t; ! int loSize = src.size (); int hiSize = 0; --- 114,121 ---- Wavelet::analysis (ReferenceVector &dest, ReferenceVector &src, int steps) { ! ReferenceVector *s = &src; ReferenceVector *d = &dest; ReferenceVector *t; ! int loSize = src.size (); int hiSize = 0; *************** *** 130,134 **** "Low pass subband is too small."); } ! anastep (*d, *s, loSize); --- 130,134 ---- "Low pass subband is too small."); } ! anastep (*d, *s, loSize); *************** *** 138,142 **** */ hiSize = loSize / 2; ! loSize = DIV2 (loSize + 1); if (d == &src) { --- 138,142 ---- */ hiSize = loSize / 2; ! loSize = DIV2 (loSize + 1); if (d == &src) { *************** *** 147,151 **** } } ! /* * If the last write went to src, we must copy a missing bit into --- 147,151 ---- } } ! /* * If the last write went to src, we must copy a missing bit into *************** *** 162,166 **** void ! Wavelet::synthesis (ReferenceVector &dest, ReferenceVector &src, int steps, int prevSteps) { --- 162,166 ---- void ! Wavelet::synthesis (ReferenceVector &dest, ReferenceVector &src, int steps, int prevSteps) { *************** *** 170,178 **** int *loSize = NEW (int [steps]); int *hiSize = NEW (int [steps]); ! loSize[0] = (src.size () + 1) / 2; hiSize[0] = src.size () / 2; ! ! for (int i = 1; i < prevSteps; i++) { loSize[i] = DIV2 (loSize [i - 1] + 1); --- 170,178 ---- int *loSize = NEW (int [steps]); int *hiSize = NEW (int [steps]); ! loSize[0] = (src.size () + 1) / 2; hiSize[0] = src.size () / 2; ! ! for (int i = 1; i < prevSteps; i++) { loSize[i] = DIV2 (loSize [i - 1] + 1); *************** *** 206,210 **** { int ret = 0; ! (void)tools_powerOfTwo (src.size (), ret); --- 206,210 ---- { int ret = 0; ! (void)tools_powerOfTwo (src.size (), ret); *************** *** 233,237 **** m_apositions = NEW (int [size + 2 * m_npad]); } ! m_apad->size (size); --- 233,237 ---- m_apositions = NEW (int [size + 2 * m_npad]); } ! m_apad->size (size); *************** *** 247,260 **** for (int j = 0; j < m_analow->fsize (); j++) { ! DPRINTF (("dst[%2d] = dst[%2d] + src[%2d] * analysisLow [%2d]\n", i, i, m_apositions[basepos1 + j + m_npad], j)); ! DPRINTF (("dst[%2d] = %+7.2f + %+7.2f * %+7.2f =====> %+8.2f\n", ! i, dest.at (i), src.at (m_apositions[basepos1 + j + m_npad]), ! m_analow->at (j), ! dest.at (i) + src.at (m_apositions[basepos1 + j + m_npad]) * m_analow->at (j))); ! dest.to (i, dest.at (i) + src.at (m_apositions[basepos1 + j + m_npad]) * m_analow->at (j)); --- 247,260 ---- for (int j = 0; j < m_analow->fsize (); j++) { ! DPRINTF (("dst[%2d] = dst[%2d] + src[%2d] * analysisLow [%2d]\n", i, i, m_apositions[basepos1 + j + m_npad], j)); ! DPRINTF (("dst[%2d] = %+7.2f + %+7.2f * %+7.2f =====> %+8.2f\n", ! i, dest.at (i), src.at (m_apositions[basepos1 + j + m_npad]), ! m_analow->at (j), ! dest.at (i) + src.at (m_apositions[basepos1 + j + m_npad]) * m_analow->at (j))); ! dest.to (i, dest.at (i) + src.at (m_apositions[basepos1 + j + m_npad]) * m_analow->at (j)); *************** *** 267,271 **** continue; } ! dest.to (halfend+i, 0.0); basepos1 = MUL2 (i) + m_anahigh->first (); --- 267,271 ---- continue; } ! dest.to (halfend+i, 0.0); basepos1 = MUL2 (i) + m_anahigh->first (); *************** *** 273,288 **** for (int j = 0; j < m_anahigh->fsize (); j++) { ! DPRINTF (("dst[%2d] = dst[%2d] + src[%2d] * analysisHigh[%2d]\n", ! basepos2, basepos2, m_apositions[basepos1 + j + m_npad], j)); ! DPRINTF (("dst[%2d] = %+7.2f + %+7.2f * %+7.2f =====> %+8.2f\n", ! i, dest.at (basepos2), src.at (m_apositions[basepos1 + j + m_npad]), ! m_anahigh->at (j), ! dest.at (basepos2) + src.at (m_apositions[basepos1 + j + m_npad]) * m_anahigh->at (j))); ! dest.to (basepos2, dest.at (basepos2) ! + src.at (m_apositions[basepos1 + j + m_npad]) * m_anahigh->at (j)); } --- 273,288 ---- for (int j = 0; j < m_anahigh->fsize (); j++) { ! DPRINTF (("dst[%2d] = dst[%2d] + src[%2d] * analysisHigh[%2d]\n", ! basepos2, basepos2, m_apositions[basepos1 + j + m_npad], j)); ! DPRINTF (("dst[%2d] = %+7.2f + %+7.2f * %+7.2f =====> %+8.2f\n", ! i, dest.at (basepos2), src.at (m_apositions[basepos1 + j + m_npad]), ! m_anahigh->at (j), ! dest.at (basepos2) + src.at (m_apositions[basepos1 + j + m_npad]) * m_anahigh->at (j))); ! dest.to (basepos2, dest.at (basepos2) ! + src.at (m_apositions[basepos1 + j + m_npad]) * m_anahigh->at (j)); } *************** *** 291,295 **** } ! void Wavelet::synstep (ReferenceVector &dest, ReferenceVector &src, int size) { --- 291,295 ---- } ! void Wavelet::synstep (ReferenceVector &dest, ReferenceVector &src, int size) { *************** *** 297,301 **** int hiSize = size/2; ! int first = m_synlow->first (); int last = m_synlow->fsize () - 1 + first; --- 297,301 ---- int hiSize = size/2; ! int first = m_synlow->first (); int last = m_synlow->fsize () - 1 + first; *************** *** 308,312 **** dest.to (x, 0.0); } ! if (m_slpsize < loSize + 2 * m_npad) { --- 308,312 ---- dest.to (x, 0.0); } ! if (m_slpsize < loSize + 2 * m_npad) { *************** *** 314,318 **** m_slpositions = NEW (int [loSize + 2 * m_npad]); } ! if (m_shpsize < hiSize + 2 * m_npad) { --- 314,318 ---- m_slpositions = NEW (int [loSize + 2 * m_npad]); } ! if (m_shpsize < hiSize + 2 * m_npad) { *************** *** 322,326 **** m_shsigns = NEW (int [hiSize + 2 * m_npad]); } ! m_slpad->size (loSize); if (m_symmetric) --- 322,326 ---- m_shsigns = NEW (int [hiSize + 2 * m_npad]); } ! m_slpad->size (loSize); if (m_symmetric) *************** *** 335,343 **** loopend = DIV2 (size-1-first); ! for (int i = -last/2; i <= loopend; i++) { basepos1 = 2 * i + first; coeff value = src.at (m_slpositions[i+m_npad]); ! for (int j = 0; j < m_synlow->fsize (); j++) { cur = basepos1 + j; --- 335,343 ---- loopend = DIV2 (size-1-first); ! for (int i = -last/2; i <= loopend; i++) { basepos1 = 2 * i + first; coeff value = src.at (m_slpositions[i+m_npad]); ! for (int j = 0; j < m_synlow->fsize (); j++) { cur = basepos1 + j; *************** *** 353,357 **** if (m_symmetric) { ! ((MirrorPosition*)m_shpad)->setraxis ((m_analow->fsize () % 2 == 0) == (size % 2 == 0)? true: false); } --- 353,357 ---- if (m_symmetric) { ! ((MirrorPosition*)m_shpad)->setraxis ((m_analow->fsize () % 2 == 0) == (size % 2 == 0)? true: false); } *************** *** 359,371 **** for (int i = -m_npad; i < hiSize + m_npad; i++) { ! m_shpositions[i+m_npad] = m_shpad->pos (i, loSize, hiSize, m_shsigns[i+m_npad]); } ! first = m_synhigh->first (); last = m_synhigh->fsize () - 1 + first; ! loopend = DIV2 (size-1-first); ! for (int i = -last/2; i <= loopend; i++) { basepos1 = 2 * i + first; --- 359,371 ---- for (int i = -m_npad; i < hiSize + m_npad; i++) { ! m_shpositions[i+m_npad] = m_shpad->pos (i, loSize, hiSize, m_shsigns[i+m_npad]); } ! first = m_synhigh->first (); last = m_synhigh->fsize () - 1 + first; ! loopend = DIV2 (size-1-first); ! for (int i = -last/2; i <= loopend; i++) { basepos1 = 2 * i + first; *************** *** 375,383 **** value *= (coeff)m_shsigns[i+m_npad]; } ! ! for (int j = 0; j < m_synhigh->fsize (); j++) { cur = basepos1 + j; ! if (cur >= 0 && cur < size) { --- 375,383 ---- value *= (coeff)m_shsigns[i+m_npad]; } ! ! for (int j = 0; j < m_synhigh->fsize (); j++) { cur = basepos1 + j; ! if (cur >= 0 && cur < size) { Index: ChangeLog =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ChangeLog,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ChangeLog 3 Dec 2007 12:40:51 -0000 1.24 --- ChangeLog 17 Apr 2008 07:27:34 -0000 1.25 *************** *** 1,2 **** --- 1,6 ---- + 2008-04-16 Herbert <he...@sp...> + * Optional support for using ImageMagick's Magick++ classes for + reading and writing images + 2007-08-07 Herbert <he...@sp...> * Various bugfixes, added ImageResizer tool class which allows *************** *** 6,10 **** 2005-08-15 Herbert <he...@sp...> * Fixed a serious memory leak in ColorVideo and a number of minor ! ones in StillImage and avilib (reported by Florian Stumpf and Johan Ehlers). * New version is 1.1. --- 10,14 ---- 2005-08-15 Herbert <he...@sp...> * Fixed a serious memory leak in ColorVideo and a number of minor ! ones in StillImage and avilib (reported by Florian Stumpf and Johan Ehlers). * New version is 1.1. *************** *** 24,33 **** * Added error message for filed `write' operation to video2grey * Fixed an error in ColorVideo::videoDimensions() ! * Made the API more consistent. This includes changing the argument list for these methods: - ColorBuffer::beautify() - Image::beautify() The order of arguments was changed by putting `yoffs' and `xoffs' ! first, followed by `ysize' and `xsize'. * Changed the signature of ColorVideo::videoDimensions(): - the return type is now `void' --- 28,37 ---- * Added error message for filed `write' operation to video2grey * Fixed an error in ColorVideo::videoDimensions() ! * Made the API more consistent. This includes changing the argument list for these methods: - ColorBuffer::beautify() - Image::beautify() The order of arguments was changed by putting `yoffs' and `xoffs' ! first, followed by `ysize' and `xsize'. * Changed the signature of ColorVideo::videoDimensions(): - the return type is now `void' *************** *** 42,46 **** operations are disabled * New version is 1.0 (final) ! 2004-12-08 Herbert <he...@sp...> * Added new Image::histEqualization() method. --- 46,50 ---- operations are disabled * New version is 1.0 (final) ! 2004-12-08 Herbert <he...@sp...> * Added new Image::histEqualization() method. *************** *** 50,54 **** 2004-07-15 Herbert <he...@sp...> ! * renamed version.h to wave_version.h to avoid clashes * New method `Image::scale()' * New shortcut methods for image statistics in WaveletTransform --- 54,58 ---- 2004-07-15 Herbert <he...@sp...> ! * renamed version.h to wave_version.h to avoid clashes * New method `Image::scale()' * New shortcut methods for image statistics in WaveletTransform *************** *** 80,84 **** easier integration into existing code) * Added support for transforming images of any size. ! * Added abstract class ImageVector as immediate base class for RowVector, ColumnVector and FullVector, so that ReferenceVector does no longer contain references to ImageArray. --- 84,88 ---- easier integration into existing code) * Added support for transforming images of any size. ! * Added abstract class ImageVector as immediate base class for RowVector, ColumnVector and FullVector, so that ReferenceVector does no longer contain references to ImageArray. *************** *** 104,120 **** too. This leads to more target platforms, OS/2 just to mention one. * Version is now 0.8c, status now beta. ! 2003-09-09 Herbert <he...@sp...> * Fixed a critical bug in ImageArray<T>::clone() which carried over to Image::clone() and ColorImage::clone(). * Version is now 0.8b. ! 2003-07-01 Herbert <he...@sp...> * Added constructor for ImageInformation object to Histogram. * WaveletTransform::level() is now WaveletTransform::subband() ! * Renamed PfiReader and PfiWriter to PfgReader and PfgWriter * added color PFI support: PfcReader and PfcWriter * Version is now 0.8a. ! 2003-06-17 Herbert <he...@sp...> * Changed the API for color images, some name changes with the --- 108,124 ---- too. This leads to more target platforms, OS/2 just to mention one. * Version is now 0.8c, status now beta. ! 2003-09-09 Herbert <he...@sp...> * Fixed a critical bug in ImageArray<T>::clone() which carried over to Image::clone() and ColorImage::clone(). * Version is now 0.8b. ! 2003-07-01 Herbert <he...@sp...> * Added constructor for ImageInformation object to Histogram. * WaveletTransform::level() is now WaveletTransform::subband() ! * Renamed PfiReader and PfiWriter to PfgReader and PfgWriter * added color PFI support: PfcReader and PfcWriter * Version is now 0.8a. ! 2003-06-17 Herbert <he...@sp...> * Changed the API for color images, some name changes with the *************** *** 123,132 **** * Ported library to IRIX * Version is now 0.8. ! 2003-05-26 Herbert <he...@sp...> * Bugfix release for waveppm and ImageArray crashes * Some name changes (beware: ColorImage is still under construction) * Version is now 0.7a. ! 2003-05-19 Herbert <he...@sp...> * Optimization of pixel/coeff access in class `ImageArray' --- 127,136 ---- * Ported library to IRIX * Version is now 0.8. ! 2003-05-26 Herbert <he...@sp...> * Bugfix release for waveppm and ImageArray crashes * Some name changes (beware: ColorImage is still under construction) * Version is now 0.7a. ! 2003-05-19 Herbert <he...@sp...> * Optimization of pixel/coeff access in class `ImageArray' *************** *** 134,160 **** * Name changes of functions in module `tools' * Version is now 0.7. ! 2003-05-13 Herbert <he...@sp...> ! * Naming convention changes, member variable names are now prefixed by `m_' * Version is now 0.6a. ! 2002-09-06 Herbert <he...@sp...> ! * Fixes to pgmhist, wavepgm, waveppm: support for Standard decomposition * Some new methods in ImageInformation and StillImage Version is now 0.6. ! 2002-05-22 Herbert <he...@sp...> * Moved normalization code from pgmcompare to ImageComparison Version is now 0.5a. ! 2002-04-25 Herbert <he...@sp...> ! * Added a few more methods to ImageInformation. ! * Added new class Histogram. ! * Added new tools pgmhist and pgmstats. * Fixed a bug in wavepgm. Version is now 0.5. ! 2002-01-18 Herbert <he...@sp...> * Moved benchmark from tools to test. --- 138,164 ---- * Name changes of functions in module `tools' * Version is now 0.7. ! 2003-05-13 Herbert <he...@sp...> ! * Naming convention changes, member variable names are now prefixed by `m_' * Version is now 0.6a. ! 2002-09-06 Herbert <he...@sp...> ! * Fixes to pgmhist, wavepgm, waveppm: support for Standard decomposition * Some new methods in ImageInformation and StillImage Version is now 0.6. ! 2002-05-22 Herbert <he...@sp...> * Moved normalization code from pgmcompare to ImageComparison Version is now 0.5a. ! 2002-04-25 Herbert <he...@sp...> ! * Added a few more methods to ImageInformation. ! * Added new class Histogram. ! * Added new tools pgmhist and pgmstats. * Fixed a bug in wavepgm. Version is now 0.5. ! 2002-01-18 Herbert <he...@sp...> * Moved benchmark from tools to test. *************** *** 163,175 **** * Removed references to outdated class diagrams. Version is no 0.4f. ! 2002-01-08 Herbert <he...@sp...> * Demorornized code again, added "for" macro for MSC. * Small fixes for Win32 compatibility. ! * New directory layout. * More tools, unified command line options etc. * Created Makefiles and INSTALL.W32 for MSC. Version is no 0.4. ! 2001-08-29 Herbert <he...@sp...> * Optmized the Wavelet transforms by changing the padding code, --- 167,179 ---- * Removed references to outdated class diagrams. Version is no 0.4f. ! 2002-01-08 Herbert <he...@sp...> * Demorornized code again, added "for" macro for MSC. * Small fixes for Win32 compatibility. ! * New directory layout. * More tools, unified command line options etc. * Created Makefiles and INSTALL.W32 for MSC. Version is no 0.4. ! 2001-08-29 Herbert <he...@sp...> * Optmized the Wavelet transforms by changing the padding code, *************** *** 179,183 **** classes. Version is no 0.3e. ! 2001-08-20 Herbert <he...@sp...> * Completed VC++ port. --- 183,187 ---- classes. Version is no 0.3e. ! 2001-08-20 Herbert <he...@sp...> * Completed VC++ port. *************** *** 187,191 **** loop variables as loop-local. * Version is now 0.3d. ! 2001-08-18 Herbert <he...@sp...> * Changed #include "ImageArray.cc" in tests to "../ImageArray.cc" --- 191,195 ---- loop variables as loop-local. * Version is now 0.3d. ! 2001-08-18 Herbert <he...@sp...> * Changed #include "ImageArray.cc" in tests to "../ImageArray.cc" *************** *** 193,197 **** * Fixed broken Makefile entry in tools/. * Version is now 0.3c. ! 2001-08-16 Herbert <he...@sp...> * Added support for color images (*Wrapper classes) --- 197,201 ---- * Fixed broken Makefile entry in tools/. * Version is now 0.3c. ! 2001-08-16 Herbert <he...@sp...> * Added support for color images (*Wrapper classes) *************** *** 204,208 **** 2001-03-09 Herbert <he...@sp...> * Version is now 0.2. ! 2001-03-09 Herbert <he...@sp...> * Reorganized Headers. --- 208,212 ---- 2001-03-09 Herbert <he...@sp...> * Version is now 0.2. ! 2001-03-09 Herbert <he...@sp...> * Reorganized Headers. Index: PpmReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PpmReader.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PpmReader.cc 7 Aug 2007 17:00:59 -0000 1.6 --- PpmReader.cc 17 Apr 2008 07:27:34 -0000 1.7 *************** *** 17,27 **** #endif ! int PpmReader::readfmt (void) { FILE *fhandle = NULL; ! int cmax = 0; ! int xsize = 0; int ysize = 0; int xysize = 0; --- 17,27 ---- #endif ! int PpmReader::readfmt (void) { FILE *fhandle = NULL; ! int cmax = 0; ! int xsize = 0; int ysize = 0; int xysize = 0; *************** *** 31,35 **** fhandle = stdin; } ! else { /* --- 31,35 ---- fhandle = stdin; } ! else { /* *************** *** 38,42 **** fhandle = fopen (m_fname, "rb"); } ! /* initialization */ pixel * allpixels = ppm_fromStream (fhandle, &ysize, &xsize, &cmax); --- 38,42 ---- fhandle = fopen (m_fname, "rb"); } ! /* initialization */ pixel * allpixels = ppm_fromStream (fhandle, &ysize, &xsize, &cmax); *************** *** 47,51 **** } xysize = xsize * ysize; ! for (int i = 0; i < m_channels; i++) { --- 47,51 ---- } xysize = xsize * ysize; ! for (int i = 0; i < m_channels; i++) { *************** *** 55,59 **** } } ! /* import */ for (int i = 0; i < xysize; i++) --- 55,59 ---- } } ! /* import */ for (int i = 0; i < xysize; i++) *************** *** 67,72 **** /* cleanup */ DELETEAR (allpixels); ! return 0; } ! --- 67,72 ---- /* cleanup */ DELETEAR (allpixels); ! return 0; } ! Index: PixmapReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PixmapReader.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PixmapReader.cc 10 Aug 2005 09:35:23 -0000 1.2 --- PixmapReader.cc 17 Apr 2008 07:27:34 -0000 1.3 *************** *** 35,39 **** success = readfmt (); } ! switch (success) { --- 35,39 ---- success = readfmt (); } ! switch (success) { Index: tools.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tools.cc 19 Sep 2007 09:35:07 -0000 1.8 --- tools.cc 17 Apr 2008 07:27:34 -0000 1.9 *************** *** 35,38 **** --- 35,44 ---- bool + tools_epsilons (double d1, double d2, double epsilon) + { + return !((d1 > d2) && (d1 - d2 > epsilon) || (d2 - d1 > epsilon)); + } + + bool tools_areaFromString (char a1, char a2, area &result) { Index: Makefile.in =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Makefile.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile.in 7 Aug 2007 17:00:58 -0000 1.11 --- Makefile.in 17 Apr 2008 07:27:34 -0000 1.12 *************** *** 53,56 **** --- 53,59 ---- PFIO = PfgReader$O PfgWriter$O PfcReader$O PfcWriter$O endif + ifneq (@MAGICK_INTER_DEF@,) + MIO = MagickInter$O + endif ifneq (@JPEG_DEF@,) JPEGO = JpgReader$O JpgWriter$O *************** *** 115,119 **** # Flags passed to the compiler # ! CPPFLAGS = -I.. -I. @CPPFLAGS@ @PFI_DEF@ @JPEG_DEF@ CXXSHARED = CXXDEBUG = @CXXDEBUG@ --- 118,122 ---- # Flags passed to the compiler # ! CPPFLAGS = -I.. -I. @CPPFLAGS@ @PFI_DEF@ @JPEG_DEF@ @MAGICK_INTER_DEF@ CXXSHARED = CXXDEBUG = @CXXDEBUG@ *************** *** 129,133 **** # OBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8) $(OBJ9)\ ! $(OBJA) $(OBJB) $(PFIO) $(JPEGO) SOURCES = $(OBJS:$O=.cc) DEPENDS = $(SOURCES:.cc=.dd) --- 132,136 ---- # OBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8) $(OBJ9)\ ! $(OBJA) $(OBJB) $(PFIO) $(JPEGO) $(MIO) SOURCES = $(OBJS:$O=.cc) DEPENDS = $(SOURCES:.cc=.dd) Index: PyramidTransform.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PyramidTransform.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyramidTransform.cc 15 Aug 2007 13:13:57 -0000 1.7 --- PyramidTransform.cc 17 Apr 2008 07:27:34 -0000 1.8 *************** *** 15,19 **** #ifndef _WIN32_WCE #include <iostream> ! #else #include "WImage/miscdefs.h" #endif --- 15,19 ---- #ifndef _WIN32_WCE #include <iostream> ! #else #include "WImage/miscdefs.h" #endif *************** *** 30,34 **** ColumnVector &cv1 = m_image->col (0); ColumnVector &cv2 = m_buffer->col (0); ! int hSize = m_image->cols (); int vSize = m_image->rows (); --- 30,34 ---- ColumnVector &cv1 = m_image->col (0); ColumnVector &cv2 = m_buffer->col (0); ! int hSize = m_image->cols (); int vSize = m_image->rows (); *************** *** 38,42 **** { int level = m_wavelet->level (rv1, rv2, steps); ! if (steps <= 0 || steps > level) { --- 38,42 ---- { int level = m_wavelet->level (rv1, rv2, steps); ! if (steps <= 0 || steps > level) { *************** *** 66,72 **** m_wavelet->anastep (cv1, cv2, vSize); } ! ! vSize = (int)DIV2 (vSize + 1); ! hSize = (int)DIV2 (hSize + 1); } } --- 66,72 ---- m_wavelet->anastep (cv1, cv2, vSize); } ! ! vSize = (int)DIV2 (vSize + 1); ! hSize = (int)DIV2 (hSize + 1); } } *************** *** 97,101 **** } ! for (int i = 1; i < steps; i++) { hSize[i] = DIV2 (hSize[i-1] + 1); --- 97,101 ---- } ! for (int i = 1; i < steps; i++) { hSize[i] = DIV2 (hSize[i-1] + 1); Index: Image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Image.cc,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Image.cc 24 Aug 2007 15:24:28 -0000 1.27 --- Image.cc 17 Apr 2008 07:27:34 -0000 1.28 *************** *** 36,39 **** --- 36,51 ---- } + bool + Image::epsilonsAt (int abs, coeff value, coeff epsilon) const + { + return tools_epsilons (at (abs), value, epsilon); + } + + bool + Image::epsilonsAt (int y, int x, coeff value, coeff epsilon) const + { + return tools_epsilons (at (y, x), value, epsilon); + } + void Image::valadjust (void) Index: ImageArray.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageArray.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImageArray.cc 7 Aug 2007 17:00:58 -0000 1.7 --- ImageArray.cc 17 Apr 2008 07:27:34 -0000 1.8 *************** *** 18,22 **** #endif #include <stdexcept> ! #include "WImage/miscdefs.h" template <class T> --- 18,22 ---- #endif #include <stdexcept> ! #include "WImage/tools.h" template <class T> *************** *** 178,199 **** for (int col = 0; col < ia.cols (); col++) { ! if (ia.at (row, col) > this->at (row, col)) ! { ! if (ia.at (row, col) - this->at (row, col) > epsilon) ! { ! //cout << "failed1: ia.at (): " << ia.at (row, col) ! // << " - this->at (): " << this->at (row, col) << endl; ! return false; ! } ! } ! else ! { ! if (this->at (row, col) - ia.at (row, col) > epsilon) ! { ! //cout << "failed2: this->at (): " << this->at (row, col) ! // << " - ia.at (): " << ia.at (row, col) << endl; ! return false; ! } ! } } } --- 178,191 ---- for (int col = 0; col < ia.cols (); col++) { ! if (!tools_epsilons (ia.at (row, col), this->at (row, col), epsilon)) ! { ! std::cout << "at " << row << " / " << col ! << ": " ! << "this: " << this->at (row, col) ! << ", that: " << ia.at (row, col) ! << ", diff: " << this->at (row, col) - ia.at (row, col) ! << std::endl; ! return false; ! } } } --- NEW FILE: MagickInter.cc --- /* * Implementation of the image operations utilities * Author: Martin Dietze * * $Date: 2008/04/17 07:27:34 $ * $Revision: 1.1 $ * */ #include "WImage/MagickInter.hh" #include <cstring> #include <iostream> #include <Magick++/Image.h> #include <Magick++/Color.h> #include <Magick++/Geometry.h> using MagickLib::Quantum; #ifdef WIN32 # include <io.h> # define _open open #else # include <unistd.h> #endif #include <fcntl.h> static int tempFileName (char *templ, const char *extension); static std::string tempFileName (const std::string &extension) { std::string theExtension = "." + extension; static char buf[64] = { '\0' }; pid_t pid = getpid(); snprintf (buf, sizeof buf - 1, "util-tmp-%05d-XXXXXX", (int)pid); if (tempFileName (buf, theExtension.c_str ()) < 0) { throw std::invalid_argument ("Could not create temp file"); } return std::string (buf); } static void scaleMagickImage (Magick::Image &img, int rows, int cols) { img.scale (Magick::Geometry ((unsigned)cols, (unsigned)rows)); } static bool isTransparent (const ColorImage &img, int y, int x, coeff *transparentColors) { for (int c = 0; c < img.colors (); ++c) { if (!tools_epsilons (img.channel(c).at (y, x), transparentColors != NULL? transparentColors[c]: -1.0, COEFF_EPSILON)) { return false; } } return true; } static coeff fixCoeff (coeff value, int depth) { return (value < 0? 0: (value > 255.0? 255.0: value)) / depth; } static Magick::ColorRGB colorRGB (const ColorImage &img, int y, int x, int actualColorDepth) { static Magick::ColorRGB color; color.alphaQuantum (0); color.red (fixCoeff (img.channel(0).at (y, x), actualColorDepth)); color.green (fixCoeff (img.channel(1).at (y, x), actualColorDepth)); color.blue (fixCoeff (img.channel(2).at (y, x), actualColorDepth)); return color; } static Magick::ColorGray colorGray (const ColorImage &img, int y, int x, int actualColorDepth) { static Magick::ColorGray color; color.alphaQuantum (0); color.shade (fixCoeff (img.channel(0).at (y, x), actualColorDepth)); return color; } Magick::Image MagickInter::magickImageFromColorImageWithTransparency (ColorImage &img, bool withTransparency, coeff *transparentColors, int colorBytes) { const Magick::Geometry geometry (img.cols (), img.rows ()); const Magick::Color background (0, 0, 0, MaxRGB); Magick::Image image (geometry, background); int actualColorDepth = colorBytes > 0? TWOPOW (8 * colorBytes): TWOPOW (image.depth ()); for (int y = 0; y < img.rows (); ++y) { for (int x = 0; x < img.cols (); ++x) { if (!withTransparency || !isTransparent(img, y, x, transparentColors)) { if (img.colors () == 3) { image.pixelColor (x, y, colorRGB (img, y, x, actualColorDepth)); } else { image.pixelColor (x, y, colorGray (img, y, x, actualColorDepth)); } } } } if (colorBytes > 0) { image.depth (8 * colorBytes); if (img.colors () == 3) { image.quantizeColorSpace (Magick::RGBColorspace); } else { image.quantizeColorSpace (Magick::GRAYColorspace); } image.quantizeColors (actualColorDepth); image.quantize (); } return image; } Magick::Image MagickInter::magickImageFromColorImage (ColorImage &img) { std::string tmp = tempFileName (img.colors () == 1? "pgm": "ppm"); try { img.write (tmp.c_str ()); } catch (const std::ios_base::failure &f) { throw std::ios_base::failure (tmp + ": " + f.what ()); } catch (const std::exception &e) { throw std::invalid_argument (tmp + ": " + e.what ()); } Magick::Image result (tmp); (void)remove (tmp.c_str ()); return result; } std::auto_ptr<ColorImage> MagickInter::colorImageFromMagickImage (Magick::Image &img) { std::string tmp = tempFileName ("ppm"); try { img.write (tmp); std::auto_ptr<ColorImage> result (NEW (ColorImage ())); result->read (tmp.c_str ()); return result; } catch (const std::ios_base::failure &f) { throw std::ios_base::failure (tmp + ": " + f.what ()); } catch (const std::exception &e) { throw std::invalid_argument (tmp + ": " + e.what ()); } throw std::invalid_argument (tmp + ": some other / unknown error."); } std::auto_ptr<ColorImage> MagickInter::obtainColorImage (const std::string &inFile) { std::auto_ptr<ColorImage> img (NEW (ColorImage ())); try { img->read (inFile.c_str ()); } catch (...) { std::string tmp = tempFileName ("ppm"); try { Magick::Image fallBack (inFile); try { fallBack.write (tmp); } catch (const std::ios_base::failure &f) { (void)remove (tmp.c_str ()); throw std::ios_base::failure (tmp + ": " + f.what ()); } catch (const std::exception &e) { (void)remove (tmp.c_str ()); throw std::invalid_argument (tmp + ": " + e.what ()); } catch (...) { (void)remove (tmp.c_str ()); throw; } try { img->read (tmp.c_str ()); (void)remove (tmp.c_str ()); } catch (...) { (void)remove (tmp.c_str ()); throw; } } catch (const std::exception &e) { throw std::ios_base::failure (e.what ()); } } return img; } void MagickInter::writeColorImageWithTransparency (ColorImage &img, const std::string &outFile, int quality, bool withTransparency, coeff *transparentColors, int colorBytes) { try { Magick::Image tmp = MagickInter::magickImageFromColorImageWithTransparency (img, withTransparency, transparentColors, colorBytes); tmp.modifyImage (); if (quality > 0) { tmp.quality (quality); } tmp.write (outFile); } catch (const std::ios_base::failure &f) { throw std::ios_base::failure (outFile + ": " + f.what ()); } catch (const std::exception &e) { throw std::invalid_argument (outFile + ": " + e.what ()); } } void MagickInter::writeColorImage (ColorImage &img, const std::string &outFile, int quality) { try { Magick::Image tmp = MagickInter::magickImageFromColorImage (img); tmp.modifyImage (); if (quality > 0) { tmp.quality (quality); } tmp.write (outFile); } catch (const std::ios_base::failure &f) { throw std::ios_base::failure (outFile + ": " + f.what ()); } catch (const std::exception &e) { throw std::invalid_argument (outFile + ": " + e.what ()); } } void MagickInter::scaleAndWriteColorImage (ColorImage &img, int rows, int cols, const std::string &outFile, int quality) { try { Magick::Image resized = magickImageFromColorImage (img); resized.modifyImage (); if (quality > 0) { //std::cout << "quality: " << quality << std::endl; resized.quality (quality); } scaleMagickImage (resized, rows, cols); resized.write (outFile); } catch (const std::ios_base::failure &f) { throw std::ios_base::failure (outFile + ": " + f.what ()); } catch (const std::exception &e) { throw std::invalid_argument (outFile + ": " + e.what ()); } } // this is copy-and-pasted (gasp) from cxxutil since we don't want this // lib to depend on it... static int tempFileName (char *templ, const char *extension) { static char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; int templen = strlen (templ); int letterlen = strlen (letters); int extenlen = strlen (extension); if(templen < 6) { return -1; } char *p = templ + templen - 6; if (strcmp (p, "XXXXXX") != 0) { return -1; } srand ((unsigned)time (NULL)); int fd; char *fname = NEW (char [templen + extenlen + 1]); strcpy (fname, templ); strcat (fname, extension); p = fname + templen - 6; for (int run = 0; run < 512; run++) { for (int i = 0; i < 6; i++) { p[i] = letters[rand () % letterlen]; } if ((fd = open (fname, O_CREAT | O_EXCL)) > 0) { break; } } if (fd < 0) { DELETE (fname); return -1; } close (fd); (void)remove (fname); strncpy (templ, fname, templen + extenlen); DELETE (fname); return 0; } Index: Makefile.msc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Makefile.msc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile.msc 7 Aug 2007 17:00:58 -0000 1.9 --- Makefile.msc 17 Apr 2008 07:27:34 -0000 1.10 *************** *** 40,43 **** --- 40,46 ---- PFIOBJ = PfgReader$O PfgWriter$O PfcReader$O PfcWriter$O !endif + !ifdef MAGICKINTERDEF + MIOBJ = MagickInter$O + !endif LIBS = #.PHONY: all clean _test _tools tar zip *************** *** 49,63 **** all: wavelet$A @echo Making tools... ! $(MAKE) PFIDEF="$(PFIDEF)" PFILIB="$(PFILIB)" -nologo -f Makefile.msc _tools @echo Done _test: @echo From ze test its beginnink... ! @cd test & $(MAKE) PFIDEF="$(PFIDEF)" PFILIB="$(PFILIB)" -nologo -f Makefile.msc all @echo From ze test its end! _tools: @echo Building in tools... ! cd tools & $(MAKE) PFIDEF="$(PFIDEF)" PFILIB="$(PFILIB)" -nologo -f Makefile.msc all @echo Done. --- 52,66 ---- all: wavelet$A @echo Making tools... ! $(MAKE) MAGICKINTERDEF="$(MAGICKINTERDEF)" PFIDEF="$(PFIDEF)" PFILIB="$(PFILIB)" -nologo -f Makefile.msc _tools @echo Done _test: @echo From ze test its beginnink... ! @cd test & $(MAKE) MAGICKINTERDEF="$(MAGICKINTERDEF)" PFIDEF="$(PFIDEF)" PFILIB="$(PFILIB)" -nologo -f Makefile.msc all @echo From ze test its end! _tools: @echo Building in tools... ! cd tools & $(MAKE) MAGICKINTERDEF="$(MAGICKINTERDEF)" PFIDEF="$(PFIDEF)" PFILIB="$(PFILIB)" -nologo -f Makefile.msc all @echo Done. *************** *** 65,69 **** # Flags passed to the compiler # ! CPPFLAGS = -I. -I../vc6/include $(PFIDEF) -DJPEG -I../jpeg-6b CXXDEBUG = -DDPRINTF="" CXXOPT = -Ox --- 68,72 ---- # Flags passed to the compiler # ! CPPFLAGS = -I. -I../vc6/include $(MAGICKINTERDEF) $(PFIDEF) -DJPEG -I../jpeg-6b CXXDEBUG = -DDPRINTF="" CXXOPT = -Ox Index: WImage.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage.hh,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** WImage.hh 12 Jul 2005 14:52:18 -0000 1.6 --- WImage.hh 17 Apr 2008 07:27:34 -0000 1.7 *************** *** 29,32 **** --- 29,35 ---- #include "WImage/ColorVideo.hh" #include "WImage/VideoFrame.hh" + #ifdef MAGICK_INTER + #include "WImage/MagickInter.hh" + #endif #ifndef _WIN32_WCE #include "WImage/AviReader.hh" Index: ImageInformation.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageInformation.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ImageInformation.cc 7 Aug 2007 17:00:58 -0000 1.5 --- ImageInformation.cc 17 Apr 2008 07:27:34 -0000 1.6 *************** *** 15,30 **** #include <iomanip> #endif ! #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) using namespace std; #endif ! static bool valless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool avalless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool posless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool idless (const CoeffInformation *c1, const CoeffInformation *c2); --- 15,34 ---- #include <iomanip> #endif ! #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) using namespace std; #endif ! static bool valless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool avalless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool posless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool ! yxless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool ! xyless (const CoeffInformation *c1, const CoeffInformation *c2); ! static bool idless (const CoeffInformation *c1, const CoeffInformation *c2); *************** *** 91,95 **** { assert (newsize >= 0); ! if (newsize > m_size) { --- 95,99 ---- { assert (newsize >= 0); ! if (newsize > m_size) { *************** *** 123,127 **** } ! bool ImageInformation::equals (ImageInformation &ii) { --- 127,131 ---- } ! bool ImageInformation::equals (ImageInformation &ii) { *************** *** 137,141 **** } ! void ImageInformation::gensort (cipredicate isless) { --- 141,145 ---- } ! void ImageInformation::gensort (cipredicate isless) { *************** *** 144,148 **** ! void ImageInformation::ssort (void) { --- 148,152 ---- ! void ImageInformation::ssort (void) { *************** *** 150,154 **** } ! void ImageInformation::asort (void) { --- 154,158 ---- } ! void ImageInformation::asort (void) { *************** *** 156,165 **** } ! void ImageInformation::psort (void) { quicksort (0, m_size - 1, posless); } ! void ImageInformation::isort (void) { --- 160,179 ---- } ! void ImageInformation::psort (void) { quicksort (0, m_size - 1, posless); } ! void ! ImageInformation::yxsort (void) ! { ! quicksort (0, m_size - 1, yxless); ! } ! void ! ImageInformation::xysort (void) ! { ! quicksort (0, m_size - 1, xyless); ! } ! void ImageInformation::isort (void) { *************** *** 167,171 **** } ! void ImageInformation::shuffle (void) { --- 181,185 ---- } ! void ImageInformation::shuffle (void) { *************** *** 181,185 **** } ! bool ImageInformation::ssorted (void) const { --- 195,199 ---- } ! bool ImageInformation::ssorted (void) const { *************** *** 195,199 **** } ! bool ImageInformation::asorted (void) const { --- 209,213 ---- } ! bool ImageInformation::asorted (void) const { *************** *** 203,207 ****... [truncated message content] |