Added another quality-controller, many small fixes.
[fic.git] / modules / quality2SE.h
bloba3a5c67c8803c96b659dd37bac7cfa4fcb8851c3
1 #ifndef QUALITY2SE_HEADER_
2 #define QUALITY2SE_HEADER_
4 #include "../interfaces.h"
7 /// \ingroup modules
8 /** Standard quality-to-SE module - uses fixed SE for all block sizes */
9 class MQuality2SE_std: public IQuality2SE {
11 DECLARE_TypeInfo_noSettings( MQuality2SE_std, "Constant square error"
12 , "Holds the same <b>square error</b> (SE) for all block sizes" )
14 public:
15 /** \name IQuality2SE interface
16 * @{ */
17 float rangeSE(float quality,int /*pixelCount*/) {
18 ASSERT( quality>=0 && quality<=1 );
19 float maxSE= 4 // approximate SE for quality=0
20 , doubles= 6; //< how many times the SE doubles
21 return maxSE/exp2(doubles) * ( exp2((1-quality)*doubles) - 1 );
23 /// @}
27 /// \ingroup modules
28 /** Alternate quality-to-SE module - uses fixed MSE for all block sizes */
29 class MQuality2SE_alt: public IQuality2SE {
31 DECLARE_TypeInfo_noSettings( MQuality2SE_alt, "Constant mean square error"
32 , "Holds the same <b>mean square error</b> (MSE) for all block sizes" )
34 public:
35 /** \name IQuality2SE interface
36 * @{ */
37 float rangeSE(float quality,int pixelCount) {
38 ASSERT( quality>=0 && quality<=1 );
39 float maxSE= 4 // approximate SE for quality=0
40 , doubles= 6; //< how many times the SE doubles
41 float sizeQuot= pixelCount/sqr(9.0);
42 return maxSE/exp2(doubles) * ( exp2((1-quality)*doubles) - 1 ) * sizeQuot;
44 /// @}
48 #endif // QUALITY2SE_HEADER_