used BT601 instead of BT709 in RGB2Lum
This commit is contained in:
parent
b5c66fe2cd
commit
1141f37cc4
@ -5,19 +5,24 @@
|
|||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
template<typename T> constexpr T RGB2Lum(const T &r, const T &g, const T &b)
|
template<typename T> constexpr T RGB2Lum(const T &r,const T &g,const T &b)
|
||||||
{
|
{
|
||||||
return 0.2126f*r+0.7152f*g+0.0722f*b;
|
return T(0.299f*r+0.587f*g+0.114f*b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> constexpr uint8 RGB2Lum(const uint8 &r, const uint8 &g, const uint8 &b)
|
template<> constexpr uint8 RGB2Lum(const uint8 &r,const uint8 &g,const uint8 &b)
|
||||||
{
|
{
|
||||||
return (r*54+g*183+b*19)>>8;
|
return uint8((r*77+g*151+b*28)>>8);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T> constexpr T RGB2LumBT709(const T &r, const T &g, const T &b)
|
||||||
|
{
|
||||||
|
return T(0.2126f*r+0.7152f*g+0.0722f*b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> constexpr T RGB2LumBT2020(const T &r,const T &g,const T &b)
|
template<typename T> constexpr T RGB2LumBT2020(const T &r,const T &g,const T &b)
|
||||||
{
|
{
|
||||||
return 0.2627f*r+0.6780f*g+0.0593f*b;
|
return T(0.2627f*r+0.6780f*g+0.0593f*b);
|
||||||
}
|
}
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
#endif//HGL_COLOR_LUM_INCLUDE
|
#endif//HGL_COLOR_LUM_INCLUDE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user