@@ -27,9 +27,9 @@ T identity(NBL_CONST_REF_ARG(T) nonlinear)
27
27
}
28
28
29
29
template<typename T>
30
- T impl_shared_2_4 (NBL_CONST_REF_ARG (T) nonlinear, typename type_traits:: scalar_type<T>::type vertex)
30
+ T impl_shared_2_4 (NBL_CONST_REF_ARG (T) nonlinear, typename scalar_type<T>::type vertex)
31
31
{
32
- typedef typename type_traits:: scalar_type<T>::type Val_t;
32
+ typedef typename scalar_type<T>::type Val_t;
33
33
bool3 right = (nonlinear > promote<T, Val_t>(vertex));
34
34
return lerp (nonlinear / Val_t (12.92 ), pow ((nonlinear + promote<T, Val_t>(0.055 )) / Val_t (1.055 ), promote<T, Val_t>(2.4 )), right);
35
35
}
@@ -38,7 +38,7 @@ T impl_shared_2_4(NBL_CONST_REF_ARG(T) nonlinear, typename type_traits::scalar_t
38
38
template<typename T>
39
39
T sRGB (NBL_CONST_REF_ARG (T) nonlinear)
40
40
{
41
- typedef typename type_traits:: scalar_type<T>::type Val_t;
41
+ typedef typename scalar_type<T>::type Val_t;
42
42
bool3 negatif = (nonlinear < promote<T, Val_t>(0.0 ));
43
43
T absVal = impl_shared_2_4<T>(abs (nonlinear), 0.04045 );
44
44
return lerp (absVal, -absVal, negatif);
@@ -48,21 +48,21 @@ T sRGB(NBL_CONST_REF_ARG(T) nonlinear)
48
48
template<typename T>
49
49
T Display_P3 (NBL_CONST_REF_ARG (T) nonlinear)
50
50
{
51
- typedef typename type_traits:: scalar_type<T>::type Val_t;
51
+ typedef typename scalar_type<T>::type Val_t;
52
52
return impl_shared_2_4<T>(nonlinear, 0.039000312 );
53
53
}
54
54
55
55
template<typename T>
56
56
T DCI_P3_XYZ (NBL_CONST_REF_ARG (T) nonlinear)
57
57
{
58
- typedef typename type_traits:: scalar_type<T>::type Val_t;
58
+ typedef typename scalar_type<T>::type Val_t;
59
59
return pow (nonlinear * Val_t (52.37 ), promote<T, Val_t>(2.6 ));
60
60
}
61
61
62
62
template<typename T>
63
63
T SMPTE_170M (NBL_CONST_REF_ARG (T) nonlinear)
64
64
{
65
- typedef typename type_traits:: scalar_type<T>::type Val_t;
65
+ typedef typename scalar_type<T>::type Val_t;
66
66
// ITU specs (and the outlier BT.2020) give different constants for these, but they introduce discontinuities in the mapping
67
67
// because HDR swapchains often employ the RGBA16_SFLOAT format, this would become apparent because its higher precision than 8,10,12 bits
68
68
Val_t alpha = 1.099296826809443 ; // 1.099 for all ITU but the BT.2020 12 bit encoding, 1.0993 otherwise
@@ -73,7 +73,7 @@ T SMPTE_170M(NBL_CONST_REF_ARG(T) nonlinear)
73
73
template<typename T>
74
74
T SMPTE_ST2084 (NBL_CONST_REF_ARG (T) nonlinear)
75
75
{
76
- typedef typename type_traits:: scalar_type<T>::type Val_t;
76
+ typedef typename scalar_type<T>::type Val_t;
77
77
const T invm2 = promote<T, Val_t>(1.0 / 78.84375 );
78
78
T _common = pow (invm2, invm2);
79
79
@@ -89,7 +89,7 @@ T SMPTE_ST2084(NBL_CONST_REF_ARG(T) nonlinear)
89
89
template<typename T>
90
90
T HDR10_HLG (NBL_CONST_REF_ARG (T) nonlinear)
91
91
{
92
- typedef typename type_traits:: scalar_type<T>::type Val_t;
92
+ typedef typename scalar_type<T>::type Val_t;
93
93
// done with log2 so constants are different
94
94
const Val_t a = 0.1239574303172 ;
95
95
const T b = promote<T, Val_t>(0.02372241 );
@@ -101,21 +101,21 @@ T HDR10_HLG(NBL_CONST_REF_ARG(T) nonlinear)
101
101
template<typename T>
102
102
T AdobeRGB (NBL_CONST_REF_ARG (T) nonlinear)
103
103
{
104
- typedef typename type_traits:: scalar_type<T>::type Val_t;
104
+ typedef typename scalar_type<T>::type Val_t;
105
105
return pow (nonlinear, promote<T, Val_t>(2.19921875 ));
106
106
}
107
107
108
108
template<typename T>
109
109
T Gamma_2_2 (NBL_CONST_REF_ARG (T) nonlinear)
110
110
{
111
- typedef typename type_traits:: scalar_type<T>::type Val_t;
111
+ typedef typename scalar_type<T>::type Val_t;
112
112
return pow (nonlinear, promote<T, Val_t>(2.2 ));
113
113
}
114
114
115
115
template<typename T>
116
116
T ACEScc (NBL_CONST_REF_ARG (T) nonlinear)
117
117
{
118
- typedef typename type_traits:: scalar_type<T>::type Val_t;
118
+ typedef typename scalar_type<T>::type Val_t;
119
119
bool3 right = (nonlinear >= promote<T, Val_t>(-0.301369863 ));
120
120
T _common = exp2 (nonlinear * Val_t (17.52 ) - promote<T, Val_t>(9.72 ));
121
121
return max (lerp (_common * Val_t (2.0 ) - promote<T, Val_t>(0.000030517578125 ), _common, right), promote<T, Val_t>(65504.0 ));
@@ -124,7 +124,7 @@ T ACEScc(NBL_CONST_REF_ARG(T) nonlinear)
124
124
template<typename T>
125
125
T ACEScct (NBL_CONST_REF_ARG (T) nonlinear)
126
126
{
127
- typedef typename type_traits:: scalar_type<T>::type Val_t;
127
+ typedef typename scalar_type<T>::type Val_t;
128
128
bool3 right = (nonlinear >= promote<T, Val_t>(0.155251141552511 ));
129
129
return max (lerp ((nonlinear - promote<T, Val_t>(0.0729055341958355 )) / Val_t (10.5402377416545 ), exp2 (nonlinear * Val_t (17.52 ) - promote<T, Val_t>(9.72 )), right), promote<T, Val_t>(65504.0 ));
130
130
}
0 commit comments