-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogC_AWG_to_Linear_Rec709.dctl
More file actions
24 lines (14 loc) · 979 Bytes
/
LogC_AWG_to_Linear_Rec709.dctl
File metadata and controls
24 lines (14 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// LogC Alexa Wide Gamut to Linear (Rec709 Primaries)
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
const float Lr = p_R > 0.1496582f ? (_powf(10.0f, (p_R - 0.385537f) / 0.2471896f) - 0.052272f) / 5.555556f : (p_R - 0.092809f) / 5.367655f;
const float Lg = p_G > 0.1496582f ? (_powf(10.0f, (p_G - 0.385537f) / 0.2471896f) - 0.052272f) / 5.555556f : (p_G - 0.092809f) / 5.367655f;
const float Lb = p_B > 0.1496582f ? (_powf(10.0f, (p_B - 0.385537f) / 0.2471896f) - 0.052272f) / 5.555556f : (p_B - 0.092809f) / 5.367655f;
const float Mr = ((Lr) * 1.617523f) + ((Lg) * -0.537287f) + ((Lb) * -0.080237f);
const float Mg = ((Lr) * -0.070573f) + ((Lg) * 1.334613f) + ((Lb) * -0.26404f);
const float Mb = ((Lr) * -0.021102f) + ((Lg) * -0.226954f) + ((Lb) * 1.248056f);
const float r = (Mr);
const float g = (Mg);
const float b = (Mb);
return make_float3(r, g, b);
}