Skip to content

Commit

Permalink
[CMAKE]: optionally enabling building of test code (-DENABLE_UNIT_TES…
Browse files Browse the repository at this point in the history
…T=ON).

[DOCS]: update INSTALL README.md README.i18n
[TonemappingOperators]: uniform interface (code enabled only if "Debug" is active, checking of missing pfs channels).
  • Loading branch information
fcomida committed Aug 31, 2016
1 parent bbf44a2 commit 53f6ce5
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 63 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Expand Up @@ -155,10 +155,12 @@ SET(LUMINANCE_HDR_H ${LUMINANCE_HDR_H}
SET(LUMINANCE_HDR_RCCS icons.qrc)
QT5_ADD_RESOURCES(LUMINANCE_HDR_RCCS_SRCS ${LUMINANCE_HDR_RCCS})

ENABLE_TESTING()

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)

IF(ENABLE_UNIT_TEST)
ENABLE_TESTING()
ADD_SUBDIRECTORY(test)
ENDIF(ENABLE_UNIT_TEST)

# translations
FILE(GLOB LUMINANCE_TS i18n/lang_*.ts)
Expand Down
113 changes: 72 additions & 41 deletions INSTALL
@@ -1,34 +1,40 @@
This is the README file for Luminance HDR
This is the INSTALL file for Luminance HDR
-------------------------------------------------------------------
Copyright (C) 2006-2010, Giuseppe Rota <grota@users.sourceforge.net>
2010-2014, Davide Anastasia <davideanastasia@users.sourceforge.net>
Franco Comida <fcomida@users.sourceforge.net>
2010-2016, Davide Anastasia <davideanastasia@users.sourceforge.net>
Franco Comida <fcomida@users.sourceforge.net>

Webpage: http://qtpfsgui.sourceforge.net
GitHub: http://github.com/LuminanceHDR/LuminanceHDR
Sourceforge: http://sourceforge.net/projects/qtpfsgui



Contents
---------
1. Basic compilation of the sources
2. Dependencies
3. Compiling the sources
2. Internationalization
3. Dependencies
4. Enabling Unit Test compilation
5. Note for Packagers

Last update: 2014.01.26
Last update: 2016.08.31

The build system is based on CMake (http://www.cmake.org/).
The build description is contained in the CMakeLists.txt file.

1. Basic compilation
-------------------------------------------------------------------
To compile from source, first execute from an EMPTY folder the command:
To compile from source execute the following command from an EMPTY folder:

> cmake <luminance source code directory>

to generate the Makefile. We strongly suggest to use an EMPTY folder OUTSIDE of the source
to generate the Makefile. We strongly suggest to use an EMPTY folder OUTSIDE the source
directory.

It is also possible to generate specific project files for well known IDE (Visual Studio,
It is also possible to generate specific project files for well known IDEs (Visual Studio,
Xcode and so on). Please, refer to CMake's manual for all the available options.
CMake will also check whether all the dependecies are available or not, and it will show
CMake will also check whether all the dependecies are available or not and it will show
a message accordingly.

Then execute the command:
Expand All @@ -42,22 +48,20 @@ Finally execute (as root) the command:
> make install

to install the luminance executable in /usr/local/bin (if not differently specified during
the configuration command). This last step also installs the icon, the desktop file,
the html documentation and the "qm" translation files. This last step is usually required
in order for Luminance HDR to locate the "qm" files used for internationalization.
the configuration command). This last step will also install the icon, the desktop file,
the html documentation and the "qm" translation files used for internationalization.

2. Internationalization
-------------------------------------------------------------------
Luminance HDR source are shipped with update translation files for internationalization.
These file are stored inside the folder "i18n". They are usually updated. Should you make
a change inside the source code (in particular on the UI), you need to update them. To
enable the update of the translations, you must configure CMake to do so, with the
following command:
Luminance HDR source are shipped with updated translation files for internationalization.
These file are stored inside the folder "i18n". Should you make a change inside the source code
(in particular on the UI), you need to update them.
Enabling updating of translations is performed issuing the following command:

> cmake -DUPDATE_TRANSLATIONS=ON .

if the current working directory (please, refer to 1. of this file) has already been
build, otherwise:
built, otherwise:

> cmake -DUPDATE_TRANSLATIONS=ON <luminance source code directory>

Expand All @@ -77,76 +81,103 @@ and then

to build correctly the whole source directory.


3. Dependencies
-------------------------------------------------------------------

Luminance has 7 dependencies:
Luminance has 12 dependencies (eleven are mandatory, one is optional):

1) Qt5 (http://qt-project.org)
Qt5 is the heart of the the graphical user interface (GUI). In the case of the Windows
version, Qt version must agree with the final building environment (Visual Studio or
*** deprecated *** MinGW)

2) exiv2 (www.exiv2.org)
libexiv2 is a C/C++ library used to extract EXIF tags from LDR and RAW image files, and is
libexiv2 is a C/C++ library used to extract EXIF tags from LDR and RAW image files, and it is
required in order to extract the aperture, exposure-time and ISO tags from the input
images (and for other EXIF-related functionalities).

