aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanilo Egea Gondolfo <danilo@FreeBSD.org>2014-06-20 17:17:54 +0000
committerDanilo Egea Gondolfo <danilo@FreeBSD.org>2014-06-20 17:17:54 +0000
commitce3d606a5b5d25c1a7fa7e2f2ddb75a284d17941 (patch)
treeda56af4d8dbe76ea4db95f5ac25d17feb92aaabd
parentd8aca34543638cbd634f5ad1d1c1ca7b40afc67c (diff)
downloadports-ce3d606a5b5d25c1a7fa7e2f2ddb75a284d17941.tar.gz
ports-ce3d606a5b5d25c1a7fa7e2f2ddb75a284d17941.zip
- Update from 1.6.4 to 1.8.5 [1]
- Use options helpers PR: ports/191179 Submitted by: ii@any.com.ru [1]
Notes
Notes: svn path=/head/; revision=358615
-rw-r--r--graphics/pfstools/Makefile120
-rw-r--r--graphics/pfstools/distinfo4
-rw-r--r--graphics/pfstools/files/epatch-src-octave-pfsopen.cpp23
-rw-r--r--graphics/pfstools/files/patch-config.h.in19
-rw-r--r--graphics/pfstools/files/patch-configure20
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-exrio.cpp28
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-hdrtiffio.cpp96
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-pfsinexr.cpp11
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-pfsinimgmagick.cpp19
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-pfsinjpeghdr.cpp22
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-pfsoutimgmagick.cpp10
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-pfsoutjpeghdr.cpp40
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-pfsoutpfm.cpp20
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-ppmio.cpp11
-rw-r--r--graphics/pfstools/files/patch-src-fileformat-rgbeio.cpp29
-rw-r--r--graphics/pfstools/files/patch-src-filter-Makefile.am20
-rw-r--r--graphics/pfstools/files/patch-src-filter-Makefile.in58
-rw-r--r--graphics/pfstools/files/patch-src-filter-pfscat.cpp37
-rw-r--r--graphics/pfstools/files/patch-src-filter-pfsclamp.cpp13
-rw-r--r--graphics/pfstools/files/patch-src-filter-pfsextractchannels.cpp11
-rw-r--r--graphics/pfstools/files/patch-src-filter-pfspanoramic.cpp38
-rw-r--r--graphics/pfstools/files/patch-src-filter-pfstag.cpp23
-rw-r--r--graphics/pfstools/files/patch-src-filter-pfswb.cpp300
-rw-r--r--graphics/pfstools/files/patch-src-hdrhtml-hdrhtml.cpp192
-rw-r--r--graphics/pfstools/files/patch-src-matlab-compatibility.h10
-rw-r--r--graphics/pfstools/files/patch-src-pfs-Makefile.in6
-rw-r--r--graphics/pfstools/files/patch-src-pfs-pfs.cpp29
-rw-r--r--graphics/pfstools/files/patch-src-pfs-pfs.h45
-rw-r--r--graphics/pfstools/files/patch-src-pfs-pfsutils.cpp11
-rw-r--r--graphics/pfstools/files/patch-src-pfsglview-picture_io.cpp29
-rw-r--r--graphics/pfstools/files/patch-src-pfsglview-picture_io.h13
-rw-r--r--graphics/pfstools/files/patch-src-pfsview-pfsview_widget.cpp22
-rw-r--r--graphics/pfstools/pkg-descr2
-rw-r--r--graphics/pfstools/pkg-plist111
34 files changed, 1293 insertions, 149 deletions
diff --git a/graphics/pfstools/Makefile b/graphics/pfstools/Makefile
index 113eb66ea751..a0fd8da8a5cf 100644
--- a/graphics/pfstools/Makefile
+++ b/graphics/pfstools/Makefile
@@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= pfstools
-PORTVERSION= 1.6.4
-PORTREVISION= 17
+PORTVERSION= 1.8.5
CATEGORIES= graphics
MASTER_SITES= SF
@@ -23,101 +22,64 @@ GNU_CONFIGURE= yes
CONFIGURE_TARGET= ${PFS_BUILD}
CONFIGURE_ARGS= --disable-jpeghdr --disable-matlab \
--with-bash=${LOCALBASE}/bin/bash
-CONFIGURE_ENV= PKG_CONFIG_PATH="${LOCALBASE}/libdata/pkgconfig"
-CPPFLAGS+= ${PFS_CPPFLAGS}
-LDFLAGS+= ${PFS_LDFLAGS}
-USES= gmake libtool
+CONFIGURE_ENV= CPPFLAGS="${PFS_CPPFLAGS}" \
+ LDFLAGS="${PFS_LDFLAGS}" \
+ PKG_CONFIG_PATH=${LOCALBASE}/libdata/pkgconfig
USE_LDCONFIG= yes
-USES= pkgconfig
+USES= gmake pkgconfig libtool
-OPTIONS_DEFINE= NETPBM OPENEXR TIFF IMAGEMAGICK OCTAVE OPENGL
+OPTIONS_DEFINE= NETPBM OPENEXR TIFF QT IMAGEMAGICK GDAL OCTAVE OPENGL
+QT_DESC= Compile programs that use QT library
+GDAL_DESC= Compile programs that use GDAL library
OCTAVE_DESC= Compile octave interface functions
OPTIONS_DEFAULT= TIFF
+OPTIONS_SUB= yes
-.include <bsd.port.options.mk>
+NETPBM_CONFIGURE_ENABLE= ppm
+NETPBM_LIB_DEPENDS= libnetpbm.so:${PORTSDIR}/graphics/netpbm
-.if ${PORT_OPTIONS:MNETPBM}
-CONFIGURE_ARGS+=--enable-ppm
-LIB_DEPENDS+= libnetpbm.so:${PORTSDIR}/graphics/netpbm
-PLIST_SUB+= PPM=""
-.else
-CONFIGURE_ARGS+=--disable-ppm
-PLIST_SUB+= PPM="@comment "
-.endif
+OPENEXR_CONFIGURE_ENABLE= openexr
+OPENEXR_CONFIGURE_ON= --with-exrdir=${LOCALBASE}/include/OpenEXR
+OPENEXR_LIB_DEPENDS= libIlmImf.so:${PORTSDIR}/graphics/OpenEXR
-.if ${PORT_OPTIONS:MOPENEXR}
-PFS_CPPFLAGS+= ${PTHREAD_CFLAGS}
-PFS_LDFLAGS+= ${PTHREAD_LIBS}
-CONFIGURE_ARGS+=--enable-openexr --with-exrdir=${LOCALBASE}/include/OpenEXR
-LIB_DEPENDS+= libIlmImf.so:${PORTSDIR}/graphics/OpenEXR
-PLIST_SUB+= EXR=""
-.else
-CONFIGURE_ARGS+=--disable-openexr
-PLIST_SUB+= EXR="@comment "
-.endif
+TIFF_CONFIGURE_ENABLE= tiff
+TIFF_LIB_DEPENDS= libtiff.so:${PORTSDIR}/graphics/tiff
-.if ${PORT_OPTIONS:MTIFF}
-CONFIGURE_ARGS+=--enable-tiff
-LIB_DEPENDS+= libtiff.so:${PORTSDIR}/graphics/tiff
-PLIST_SUB+= TIFF=""
-.else
-CONFIGURE_ARGS+=--disable-tiff
-PLIST_SUB+= TIFF="@comment "
-.endif
+QT_USE= QT4=moc_build,corelib,gui
+QT_CONFIGURE_ENABLE= qt
-CONFIGURE_ARGS+=--disable-qt
-PLIST_SUB+= QT="@comment "
+IMAGEMAGICK_CONFIGURE_ENABLE= imagemagick
+IMAGEMAGICK_LIB_DEPENDS= libMagick++-6.Q*.so:${PORTSDIR}/graphics/ImageMagick
-.if ${PORT_OPTIONS:MIMAGEMAGICK}
-CONFIGURE_ARGS+=--enable-imagemagick
-LIB_DEPENDS+= libMagick++-6.Q*.so:${PORTSDIR}/graphics/ImageMagick
-PLIST_SUB+= IM=""
-.else
-CONFIGURE_ARGS+=--disable-imagemagick
-PLIST_SUB+= IM="@comment "
-.endif
+GDAL_CONFIGURE_ENABLE= gdal
+GDAL_LIB_DEPENDS= libgdal.so:${PORTSDIR}/graphics/gdal
-.if ${PORT_OPTIONS:MOCTAVE}
-CONFIGURE_ARGS+=--enable-octave
-USES+= fortran
+OPENGL_CONFIGURE_ENABLE= opengl
+OPENGL_USE= GL=glut
-# need to determine which octave installed which patching
-PATCH_DEPENDS+= mkoctfile:${PORTSDIR}/math/octave
-BUILD_DEPENDS+= mkoctfile:${PORTSDIR}/math/octave
-RUN_DEPENDS+= octave:${PORTSDIR}/math/octave
+OCTAVE_CONFIGURE_ENABLE= octave
+OCTAVE_PATCH_DEPENDS= octave-config:${PORTSDIR}/math/octave
+OCTAVE_BUILD_DEPENDS= mkoctfile:${PORTSDIR}/math/octave
+OCTAVE_RUN_DEPENDS= octave:${PORTSDIR}/math/octave
+
+.include <bsd.port.options.mk>
+.if ${PORT_OPTIONS:MOCTAVE}
OCTAVE_BASE?= ${LOCALBASE}
OCTAVE_VERSION!=${OCTAVE_BASE}/bin/octave-config -v 2>&1 || ${ECHO} "0"
+OCTAVE_SITE_OCT!=${OCTAVE_BASE}/bin/octave-config --oct-site-dir 2>&1 || ${ECHO} ""
+OCTAVE_SITE_M!= ${OCTAVE_BASE}/bin/octave-config --m-site-dir 2>&1 || ${ECHO} ""
PLIST_SUB+= OCTAVE="" \
- OCTAVE_VERSION=${OCTAVE_VERSION} \
OCTAVE_BASE=${OCTAVE_BASE} \
- BUILD=${PFS_BUILD}
-.if (!empty(OCTAVE_VERSION:M[3-9].*))
-EXTRA_PATCHES+= ${PATCHDIR}/epatch-src-octave-pfsopen.cpp
-.endif
-MAN1+= pfsoctavelum.1 \
- pfsoctavergb.1 \
- pfsstat.1
-.else
-CONFIGURE_ARGS+=--disable-octave
-PLIST_SUB+= OCTAVE="@comment "
-.endif
-
-.if ${PORT_OPTIONS:MOPENGL}
-CONFIGURE_ARGS+=--enable-opengl
-USE_GL= glut
-PLIST_SUB+= GL=""
-.else
-CONFIGURE_ARGS+=--disable-opengl
-PLIST_SUB+= GL="@comment "
-.endif
-
-.if ${PORT_OPTIONS:MOCTAVE}
-pre-configure:
- @${REINPLACE_CMD} \
- -e 's|/usr/bin/octave|${LOCALBASE}/bin/octave|' \
- ${WRKSRC}/src/octave/*
+ OCTAVE_SITE_M=${OCTAVE_SITE_M:S|^${OCTAVE_BASE}/||} \
+ OCTAVE_SITE_OCT=${OCTAVE_SITE_OCT:S|^${OCTAVE_BASE}/||}
+USES+= shebangfix
+SHEBANG_FILES= src/octave/*
+SHEBANG_LANG+= octave
+octave_OLD_CMD?=/usr/bin/octave
+octave_CMD?= ${LOCALBASE}/bin/octave
.endif
.include <bsd.port.mk>
+
diff --git a/graphics/pfstools/distinfo b/graphics/pfstools/distinfo
index 8107b19ec240..4d277bbeb8f8 100644
--- a/graphics/pfstools/distinfo
+++ b/graphics/pfstools/distinfo
@@ -1,2 +1,2 @@
-SHA256 (pfstools-1.6.4.tar.gz) = 18d2d8fe64fd88ceda5b61cd7504f801c859989b6220965eb5c254e3d902dfe8
-SIZE (pfstools-1.6.4.tar.gz) = 588801
+SHA256 (pfstools-1.8.5.tar.gz) = 2cf958d39ee3b65b034796b0abeea727590561936e295461de6365a750167306
+SIZE (pfstools-1.8.5.tar.gz) = 846001
diff --git a/graphics/pfstools/files/epatch-src-octave-pfsopen.cpp b/graphics/pfstools/files/epatch-src-octave-pfsopen.cpp
deleted file mode 100644
index c697f03103b8..000000000000
--- a/graphics/pfstools/files/epatch-src-octave-pfsopen.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
---- src/octave/pfsopen.cpp.orig 2006-04-06 12:33:02.000000000 +0000
-+++ src/octave/pfsopen.cpp 2008-02-12 10:59:44.000000000 +0000
-@@ -54,8 +54,9 @@
- return retval;
- }
-
-- if( !args(0).is_string() && !args(0).is_stream() ) {
-+ if( !args(0).is_string() && !args(0).is_real_scalar() ) {
- error( SCRIPT_NAME ": expected file name or file descriptor as the first argument!");
-+ // file descriptors are represented as integers (stored as doubles) in Octave 3.0
- return retval;
- }
-
-@@ -120,8 +121,7 @@
- }
- } else {
- // File descriptor given
-- octave_stream fid = args(0).stream_value();
-- int fd = dup( fid.file_number() );
-+ int fd = dup( (int) args(0).scalar_value() );
- if( writeMode ) {
- fh = fdopen( fd, "wb" );
- if( fh == NULL ) {
diff --git a/graphics/pfstools/files/patch-config.h.in b/graphics/pfstools/files/patch-config.h.in
new file mode 100644
index 000000000000..5ccb1e8ad682
--- /dev/null
+++ b/graphics/pfstools/files/patch-config.h.in
@@ -0,0 +1,19 @@
+--- config.h.in.orig 2011-10-27 08:40:42.000000000 +0000
++++ config.h.in 2014-02-20 19:04:01.536587053 +0000
+@@ -99,13 +99,13 @@
+
+ /* Output stream for debug messages. */
+ #ifdef DEBUG
+-#define DEBUG_STR cerr
++#define DEBUG_STR std::cerr
+ #else
+-#define DEBUG_STR if(1); else cerr
++#define DEBUG_STR if(1); else std::cerr
+ #endif
+ /* Output stream for verbose messages */
+ #define VERBOSE_STR if(verbose) std::cerr << PROG_NAME << ": "
+
+
+ /* On some systems iostream, string etc are in 'std' namespace */
+-using namespace std;
++//using namespace std;
diff --git a/graphics/pfstools/files/patch-configure b/graphics/pfstools/files/patch-configure
new file mode 100644
index 000000000000..974695df5100
--- /dev/null
+++ b/graphics/pfstools/files/patch-configure
@@ -0,0 +1,20 @@
+--- configure.orig 2011-10-27 08:40:31.000000000 +0000
++++ configure 2014-02-20 19:04:01.546588828 +0000
+@@ -14827,7 +14827,7 @@
+ imagemagick_support="no"
+ else
+ IMAGEMAGICK_CFLAGS=$pkg_cv_IMAGEMAGICK_CFLAGS
+- IMAGEMAGICK_LIBS=$pkg_cv_IMAGEMAGICK_LIBS
++ IMAGEMAGICK_LIBS="$pkg_cv_IMAGEMAGICK_LIBS /usr/local/lib/gcc47/libstdc++.so"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
+
+@@ -15411,7 +15411,7 @@
+ if test -z "$QTDIR"; then
+ MOC="moc-qt4"
+ else
+- MOC="$QTDIR/bin/moc"
++ MOC="$QTDIR/bin/moc-qt4"
+ fi
+
+ # Check whether --with-moc was given.
diff --git a/graphics/pfstools/files/patch-src-fileformat-exrio.cpp b/graphics/pfstools/files/patch-src-fileformat-exrio.cpp
new file mode 100644
index 000000000000..e2d1f9a16320
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-exrio.cpp
@@ -0,0 +1,28 @@
+--- src/fileformat/exrio.cpp.orig 2005-06-15 13:36:54.000000000 +0000
++++ src/fileformat/exrio.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -54,14 +54,14 @@
+ }
+
+ DEBUG_STR << "OpenEXR file \"" << filename << "\" ("
+- << width << "x" << height << ")" << endl;
++ << width << "x" << height << ")" << std::endl;
+ }
+
+ void OpenEXRReader::readImage( pfs::Array2D *R, pfs::Array2D *G,
+ pfs::Array2D *B )
+ {
+ assert(file!=NULL);
+- DEBUG_STR << "Reading OpenEXR file... " << endl;
++ DEBUG_STR << "Reading OpenEXR file... " << std::endl;
+
+ Imf::Rgba* tmp_img = new Imf::Rgba[width*height];
+
+@@ -93,7 +93,7 @@
+ OpenEXRReader::~OpenEXRReader()
+ {
+ delete file;
+- file==NULL;
++ file=NULL;
+ }
+
+ OpenEXRWriter::OpenEXRWriter(const char* filename)
diff --git a/graphics/pfstools/files/patch-src-fileformat-hdrtiffio.cpp b/graphics/pfstools/files/patch-src-fileformat-hdrtiffio.cpp
new file mode 100644
index 000000000000..fbfe58ab08b2
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-hdrtiffio.cpp
@@ -0,0 +1,96 @@
+--- src/fileformat/hdrtiffio.cpp.orig 2011-10-27 08:39:07.000000000 +0000
++++ src/fileformat/hdrtiffio.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -66,7 +66,7 @@
+ }
+
+ DEBUG_STR << "TIFF file \"" << filename << "\" ("
+- << width << "x" << height << ")" << endl;
++ << width << "x" << height << ")" << std::endl;
+
+ //--- image parameters
+ if(!TIFFGetField(tif, TIFFTAG_COMPRESSION, &comp)) // compression type
+@@ -81,7 +81,7 @@
+ switch(phot)
+ {
+ case PHOTOMETRIC_LOGLUV:
+- DEBUG_STR << "Photometric data: LogLuv" << endl;
++ DEBUG_STR << "Photometric data: LogLuv" << std::endl;
+ if (comp != COMPRESSION_SGILOG && comp != COMPRESSION_SGILOG24)
+ {
+ TIFFClose(tif);
+@@ -96,7 +96,7 @@
+ relative_values=true;
+ break;
+ case PHOTOMETRIC_RGB:
+- DEBUG_STR << "Photometric data: RGB" << endl;
++ DEBUG_STR << "Photometric data: RGB" << std::endl;
+ // read extra samples (# of alpha channels)
+ if (TIFFGetField( tif, TIFFTAG_EXTRASAMPLES,
+ &extra_samples_per_pixel, &extra_sample_types )!=1)
+@@ -121,36 +121,36 @@
+ if( bps==8 )
+ {
+ TypeOfData = BYTE;
+- DEBUG_STR << "8bit per channel" << endl;
++ DEBUG_STR << "8bit per channel" << std::endl;
+ strcpy(format_string,"linear 8bit RGB");
+ relative_values=false; //!! TODO: verify if 8bit is always gamma corrected
+ }
+ else if( bps==16 )
+ {
+ TypeOfData = WORD;
+- DEBUG_STR << "16bit per channel" << endl;
++ DEBUG_STR << "16bit per channel" << std::endl;
+ strcpy(format_string,"linear 16bit RGB");
+ relative_values=true; //!! TODO: verify this case!!
+ }
+ else
+ {
+ TypeOfData = FLOAT;
+- DEBUG_STR << "32bit float per channel" << endl;
++ DEBUG_STR << "32bit float per channel" << std::endl;
+ strcpy(format_string,"linear 32bit float RGB");
+ relative_values=true;
+ }
+ break;
+ case PHOTOMETRIC_MINISBLACK: // HDR video camera format (grayscale)
+- DEBUG_STR << "Photometric data: MINISBLACK (hdrv camera)" << endl;
++ DEBUG_STR << "Photometric data: MINISBLACK (hdrv camera)" << std::endl;
+ if (!TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &bps) || !bps==1)
+ {
+ TIFFClose(tif);
+ throw pfs::Exception("TIFF: Unsupported samples per pixel for "
+ "grayscale image");
+ }
+- if (!TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bps) || !bps==16)
++ if (!TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bps) || !(bps==16))
+ {
+- DEBUG_STR << "Detected bits per sample: " << bps << endl;
++ DEBUG_STR << "Detected bits per sample: " << bps << std::endl;
+ TIFFClose(tif);
+ throw pfs::Exception("TIFF: unsupported bits per sample for "
+ "grayscale image.");
+@@ -160,7 +160,7 @@
+ relative_values=true;
+ break;
+ default:
+- DEBUG_STR << "Unsupported photometric type: " << phot << endl;
++ DEBUG_STR << "Unsupported photometric type: " << phot << std::endl;
+ TIFFClose(tif);
+ strcpy(format_string,"unknown");
+ relative_values=false;
+@@ -184,12 +184,12 @@
+ //--- image length
+ uint32 imagelength;
+ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
+- DEBUG_STR << "Image length: " << imagelength << endl;
++ DEBUG_STR << "Image length: " << imagelength << std::endl;
+
+ //--- image scanline size
+ uint32 scanlinesize = TIFFScanlineSize(tif);
+ buf.vp = _TIFFmalloc(scanlinesize);
+-// DEBUG_STR << "Scanline size: " << scanlinesize << endl;
++// DEBUG_STR << "Scanline size: " << scanlinesize << std::endl;
+
+
+ //--- read scan lines
diff --git a/graphics/pfstools/files/patch-src-fileformat-pfsinexr.cpp b/graphics/pfstools/files/patch-src-fileformat-pfsinexr.cpp
new file mode 100644
index 000000000000..2e87ac0be637
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-pfsinexr.cpp
@@ -0,0 +1,11 @@
+--- src/fileformat/pfsinexr.cpp.orig 2008-01-01 13:01:21.000000000 +0000
++++ src/fileformat/pfsinexr.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -234,7 +234,7 @@
+ }
+
+ file.setFrameBuffer( frameBuffer );
+- file.readPixels( dw.min.y, dw.max.y );
++ file.readPixels( dtw.min.y, dtw.max.y );
+
+ VERBOSE_STR << "reading file (linear) '" << ff.fileName << "'" << std::endl;
+
diff --git a/graphics/pfstools/files/patch-src-fileformat-pfsinimgmagick.cpp b/graphics/pfstools/files/patch-src-fileformat-pfsinimgmagick.cpp
new file mode 100644
index 000000000000..59c148e73797
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-pfsinimgmagick.cpp
@@ -0,0 +1,19 @@
+--- src/fileformat/pfsinimgmagick.cpp.orig 2008-10-03 19:07:34.000000000 +0000
++++ src/fileformat/pfsinimgmagick.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -108,6 +108,7 @@
+ if( ff.fh == NULL ) break; // No more frames
+ it.closeFrameFile( ff );
+
++ Magick::InitializeMagick(*argv);
+ VERBOSE_STR << "reading file '" << ff.fileName << "'" << std::endl;
+ Magick::Image imImage( ff.fileName );
+
+@@ -172,7 +173,7 @@
+ frame->getTags()->setString( "FILE_NAME", fileNameTag );
+
+ char strbuf[3];
+- snprintf( strbuf, 3, "%d", imImage.depth() );
++ snprintf( strbuf, 3, "%lu", imImage.depth() );
+ frame->getTags()->setString("BITDEPTH", strbuf );
+
+ pfsio.writeFrame( frame, stdout );
diff --git a/graphics/pfstools/files/patch-src-fileformat-pfsinjpeghdr.cpp b/graphics/pfstools/files/patch-src-fileformat-pfsinjpeghdr.cpp
new file mode 100644
index 000000000000..7fbcfe4390eb
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-pfsinjpeghdr.cpp
@@ -0,0 +1,22 @@
+--- src/fileformat/pfsinjpeghdr.cpp.orig 2005-11-04 08:54:27.000000000 +0000
++++ src/fileformat/pfsinjpeghdr.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -123,8 +123,8 @@
+ case JPEG_HEADER_HDR: // HDR image
+ jpeghdr_start_decompress(&jhinf);
+ frame = pfsio.createFrame( jhinf.cinfo.output_width, jhinf.cinfo.output_height );
+- hdrscan = (JHSAMPLE *)malloc(jhinf.cinfo.output_width * jhinf.cinfo.output_height *
+- sizeof(JHSAMPLE)*3);
++ hdrscan =
++ new JHSAMPLE[jhinf.cinfo.output_width * jhinf.cinfo.output_height * 3];
+ // Important: test jhinf.output_scanline, not jhinf.cinfo
+ int index ;
+ index = 0;
+@@ -144,7 +144,7 @@
+ (Z->getRawData())[i] = hdrscan[3*i + 2];
+ }
+ pfs::transformColorSpace( pfs::CS_RGB, X, Y, Z, pfs::CS_XYZ, X, Y, Z );
+- free((void *)hdrscan);
++ delete[] hdrscan;
+ break;
+ case JPEG_HEADER_OK: // LDR image
+ case JPEG_SUSPENDED:
diff --git a/graphics/pfstools/files/patch-src-fileformat-pfsoutimgmagick.cpp b/graphics/pfstools/files/patch-src-fileformat-pfsoutimgmagick.cpp
new file mode 100644
index 000000000000..ee1d1690866c
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-pfsoutimgmagick.cpp
@@ -0,0 +1,10 @@
+--- src/fileformat/pfsoutimgmagick.cpp.orig 2011-03-15 08:47:24.000000000 +0000
++++ src/fileformat/pfsoutimgmagick.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -190,6 +190,7 @@
+ if( alpha != NULL )
+ imgBuffer[i++] = (unsigned short)(maxValue-clamp((*alpha)(pix),0.f,1.f)*maxValue);
+ }
++ Magick::InitializeMagick(*argv);
+ Magick::Image imImage( frame->getWidth(), frame->getHeight(),
+ (alpha == NULL ? "RGB" : "RGBA"), Magick::ShortPixel, imgBuffer );
+ imImage.quality( quality );
diff --git a/graphics/pfstools/files/patch-src-fileformat-pfsoutjpeghdr.cpp b/graphics/pfstools/files/patch-src-fileformat-pfsoutjpeghdr.cpp
new file mode 100644
index 000000000000..3985dd8c675a
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-pfsoutjpeghdr.cpp
@@ -0,0 +1,40 @@
+--- src/fileformat/pfsoutjpeghdr.cpp.orig 2005-11-04 08:54:27.000000000 +0000
++++ src/fileformat/pfsoutjpeghdr.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -69,8 +69,7 @@
+ jhinf.correction = correction;
+ jpeg_stdio_dest(&jhinf.cinfo, fh);
+
+- image = (JHSAMPLE *)malloc(width * height *
+- sizeof(JHSAMPLE)*3);
++ image = new JHSAMPLE[width * height * 3];
+
+ for(int i=0;i<width * height;i++)
+ {
+@@ -91,7 +90,7 @@
+ // Or, assign jhinf.tmi 8-bit grayscale values in scanline order
+ jpeghdr_do_compress(&jhinf);
+ jpeghdr_destroy_compress(&jhinf);
+- fclose(fh);
++ delete[] image;
+ }
+
+ void writeHDRJPEGRGB( FILE *fh, int width, int height,
+@@ -111,8 +110,7 @@
+ jhinf.beta = beta;
+ jpeg_stdio_dest(&jhinf.cinfo, fh);
+
+- image = (JHSAMPLE *)malloc(width * height *
+- sizeof(JHSAMPLE)*3);
++ image = new JHSAMPLE[width * height * 3];
+
+ for(int i=0;i<width * height;i++)
+ {
+@@ -135,7 +133,7 @@
+ jpeghdr_do_compress(&jhinf);
+ jpeghdr_destroy_compress(&jhinf);
+
+- free( image );
++ delete[] image;
+ }
+
+ void writeFrames( int argc, char* argv[] )
diff --git a/graphics/pfstools/files/patch-src-fileformat-pfsoutpfm.cpp b/graphics/pfstools/files/patch-src-fileformat-pfsoutpfm.cpp
new file mode 100644
index 000000000000..e4efb7e6edf5
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-pfsoutpfm.cpp
@@ -0,0 +1,20 @@
+--- src/fileformat/pfsoutpfm.cpp.orig 2005-06-15 13:36:54.000000000 +0000
++++ src/fileformat/pfsoutpfm.cpp 2014-02-20 19:04:01.546588828 +0000
+@@ -74,7 +74,7 @@
+ }
+ int written = fwrite( line, sizeof( float ), lineSize, fh );
+ if( written != lineSize )
+- throw new pfs::Exception( "Unable to write data" );
++ throw pfs::Exception( "Unable to write data" );
+ }
+ delete[] line;
+ }
+@@ -94,7 +94,7 @@
+ }
+ int written = fwrite( line, sizeof( float ), lineSize, fh );
+ if( written != lineSize )
+- throw new pfs::Exception( "Unable to write data" );
++ throw pfs::Exception( "Unable to write data" );
+ }
+ delete[] line;
+ }
diff --git a/graphics/pfstools/files/patch-src-fileformat-ppmio.cpp b/graphics/pfstools/files/patch-src-fileformat-ppmio.cpp
new file mode 100644
index 000000000000..b4ad7a40faa0
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-ppmio.cpp
@@ -0,0 +1,11 @@
+--- src/fileformat/ppmio.cpp.orig 2009-05-25 19:24:49.000000000 +0000
++++ src/fileformat/ppmio.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -34,6 +34,8 @@
+ #include <math.h>
+ #include <assert.h>
+
++#define log2(x) ((float)log(x)/log(2))
++
+ struct PPMData
+ {
+ pixval maxPV;
diff --git a/graphics/pfstools/files/patch-src-fileformat-rgbeio.cpp b/graphics/pfstools/files/patch-src-fileformat-rgbeio.cpp
new file mode 100644
index 000000000000..ffaa1c95a733
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-fileformat-rgbeio.cpp
@@ -0,0 +1,29 @@
+--- src/fileformat/rgbeio.cpp.orig 2007-12-06 11:00:49.000000000 +0000
++++ src/fileformat/rgbeio.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -141,7 +141,7 @@
+ // Reading RGBE files
+ void readRadianceHeader( FILE *file, int &width, int &height, float &exposure )
+ {
+- DEBUG_STR << "RGBE: reading header..." << endl;
++ DEBUG_STR << "RGBE: reading header..." << std::endl;
+
+ // read header information
+ char head[255];
+@@ -208,7 +208,7 @@
+ height = height - width;
+ }
+ */
+- DEBUG_STR << "RGBE: image size " << width << "x" << height << endl;
++ DEBUG_STR << "RGBE: image size " << width << "x" << height << std::endl;
+ }
+
+
+@@ -389,7 +389,7 @@
+ int width = X->getCols();
+ int height = X->getRows();
+
+- DEBUG_STR << "RGBE: writing image " << width << "x" << height << endl;
++ DEBUG_STR << "RGBE: writing image " << width << "x" << height << std::endl;
+
+ if( Y->getCols() != width || Y->getRows() != height ||
+ Z->getCols() != width || Z->getRows() != height )
diff --git a/graphics/pfstools/files/patch-src-filter-Makefile.am b/graphics/pfstools/files/patch-src-filter-Makefile.am
new file mode 100644
index 000000000000..8699f8f123c1
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-Makefile.am
@@ -0,0 +1,20 @@
+--- src/filter/Makefile.am.orig 2009-05-30 06:59:10.000000000 +0000
++++ src/filter/Makefile.am 2014-02-20 19:04:01.556587853 +0000
+@@ -1,6 +1,7 @@
+ ###
+ bin_PROGRAMS = pfsgamma pfsclamp pfstag pfssize pfsextractchannels pfspanoramic \
+- pfsrotate pfsflip pfscut pfspad pfscat pfsabsolute pfsdisplayfunction
++ pfsrotate pfsflip pfscut pfspad pfscat pfsabsolute pfsdisplayfunction \
++ pfswb
+
+ man_MANS = pfsgamma.1 pfsclamp.1 pfstag.1 pfssize.1 pfsextractchannels.1 \
+ pfspanoramic.1 pfsrotate.1 pfsflip.1 pfscut.1 pfspad.1 pfscat.1 \
+@@ -34,6 +35,8 @@
+
+ pfsabsolute_SOURCES = pfsabsolute.cpp
+
++pfswb_SOURCES = pfswb.cpp
++
+ LIBS += ../pfs/libpfs-1.2.la
+ INCLUDES = -I${srcdir}/../pfs
+
diff --git a/graphics/pfstools/files/patch-src-filter-Makefile.in b/graphics/pfstools/files/patch-src-filter-Makefile.in
new file mode 100644
index 000000000000..2c983cd4482e
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-Makefile.in
@@ -0,0 +1,58 @@
+--- src/filter/Makefile.in.orig 2011-10-27 08:40:29.000000000 +0000
++++ src/filter/Makefile.in 2014-02-20 19:04:01.556587853 +0000
+@@ -38,7 +38,8 @@
+ pfssize$(EXEEXT) pfsextractchannels$(EXEEXT) \
+ pfspanoramic$(EXEEXT) pfsrotate$(EXEEXT) pfsflip$(EXEEXT) \
+ pfscut$(EXEEXT) pfspad$(EXEEXT) pfscat$(EXEEXT) \
+- pfsabsolute$(EXEEXT) pfsdisplayfunction$(EXEEXT)
++ pfsabsolute$(EXEEXT) pfsdisplayfunction$(EXEEXT) \
++ pfswb$(EXEEXT)
+ subdir = src/filter
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -54,6 +55,9 @@
+ CONFIG_CLEAN_VPATH_FILES =
+ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+ PROGRAMS = $(bin_PROGRAMS)
++am_pfswb_OBJECTS = pfswb.$(OBJEXT)
++pfswb_OBJECTS = $(am_pfswb_OBJECTS)
++pfswb_LDADD = $(LDADD)
+ am_pfsabsolute_OBJECTS = pfsabsolute.$(OBJEXT)
+ pfsabsolute_OBJECTS = $(am_pfsabsolute_OBJECTS)
+ pfsabsolute_LDADD = $(LDADD)
+@@ -120,13 +124,15 @@
+ $(pfscut_SOURCES) $(pfsdisplayfunction_SOURCES) \
+ $(pfsextractchannels_SOURCES) $(pfsflip_SOURCES) \
+ $(pfsgamma_SOURCES) $(pfspad_SOURCES) $(pfspanoramic_SOURCES) \
+- $(pfsrotate_SOURCES) $(pfssize_SOURCES) $(pfstag_SOURCES)
++ $(pfsrotate_SOURCES) $(pfssize_SOURCES) $(pfstag_SOURCES) \
++ $(pfswb_SOURCES)
+ DIST_SOURCES = $(pfsabsolute_SOURCES) $(pfscat_SOURCES) \
+ $(pfsclamp_SOURCES) $(pfscut_SOURCES) \
+ $(pfsdisplayfunction_SOURCES) $(pfsextractchannels_SOURCES) \
+ $(pfsflip_SOURCES) $(pfsgamma_SOURCES) $(pfspad_SOURCES) \
+ $(pfspanoramic_SOURCES) $(pfsrotate_SOURCES) \
+- $(pfssize_SOURCES) $(pfstag_SOURCES)
++ $(pfssize_SOURCES) $(pfstag_SOURCES) \
++ $(pfswb_SOURCES)
+ am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+ am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+@@ -314,6 +320,7 @@
+ pfspad_SOURCES = pfspad.cpp
+ pfscat_SOURCES = pfscat.cpp
+ pfsabsolute_SOURCES = pfsabsolute.cpp
++pfswb_SOURCES = pfswb.cpp
+ INCLUDES = -I${srcdir}/../pfs
+ all: all-am
+
+@@ -392,6 +399,9 @@
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
++pfswb$(EXEEXT): $(pfswb_OBJECTS) $(pfswb_DEPENDENCIES)
++ @rm -f pfswb$(EXEEXT)
++ $(CXXLINK) $(pfswb_LDFLAGS) $(pfswb_OBJECTS) $(pfswb_LDADD) $(LIBS)
+ pfsabsolute$(EXEEXT): $(pfsabsolute_OBJECTS) $(pfsabsolute_DEPENDENCIES)
+ @rm -f pfsabsolute$(EXEEXT)
+ $(CXXLINK) $(pfsabsolute_OBJECTS) $(pfsabsolute_LDADD) $(LIBS)
diff --git a/graphics/pfstools/files/patch-src-filter-pfscat.cpp b/graphics/pfstools/files/patch-src-filter-pfscat.cpp
new file mode 100644
index 000000000000..c2e7e0208f5a
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-pfscat.cpp
@@ -0,0 +1,37 @@
+--- src/filter/pfscat.cpp.orig 2008-01-01 13:01:21.000000000 +0000
++++ src/filter/pfscat.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -27,6 +27,7 @@
+ #include <pfs.h>
+ #include <climits>
+ #include <iostream>
++#include <vector>
+ #include <getopt.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+@@ -202,16 +203,12 @@
+
+ pfs::FrameFileIterator it ( argc, argv, "rb", NULL, NULL, optString, cmdLineOptions);
+ int pipe_no = 0;
+-pfs::FrameFile * ff;
+-ff = (pfs::FrameFile *) malloc ((pipe_no+1) * sizeof(pfs::FrameFile));
+-
++std::vector<pfs::FrameFile> ff;
+ while (1) {
+- ff[pipe_no] = it.getNextFrameFile();
++ ff.push_back(it.getNextFrameFile());
+ if (ff[pipe_no].fh == NULL) break; // no more files
+ pipe_no++;
+- ff=(pfs::FrameFile *) realloc(ff, (pipe_no+1)*sizeof(pfs::FrameFile));
+ }
+-
+ if(pipe_no == 0) { // no named pipes
+ pipe_no = 1;
+ pipes = false;
+@@ -408,7 +405,6 @@
+ }
+
+ for (int i=0; i<pipe_no; i++) it.closeFrameFile(ff[i]);
+-free(ff);
+ }
+
+
diff --git a/graphics/pfstools/files/patch-src-filter-pfsclamp.cpp b/graphics/pfstools/files/patch-src-filter-pfsclamp.cpp
new file mode 100644
index 000000000000..9609aab7de72
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-pfsclamp.cpp
@@ -0,0 +1,13 @@
+--- src/filter/pfsclamp.cpp.orig 2005-11-02 13:35:42.000000000 +0000
++++ src/filter/pfsclamp.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -151,8 +151,8 @@
+ }
+ else
+ {
+- clampMin = (clampMin>1e-4) ? clampMin : 1e-4;
+- clampMax = (clampMax<1e8) ? clampMax : 1e8;
++ clampMin = (clampMin>1e-20) ? clampMin : 1e-20;
++ clampMax = (clampMax<1e+20) ? clampMax : 1e+20;
+ if( clampMin >= clampMax )
+ throw pfs::Exception("incorrect clamping range");
+ }
diff --git a/graphics/pfstools/files/patch-src-filter-pfsextractchannels.cpp b/graphics/pfstools/files/patch-src-filter-pfsextractchannels.cpp
new file mode 100644
index 000000000000..fffd141048ce
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-pfsextractchannels.cpp
@@ -0,0 +1,11 @@
+--- src/filter/pfsextractchannels.cpp.orig 2005-06-15 13:36:54.000000000 +0000
++++ src/filter/pfsextractchannels.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -46,7 +46,7 @@
+ "See man page for more information.\n" );
+ }
+
+-static void errorCheck( bool condition, char *string )
++static void errorCheck( bool condition, char const *string )
+ {
+ if( !condition ) {
+ fprintf( stderr, PROG_NAME " error: %s\n", string );
diff --git a/graphics/pfstools/files/patch-src-filter-pfspanoramic.cpp b/graphics/pfstools/files/patch-src-filter-pfspanoramic.cpp
new file mode 100644
index 000000000000..7421fa68e262
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-pfspanoramic.cpp
@@ -0,0 +1,38 @@
+--- src/filter/pfspanoramic.cpp.orig 2010-02-18 11:27:03.000000000 +0000
++++ src/filter/pfspanoramic.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -93,7 +93,7 @@
+ }
+
+ //TODO: optimize rotations by precomputing sines and cosines
+- Vector3D rotateX(double angle)
++ void rotateX(double angle)
+ {
+ angle *= (M_PI / 180);
+
+@@ -107,7 +107,7 @@
+ z = z2;
+ }
+
+- Vector3D rotateY(double angle)
++ void rotateY(double angle)
+ {
+ angle *= (M_PI / 180);
+
+@@ -121,7 +121,7 @@
+ z = z2;
+ }
+
+- Vector3D rotateZ(double angle)
++ void rotateZ(double angle)
+ {
+ angle *= (M_PI / 180);
+
+@@ -195,7 +195,7 @@
+ {
+ char *opts;
+
+- if(opts = strchr(name, '/'))
++ if ((opts = strchr(name, '/')))
+ {
+ *opts++ = '\0';
+ }
diff --git a/graphics/pfstools/files/patch-src-filter-pfstag.cpp b/graphics/pfstools/files/patch-src-filter-pfstag.cpp
new file mode 100644
index 000000000000..37b8457c8174
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-pfstag.cpp
@@ -0,0 +1,23 @@
+--- src/filter/pfstag.cpp.orig 2005-06-15 13:36:54.000000000 +0000
++++ src/filter/pfstag.cpp 2014-02-20 19:04:01.556587853 +0000
+@@ -58,7 +58,7 @@
+ string channel;
+ };
+
+-typedef list<TagOperation> ListOfTags;
++typedef std::list<TagOperation> ListOfTags;
+
+ TagOperation parseTagOperation( const char *tag, bool remove )
+ {
+@@ -133,9 +133,9 @@
+ for( it = setTags.begin(); it != setTags.end(); it++ ) {
+ TagOperation &tagop = *it;
+ if( tagop.remove )
+- cerr << PROG_NAME ": remove tag '" << tagop.name << "'\n";
++ std::cerr << PROG_NAME ": remove tag '" << tagop.name << "'\n";
+ else
+- cerr << PROG_NAME ": set tag '" << tagop.name << "' to '" << tagop.value << "'\n";
++ std::cerr << PROG_NAME ": set tag '" << tagop.name << "' to '" << tagop.value << "'\n";
+ }
+
+ }
diff --git a/graphics/pfstools/files/patch-src-filter-pfswb.cpp b/graphics/pfstools/files/patch-src-filter-pfswb.cpp
new file mode 100644
index 000000000000..2169cd65bb1a
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-filter-pfswb.cpp
@@ -0,0 +1,300 @@
+--- src/filter/pfswb.cpp.orig 2014-02-20 19:04:01.556587853 +0000
++++ src/filter/pfswb.cpp 2014-02-20 19:06:49.706586923 +0000
+@@ -0,0 +1,297 @@
++/**
++ * @file pfswb.cpp
++ * @brief Adjust white balance in RGB color space
++ *
++ * This file is a part of PFSTOOLS package.
++ * ----------------------------------------------------------------------
++ * Copyright (C) 2008 Iouri V. Ivliev
++ *
++ * This program 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 2 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, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ * ----------------------------------------------------------------------
++ *
++ * @author Iouri V. Ivliev <ii@any.com.ru>
++ *
++ * $Id: $
++ */
++
++#include <config.h>
++
++#include <exception>
++#include <iostream>
++#include <sys/limits.h>
++#include <stdlib.h>
++#include <getopt.h>
++
++#include <pfs.h>
++
++#define PROG_NAME "pfswb"
++
++class QuietException
++{
++};
++
++static void printHelp()
++{
++ std::cerr << PROG_NAME " (" PACKAGE_STRING ") :\n"
++ "\t[--red <val>] [--green <val>] [--blue <val>]\n"
++ "\t[--auto] [--x <val>] [--y <val>] [--width <val>] [--height <val>]\n"
++ "\t[--keep-lum]\n"
++ "\t[--verbose] [--help]\n"
++ "See man page for more information.\n";
++}
++
++// verbose mode
++static bool verbose = false;
++
++// auto WB
++static bool autowb = false;
++// default gray box bounds
++static int x = 0;
++static int y = 0;
++static int width = INT_MAX/2;
++static int height = INT_MAX/2;
++
++// keep original luminance
++static bool keep = false;
++
++// default WB multipliers
++static float red = 1.f;
++static float green = 1.f;
++static float blue = 1.f;
++
++static void multipliers(
++ const pfs::Array2D &R, const pfs::Array2D &G, const pfs::Array2D &B,
++ float &r, float &g, float &b)
++{
++ r = red;
++ g = green;
++ b = blue;
++ if (!autowb) return;
++ // auto WB gray box
++ int w = R.getCols();
++ int h = R.getRows();
++ if (x>=w || y>=h)
++ throw pfs::Exception("gray box is out of frame bounds");
++ int x1 = width+x;
++ if (x1>w) x1 = w;
++ int y1 = height+y;
++ if (y1>h) y1 = h;
++ VERBOSE_STR
++ << "auto WB gray box: "
++ << (x1-x) << "x" << (y1-y) << "+" << x << "+" << y << std::endl;
++ // auto WB multipliers
++ double ar = 0.;
++ double ag = 0.;
++ double ab = 0.;
++ for (int y0=y; y0<y1; ++y0)
++ {
++ for (int x0=x; x0<x1; ++x0)
++ {
++ ar += R(x0,y0);
++ ag += G(x0,y0);
++ ab += B(x0,y0);
++ }
++ }
++ int n = (x1-x)*(y1-y);
++ ar /= n;
++ ag /= n;
++ ab /= n;
++ VERBOSE_STR << "average red value: " << ar << std::endl;
++ VERBOSE_STR << "average green value: " << ag << std::endl;
++ VERBOSE_STR << "average blue value: " << ab << std::endl;
++ float a = (float)((ar+ag+ab)/3.);
++ r *= a/ar;
++ g *= a/ag;
++ b *= a/ab;
++}
++
++static void pfswb()
++{
++ pfs::DOMIO pfsio;
++ VERBOSE_STR << "auto WB: " << (autowb ? "yes" : "no" ) << std::endl;
++ VERBOSE_STR << "base red multiplier value: " << red << std::endl;
++ VERBOSE_STR << "base green multiplier value: " << green << std::endl;
++ VERBOSE_STR << "base blue multiplier value: " << blue << std::endl;
++ VERBOSE_STR << "keep original luminance: " << (keep ? "yes" : "no" ) << std::endl;
++ while (true)
++ {
++ // Read frame
++ pfs::Frame *frame = pfsio.readFrame( stdin );
++ if (!frame)
++ {
++ break; // No more frames
++ }
++ // Get channels
++ pfs::Channel *X, *Y, *Z;
++ frame->getXYZChannels(X, Y, Z);
++ if (!(Y && X && Z))
++ {
++ throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
++ }
++ int w = Y->getCols();
++ int h = Y->getRows();
++ int s = w*h;
++ float min = 1e20, max = -1e20;
++ for (int i=s; i--; )
++ {
++ float const &l = (*Y)(i);
++ if (min > l) min = l;
++ if (max < l) max = l;
++ }
++ VERBOSE_STR << "luminance range of original frame: " << min << ":" << max << std::endl;
++ // Convert from XYZ to RGB
++ pfs::transformColorSpace(pfs::CS_XYZ, X, Y, Z, pfs::CS_RGB, X, Y, Z);
++ // WB adjustment
++ float r, g, b;
++ multipliers(*X,*Y,*Z,r,g,b);
++ VERBOSE_STR << "red multiplier value: " << r << std::endl;
++ VERBOSE_STR << "green multiplier value: " << g << std::endl;
++ VERBOSE_STR << "blue multiplier value: " << b << std::endl;
++ for (int i=s; i--; )
++ {
++ (*X)(i) *= r;
++ (*Y)(i) *= g;
++ (*Z)(i) *= b;
++ }
++ // Convert back to XYZ
++ pfs::transformColorSpace(pfs::CS_RGB, X, Y, Z, pfs::CS_XYZ, X, Y, Z);
++ float amin = 1e20, amax = -1e20;
++ for (int i=s; i--; )
++ {
++ float const &l = (*Y)(i);
++ if (amin > l) amin = l;
++ if (amax < l) amax = l;
++ }
++ VERBOSE_STR << "luminance range of adjusted frame: " << amin << ":" << amax << std::endl;
++ if (keep)
++ {
++ float k = (max-min)/(amax-amin);
++ float nmin = 1e20, nmax = -1e20;
++ for (int i=s; i--; )
++ {
++ float const &l = ((*Y)(i)-amin)*k+min;
++ if (nmin > l) nmin = l;
++ if (nmax < l) nmax = l;
++ (*Y)(i) = l;
++ }
++ VERBOSE_STR << "restored luminance range: " << nmin << ":" << nmax << std::endl;
++ }
++ // Write frame
++ pfsio.writeFrame(frame, stdout);
++ pfsio.freeFrame(frame);
++ }
++}
++
++int main(int argc, char *const argv[])
++{
++ static const struct option cmdLineOptions[] = {
++ { "help", no_argument, NULL, 'h' },
++ { "verbose", no_argument, NULL, 'v' },
++ { "auto", no_argument, NULL, 'A' },
++ { "x", required_argument, NULL, 'X' },
++ { "y", required_argument, NULL, 'Y' },
++ { "width", required_argument, NULL, 'W' },
++ { "height", required_argument, NULL, 'H' },
++ { "keep-lum", no_argument, NULL, 'k' },
++ { "red", required_argument, NULL, 'r' },
++ { "green", required_argument, NULL, 'g' },
++ { "blue", required_argument, NULL, 'b' },
++ { NULL, 0, NULL, 0 }
++ };
++
++ try
++ {
++ int optionIndex = 0;
++ while (true)
++ {
++ int c = getopt_long(argc, argv, "hvAX:Y:W:H:kr:g:b:", cmdLineOptions, &optionIndex);
++ if (c == -1)
++ {
++ break;
++ }
++ switch (c)
++ {
++ case 'h':
++ printHelp();
++ throw QuietException();
++ case 'v':
++ verbose = true;
++ break;
++ case 'A':
++ autowb = true;
++ break;
++ case 'X':
++ x = (int)strtol(optarg, NULL, 10);
++ if (x<=0)
++ throw pfs::Exception("gray box x value out of range, should be >0");
++ break;
++ case 'Y':
++ y = (int)strtol(optarg, NULL, 10);
++ if (y<=0)
++ throw pfs::Exception("gray box y value out of range, should be >0");
++ break;
++ case 'W':
++ width = (int)strtol(optarg, NULL, 10);
++ if (width<=0)
++ throw pfs::Exception("gray box width value out of range, should be >0");
++ break;
++ case 'H':
++ height = (int)strtol(optarg, NULL, 10);
++ if (height<=0)
++ throw pfs::Exception("gray box height value out of range, should be >0");
++ break;
++ case 'k':
++ keep = true;
++ break;
++ case 'r':
++ red = strtof(optarg, NULL);
++ if (red<=0.0f)
++ throw pfs::Exception("red multiplier value out of range, should be >0");
++ break;
++ case 'g':
++ green = strtof(optarg, NULL);
++ if (green<=0.0f)
++ throw pfs::Exception("green multiplier value out of range, should be >0");
++ break;
++ case 'b':
++ blue = strtof(optarg, NULL);
++ if (blue<=0.0f)
++ throw pfs::Exception("blue multiplier value out of range, should be >0");
++ break;
++ case '?':
++ throw QuietException();
++ case ':':
++ throw QuietException();
++ }
++ }
++
++ pfswb();
++ }
++ catch (std::exception ex)
++ {
++ std::cerr << PROG_NAME" std error: " << ex.what() << std::endl;
++ return EXIT_FAILURE;
++ }
++ catch (pfs::Exception ex)
++ {
++ std::cerr << PROG_NAME" error: " << ex.getMessage() << std::endl;
++ return EXIT_FAILURE;
++ }
++ catch (QuietException ex)
++ {
++ return EXIT_FAILURE;
++ }
++ return EXIT_SUCCESS;
++}
diff --git a/graphics/pfstools/files/patch-src-hdrhtml-hdrhtml.cpp b/graphics/pfstools/files/patch-src-hdrhtml-hdrhtml.cpp
new file mode 100644
index 000000000000..a836ec38fb9e
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-hdrhtml-hdrhtml.cpp
@@ -0,0 +1,192 @@
+--- src/hdrhtml/hdrhtml.cpp.orig 2009-03-11 21:45:55.000000000 +0000
++++ src/hdrhtml/hdrhtml.cpp 2014-02-20 19:04:01.566588122 +0000
+@@ -27,6 +27,7 @@
+
+ #include "hdrhtml.h"
+
++#include <limits>
+ #include <algorithm>
+ #include <math.h>
+ #include <fstream>
+@@ -48,6 +49,8 @@
+
+ #include <config.h>
+
++#define log2f(x) ((float)logf(x)/logf(2))
++
+ // ================================================
+ // Parameters controllig the web page
+ // ================================================
+@@ -94,8 +97,8 @@
+
+ if( min_val > max_val ) // missing min/max info
+ {
+- min_val = numeric_limits<T>::max();
+- max_val = numeric_limits<T>::min();
++ min_val = std::numeric_limits<T>::max();
++ max_val = std::numeric_limits<T>::min();
+
+ for( int k=0; k < d_size; k++ ) {
+ if( data[k] > max_val ) max_val = data[k];
+@@ -195,6 +198,7 @@
+ this->y_i = new float[lut_size];
+ own_y_i = true;
+ memcpy(this->y_i, other.y_i, lut_size * sizeof(float));
++ return *this;
+ }
+
+ ~UniformArrayLUT()
+@@ -341,7 +345,7 @@
+ for( int k = 1; k < bin_n; k++ )
+ hist.n[k] += hist.n[k-1];
+
+-// cerr << "d_size: " << d_size << " hist.n: " << hist.n[bin_n-1] << "\n";
++// std::cerr << "d_size: " << d_size << " hist.n: " << hist.n[bin_n-1] << "\n";
+ assert( hist.n[bin_n-1] == d_size );
+ }
+
+@@ -361,7 +365,7 @@
+ // Text template file utils
+ // ================================================
+
+-typedef void (*replace_callback)( ostream &out, void *user_data, const char *parameter );
++typedef void (*replace_callback)( std::ostream &out, void *user_data, const char *parameter );
+
+ class ReplacePattern
+ {
+@@ -403,7 +407,7 @@
+ {
+ }
+
+- virtual void write_replacement( ostream &out, const char *parameter = NULL )
++ virtual void write_replacement( std::ostream &out, const char *parameter = NULL )
+ {
+ if( callback != NULL )
+ callback( out, user_data, parameter );
+@@ -567,7 +571,7 @@
+ // Skip white spaces
+ while( line_str[pos] == ' ' || line_str[pos] == '\t' ) pos++;
+ int new_pos = line_str.find_first_of( ',', pos );
+- int len;
++ size_t len;
+ if( new_pos == std::string::npos ) {
+ if( k != columns-1 ) {
+ std::string full_message( "Missing column data in the file: " );
+@@ -576,16 +580,16 @@
+ }
+ len = std::string::npos;
+ } else
+- len = new_pos-pos;
++ len = (size_t)(new_pos-pos);
+
+ float value;
+ if( len == 0 ) {
+- value = numeric_limits<float>::quiet_NaN();
++ value = std::numeric_limits<float>::quiet_NaN();
+ } else {
+ std::string token = line_str.substr( pos, len );
+ const char *str_beg = token.c_str();
+ char *str_end;
+-// cerr << "token: " << str_beg << "\n";
++// std::cerr << "token: " << str_beg << "\n";
+ value = strtof( str_beg, &str_end );
+ if( str_beg == str_end ) {
+ std::ostringstream error_message;
+@@ -643,15 +647,15 @@
+ basis_table.data[0][k] = log2f( basis_table.data[0][k] );
+
+ // Fix zero and negative values in the image, convert to log2 space, find min and max values
+- float img_min = numeric_limits<float>::max();
+- float img_max = numeric_limits<float>::min();
++ float img_min = std::numeric_limits<float>::max();
++ float img_max = std::numeric_limits<float>::min();
+ {
+ float *arrays[] = { R, G, B, Y };
+ int k;
+
+ for( k = 0; k < 4; k++ ) {
+ float *x = arrays[k];
+- float min_val = numeric_limits<float>::max(), max_val = numeric_limits<float>::min();
++ float min_val = std::numeric_limits<float>::max(), max_val = std::numeric_limits<float>::min();
+ for( int i=0; i < pixels; i++ ) {
+ if( x[i] < min_val && x[i] > 0)
+ min_val = x[i];
+@@ -741,7 +745,7 @@
+ for( int k=1; k <= f8_stops+1; k++ ) {
+
+
+- float max_value = (float)numeric_limits<unsigned short>::max(); //(1<<16) -1;
++ float max_value = (float)std::numeric_limits<unsigned short>::max(); //(1<<16) -1;
+
+ float exp_multip = log2f(1/powf( 2, l_start + k*8 ));
+
+@@ -796,9 +800,9 @@
+
+ }
+
+-void print_image_objects( ostream &out, void *user_data, const char *parameter );
+-void print_cf_table( ostream &out, void *user_data, const char *parameter );
+-void print_image_htmlcode( ostream &out, void *user_data, const char *parameter );
++void print_image_objects( std::ostream &out, void *user_data, const char *parameter );
++void print_cf_table( std::ostream &out, void *user_data, const char *parameter );
++void print_image_htmlcode( std::ostream &out, void *user_data, const char *parameter );
+
+ void HDRHTMLSet::generate_webpage( const char *page_template, const char *image_template,
+ const char *object_output, const char *html_output)
+@@ -852,11 +856,11 @@
+
+ }
+
+-void print_image_objects( ostream &out, void *user_data, const char *parameter )
++void print_image_objects( std::ostream &out, void *user_data, const char *parameter )
+ {
+ HDRHTMLSet *hdrhtml_set = (HDRHTMLSet*)user_data;
+
+- list<HDRHTMLImage>::iterator it;
++ std::list<HDRHTMLImage>::iterator it;
+ for( it = hdrhtml_set->image_list.begin(); it != hdrhtml_set->image_list.end(); it++ ) {
+ std::string obj_name( "hdr_" );
+ obj_name.append( it->base_name );
+@@ -882,7 +886,7 @@
+
+ }
+
+-void print_image_htmlcode( ostream &out, HDRHTMLSet *hdrhtml_set, const HDRHTMLImage &it )
++void print_image_htmlcode( std::ostream &out, HDRHTMLSet *hdrhtml_set, const HDRHTMLImage &it )
+ {
+ std::string obj_name( "hdr_" );
+ obj_name.append( it.base_name );
+@@ -907,13 +911,13 @@
+
+ }
+
+-void print_image_htmlcode( ostream &out, void *user_data, const char *parameter )
++void print_image_htmlcode( std::ostream &out, void *user_data, const char *parameter )
+ {
+ HDRHTMLSet *hdrhtml_set = (HDRHTMLSet*)user_data;
+
+ if( parameter != NULL ) {
+
+- list<HDRHTMLImage>::iterator it;
++ std::list<HDRHTMLImage>::iterator it;
+ for( it = hdrhtml_set->image_list.begin(); it != hdrhtml_set->image_list.end(); it++ ) {
+ if( it->base_name.compare( parameter ) == 0 )
+ break;
+@@ -925,7 +929,7 @@
+
+ } else {
+
+- list<HDRHTMLImage>::iterator it;
++ std::list<HDRHTMLImage>::iterator it;
+ for( it = hdrhtml_set->image_list.begin(); it != hdrhtml_set->image_list.end(); it++ ) {
+
+ print_image_htmlcode( out, hdrhtml_set, *it );
+@@ -935,7 +939,7 @@
+
+ }
+
+-void print_cf_table( ostream &out, void *user_data, const char *parameter )
++void print_cf_table( std::ostream &out, void *user_data, const char *parameter )
+ {
+ CSVTable *cf = (CSVTable*)user_data;
+
diff --git a/graphics/pfstools/files/patch-src-matlab-compatibility.h b/graphics/pfstools/files/patch-src-matlab-compatibility.h
new file mode 100644
index 000000000000..e44f8dd8d1e6
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-matlab-compatibility.h
@@ -0,0 +1,10 @@
+--- src/matlab/compatibility.h.orig 2007-03-01 14:10:57.000000000 +0000
++++ src/matlab/compatibility.h 2014-02-20 19:04:01.566588122 +0000
+@@ -59,6 +59,6 @@
+
+ #endif
+
+-#define DEBUG_STR if(1); else cerr
++#define DEBUG_STR if(1); else std::cerr
+
+ #endif
diff --git a/graphics/pfstools/files/patch-src-pfs-Makefile.in b/graphics/pfstools/files/patch-src-pfs-Makefile.in
index 0f3aa7a07be7..ef59e95192bf 100644
--- a/graphics/pfstools/files/patch-src-pfs-Makefile.in
+++ b/graphics/pfstools/files/patch-src-pfs-Makefile.in
@@ -1,6 +1,6 @@
---- src/pfs/Makefile.in.orig 2008-01-01 14:27:14.000000000 +0000
-+++ src/pfs/Makefile.in 2008-02-12 10:59:44.000000000 +0000
-@@ -243,7 +243,7 @@
+--- src/pfs/Makefile.in.orig 2011-10-27 08:40:30.000000000 +0000
++++ src/pfs/Makefile.in 2014-02-20 19:04:01.566588122 +0000
+@@ -259,7 +259,7 @@
library_includedir = $(includedir)/pfs-1.2
library_include_HEADERS = pfs.h array2d.h
#INCLUDES =
diff --git a/graphics/pfstools/files/patch-src-pfs-pfs.cpp b/graphics/pfstools/files/patch-src-pfs-pfs.cpp
new file mode 100644
index 000000000000..a1469ed98dbf
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-pfs-pfs.cpp
@@ -0,0 +1,29 @@
+--- src/pfs/pfs.cpp.orig 2010-07-14 09:44:27.000000000 +0000
++++ src/pfs/pfs.cpp 2014-02-20 19:04:01.566588122 +0000
+@@ -71,7 +71,7 @@
+ // TagContainer implementation
+ //------------------------------------------------------------------------------
+
+-typedef list<string> TagList;
++typedef std::list<string> TagList;
+
+ class TagIteratorImpl: public TagIterator
+ {
+@@ -570,7 +570,7 @@
+
+ //Read channel IDs and tags
+ // FrameImpl::ChannelID *channelID = new FrameImpl::ChannelID[channelCount];
+- list<ChannelImpl*> orderedChannel;
++ std::list<ChannelImpl*> orderedChannel;
+ for( int i = 0; i < channelCount; i++ ) {
+ char channelName[MAX_CHANNEL_NAME+1], *rs;
+ rs = fgets( channelName, MAX_CHANNEL_NAME, inputStream );
+@@ -592,7 +592,7 @@
+
+
+ //Read channels
+- list<ChannelImpl*>::iterator it;
++ std::list<ChannelImpl*>::iterator it;
+ for( it = orderedChannel.begin(); it != orderedChannel.end(); it++ ) {
+ ChannelImpl *ch = *it;
+ int size = frame->getWidth()*frame->getHeight();
diff --git a/graphics/pfstools/files/patch-src-pfs-pfs.h b/graphics/pfstools/files/patch-src-pfs-pfs.h
new file mode 100644
index 000000000000..72276e7d04fc
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-pfs-pfs.h
@@ -0,0 +1,45 @@
+--- src/pfs/pfs.h.orig 2006-03-01 17:21:16.000000000 +0000
++++ src/pfs/pfs.h 2014-02-20 19:04:01.566588122 +0000
+@@ -115,6 +115,7 @@
+ class TagIterator
+ {
+ public:
++ virtual ~TagIterator() {};
+ /**
+ * Get next item on the list.
+ *
+@@ -135,6 +136,7 @@
+ class TagContainer
+ {
+ public:
++ virtual ~TagContainer() {};
+ /**
+ * Get a string tag of the name tagName from the TagContainer.
+ * @param tagName name of the tag to retrieve
+@@ -181,6 +183,7 @@
+ */
+ class Channel : public Array2D {
+ public:
++ virtual ~Channel() {};
+ /**
+ * Gets width of the channel (in pixels).
+ * This is a synonym for Array2D::getCols().
+@@ -226,6 +229,7 @@
+ class ChannelIterator
+ {
+ public:
++ virtual ~ChannelIterator() {};
+ /**
+ * Get next item on the list.
+ */
+@@ -580,7 +584,9 @@
+ */
+ Exception( const char* const message )
+ {
+- strcpy( msg, message );
++ const size_t s = sizeof(msg)/sizeof(msg[0]) - 1;
++ strncpy( msg, message, s );
++ msg[s] = '\0';
+ }
+
+ ~Exception() {};
diff --git a/graphics/pfstools/files/patch-src-pfs-pfsutils.cpp b/graphics/pfstools/files/patch-src-pfs-pfsutils.cpp
new file mode 100644
index 000000000000..8411a378e87f
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-pfs-pfsutils.cpp
@@ -0,0 +1,11 @@
+--- src/pfs/pfsutils.cpp.orig 2006-09-21 21:42:54.000000000 +0000
++++ src/pfs/pfsutils.cpp 2014-02-20 19:04:01.566588122 +0000
+@@ -81,7 +81,7 @@
+ char fileName[1024];
+ FILE *stdinout;
+
+- typedef list<FilePattern> PatternList;
++ typedef std::list<FilePattern> PatternList;
+
+ PatternList patternList;
+ PatternList::iterator currentPattern;
diff --git a/graphics/pfstools/files/patch-src-pfsglview-picture_io.cpp b/graphics/pfstools/files/patch-src-pfsglview-picture_io.cpp
new file mode 100644
index 000000000000..3e0a7b5faf04
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-pfsglview-picture_io.cpp
@@ -0,0 +1,29 @@
+--- src/pfsglview/picture_io.cpp.orig 2006-11-20 12:13:13.000000000 +0000
++++ src/pfsglview/picture_io.cpp 2014-02-20 19:04:01.566588122 +0000
+@@ -87,7 +87,7 @@
+ return;
+
+ // only XYZ channels are taken into consideration
+- if( channel != "XYZ" && channel != "X00" && channel != "0Y0" && channel != "00Z" ) {
++ if (strcmp(channel,"XYZ") && strcmp(channel,"X00") && strcmp(channel,"0Y0") && strcmp(channel,"00Z")) {
+ if(verbose)
+ fprintf( stderr, "WARNING: wrong channel (PictureIO::setFrame())\n");
+ return;
+@@ -573,7 +573,7 @@
+ }
+ std::sort(vec.begin(), vec.end());
+
+- printf("size: %d\n", vec.size());
++ printf("size: %lu\n", vec.size());
+
+ val = vec[0];
+ std::vector<unsigned int> svec;
+@@ -589,7 +589,7 @@
+
+ float dr = svec[ svec.size()-1] / svec[0];
+
+- printf("min:%ld max:%ld svec size: %d dr:%f\n", vec[0], vec[ vec.size()-1], svec.size(), log10(dr));
++ printf("min:%u max:%u svec size: %lu dr:%f\n", vec[0], vec[ vec.size()-1], svec.size(), log10(dr));
+
+
+
diff --git a/graphics/pfstools/files/patch-src-pfsglview-picture_io.h b/graphics/pfstools/files/patch-src-pfsglview-picture_io.h
new file mode 100644
index 000000000000..015dfbb8ecd1
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-pfsglview-picture_io.h
@@ -0,0 +1,13 @@
+--- src/pfsglview/picture_io.h.orig 2008-07-29 16:14:30.000000000 +0000
++++ src/pfsglview/picture_io.h 2014-02-20 19:04:01.566588122 +0000
+@@ -6,7 +6,9 @@
+
+ #define MAX_FRAMES_IN_MEMORY 10
+
+-class pfs::Frame;
++namespace pfs {
++class Frame;
++};
+ enum LumMappingMethod {
+ MAP_LINEAR,
+ MAP_GAMMA1_4,
diff --git a/graphics/pfstools/files/patch-src-pfsview-pfsview_widget.cpp b/graphics/pfstools/files/patch-src-pfsview-pfsview_widget.cpp
new file mode 100644
index 000000000000..3491ffaeeaf4
--- /dev/null
+++ b/graphics/pfstools/files/patch-src-pfsview-pfsview_widget.cpp
@@ -0,0 +1,22 @@
+--- src/pfsview/pfsview_widget.cpp.orig 2011-04-30 14:01:17.000000000 +0000
++++ src/pfsview/pfsview_widget.cpp 2014-02-20 19:04:01.566588122 +0000
+@@ -142,7 +142,7 @@
+ // Chose first available channel
+ pfs::ChannelIterator *it = frame->getChannels();
+ if( !it->hasNext() ) // TODO: failover
+- throw new pfs::Exception( "No channels available!" );
++ throw pfs::Exception( "No channels available!" );
+ visibleChannel = it->getNext()->getName();
+ } else if( visibleChannel != COLOR_CHANNELS ) {
+ // Get a new pointer, as the old frame object
+@@ -335,8 +335,8 @@
+ assert( !color || (color && B != NULL) );
+
+
+- float lutPixFloor[257*2];
+- QRgb lutPixel[257*2];
++ float lutPixFloor[257*2+1];
++ QRgb lutPixel[257*2+1];
+ int lutSize;
+ if( !color && ( negativeTreatment == NEGATIVE_GREEN_SCALE ||
+ negativeTreatment == NEGATIVE_ABSOLUTE ) ) { // Handle negative numbers
diff --git a/graphics/pfstools/pkg-descr b/graphics/pfstools/pkg-descr
index 9b5a6b3558c6..19e35ba14c0c 100644
--- a/graphics/pfstools/pkg-descr
+++ b/graphics/pfstools/pkg-descr
@@ -1,4 +1,4 @@
A set of command line (and one GUI) programs for reading, writing, manipulating
and viewing high-dynamic range (HDR) images and video frames.
-WWW: http://www.mpi-inf.mpg.de/resources/pfstools/
+WWW: http://pfstools.sourceforge.net/
diff --git a/graphics/pfstools/pkg-plist b/graphics/pfstools/pkg-plist
index 4557fd9d57f6..90421987b5e8 100644
--- a/graphics/pfstools/pkg-plist
+++ b/graphics/pfstools/pkg-plist
@@ -19,37 +19,44 @@ bin/pfscut
bin/pfspad
bin/pfscat
bin/pfsabsolute
-%%PPM%%bin/pfsinppm
-%%PPM%%bin/pfsoutppm
-%%EXR%%bin/pfsinexr
-%%EXR%%bin/pfsoutexr
+bin/pfsdisplayfunction
+bin/pfswb
+%%IMAGEMAGICK%%bin/pfsouthdrhtml
+%%NETPBM%%bin/pfsinppm
+%%NETPBM%%bin/pfsoutppm
+%%OPENEXR%%bin/pfsinexr
+%%OPENEXR%%bin/pfsoutexr
%%TIFF%%bin/pfsintiff
%%TIFF%%bin/pfsouttiff
-%%IM%%bin/pfsinimgmagick
-%%IM%%bin/pfsoutimgmagick
+%%IMAGEMAGICK%%bin/pfsinimgmagick
+%%IMAGEMAGICK%%bin/pfsoutimgmagick
%%QT%%bin/pfsview
%%QT%%bin/pfsv
%%OCTAVE%%bin/pfsoctavelum
%%OCTAVE%%bin/pfsoctavergb
%%OCTAVE%%bin/pfsstat
-%%GL%%bin/pfsglview
+%%OPENGL%%bin/pfsglview
+%%GDAL%%bin/pfsingdal
include/pfs-1.2/pfs.h
include/pfs-1.2/array2d.h
-lib/libpfs-1.2.a
-lib/libpfs-1.2.la
-lib/libpfs-1.2.so
+lib/libpfs-1.2.so.0.0.0
lib/libpfs-1.2.so.0
+lib/libpfs-1.2.so
+lib/libpfs-1.2.a
libdata/pkgconfig/pfs.pc
man/man1/pfsabsolute.1.gz
man/man1/pfscat.1.gz
man/man1/pfsclamp.1.gz
man/man1/pfscut.1.gz
+man/man1/pfsdisplayfunction.1.gz
man/man1/pfsextractchannels.1.gz
man/man1/pfsflip.1.gz
man/man1/pfsgamma.1.gz
+%%OPENGL%%man/man1/pfsglview.1.gz
man/man1/pfsin.1.gz
man/man1/pfsindcraw.1.gz
man/man1/pfsinexr.1.gz
+man/man1/pfsingdal.1.gz
man/man1/pfsinimgmagick.1.gz
man/man1/pfsinjpeghdr.1.gz
man/man1/pfsinmulti.1.gz
@@ -57,9 +64,12 @@ man/man1/pfsinpfm.1.gz
man/man1/pfsinppm.1.gz
man/man1/pfsinrgbe.1.gz
man/man1/pfsintiff.1.gz
+%%OCTAVE%%man/man1/pfsoctavelum.1.gz
+%%OCTAVE%%man/man1/pfsoctavergb.1.gz
man/man1/pfsout.1.gz
man/man1/pfsoutexr.1.gz
man/man1/pfsoutffmpeg.1.gz
+%%IMAGEMAGICK%%man/man1/pfsouthdrhtml.1.gz
man/man1/pfsoutimgmagick.1.gz
man/man1/pfsoutjpeghdr.1.gz
man/man1/pfsoutpfm.1.gz
@@ -70,37 +80,56 @@ man/man1/pfspad.1.gz
man/man1/pfspanoramic.1.gz
man/man1/pfsrotate.1.gz
man/man1/pfssize.1.gz
+%%OCTAVE%%man/man1/pfsstat.1.gz
man/man1/pfstag.1.gz
-%%OCTAVE%%@cwd %%OCTAVE_BASE%%
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfsclose.oct
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfsget.oct
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfsopen.oct
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfsput.oct
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfsread.oct
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfstransform_colorspace.oct
-%%OCTAVE%%libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools/pfswrite.oct
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfs_close_frames.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfs_open_frames.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfs_read_luminance.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfs_read_rgb.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfs_read_xyz.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfs_write_rgb.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfssize.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfsview.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfsview_list.m
-%%OCTAVE%%share/octave/%%OCTAVE_VERSION%%/site/m/pfstools/pfsview_rgb.m
-%%OCTAVE%%@cwd %%PFS_BASE%%
+%%QT%%man/man1/pfsv.1.gz
+%%QT%%man/man1/pfsview.1.gz
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_c_b2.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_t_b2.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_c_b3.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_t_b3.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_c_b4.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_t_b4.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_c_b5.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_t_b5.csv
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_default_templ/hdrhtml_page_templ.html
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_default_templ/hdrhtml_image_templ.html
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/loading-spinner.gif
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/information-red.png
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-red.png
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/hdr_viewer.js
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-black.png
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/information.png
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/mouse2touch.js
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/mootools-1.2.4.js
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/hdr_viewer.css
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-white.png
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_page_templ.html
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_image_templ_slider-above.html
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_image_templ.html
+%%IMAGEMAGICK%%%%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_page_templ_short.html
@dirrm include/pfs-1.2
+%%IMAGEMAGICK%%@dirrm %%DATADIR%%/hdrhtml_hdrlabs_templ/hdrhtml_assets
+%%IMAGEMAGICK%%@dirrm %%DATADIR%%/hdrhtml_hdrlabs_templ
+%%IMAGEMAGICK%%@dirrm %%DATADIR%%/hdrhtml_default_templ
+%%IMAGEMAGICK%%@dirrm %%DATADIR%%
%%OCTAVE%%@cwd %%OCTAVE_BASE%%
-%%OCTAVE%%@dirrm share/octave/%%OCTAVE_VERSION%%/site/m/pfstools
-%%OCTAVE%%@dirrmtry share/octave/%%OCTAVE_VERSION%%/site/m
-%%OCTAVE%%@dirrmtry share/octave/%%OCTAVE_VERSION%%/site
-%%OCTAVE%%@dirrmtry share/octave/%%OCTAVE_VERSION%%
-%%OCTAVE%%@dirrmtry share/octave
-%%OCTAVE%%@dirrm libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%/pfstools
-%%OCTAVE%%@dirrmtry libexec/octave/%%OCTAVE_VERSION%%/site/oct/%%BUILD%%
-%%OCTAVE%%@dirrmtry libexec/octave/%%OCTAVE_VERSION%%/site/oct
-%%OCTAVE%%@dirrmtry libexec/octave/%%OCTAVE_VERSION%%/site
-%%OCTAVE%%@dirrmtry libexec/octave/%%OCTAVE_VERSION%%
-%%OCTAVE%%@dirrmtry libexec/octave
-%%OCTAVE%%@cwd %%PFS_BASE%%
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfsclose.oct
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfsget.oct
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfsopen.oct
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfsput.oct
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfsread.oct
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfstransform_colorspace.oct
+%%OCTAVE%%%%OCTAVE_SITE_OCT%%/pfstools/pfswrite.oct
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfs_close_frames.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfs_open_frames.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfs_read_luminance.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfs_read_rgb.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfs_read_xyz.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfs_write_rgb.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfssize.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfsview.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfsview_list.m
+%%OCTAVE%%%%OCTAVE_SITE_M%%/pfstools/pfsview_rgb.m
+%%OCTAVE%%@dirrm %%OCTAVE_SITE_OCT%%/pfstools
+%%OCTAVE%%@dirrm %%OCTAVE_SITE_M%%/pfstools