|
@@ -26,6 +26,8 @@ uniform float height_d2;
|
|
uniform float width_x2_i;
|
|
uniform float width_x2_i;
|
|
uniform float maximum_over_sdr_white_nits;
|
|
uniform float maximum_over_sdr_white_nits;
|
|
uniform float sdr_white_nits_over_maximum;
|
|
uniform float sdr_white_nits_over_maximum;
|
|
|
|
+uniform float hlg_exponent;
|
|
|
|
+uniform float hlg_lw;
|
|
|
|
|
|
uniform float4 color_vec0;
|
|
uniform float4 color_vec0;
|
|
uniform float4 color_vec1;
|
|
uniform float4 color_vec1;
|
|
@@ -213,7 +215,7 @@ float PS_HLG_Y_709_2020(FragPos frag_in) : TARGET
|
|
{
|
|
{
|
|
float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
|
|
float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
|
|
rgb = rec709_to_rec2020(rgb);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
- rgb = linear_to_hlg(rgb);
|
|
|
|
|
|
+ rgb = linear_to_hlg(rgb, hlg_lw);
|
|
float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
|
|
float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
|
|
y = (65472. / 65535.) * y + (32. / 65535.); // set up truncation to 10 bits
|
|
y = (65472. / 65535.) * y + (32. / 65535.); // set up truncation to 10 bits
|
|
return y;
|
|
return y;
|
|
@@ -241,7 +243,7 @@ float PS_I010_HLG_Y_709_2020(FragPos frag_in) : TARGET
|
|
{
|
|
{
|
|
float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
|
|
float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
|
|
rgb = rec709_to_rec2020(rgb);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
- rgb = linear_to_hlg(rgb);
|
|
|
|
|
|
+ rgb = linear_to_hlg(rgb, hlg_lw);
|
|
float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
|
|
float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
|
|
return y * (1023. / 65535.);
|
|
return y * (1023. / 65535.);
|
|
}
|
|
}
|
|
@@ -288,7 +290,7 @@ float2 PS_HLG_UV_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
|
|
float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
|
|
float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
|
|
float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
|
|
float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
- rgb = linear_to_hlg(rgb);
|
|
|
|
|
|
+ rgb = linear_to_hlg(rgb, hlg_lw);
|
|
float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
|
|
float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
|
|
float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
|
|
float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
|
|
float2 uv = float2(u, v);
|
|
float2 uv = float2(u, v);
|
|
@@ -364,7 +366,7 @@ float PS_I010_HLG_U_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
|
|
float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
|
|
float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
|
|
float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
|
|
float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
- rgb = linear_to_hlg(rgb);
|
|
|
|
|
|
+ rgb = linear_to_hlg(rgb, hlg_lw);
|
|
float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
|
|
float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
|
|
return u * (1023. / 65535.);
|
|
return u * (1023. / 65535.);
|
|
}
|
|
}
|
|
@@ -402,7 +404,7 @@ float PS_I010_HLG_V_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
|
|
float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
|
|
float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
|
|
float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
|
|
float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
rgb = rec709_to_rec2020(rgb);
|
|
- rgb = linear_to_hlg(rgb);
|
|
|
|
|
|
+ rgb = linear_to_hlg(rgb, hlg_lw);
|
|
float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
|
|
float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
|
|
return v * (1023. / 65535.);
|
|
return v * (1023. / 65535.);
|
|
}
|
|
}
|
|
@@ -587,7 +589,7 @@ float4 PSI010_HLG_2020_709_Reverse(VertTexPos frag_in) : TARGET
|
|
float cr = image2.Load(xy0_chroma).x * ratio;
|
|
float cr = image2.Load(xy0_chroma).x * ratio;
|
|
float3 yuv = float3(y, cb, cr);
|
|
float3 yuv = float3(y, cb, cr);
|
|
float3 hlg = YUV_to_RGB(yuv);
|
|
float3 hlg = YUV_to_RGB(yuv);
|
|
- float3 hdr2020 = hlg_to_linear(hlg) * maximum_over_sdr_white_nits;
|
|
|
|
|
|
+ float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
|
|
float3 rgb = rec2020_to_rec709(hdr2020);
|
|
float3 rgb = rec2020_to_rec709(hdr2020);
|
|
return float4(rgb, 1.0);
|
|
return float4(rgb, 1.0);
|
|
}
|
|
}
|
|
@@ -619,7 +621,7 @@ float4 PSP010_HLG_2020_709_Reverse(VertTexPos frag_in) : TARGET
|
|
float2 cbcr = image1.Load(int3(frag_in.uv, 0)).xy;
|
|
float2 cbcr = image1.Load(int3(frag_in.uv, 0)).xy;
|
|
float3 yuv = float3(y, cbcr);
|
|
float3 yuv = float3(y, cbcr);
|
|
float3 hlg = YUV_to_RGB(yuv);
|
|
float3 hlg = YUV_to_RGB(yuv);
|
|
- float3 hdr2020 = hlg_to_linear(hlg) * maximum_over_sdr_white_nits;
|
|
|
|
|
|
+ float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
|
|
float3 rgb = rec2020_to_rec709(hdr2020);
|
|
float3 rgb = rec2020_to_rec709(hdr2020);
|
|
return float4(rgb, 1.0);
|
|
return float4(rgb, 1.0);
|
|
}
|
|
}
|