Peak-Luminance Detection for Tone Mapping
Peak-luminance detection estimates the brightness range present in decoded pictures so tone mapping can respond to the content.
A mapper needs a source-range estimate. Peak detection obtains one by examining the decoded picture, rather than using only a mastering record or a configured assumption.
Define the statistic before taking its maximum
Stored video values need their range, transfer, and color interpretation. Taking a raw integer maximum does not by itself give a light level. A detector analyzes a defined quantity, such as a light-domain component statistic or a perceptual representation, then supplies it in the units its mapper expects.
For a neutral PQ-gray example, recovered light levels can be expressed in nits. Colored pictures need the statistic's component/luminance definition too: a maximum RGB component and weighted luminance are different quantities.
Test a frame with a few extreme samples
Suppose 10,000 neutral-gray samples consist of 9,990 at 100 nits and ten at 1,000 nits:
| Estimate | Result in this constructed frame |
|---|---|
| Absolute maximum | 1,000 nits |
| 99.9th percentile, nearest-rank method | 100 nits |
| Average | 100.9 nits |
The maximum sees the ten intense samples. The percentile selects the 9,990th sorted sample, at 100. The average is (9,990 × 100 + 10 × 1,000)/10,000 = 100.9.
These statistics describe the same frame differently. Using the absolute maximum can reserve mapping range for a tiny sparkle. Discounting a small upper tail can give the rest of the scene more room but may compress or clip those rare highlights more strongly. The selected policy establishes that tradeoff.
A practical detector can use sampled pixels or a histogram rather than sorting every value. Bin precision, selected picture area, and the treatment of exceptional values then affect the estimate. The example demonstrates percentile reasoning, not a particular library's binning or default setting.
Keep source information in its proper role
| Input to a mapping | Role |
|---|---|
| Mastering-display maximum | Context about the grading reference |
| MaxCLL | A reported sequence-level content bound |
| Dynamic scene statistics | Prepared information for the current content interval |
| Runtime detected peak | The detector's estimate from analyzed pictures |
| Destination peak | The output range to fit |
These values can be combined or selected according to the implementation. Missing metadata can make picture analysis especially useful, while a detector still needs an appropriate interpretation of the source.
Finally, the estimate should be managed across time. A single flash can otherwise change a global curve for an unchanged face. Scene-adaptive mapping develops that stability problem. For an Emby comparison, record the source information and actual processing path, then watch a dim scene with isolated lights as well as a broadly bright one. Those scenes exercise the estimator's real decision.