Package: hugin
Version: 0.7.0-2
Severity: normal
Hugin embeds a slightly modified version of the VIGRA 1.5 library.
However, this library is already packaged for Debian[1]. It would be
great if the necessary changes were pushed to VIGRA's upstream and Hugin
started to use/link system version of the library, rather than an
embedded copy.
I attach diffs between VIGRA 1.5 and the code present in the Hugin
sources. Please note that VIGRA 1.6 has been already released (although
it is not yet in Debian[2]), so some of the missing features might have
been already implemented upstream.
[1] http://packages.qa.debian.org/libvigraimpex
[2] http://lists.debian.org/debian-mentors/2009/08/msg00262.html
--
Jakub Wilk
diff -urb libvigraimpex-1.5.0/include/vigra/codec.hxx hugin-0.7.0/src/foreign/vigra/vigra/codec.hxx
--- libvigraimpex-1.5.0/include/vigra/codec.hxx 2006-12-07 21:52:07.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra/codec.hxx 2008-09-14 23:00:41.000000000 +0200
@@ -65,11 +65,11 @@
// "undefined", "RLE", "LZW", "LOSSLESS", "JPEG", "DEFLATE"
// possible file types:
-// "undefined", "TIFF", "VIFF", "JPEG", "PNG", "PNM", "BMP", "SUN", "XPM"
+// "undefined", "TIFF", "VIFF", "JPEG", "PNG", "PNM", "BMP", "SUN", "XPM", "EXR"
// possible name extensions:
// "undefined", "tif", "tiff", "jpg", "jpeg", "png", "pnm", "bmp", "sun",
-// "xpm" (also capital forms)
+// "xpm", "exr" (also capital forms)
namespace vigra
{
@@ -165,6 +165,12 @@
return vigra::Diff2D();
}
+ virtual vigra::Size2D getCanvasSize() const
+ {
+ return vigra::Size2D(this->getWidth(), this->getHeight());
+ }
+
+
virtual unsigned int getOffset() const = 0;
virtual const void * currentScanlineOfBand( unsigned int ) const = 0;
@@ -200,6 +206,11 @@
virtual void setPosition( const vigra::Diff2D & pos )
{
}
+
+ virtual void setCanvasSize( const vigra::Size2D & size)
+ {
+ }
+
virtual void setXResolution( float xres )
{
}
diff -urb libvigraimpex-1.5.0/include/vigra/config.hxx hugin-0.7.0/src/foreign/vigra/vigra/config.hxx
--- libvigraimpex-1.5.0/include/vigra/config.hxx 2006-12-07 21:52:07.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra/config.hxx 2008-09-14 23:00:41.000000000 +0200
@@ -108,7 +108,7 @@
#elif defined(VIGRA_STATIC_LIB)
#define VIGRA_EXPORT
#else
- #define VIGRA_EXPORT __declspec(dllimport)
+ #define VIGRA_EXPORT
#endif
#endif // _MSC_VER
diff -urb libvigraimpex-1.5.0/include/vigra/error.hxx hugin-0.7.0/src/foreign/vigra/vigra/error.hxx
--- libvigraimpex-1.5.0/include/vigra/error.hxx 2006-12-07 21:52:07.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra/error.hxx 2008-09-14 23:00:41.000000000 +0200
@@ -42,6 +42,8 @@
#include <stdexcept>
#include <stdio.h>
#include <string>
+#include <iostream>
+
#include "config.hxx"
/*! \page ErrorReporting Error Reporting
@@ -131,11 +133,13 @@
char const * file, int line)
{
sprintf(what_, "\n%.30s\n%.900s\n(%.100s:%d)\n", prefix, message, file, line);
+ std::cerr << "ContractViolation: " << what_ << std::endl;
}
ContractViolation(char const * prefix, char const * message)
{
sprintf(what_, "\n%.30s\n%.900s\n", prefix, message);
+ std::cerr << "ContractViolation: " << what_ << std::endl;
}
virtual const char * what() const throw()
diff -urb libvigraimpex-1.5.0/include/vigra/imageinfo.hxx hugin-0.7.0/src/foreign/vigra/vigra/imageinfo.hxx
--- libvigraimpex-1.5.0/include/vigra/imageinfo.hxx 2006-12-07 21:52:08.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra/imageinfo.hxx 2008-09-14 23:00:41.000000000 +0200
@@ -265,7 +265,7 @@
/** Set the position of the upper Left corner on a global
canvas.
- Currently only supported by TIFF and PNG files.
+ Currently only supported by TIFF, PNG and OpenEXR files.
The offset is encoded in the XPosition and YPosition TIFF tags.
@@ -279,6 +279,19 @@
**/
VIGRA_EXPORT Diff2D getPosition() const;
+
+ /** Get the size of the canvas, on which the image is positioned at
+ getPosition()
+ **/
+ VIGRA_EXPORT Size2D getCanvasSize() const;
+
+
+ /** Get the size of the canvas, on which the image is positioned at
+ getPosition()
+ **/
+ VIGRA_EXPORT ImageExportInfo & setCanvasSize(const Size2D & size);
+
+
/**
ICC profiles (handled as raw data so far).
see getICCProfile()/setICCProfile()
@@ -299,6 +312,7 @@
std::string m_filename, m_filetype, m_pixeltype, m_comp;
float m_x_res, m_y_res;
Diff2D m_pos;
+ Size2D m_canvas_size;
ICCProfile m_icc_profile;
};
@@ -416,6 +430,12 @@
**/
VIGRA_EXPORT Diff2D getPosition() const;
+ /** Get the size of the canvas, on which the image is positioned at
+ getPosition()
+ **/
+ VIGRA_EXPORT Size2D getCanvasSize() const;
+
+
/** Returns the image resolution in horizontal direction
**/
VIGRA_EXPORT float getXResolution() const;
@@ -442,6 +462,7 @@
int m_width, m_height, m_num_bands, m_num_extra_bands;
float m_x_res, m_y_res;
Diff2D m_pos;
+ Size2D m_canvas_size;
ICCProfile m_icc_profile;
};
diff -urb libvigraimpex-1.5.0/include/vigra/impex.hxx hugin-0.7.0/src/foreign/vigra/vigra/impex.hxx
--- libvigraimpex-1.5.0/include/vigra/impex.hxx 2006-12-07 21:52:08.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra/impex.hxx 2008-09-14 23:00:41.000000000 +0200
@@ -789,8 +789,10 @@
typedef typename AccessorValueType::value_type SrcValueType;
std::string pixeltype = info.getPixelType();
std::auto_ptr<Encoder> enc = encoder(info);
- bool downcast = negotiatePixelType(enc->getFileType(),
- TypeAsString<SrcValueType>::result(), pixeltype);
+ // dangelo: never ever downcast! This wrecks HAVOC on floating point images.
+ //bool downcast = negotiatePixelType(enc->getFileType(),
+ // TypeAsString<SrcValueType>::result(), pixeltype);
+ bool downcast = false;
enc->setPixelType(pixeltype);
if(pixeltype == "UINT8")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, (UInt8)0);
Only in hugin-0.7.0/src/foreign/vigra/vigra: vigra.vcproj
diff -urb libvigraimpex-1.5.0/include/vigra/windows.h hugin-0.7.0/src/foreign/vigra/vigra/windows.h
--- libvigraimpex-1.5.0/include/vigra/windows.h 2006-12-07 21:52:06.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra/windows.h 2008-09-14 23:00:41.000000000 +0200
@@ -43,7 +43,9 @@
#if defined(_WIN32)
# define VC_EXTRALEAN
+#ifndef NOMINMAX
# define NOMINMAX
+#endif
# include <windows.h>
# undef NOMINMAX
# ifdef DIFFERENCE
Only in libvigraimpex-1.5.0/src/impex/: .cvsignore
Only in hugin-0.7.0/src/foreign/vigra/vigra_impex/: CMakeLists.txt
Only in libvigraimpex-1.5.0/src/impex/: Makefile
Only in libvigraimpex-1.5.0/src/impex/: Makefile.in
diff -urb libvigraimpex-1.5.0/src/impex/codecmanager.cxx hugin-0.7.0/src/foreign/vigra/vigra_impex/codecmanager.cxx
--- libvigraimpex-1.5.0/src/impex/codecmanager.cxx 2006-12-07 21:52:12.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/codecmanager.cxx 2008-09-14 23:00:41.000000000 +0200
@@ -35,6 +35,8 @@
/* */
/************************************************************************/
+#include <hugin_config.h>
+
#include <fstream>
#include <algorithm>
#include <cctype> // std::tolower
@@ -56,6 +58,7 @@
#include "bmp.hxx"
#include "gif.hxx"
#include "hdr.hxx"
+#include "exr.hxx"
namespace vigra
{
@@ -77,6 +80,9 @@
#ifdef HasTIFF
import( new TIFFCodecFactory() );
#endif
+#ifdef HasEXR
+ import( new ExrCodecFactory() );
+#endif
import( new SunCodecFactory() );
import( new PnmCodecFactory() );
import( new ViffCodecFactory() );
@@ -224,16 +230,15 @@
std::string fileType = filetype;
if ( fileType == "undefined" ) {
-
fileType = getFileTypeByMagicString(filename);
- vigra_precondition( !fileType.empty(),
- "did not find a matching file type." );
-
#ifdef DEBUG
std::cerr << "detected " << fileType
<< " file format by magicstring of " << filename
<< std::endl;
#endif
+ vigra_precondition( !fileType.empty(),
+ "did not find a matching file type." );
+
}
// return a codec factory by the file type
Only in hugin-0.7.0/src/foreign/vigra/vigra_impex/: exr.cxx
Only in hugin-0.7.0/src/foreign/vigra/vigra_impex/: exr.hxx
diff -urb libvigraimpex-1.5.0/src/impex/hdr.cxx hugin-0.7.0/src/foreign/vigra/vigra_impex/hdr.cxx
--- libvigraimpex-1.5.0/src/impex/hdr.cxx 2006-12-07 21:52:13.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/hdr.cxx 2008-09-14 23:00:41.000000000 +0200
@@ -356,7 +356,7 @@
{
VIGRA_IMPEX_FINALIZED(pimpl->finalized);
if ( pixeltype != "FLOAT" )
- vigra_fail( "internal error: pixeltype not supported." );
+ vigra_fail( "internal error: pixeltype " + pixeltype + " not supported." );
pimpl->pixeltype = "FLOAT";
}
diff -urb libvigraimpex-1.5.0/src/impex/iccjpeg.c hugin-0.7.0/src/foreign/vigra/vigra_impex/iccjpeg.c
--- libvigraimpex-1.5.0/src/impex/iccjpeg.c 2006-12-07 21:52:06.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/iccjpeg.c 2008-09-14 23:00:41.000000000 +0200
@@ -54,6 +54,8 @@
* license.
*/
+#include <hugin_config.h>
+
#ifdef HasJPEG
#include <stdlib.h> /* define malloc() */
diff -urb libvigraimpex-1.5.0/src/impex/iccjpeg.h hugin-0.7.0/src/foreign/vigra/vigra_impex/iccjpeg.h
--- libvigraimpex-1.5.0/src/impex/iccjpeg.h 2006-12-07 21:52:06.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/iccjpeg.h 2008-09-14 23:00:41.000000000 +0200
@@ -24,9 +24,12 @@
#ifdef HasJPEG
+
#include <stdio.h> /* needed to define "FILE", "NULL" */
# include <jpeglib.h>
-
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* This routine writes the given ICC profile data into a JPEG file.
* It *must* be called AFTER calling jpeg_start_compress() and BEFORE
@@ -79,6 +82,10 @@
JOCTET **icc_data_ptr,
unsigned int *icc_data_len));
+#ifdef __cplusplus
+}
+#endif
+
#endif
#endif
diff -urb libvigraimpex-1.5.0/src/impex/imageinfo.cxx hugin-0.7.0/src/foreign/vigra/vigra_impex/imageinfo.cxx
--- libvigraimpex-1.5.0/src/impex/imageinfo.cxx 2006-12-07 21:52:13.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/imageinfo.cxx 2008-09-14 23:00:41.000000000 +0200
@@ -347,6 +347,20 @@
return *this;
}
+vigra::Size2D ImageExportInfo::getCanvasSize() const
+{
+ return m_canvas_size ;
+}
+
+
+ImageExportInfo & ImageExportInfo::setCanvasSize(const Size2D & size)
+{
+ //std::cerr << "ImageExportInfo: setting canvas size: " << size << std::endl;
+ m_canvas_size = size;
+ return *this;
+}
+
+
vigra::Diff2D ImageExportInfo::getPosition() const
{
return m_pos;
@@ -415,6 +429,7 @@
enc->setXResolution(info.getXResolution());
enc->setYResolution(info.getYResolution());
enc->setPosition(info.getPosition());
+ enc->setCanvasSize(info.getCanvasSize());
if ( info.getICCProfile().size() > 0 ) {
enc->setICCProfile(info.getICCProfile());
@@ -437,6 +452,7 @@
m_num_bands = decoder->getNumBands();
m_num_extra_bands = decoder->getNumExtraBands();
m_pos = decoder->getPosition();
+ m_canvas_size = decoder->getCanvasSize();
m_icc_profile = decoder->getICCProfile();
@@ -527,6 +543,12 @@
return m_pos;
}
+Size2D ImageImportInfo::getCanvasSize() const
+{
+ return m_canvas_size;
+}
+
+
float ImageImportInfo::getXResolution() const
{
return m_x_res;
Only in libvigraimpex-1.5.0/src/impex/: impex.dev
Only in libvigraimpex-1.5.0/src/impex/: impex.dsp
Only in libvigraimpex-1.5.0/src/impex/: impex.vcproj
diff -urb libvigraimpex-1.5.0/src/impex/jpeg.cxx hugin-0.7.0/src/foreign/vigra/vigra_impex/jpeg.cxx
--- libvigraimpex-1.5.0/src/impex/jpeg.cxx 2006-12-07 21:52:13.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/jpeg.cxx 2008-09-14 23:00:41.000000000 +0200
@@ -40,6 +40,8 @@
* - Added ICC support.
*/
+#include <hugin_config.h>
+
#ifdef HasJPEG
#include <stdexcept>
@@ -362,7 +364,7 @@
#else
: file( filename.c_str(), "w" ),
#endif
- scanline(0), quality(-1), finalized(false)
+ scanline(0), quality(100), finalized(false)
{
// setup setjmp() error handling
info.err = jpeg_std_error( ( jpeg_error_mgr * ) &err );
diff -urb libvigraimpex-1.5.0/src/impex/png.cxx hugin-0.7.0/src/foreign/vigra/vigra_impex/png.cxx
--- libvigraimpex-1.5.0/src/impex/png.cxx 2006-12-07 21:52:13.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/png.cxx 2008-09-14 23:00:41.000000000 +0200
@@ -44,6 +44,7 @@
* - Added support for x and y resolution fields.
*/
+#include <hugin_config.h>
#ifdef HasPNG
#include "vigra/config.hxx"
diff -urb libvigraimpex-1.5.0/src/impex/tiff.cxx hugin-0.7.0/src/foreign/vigra/vigra_impex/tiff.cxx
--- libvigraimpex-1.5.0/src/impex/tiff.cxx 2006-12-07 21:52:13.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/tiff.cxx 2008-09-14 23:00:41.000000000 +0200
@@ -53,6 +53,8 @@
* Andrew Mihal's modifications are covered by the VIGRA license.
*/
+#include <hugin_config.h>
+
#ifdef HasTIFF
#ifdef _MSC_VER
@@ -73,6 +75,7 @@
{
#include <tiff.h>
#include <tiffio.h>
+#include <tiffvers.h>
}
namespace vigra {
@@ -97,15 +100,20 @@
desc.pixelTypes[8] = "DOUBLE";
// init compression types
- desc.compressionTypes.resize(5);
+ desc.compressionTypes.resize(6);
desc.compressionTypes[0] = "NONE";
desc.compressionTypes[1] = "RLE";
- desc.compressionTypes[2] = "JPEG";
- desc.compressionTypes[3] = "LZW";
- desc.compressionTypes[4] = "DEFLATE";
+ desc.compressionTypes[2] = "PACKBITS";
+ desc.compressionTypes[3] = "JPEG";
+ desc.compressionTypes[4] = "LZW";
+ desc.compressionTypes[5] = "DEFLATE";
// init magic strings
+#if TIFFLIB_VERSION > 20070712
+ desc.magicStrings.resize(3);
+#else
desc.magicStrings.resize(2);
+#endif
desc.magicStrings[0].resize(4);
desc.magicStrings[0][0] = '\115';
desc.magicStrings[0][1] = '\115';
@@ -116,6 +124,14 @@
desc.magicStrings[1][1] = '\111';
desc.magicStrings[1][2] = '\052';
desc.magicStrings[1][3] = '\000';
+#if TIFFLIB_VERSION > 20070712
+ // magic for bigtiff
+ desc.magicStrings[2].resize(4);
+ desc.magicStrings[2][0] = '\111';
+ desc.magicStrings[2][1] = '\111';
+ desc.magicStrings[2][2] = '\053';
+ desc.magicStrings[2][3] = '\000';
+#endif
// init file extensions
desc.fileExtensions.resize(2);
@@ -160,6 +176,7 @@
photometric, planarconfig, fillorder, extra_samples_per_pixel;
float x_resolution, y_resolution;
Diff2D position;
+ Size2D canvasSize;
Decoder::ICCProfile iccProfile;
@@ -384,7 +401,8 @@
// get bits per pixel
if ( !TIFFGetField( tiff, TIFFTAG_BITSPERSAMPLE, &bits_per_sample ) )
{
- std::cerr << "Warning: no TIFFTAG_BITSPERSAMPLE, using 8 bits per sample.\n";
+ // dangelo: commented out
+ //std::cerr << "Warning: no TIFFTAG_BITSPERSAMPLE, using 8 bits per sample.\n";
bits_per_sample = 8;
}
// get pixeltype
@@ -420,8 +438,9 @@
vigra_fail( "TIFFDecoderImpl::init(): Sampleformat or Datatype tag undefined and guessing sampletype from Bits per Sample failed." );
break;
}
- std::cerr << "Warning: no TIFFTAG_SAMPLEFORMAT or TIFFTAG_DATATYPE, "
- "guessing pixeltype '" << pixeltype << "'.\n";
+ // dangelo commented out warnings
+ // std::cerr << "Warning: no TIFFTAG_SAMPLEFORMAT or TIFFTAG_DATATYPE, "
+ // "guessing pixeltype '" << pixeltype << "'.\n";
}
}
@@ -437,6 +456,7 @@
// other fields
uint16 u16value;
+ uint32 u32value;
float unitLength = 1;
if (TIFFGetField( tiff, TIFFTAG_RESOLUTIONUNIT, &u16value )) {
switch (u16value) {
@@ -474,6 +494,20 @@
position.y = (int)floor(fvalue + 0.5);
}
+ // canvas size
+ if (TIFFGetField( tiff, TIFFTAG_PIXAR_IMAGEFULLWIDTH, &u32value )) {
+ canvasSize.x = u32value;
+ }
+ if (TIFFGetField( tiff, TIFFTAG_PIXAR_IMAGEFULLLENGTH, &u32value )) {
+ canvasSize.y = u32value;
+ }
+
+ if ((uint32)canvasSize.x < position.x + width || (uint32)canvasSize.y < position.y + height)
+ {
+ //std::cerr << "Warning: invalid TIFFTAG_PIXAR_IMAGEFULLWIDTH/LENGTH tags" << std::endl;
+ canvasSize.x = canvasSize.y = 0;
+ }
+
// ICC Profile
UInt32 iccProfileLength = 0;
const unsigned char *iccProfilePtr = NULL;
@@ -622,6 +656,11 @@
return pimpl->position;
}
+ vigra::Size2D TIFFDecoder::getCanvasSize() const
+ {
+ return pimpl->canvasSize;
+ }
+
std::string TIFFDecoder::getPixelType() const
{
return pimpl->pixeltype;
@@ -723,6 +762,8 @@
tiffcomp = COMPRESSION_OJPEG;
else if ( comp == "RLE" || comp == "RunLength")
tiffcomp = COMPRESSION_CCITTRLE;
+ else if ( comp == "PACKBITS")
+ tiffcomp = COMPRESSION_PACKBITS;
else if ( comp == "LZW" )
tiffcomp = COMPRESSION_LZW;
else if ( comp == "DEFLATE" )
@@ -821,6 +862,16 @@
TIFFSetField( tiff, TIFFTAG_YPOSITION, position.y / y_resolution);
}
+ if ((uint32)canvasSize.x >= position.x + width
+ && (uint32)canvasSize.y >= position.y + height)
+ {
+ //std::cerr << "Setting canvas size: " << canvasSize << std::endl;
+ TIFFSetField( tiff, TIFFTAG_PIXAR_IMAGEFULLWIDTH, canvasSize.x);
+ TIFFSetField( tiff, TIFFTAG_PIXAR_IMAGEFULLLENGTH, canvasSize.y);
+ } else {
+ //std::cerr << "Invalid canvas size: " << canvasSize << std::endl;
+ }
+
// Set ICC profile, if available.
if (iccProfile.size()) {
TIFFSetField(tiff, TIFFTAG_ICCPROFILE,
@@ -889,6 +940,13 @@
pimpl->position = pos;
}
+ void TIFFEncoder::setCanvasSize( const vigra::Size2D & size )
+ {
+ //std::cerr << "TIFF: setting canvas size: " << size << std::endl;
+ VIGRA_IMPEX_FINALIZED(pimpl->finalized);
+ pimpl->canvasSize = size;
+ }
+
void TIFFEncoder::setXResolution( float xres )
{
VIGRA_IMPEX_FINALIZED(pimpl->finalized);
diff -urb libvigraimpex-1.5.0/src/impex/tiff.hxx hugin-0.7.0/src/foreign/vigra/vigra_impex/tiff.hxx
--- libvigraimpex-1.5.0/src/impex/tiff.hxx 2006-12-07 21:52:13.000000000 +0100
+++ hugin-0.7.0/src/foreign/vigra/vigra_impex/tiff.hxx 2008-09-14 23:00:41.000000000 +0200
@@ -82,6 +82,8 @@
unsigned int getNumExtraBands() const;
Diff2D getPosition() const;
+ Size2D getCanvasSize() const;
+
const void * currentScanlineOfBand( unsigned int ) const;
void nextScanline();
@@ -113,6 +115,8 @@
void setPixelType( const std::string & );
void setPosition( const vigra::Diff2D & pos );
+ void setCanvasSize( const Size2D & pos );
+
void setXResolution( float xres );
void setYResolution( float yres );
Only in libvigraimpex-1.5.0/src/impex/: vigraimpex_dll.vcproj