StelToneReproducer.hpp   StelToneReproducer.hpp 
skipping to change at line 22 skipping to change at line 22
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELTONEREPRODUCER_HPP_ #ifndef _STELTONEREPRODUCER_HPP_
#define _STELTONEREPRODUCER_HPP_ #define _STELTONEREPRODUCER_HPP_
#include "config.h"
#include <cmath> #include <cmath>
//! Converts tones in function of the eye adaptation to luminance. //! Converts tones in function of the eye adaptation to luminance.
//! The aim is to get on the screen something which is perceptualy accurate , //! The aim is to get on the screen something which is perceptualy accurate ,
//! ie. to compress high dynamic range luminance to CRT display range. //! ie. to compress high dynamic range luminance to CRT display range.
//! The class perform mainly a fast implementation of the algorithm from th e //! The class perform mainly a fast implementation of the algorithm from th e
//! paper [1], with more accurate values from [2]. The blue shift formula i s taken //! paper [1], with more accurate values from [2]. The blue shift formula i s taken
//! from [3] and combined with the Scotopic vision formula from [4]. //! from [3] and combined with the Scotopic vision formula from [4].
//! //!
//! Important : you may call setDisplayAdaptationLuminance() //! Important : you may call setDisplayAdaptationLuminance()
skipping to change at line 84 skipping to change at line 82
//! Get the eye adaptation luminance for the world //! Get the eye adaptation luminance for the world
float getWorldAdaptationLuminance() const float getWorldAdaptationLuminance() const
{ {
return Lwa; return Lwa;
} }
//! Set the global scale applied to input lumiances, i.e before the adaptation //! Set the global scale applied to input lumiances, i.e before the adaptation
//! It is the parameter to modify to simulate aperture*exposition ti me //! It is the parameter to modify to simulate aperture*exposition ti me
//! @param scale the global input scale //! @param scale the global input scale
void setInputScale(float scale=1.f); void setInputScale(float scale=1.f);
//! Get the global scale applied to input lumiances, i.e before the adaptation //! Get the global scale applied to input luminances, i.e before the adaptation
float getInputScale() const float getInputScale() const
{ {
return inputScale; return inputScale;
} }
//! Set the maximum luminance of the display (CRT, screen etc..) //! Set the maximum luminance of the display (CRT, screen etc..)
//! This value is used to scale the RGB range //! This value is used to scale the RGB range
//! @param maxdL the maximum lumiance in cd/m^2. Initial default val ue is 120 cd/m^2 //! @param maxdL the maximum lumiance in cd/m^2. Initial default val ue is 120 cd/m^2
void setMaxDisplayLuminance(float maxdL) void setMaxDisplayLuminance(float maxdL)
{ {
skipping to change at line 130 skipping to change at line 128
//! Return adapted luminance from display to world //! Return adapted luminance from display to world
//! @param displayLuminance the display luminance to convert in cd/m ^2 //! @param displayLuminance the display luminance to convert in cd/m ^2
//! @return the converted world luminance in cd/m^2 //! @return the converted world luminance in cd/m^2
float reverseAdaptLuminance(float displayLuminance) const float reverseAdaptLuminance(float displayLuminance) const
{ {
return (float) std::pow((float)(displayLuminance/term2),1.f/ alphaWaOverAlphaDa)/(inputScale*M_PI*0.0001f); return (float) std::pow((float)(displayLuminance/term2),1.f/ alphaWaOverAlphaDa)/(inputScale*M_PI*0.0001f);
} }
//! Return adapted luminance from world to display with 1 correspond ing to full display white //! Return adapted luminance from world to display with 1 correspond ing to full display white
//! @param worldLuminance the world luminance to convert in cd/m^2 //! @param worldLuminance the world luminance to convert in cd/m^2
//! @return the converted display luminance with 1 corresponding to full display white. The value can be more than 1 when saturation.. //! @return the converted display luminance with 1 corresponding to full display white. The value can be more than 1 when saturated.
float adaptLuminanceScaled(float worldLuminance) const float adaptLuminanceScaled(float worldLuminance) const
{ {
return adaptLuminance(worldLuminance)*oneOverMaxdL; return adaptLuminance(worldLuminance)*oneOverMaxdL;
} }
//! Return adapted luminance from display to world with 1 correspond ing to full display white //! Return adapted luminance from display to world with 1 correspond ing to full display white
//! @param displayLuminance the display luminance with 1 correspondi ng to full display white. The value can be more than 1 when saturation.. //! @param displayLuminance the display luminance with 1 correspondi ng to full display white. The value can be more than 1 when saturated.
//! @return the converted world luminance in cd/m^2 //! @return the converted world luminance in cd/m^2
float reverseAdaptLuminanceScaled(float displayLuminance) const float reverseAdaptLuminanceScaled(float displayLuminance) const
{ {
return reverseAdaptLuminance(displayLuminance/oneOverMaxdL); return reverseAdaptLuminance(displayLuminance/oneOverMaxdL);
} }
//! Return adapted ln(luminance) from world to display with 1 corres ponding to full display white //! Return adapted ln(luminance) from world to display with 1 corres ponding to full display white
//! @param lnWorldLuminance the world luminance to convert in ln(cd/ m^2) //! @param lnWorldLuminance the world luminance to convert in ln(cd/ m^2)
//! @param pFact the power at whihc the result should be set. The de //! @param pFact the power at which the result should be set. The de
fault is 0.5 and therefore return the square root of the adapted luminance fault is 0.5 and therefore return the square root of the adapted luminance
//! @return the converted display set at the pFact power. Luminance //! @return the converted display set at the pFact power. Luminance
with 1 corresponding to full display white. The value can be more than 1 wh with 1 corresponding to full display white. The value can be more than 1 wh
en saturation.. en saturated.
float adaptLuminanceScaledLn(float lnWorldLuminance, float pFact=0.5 f) const float adaptLuminanceScaledLn(float lnWorldLuminance, float pFact=0.5 f) const
{ {
const float lnPix0p0001 = -8.0656104861f; const float lnPix0p0001 = -8.0656104861f;
return std::exp(((lnInputScale+lnWorldLuminance+lnPix0p0001) *alphaWaOverAlphaDa+lnTerm2+lnOneOverMaxdL)*pFact); return std::exp(((lnInputScale+lnWorldLuminance+lnPix0p0001) *alphaWaOverAlphaDa+lnTerm2+lnOneOverMaxdL)*pFact);
} }
//! Convert from xyY color system to RGB. //! Convert from xyY color system to RGB.
//! The first two components x and y indicate the "color", the Y is luminance in cd/m^2. //! The first two components x and y indicate the "color", the Y is luminance in cd/m^2.
//! @param xyY an array of 3 floats which are replaced by the conver ted RGB values //! @param xyY an array of 3 floats which are replaced by the conver ted RGB values
void xyYToRGB(float* xyY) const; void xyYToRGB(float* xyY) const;
 End of changes. 5 change blocks. 
10 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/