[FFmpeg-devel] [PATCH] lavfi: add opencl tonemap filter.

Niklas Haas ffmpeg at haasn.xyz
Thu May 24 13:27:03 EEST 2018


On Thu, 24 May 2018 08:58:22 +0000, "Song, Ruiling" <ruiling.song at intel.com> wrote:
> Where comes the "1000 cd/m² is the reference display peak"? seems no clear statement in BT2100?

The concept of there being a "standard" 1000 cd/m² display is introduced
in multiple places. Refer to Table 5 of ITU-R BT.2100, specifically the
section called "HLG Reference EOTF, in particular this definition:

> γ = 1.2 at the nominal display peak luminance of 1 000 cd/m². [5d, 5e, 5f]

And also the Note 5e below it, which explains how to adjust the gamma
if you are displaying on a display with a peak luminance that is
different from 1000 cd/m².

This is pretty much as close to saying that a reference HLG display
should have a peak of 1000 cd/m² as you can get without explicitly
saying it, since that value is essentially the assumption they
hard-coded into their formula.

In addition to this, the ITU-R further reinforces this concept heavily
throughout their ITU-R Report BT.2390, which includes e.g. such
sentences:

> In order to determine the appropriate system gamma for a 1 000 cd/m²
> reference display, NHK conducted a series of experiments with an
> indoor test scene.

So the concept of a “HLG reference display” is not something I made up.
(Incidentally, 1000 cd/m² is also the value you hard-code in your OOTF)

> If that is true, my code is wrong to detect peak of untagged source.
>     if (!peak)
>         peak = in->color_trc == AVCOL_TRC_SMPTE2084 ? 100.0f : 12.0f;
> so here I should change it from 12.0f to 10.0f?

Yes, given that you're defaulting the OOTF to 1000 this is definitely a
good idea, otherwise white won't map to white. (Observe that you have
the scaling factor in your ootf_hlg hard-coded as 1000.0f / REFERENCE_WHITE
= 10.0)

> Thanks for point this out. I mis-understand the code in libplacebo, because inverse_ootf() was also called if need_ootf is true, which makes I fail to understand it correctly.

pl_shader_inverse_ootf() is parametrized by the actual OOTF to use.
Observe that the inverse_ootf() definition in libplacebo is a no-op if
the `enum pl_color_light` is given as PL_COLOR_LIGHT_DISPLAY.


More information about the ffmpeg-devel mailing list