libobs: Cap HLG video at 1000 nits
parent
d7fb4361a5
commit
8909e44870
|
@ -2258,17 +2258,18 @@ static bool update_async_texrender(struct obs_source *source,
|
|||
set_eparam(conv, "height_d2", (float)cy * 0.5f);
|
||||
set_eparam(conv, "width_x2_i", 0.5f / (float)cx);
|
||||
|
||||
const float hdr_nominal_peak_level =
|
||||
obs->video.hdr_nominal_peak_level;
|
||||
/* BT.2408 says higher than 1000 isn't comfortable */
|
||||
float hlg_peak_level = obs->video.hdr_nominal_peak_level;
|
||||
if (hlg_peak_level > 1000.f)
|
||||
hlg_peak_level = 1000.f;
|
||||
|
||||
const float maximum_nits = (frame->trc == VIDEO_TRC_HLG)
|
||||
? hdr_nominal_peak_level
|
||||
? hlg_peak_level
|
||||
: 10000.f;
|
||||
set_eparam(conv, "maximum_over_sdr_white_nits",
|
||||
maximum_nits / obs_get_video_sdr_white_level());
|
||||
const float hlg_gamma =
|
||||
1.2f +
|
||||
(0.42f * log10f(hdr_nominal_peak_level / 1000.f));
|
||||
const float hlg_exponent = hlg_gamma - 1.f;
|
||||
const float hlg_exponent =
|
||||
0.2f + (0.42f * log10f(hlg_peak_level / 1000.f));
|
||||
set_eparam(conv, "hlg_exponent", hlg_exponent);
|
||||
|
||||
struct vec4 vec0, vec1, vec2;
|
||||
|
|
Loading…
Reference in New Issue