3) fftw3 (www.fftw.org)
FFTW is required by the fast implementation of Durand tonemapping algorithm. Luminance
requires the "float" version of fftw3 (usually called fftw3f or fftw3-single on MacPorts).
FFTW is required by the fast implementation of various tonemapping algorithm and anti-ghosting feature.
Luminance HDR requires the "float" version of fftw3 (usually called fftw3f or fftw3-single on MacPorts).

4) libtiff (http://www.remotesensing.org/libtiff)
libtiff is required because of the tiff load/save feature.

5) OpenEXR (www.openexr.com)
5) libjpeg (http://libjpeg.sourceforge.net/)
libjpeg is required because of the jpeg load/save feature.

6) libpng (http://libpng.org/)
libpng is required because of the png save feature.

7) OpenEXR (www.openexr.com)
OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light &
Magic for use in computer imaging applications. The package is also known as *ilmbase*
in some GNU/Linux distributions.

6) Gnu Gsl (http://www.gnu.org/software/gsl/)
8) Gnu Gsl (http://www.gnu.org/software/gsl/)
Gnu GSL is required because Mantiuk08 TMO uses this library.

7) LibRAW (http://www.libraw.org/)
9) LibRAW (http://www.libraw.org/)
Used to read the vast majority of RAW file on the market.

10) LCMS2 (http://www.littlecms.com/)
Luminance HDR color management engine.

11) Boost (http://www.boost.org/)
Boost provides free peer-reviewed portable C++ source libraries used inside Luminance HDR project.

12) cfitsio (Optional) (http://heasarc.gsfc.nasa.gov/fitsio/)
CFITSIO is a library of C and Fortran subroutines for reading and writing data files in FITS
(Flexible Image Transport System) data format.
Luminance HDR can optionally support this file format commonly used by the astrophotographers community.
The build system will automatically detect the presence of the library in the system enabling proper support
for astronomical image processing.


Windows:
Currently, Luminance HDR can be compiled using Microsoft Visual Studio. It both works
Currently, Luminance HDR can be compiled using Microsoft Visual Studio. It either works
using precompiled libraries (supplied at
http://sourceforge.net/projects/qtpfsgui/files/DEPs/ for different versions of
Visual Studio) or build entirely every dependency and Luminance itself using a script file
Visual Studio) or building every dependency and Luminance itself using a script file
(build/msvc/getDependencies.cmd. More information can be found inside build/msvc/README.txt).

NOTE: depending on your compiler (MinGW GCC or MS Visual Studio), you must download the
proper version of Qt, or build it yourself accordingly.
NOTE: depending on your compiler (MinGW GCC or MS Visual Studio), you must either download the
proper version of Qt or build it yourself accordingly.

