Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions player/lua/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -810,30 +810,33 @@ local function append_hdr(s, hdr, video_out)
return
end

local function should_show(val)
return val and val ~= 203 and val > 0
local function has(val, target)
return val and math.abs(val - target) > 1e-4
end

-- If we are printing video out parameters it is just display, not mastering
local display_prefix = video_out and "Display:" or "Mastering display:"

local indent = ""
local has_dml = has(hdr["min-luma"], 0.203) or has(hdr["max-luma"], 203)
local has_cll = hdr["max-cll"] and hdr["max-cll"] > 0
local has_fall = hdr["max-fall"] and hdr["max-fall"] > 0

if should_show(hdr["max-cll"]) or should_show(hdr["max-luma"]) then
if has_dml or has_cll or has_fall then
append(s, "", {prefix="HDR10:"})
if hdr["min-luma"] and should_show(hdr["max-luma"]) then
if has_dml then
-- libplacebo uses close to zero values as "defined zero"
hdr["min-luma"] = hdr["min-luma"] <= 1e-6 and 0 or hdr["min-luma"]
append(s, format("%.2g / %.0f", hdr["min-luma"], hdr["max-luma"]),
{prefix=display_prefix, suffix=" cd/m²", nl="", indent=indent})
indent = o.prefix_sep .. o.prefix_sep
end
if should_show(hdr["max-cll"]) then
if has_cll then
append(s, string.format("%.0f", hdr["max-cll"]), {prefix="MaxCLL:",
suffix=" cd/m²", nl="", indent=indent})
indent = o.prefix_sep .. o.prefix_sep
end
if hdr["max-fall"] and hdr["max-fall"] > 0 then
if has_fall then
append(s, hdr["max-fall"], {prefix="MaxFALL:", suffix=" cd/m²", nl="",
indent=indent})
end
Expand Down
Loading