From: Enblend <enb...@li...> - 2009-11-09 14:43:41
|
details: http://enblend.hg.sourceforge.net/hgweb/enblend/enblend/rev/e29281594440 changeset: diffs (616 lines): diff -r f312b1189a2d -r e29281594440 VERSION --- a/VERSION Sun Nov 08 15:15:01 2009 +0100 +++ b/VERSION Mon Nov 09 11:10:35 2009 +0100 @@ -1,1 +1,1 @@ -4.0-f5875cce3ccb +4.0-f312b1189a2d diff -r f312b1189a2d -r e29281594440 doc/enblend.info --- a/doc/enblend.info Sun Nov 08 15:15:01 2009 +0100 +++ b/doc/enblend.info Mon Nov 09 11:10:35 2009 +0100 @@ -30,7 +30,7 @@ Enblend ******* -This manual is for Enblend (version 4.0-dd32463fe9de, 7 November 2009), +This manual is for Enblend (version 4.0-dd32463fe9de, 9 November 2009), a tool for compositing images in such a way that the seam between the images is invisible, or at least very difficult to see. diff -r f312b1189a2d -r e29281594440 doc/enfuse.info --- a/doc/enfuse.info Sun Nov 08 15:15:01 2009 +0100 +++ b/doc/enfuse.info Mon Nov 09 11:10:35 2009 +0100 @@ -90,7 +90,7 @@ Enfuse ****** -This manual is for Enfuse (version 4.0-dd32463fe9de, 7 November 2009), +This manual is for Enfuse (version 4.0-dd32463fe9de, 9 November 2009), a program to merge different exposures of the same scene to produce an image that looks much like a tonemapped image. diff -r f312b1189a2d -r e29281594440 doc/versenblend.texi --- a/doc/versenblend.texi Sun Nov 08 15:15:01 2009 +0100 +++ b/doc/versenblend.texi Mon Nov 09 11:10:35 2009 +0100 @@ -1,4 +1,4 @@ -@set UPDATED 7 November 2009 +@set UPDATED 9 November 2009 @set UPDATED-MONTH November 2009 @set EDITION 4.0-dd32463fe9de @set VERSION 4.0-dd32463fe9de diff -r f312b1189a2d -r e29281594440 doc/versenfuse.texi --- a/doc/versenfuse.texi Sun Nov 08 15:15:01 2009 +0100 +++ b/doc/versenfuse.texi Mon Nov 09 11:10:35 2009 +0100 @@ -1,4 +1,4 @@ -@set UPDATED 7 November 2009 +@set UPDATED 9 November 2009 @set UPDATED-MONTH November 2009 @set EDITION 4.0-dd32463fe9de @set VERSION 4.0-dd32463fe9de diff -r f312b1189a2d -r e29281594440 include/vigra/float_cast.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/vigra/float_cast.h Mon Nov 09 11:10:35 2009 +0100 @@ -0,0 +1,143 @@ +/* +** Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com> +** +** Permission to use, copy, modify, distribute, and sell this file for any +** purpose is hereby granted without fee, provided that the above copyright +** and this permission notice appear in all copies. No representations are +** made about the suitability of this software for any purpose. It is +** provided "as is" without express or implied warranty. +*/ + +/* Version 1.1 */ + + +/*============================================================================ +** On Intel Pentium processors (especially PIII and probably P4), converting +** from float to int is very slow. To meet the C specs, the code produced by +** most C compilers targeting Pentium needs to change the FPU rounding mode +** before the float to int conversion is performed. +** +** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It +** is this flushing of the pipeline which is so slow. +** +** Fortunately the ISO C99 specifications define the functions lrint, lrintf, +** llrint and llrintf which fix this problem as a side effect. +** +** On Unix-like systems, the configure process should have detected the +** presence of these functions. If they weren't found we have to replace them +** here with a standard C cast. +*/ + +/* +** The C99 prototypes for lrint and lrintf are as follows: +** +** long int lrintf (float x) ; +** long int lrint (double x) ; +*/ + +//#include "config.h" + +/* The presence of the required functions are detected during the configure +** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in +** the config.h file. +*/ + +#ifndef __FLOAT_CAST_H__ +#define __FLOAT_CAST_H__ + +#if (HAVE_LRINT && HAVE_LRINTF) + +/* These defines enable functionality introduced with the 1999 ISO C +** standard. They must be defined before the inclusion of math.h to +** engage them. If optimisation is enabled, these functions will be +** inlined. With optimisation switched off, you have to link in the +** maths library using -lm. +*/ + +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 + +#define __USE_ISOC9X 1 +#define __USE_ISOC99 1 + +#include <math.h> + +#elif (defined (_MSC_VER)) + +/* Win32 doesn't seem to have these functions. +** Therefore implement inline versions of these functions here. +*/ + +#if defined(_M_X64) + +#include <intrin.h> + +__forceinline long long int llrint (double flt) { + return (long long int) _mm_cvtsd_si64x(_mm_loadu_pd(&flt)); +} + +__forceinline long int lrint (double flt) { + return (long int) _mm_cvtsd_si64x(_mm_loadu_pd(&flt)); +} + +#else + +__forceinline long int lrint (double flt) { + long int intgr; + __asm { + fld flt + fistp intgr + } + return intgr; +} + +__forceinline long int lrintf(float flt) { + long int intgr; + __asm { + fld flt + fistp intgr + } + return intgr; +} + +__forceinline long int lrintl(long double flt) { + long int intgr; + __asm { + fld flt + fistp intgr + } + return intgr; +} + +__forceinline long long int llrint(double flt) { + long long int intgr; + __asm { + fld flt + fistp intgr + } + return intgr; +} + +__forceinline long long int llrintf(float flt) { + long long int intgr; + __asm { + fld flt + fistp intgr + } + return intgr; +} + +__forceinline long long int llrintl(long double flt) { + long long int intgr; + __asm { + fld flt + fistp intgr + } + return intgr; +} + +#endif /* _M_X64 */ + +#endif + +#endif /* __FLOAT_CAST_H__ */ diff -r f312b1189a2d -r e29281594440 include/vigra/numerictraits.hxx --- a/include/vigra/numerictraits.hxx Sun Nov 08 15:15:01 2009 +0100 +++ b/include/vigra/numerictraits.hxx Mon Nov 09 11:10:35 2009 +0100 @@ -46,6 +46,11 @@ #include <complex> #include "vigra/metaprogramming.hxx" #include "vigra/sized_int.hxx" +#ifdef _MSC_VER + // define missing lrint, lrintf function in Visual C++ + // needed for changes by Andrew Mihal 20061130 + #include "vigra/float_cast.h" +#endif /********************************************************/ /* */ diff -r f312b1189a2d -r e29281594440 src/Makefile.am --- a/src/Makefile.am Sun Nov 08 15:15:01 2009 +0100 +++ b/src/Makefile.am Mon Nov 09 11:10:35 2009 +0100 @@ -9,7 +9,7 @@ enblend_SOURCES = anneal.h assemble.h blend.h bounds.h \ common.h enblend.h enblend.cc fixmath.h \ - float_cast.h global.h gpu.cc gpu.h mask.h \ + global.h gpu.cc gpu.h mask.h \ nearest.h numerictraits.h openmp.h path.h pyramid.h \ error_message.h error_message.cc \ filenameparse.h filenameparse.cc \ @@ -23,7 +23,7 @@ -I${top_srcdir}/include enfuse_SOURCES = assemble.h blend.h bounds.h common.h \ - enfuse.h enfuse.cc fixmath.h float_cast.h \ + enfuse.h enfuse.cc fixmath.h \ global.h mga.h numerictraits.h openmp.h pyramid.h \ error_message.h error_message.cc \ filenameparse.h filenameparse.cc \ diff -r f312b1189a2d -r e29281594440 src/enblend.cc --- a/src/enblend.cc Sun Nov 08 15:15:01 2009 +0100 +++ b/src/enblend.cc Mon Nov 09 11:10:35 2009 +0100 @@ -28,9 +28,6 @@ #define isnan _isnan #endif // _MSC_VER -// Defines lrint for fast fromRealPromotes -#include "float_cast.h" - #ifdef _WIN32 // Make sure we bring in windows.h the right way #define _STLP_VERBOSE_AUTO_LINK diff -r f312b1189a2d -r e29281594440 src/enblend_msvc2008.vcproj --- a/src/enblend_msvc2008.vcproj Sun Nov 08 15:15:01 2009 +0100 +++ b/src/enblend_msvc2008.vcproj Mon Nov 09 11:10:35 2009 +0100 @@ -464,10 +464,6 @@ > </File> <File - RelativePath=".\float_cast.h" - > - </File> - <File RelativePath=".\win32helpers\getopt.h" > </File> diff -r f312b1189a2d -r e29281594440 src/enfuse.cc --- a/src/enfuse.cc Sun Nov 08 15:15:01 2009 +0100 +++ b/src/enfuse.cc Mon Nov 09 11:10:35 2009 +0100 @@ -26,10 +26,7 @@ #include <win32helpers\win32config.h> #endif #define isnan _isnan -#endif // _MSC_VER - -// Defines lrint for fast fromRealPromotes -#include "float_cast.h" +#endif //MSC_VER #ifdef _WIN32 // Make sure we bring in windows.h the right way diff -r f312b1189a2d -r e29281594440 src/enfuse_msvc2008.vcproj --- a/src/enfuse_msvc2008.vcproj Sun Nov 08 15:15:01 2009 +0100 +++ b/src/enfuse_msvc2008.vcproj Mon Nov 09 11:10:35 2009 +0100 @@ -460,10 +460,6 @@ > </File> <File - RelativePath=".\float_cast.h" - > - </File> - <File RelativePath=".\win32helpers\getopt.h" > </File> diff -r f312b1189a2d -r e29281594440 src/filespec.cc --- a/src/filespec.cc Sun Nov 08 15:15:01 2009 +0100 +++ b/src/filespec.cc Mon Nov 09 11:10:35 2009 +0100 @@ -43,13 +43,6 @@ #include <boost/assign/list_of.hpp> - -#ifdef _WIN32 -// FIXME: Defines lrint() for fast fromRealPromotes and _must_ be -// included before "vigra/imageinfo.hxx". This is ugly beyond belief! -#include "float_cast.h" -#endif - #include "vigra/imageinfo.hxx" #ifdef HAVE_CONFIG_H diff -r f312b1189a2d -r e29281594440 src/float_cast.h --- a/src/float_cast.h Sun Nov 08 15:15:01 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -** Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com> -** -** Permission to use, copy, modify, distribute, and sell this file for any -** purpose is hereby granted without fee, provided that the above copyright -** and this permission notice appear in all copies. No representations are -** made about the suitability of this software for any purpose. It is -** provided "as is" without express or implied warranty. -*/ - -/* Version 1.1 */ - - -/*============================================================================ -** On Intel Pentium processors (especially PIII and probably P4), converting -** from float to int is very slow. To meet the C specs, the code produced by -** most C compilers targeting Pentium needs to change the FPU rounding mode -** before the float to int conversion is performed. -** -** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It -** is this flushing of the pipeline which is so slow. -** -** Fortunately the ISO C99 specifications define the functions lrint, lrintf, -** llrint and llrintf which fix this problem as a side effect. -** -** On Unix-like systems, the configure process should have detected the -** presence of these functions. If they weren't found we have to replace them -** here with a standard C cast. -*/ - -/* -** The C99 prototypes for lrint and lrintf are as follows: -** -** long int lrintf (float x) ; -** long int lrint (double x) ; -*/ - -//#include "config.h" - -/* The presence of the required functions are detected during the configure -** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in -** the config.h file. -*/ - -#ifndef __FLOAT_CAST_H__ -#define __FLOAT_CAST_H__ - -#if (HAVE_LRINT && HAVE_LRINTF) - -/* These defines enable functionality introduced with the 1999 ISO C -** standard. They must be defined before the inclusion of math.h to -** engage them. If optimisation is enabled, these functions will be -** inlined. With optimisation switched off, you have to link in the -** maths library using -lm. -*/ - -#define _ISOC9X_SOURCE 1 -#define _ISOC99_SOURCE 1 - -#define __USE_ISOC9X 1 -#define __USE_ISOC99 1 - -#include <math.h> - -#elif (defined (_MSC_VER)) - -/* Win32 doesn't seem to have these functions. -** Therefore implement inline versions of these functions here. -*/ - -#if defined(_M_X64) - -#include <intrin.h> - -__forceinline long long int llrint (double flt) { - return (long long int) _mm_cvtsd_si64x(_mm_loadu_pd(&flt)); -} - -__forceinline long int lrint (double flt) { - return (long int) _mm_cvtsd_si64x(_mm_loadu_pd(&flt)); -} - -#else - -__forceinline long int lrint (double flt) { - long int intgr; - __asm { - fld flt - fistp intgr - } - return intgr; -} - -__forceinline long int lrintf(float flt) { - long int intgr; - __asm { - fld flt - fistp intgr - } - return intgr; -} - -__forceinline long int lrintl(long double flt) { - long int intgr; - __asm { - fld flt - fistp intgr - } - return intgr; -} - -__forceinline long long int llrint(double flt) { - long long int intgr; - __asm { - fld flt - fistp intgr - } - return intgr; -} - -__forceinline long long int llrintf(float flt) { - long long int intgr; - __asm { - fld flt - fistp intgr - } - return intgr; -} - -__forceinline long long int llrintl(long double flt) { - long long int intgr; - __asm { - fld flt - fistp intgr - } - return intgr; -} - -#endif /* _M_X64 */ - -#endif - -#endif /* __FLOAT_CAST_H__ */ diff -r f312b1189a2d -r e29281594440 src/vigra_impex/bmp.cxx --- a/src/vigra_impex/bmp.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/bmp.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -36,7 +36,6 @@ #include <iostream> #include <fstream> -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "error.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/byteorder.cxx --- a/src/vigra_impex/byteorder.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/byteorder.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -36,7 +36,6 @@ #include <algorithm> #include <stdexcept> -#include "../float_cast.h" #include "byteorder.hxx" #include "vigra/sized_int.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/codecmanager.cxx --- a/src/vigra_impex/codecmanager.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/codecmanager.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -45,7 +45,6 @@ #include <iostream> #endif -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/error.hxx" #include "vigra/imageinfo.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/exr.cxx --- a/src/vigra_impex/exr.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/exr.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -39,7 +39,6 @@ #ifdef HasEXR -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "void_vector.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/gif.cxx --- a/src/vigra_impex/gif.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/gif.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -38,7 +38,6 @@ #include <stdexcept> #include <vector> #include <algorithm> -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "error.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/hdr.cxx --- a/src/vigra_impex/hdr.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/hdr.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -34,7 +34,6 @@ /* */ /************************************************************************/ -#include "../float_cast.h" #include "vigra/sized_int.hxx" #include "error.hxx" #include "hdr.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/imageinfo.cxx --- a/src/vigra_impex/imageinfo.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/imageinfo.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -56,7 +56,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "../float_cast.h" #include "vigra/imageinfo.hxx" #include "codecmanager.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/jpeg.cxx --- a/src/vigra_impex/jpeg.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/jpeg.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -47,7 +47,6 @@ #include <stdexcept> #include <csetjmp> -#include "../float_cast.h" #include "vigra/config.hxx" #include "void_vector.hxx" #include "error.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/png.cxx --- a/src/vigra_impex/png.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/png.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -50,7 +50,6 @@ #ifdef HasPNG -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "void_vector.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/pnm.cxx --- a/src/vigra_impex/pnm.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/pnm.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -37,7 +37,6 @@ #include <cmath> #include <iostream> #include <fstream> -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "error.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/rgbe.c --- a/src/vigra_impex/rgbe.c Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/rgbe.c Mon Nov 09 11:10:35 2009 +0100 @@ -2,7 +2,6 @@ * WHILE THE AUTHORS HAVE TRIED TO ENSURE THE PROGRAM WORKS CORRECTLY, * IT IS STRICTLY USE AT YOUR OWN RISK. */ -#include "../float_cast.h" #include "rgbe.h" #include <math.h> #include <stdlib.h> diff -r f312b1189a2d -r e29281594440 src/vigra_impex/sun.cxx --- a/src/vigra_impex/sun.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/sun.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -36,7 +36,6 @@ #include <fstream> #include <stdexcept> -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "error.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/tiff.cxx --- a/src/vigra_impex/tiff.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/tiff.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -67,7 +67,6 @@ // NB (jbeda): tiffio.h is going to include this anyway. Let's include // it now so that we can control how it comes in. Namely, we want // to get our version that doesn't set the evil min/max macros. -#include "../float_cast.h" #include "vigra/windows.h" #include "vigra/imageinfo.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/viff.cxx --- a/src/vigra_impex/viff.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/viff.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -41,7 +41,6 @@ #include <iostream> #include <fstream> -#include "../float_cast.h" #include "vigra/config.hxx" #include "vigra/sized_int.hxx" #include "error.hxx" diff -r f312b1189a2d -r e29281594440 src/vigra_impex/void_vector.cxx --- a/src/vigra_impex/void_vector.cxx Sun Nov 08 15:15:01 2009 +0100 +++ b/src/vigra_impex/void_vector.cxx Mon Nov 09 11:10:35 2009 +0100 @@ -34,7 +34,6 @@ /* */ /************************************************************************/ -#include "../float_cast.h" #include "void_vector.hxx" namespace vigra |