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 <QDebug>
//! 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()
//! and setWorldAdaptationLuminance() before any call to xyYToRGB() //! and setWorldAdaptationLuminance() before any call to xyYToRGB()
//! or adaptLuminance otherwise the default values will be used. (they are //! or adaptLuminance otherwise the default values will be used. (they are
skipping to change at line 134 skipping to change at line 136
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 fault is 0.5 and therefore return the square root of the adapted luminance //! @param pFact the power at whihc the result should be set. The de fault is 0.5 and therefore return the square root of the adapted 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 en saturation.. //! @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 en saturation..
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) //Needs better name
*alphaWaOverAlphaDa+lnTerm2+lnOneOverMaxdL)*pFact); const float temp = ((lnInputScale + lnWorldLuminance
+ lnPix0p0001) *
alphaWaOverAlphaDa+lnTerm2 + lnO
neOverMaxdL) * pFact;
// Optimization:
// Always using exp here takes 6-9% of runtime in release mo
de.
// This code is used to determine point source radius.
//
// If this value is < 5 (and < 4, for that matter), the star
won't
// even be displayed as it's radius is too low. We also get
rid
// of ~90% of exp calls.
if(temp < -5.0f)
{
return 0.0f;
}
return std::exp(temp);
} }
//! 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;
void getShadersParams(float& a, float& b, float & c) const void getShadersParams(float& a, float& b, float & c) const
{ {
a=alphaWaOverAlphaDa; a=alphaWaOverAlphaDa;
 End of changes. 2 change blocks. 
2 lines changed or deleted 24 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/