GNU/Linux:
On GNU/Linux you have to compile the code and you need the aforementioned packages
(and the *devel* or *dev* ones, depending on the distribution's naming convention).
CMake will guide you to correctly understand which dependency are missing and which are not.

Mac OS X:
On Mac OS X, all the dependecies can be obtained using MacPorts, except LibRAW, which
needs to compiled straight from source, and Qt5, which must be download from the official
On Mac OS X, all the dependecies can be obtained using MacPorts, except LibRAW that
must be compiled straight from source, and Qt5 which must be downloaded from the official
website of the Qt project.

4. Enabling Unit Test compilation
-------------------------------------------------------------------
In order to enable the compilation of our testing code pass -DENABLE_UNIT_TEST=ON option to cmake.
Google's framework 'gtest' must be installed in your system, the resulting test executables
will be placed under <BUILD_ROOT>/test where <BUILD_ROOT> is your building root directory.

4. Note for Packagers
5. Note for Packagers
-------------------------------------------------------------------
Luminance's default installation prefix is "/usr/local". You can execute:

> cmake -DCMAKE_INSTALL_PREFIX=/usr

before running make in order to modify the default CMAKE_INSTALL_PREFIX.

Icon luminance.png will be installed in ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps.
Icon luminance-hdr.png will be installed in ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps.
You may need to run update-desktop-database in case Luminance's entry doesn't show up
in the graphical menus. Translation files will be installed inside
${CMAKE_INSTALL_PREFIX}/share/luminance/i18n. Help files will be installed inside
${CMAKE_INSTALL_PREFIX}/share/luminance/help.
in the graphical menus.
Translation files will be installed inside ${CMAKE_INSTALL_PREFIX}/share/luminance-hdr/i18n
Help files will be installed inside ${CMAKE_INSTALL_PREFIX}/share/luminance-hdr/help

Running:

> qmake -DCMAKE_BUILD_TYPE={Debug,Release,RelWithDebInfo}
> cmake -DCMAKE_BUILD_TYPE={Debug,Release,RelWithDebInfo}

creates a Makefile that builds Luminance with different debug levels. It is strongly
suggest to use *RelWithDebInfo*: this option will leave inside the final executable all
Expand All @@ -158,10 +189,10 @@ In GNU/Linux you have to compile the code and you need the packages mentioned in
(and the *devel* or *dev* ones, depending on the distribution's naming convention).
If you want to compile the sources in windows, you need to have a compiled version of all
the dependencies.
Building Luminance from sources on Mac OS X can be performed build a Makefile or an Xcode
project using CMake. By default, CMake builds a Makefile on Mac OS X.
Building Luminance from sources on Mac OS X can be performed creating a Makefile or an Xcode
project using CMake. By default, CMake creates a Makefile on Mac OS X.

OpenMP is only available if compiling with GCC 4.3 or newer and Microsoft Visual Studio
OpenMP is only available if compiling with GCC 4.3 or newer or with Microsoft Visual Studio
(CMake will correctly find the right option for OpenMP accordingly to your compiler).

Optimisation note: the default compiler flags include SSE2 and [Linux only] OpenMP.
Expand Down
2 changes: 1 addition & 1 deletion README.i18n
@@ -1,4 +1,4 @@
This is the README file for translations (i18n) for Luminance HDR
This is the README file for contributing translations (i18n) to Luminance HDR
-------------------------------------------------------------------

Contents
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Luminance HDR
===============
Copyright (C) 2010-2015 - Davide Anastasia <davideanastasia@users.sourceforge.net>, Franco Comida <fcomida@users.sourceforge.net>, Daniel Kaneider <danielkaneider@users.sourceforge.net> and many contributors and translators
Copyright (C) 2010-2016 - Davide Anastasia <davideanastasia@users.sourceforge.net>, Franco Comida <fcomida@users.sourceforge.net>, Daniel Kaneider <danielkaneider@users.sourceforge.net> and many contributors and translators

Copyright (C) 2006-2010 - Giuseppe Rota <grota@users.sourceforge.net>

Expand Down
8 changes: 5 additions & 3 deletions src/TonemappingOperators/ashikhmin02/pfstmo_ashikhmin02.cpp
Expand Up @@ -32,9 +32,6 @@
#include <iostream>
#include <cassert>

#include <QFile>


#include "Libpfs/frame.h"
#include "Libpfs/colorspace/colorspace.h"
#include "Libpfs/progress.h"
Expand Down Expand Up @@ -76,6 +73,11 @@ void pfstmo_ashikhmin02(pfs::Frame& frame, bool simple_flag, float lc_value, int
assert( Xr != NULL );
assert( Yr != NULL );
assert( Zr != NULL );
if ( !Xr || !Yr || !Zr )
{
throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
}


pfs::transformColorSpace( pfs::CS_RGB, Xr, Yr, Zr, pfs::CS_XYZ, Xr, Yr, Zr );
float maxLum, avLum, minLum;
Expand Down
10 changes: 6 additions & 4 deletions src/TonemappingOperators/drago03/pfstmo_drago03.cpp
Expand Up @@ -42,19 +42,21 @@

void pfstmo_drago03(pfs::Frame& frame, float biasValue, pfs::Progress &ph)
{
#ifndef NDEBUG
std::cout << "pfstmo_drago03 (";
std::cout << "bias: " << biasValue << ")" << std::endl;
#endif

pfs::Channel *X, *Y, *Z;
frame.getXYZChannels( X, Y, Z );

frame.getTags().setTag("LUMINANCE", "RELATIVE");
//---

if ( Y == NULL )
if ( !X || !Y || !Z )
{
throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
}

frame.getTags().setTag("LUMINANCE", "RELATIVE");
//---

pfs::Array2Df& Xr = *X;
pfs::Array2Df& Yr = *Y;
Expand Down
6 changes: 3 additions & 3 deletions src/TonemappingOperators/fattal02/pfstmo_fattal02.cpp
Expand Up @@ -82,17 +82,17 @@ void pfstmo_fattal02(pfs::Frame& frame,
//Store RGB data temporarily in XYZ channels
pfs::Channel *R, *G, *B;
frame.getXYZChannels( R, G, B );
frame.getTags().setTag("LUMINANCE", "RELATIVE");
//---

if ( !R || !G || !B )
{
throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
}

frame.getTags().setTag("LUMINANCE", "RELATIVE");
// tone mapping
int w = frame.getWidth();
int h = frame.getHeight();
const int w = frame.getWidth();
const int h = frame.getHeight();

pfs::Array2Df Yr(w,h);
pfs::Array2Df L(w,h);
Expand Down
9 changes: 7 additions & 2 deletions src/TonemappingOperators/mantiuk06/pfstmo_mantiuk06.cpp
Expand Up @@ -87,8 +87,13 @@ void pfstmo_mantiuk06(pfs::Frame& frame, float scaleFactor,
pfs::Channel *inRed, *inGreen, *inBlue;
frame.getXYZChannels(inRed, inGreen, inBlue);

int cols = frame.getWidth();
int rows = frame.getHeight();
if ( !inRed || !inGreen || !inBlue )
{
throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
}

const int cols = frame.getWidth();
const int rows = frame.getHeight();

pfs::Array2Df inY( cols, rows );
pfs::transformRGB2Y(inRed, inGreen, inBlue, &inY);
Expand Down
12 changes: 10 additions & 2 deletions src/TonemappingOperators/mantiuk08/pfstmo_mantiuk08.cpp
Expand Up @@ -63,11 +63,13 @@ void pfstmo_mantiuk08(pfs::Frame& frame, float saturation_factor, float contrast
if ( saturation_factor < 0.0f || saturation_factor > 2.0f )
throw pfs::Exception("incorrect saturation factor, accepted range is (0..2)");

#ifndef NDEBUG
std::cout << "pfstmo_mantiuk08 (";
std::cout << "saturation factor: " << saturation_factor;
std::cout << ", contrast enhancement factor: " << contrast_enhance_factor;
std::cout << ", white_y: " << white_y;
std::cout << ", setluminance: " << setluminance << ")" << std::endl;
#endif

DisplayFunction *df = NULL;
DisplaySize *ds = NULL;
Expand All @@ -83,8 +85,14 @@ void pfstmo_mantiuk08(pfs::Frame& frame, float saturation_factor, float contrast

pfs::Channel *inX, *inY, *inZ;
frame.getXYZChannels(inX, inY, inZ);
int cols = frame.getWidth();
int rows = frame.getHeight();

if ( !inX || !inY || !inZ )
{
throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
}

const int cols = frame.getWidth();
const int rows = frame.getHeight();

pfs::Array2Df R( cols, rows );
pfs::transformColorSpace(pfs::CS_XYZ, inX, inY, inZ, pfs::CS_RGB, inX, &R, inZ);
Expand Down
4 changes: 3 additions & 1 deletion src/TonemappingOperators/pattanaik00/pfstmo_pattanaik00.cpp
Expand Up @@ -71,25 +71,27 @@ void pfstmo_pattanaik00(pfs::Frame& frame,
//Arod = -1.0f;
float fps = 16.0f; //not used

#ifndef NDEBUG
std::cout << "pfstmo_pattanaik00 (";
std::cout << "local: " << local << ", ";
std::cout << "multiplier: " << multiplier << ", ";
std::cout << "Acone: " << Acone << ", ";
std::cout << "Arod: " << Arod << ", ";
std::cout << "autolum: " << autolum << ")" << std::endl;
#endif

boost::scoped_ptr<VisualAdaptationModel> am(new VisualAdaptationModel());

pfs::Channel *X, *Y, *Z;
frame.getXYZChannels( X, Y, Z );
frame.getTags().setTag("LUMINANCE", "RELATIVE");
//---

if ( Y==NULL || X==NULL || Z==NULL)
{
throw pfs::Exception( "Missing X, Y, Z channels in the PFS stream" );
}

frame.getTags().setTag("LUMINANCE", "RELATIVE");
// adaptation model
if ( multiplier != 1.0f ) {
multiplyChannels(*X, *Y, *Z, multiplier );
Expand Down

0 comments on commit 53f6ce5

Please sign in to comment.