|
| 1 | +//P3-D65 Gamma 2.4 ACES ODT |
| 2 | +#if (((__RESOLVE_VER_MAJOR__ == 18) && (__RESOLVE_VER_MINOR__ >= 6)) || (__RESOLVE_VER_MAJOR__ >= 19)) |
| 3 | +DEFINE_ACES_PARAM(Y_MIN: 0.02, |
| 4 | + Y_MID: 8.6564, |
| 5 | + Y_MAX: 48.0, |
| 6 | + DISPLAY_PRI: { 0.68000, 0.32000, 0.26500, 0.69000, 0.15000, 0.06000, 0.31270, 0.32900 }, |
| 7 | + LIMITING_PRI: { 0.68000, 0.32000, 0.26500, 0.69000, 0.15000, 0.06000, 0.31270, 0.32900 }, |
| 8 | + EOTF: fwd_gamma, |
| 9 | + INVERSE_EOTF: rev_gamma, |
| 10 | + SURROUND: 0, |
| 11 | + STRETCH_BLACK: 1, |
| 12 | + D60_SIM: 0, |
| 13 | + LEGAL_RANGE: 0, |
| 14 | + OUTPUT_COLORSPACE_TAG: P3D65_48nits) |
| 15 | +#else |
| 16 | +DEFINE_ACES_PARAM(Y_MIN: 0.02, |
| 17 | + Y_MID: 8.6564, |
| 18 | + Y_MAX: 48.0, |
| 19 | + DISPLAY_PRI: { 0.68000, 0.32000, 0.26500, 0.69000, 0.15000, 0.06000, 0.31270, 0.32900 }, |
| 20 | + LIMITING_PRI: { 0.68000, 0.32000, 0.26500, 0.69000, 0.15000, 0.06000, 0.31270, 0.32900 }, |
| 21 | + EOTF: fwd_gamma, |
| 22 | + INVERSE_EOTF: rev_gamma, |
| 23 | + SURROUND: 0, |
| 24 | + STRETCH_BLACK: 1, |
| 25 | + D60_SIM: 0, |
| 26 | + LEGAL_RANGE: 0) |
| 27 | + |
| 28 | +#endif |
| 29 | + |
| 30 | + |
| 31 | +__DEVICE__ float lin_to_gamma(float x) { |
| 32 | + return _fmaxf(_powf(x, 1.0f / 2.6f), 0.0f); |
| 33 | +} |
| 34 | + |
| 35 | +__DEVICE__ float gamma_to_lin(float x) { |
| 36 | + return _fmaxf(_powf(x, 2.6f), 0.0f); |
| 37 | +} |
| 38 | + |
| 39 | + |
| 40 | +__DEVICE__ float3 fwd_gamma(float3 p_InputCV, __CONSTANTREF__ AcesTransformUserSettingParams* p_AcesParams) |
| 41 | +{ |
| 42 | + float3 outputCV; |
| 43 | + |
| 44 | + outputCV.x = lin_to_gamma(p_InputCV.x); |
| 45 | + outputCV.y = lin_to_gamma(p_InputCV.y); |
| 46 | + outputCV.z = lin_to_gamma(p_InputCV.z); |
| 47 | + |
| 48 | + return outputCV; |
| 49 | +} |
| 50 | + |
| 51 | +__DEVICE__ float3 rev_gamma(float3 p_InputCV, __CONSTANTREF__ AcesTransformUserSettingParams* p_AcesParams) |
| 52 | +{ |
| 53 | + float3 outputCV; |
| 54 | + |
| 55 | + |
| 56 | + outputCV.x = gamma_to_lin(p_InputCV.x); |
| 57 | + outputCV.y = gamma_to_lin(p_InputCV.y); |
| 58 | + outputCV.z = gamma_to_lin(p_InputCV.z); |
| 59 | + |
| 60 | + return outputCV; |
| 61 | +} |
| 62 | + |
| 63 | + |
| 64 | +__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) { |
| 65 | + |
| 66 | + const float3 result = AcesOutputTransform(p_R, p_G, p_B); |
| 67 | + |
| 68 | + return result; |
| 69 | +} |
0 commit comments