mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs: Fix NaNs when using EETF for HLG
This commit is contained in:
parent
ed85307f7e
commit
a82bbb416f
|
@ -97,12 +97,11 @@ float3 maxRGB_eetf(float3 rgb, float Lw, float Lmax)
|
|||
float maxRGB1_pq = linear_to_st2084_channel(maxRGB_linear);
|
||||
float maxRGB2_pq = eetf_0_1000(Lw, maxRGB1_pq);
|
||||
float maxRGB2_linear = st2084_to_linear_channel(maxRGB2_pq);
|
||||
float scaling_ratio = maxRGB2_linear / maxRGB_linear;
|
||||
|
||||
// scaling_ratio could be NaN
|
||||
scaling_ratio = max(0., scaling_ratio);
|
||||
// avoid divide-by-zero possibility
|
||||
maxRGB_linear = max(6.10352e-5, maxRGB_linear);
|
||||
|
||||
rgb *= scaling_ratio;
|
||||
rgb *= maxRGB2_linear / maxRGB_linear;
|
||||
return rgb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue