diff mbox

[FFmpeg-devel,1/4] vf_tonemap: Update the default peak values

Message ID 20180725154640.89762-1-vittorio.giovara@gmail.com
State Accepted
Commit ce7ca726b2cae0eeb4a4e688c5c7d0ea05776832
Headers show

Commit Message

Vittorio Giovara July 25, 2018, 3:46 p.m. UTC
When there is no metadata attached to a frame, take into account both
the PQ and HLG transfers, and change the HLG default value to 10:
the value of 12 is the maximum range in scene referred light, but
the reference OOTF maps this from 0 to 1000 cd/m² on the ideal HLG
monitor.

This matches what vf_tonemap_opencl does.
---
 libavfilter/vf_tonemap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Carl Eugen Hoyos July 25, 2018, 6:31 p.m. UTC | #1
2018-07-25 17:46 GMT+02:00, Vittorio Giovara <vittorio.giovara@gmail.com>:
> When there is no metadata attached to a frame, take into account both
> the PQ and HLG transfers, and change the HLG default value to 10

Sounds like two independent changes to me.

(While splitting a function and adding it to a second filter
can be split but may be merged imo.)

Carl Eugen
Vittorio Giovara July 31, 2018, 8:21 a.m. UTC | #2
On Wed, Jul 25, 2018 at 5:46 PM, Vittorio Giovara <
vittorio.giovara@gmail.com> wrote:

> When there is no metadata attached to a frame, take into account both
> the PQ and HLG transfers, and change the HLG default value to 10:
> the value of 12 is the maximum range in scene referred light, but
> the reference OOTF maps this from 0 to 1000 cd/m² on the ideal HLG
> monitor.
>
> This matches what vf_tonemap_opencl does.
> ---
>  libavfilter/vf_tonemap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>

haasn was suggesting to change the title to `vf_tonemap: Fix the logic for
detecting the maximum peak of untagged sources` in order to better describe
the contents of this patch (and avoid having to split this simple change).
If no objections I'll amend the commit title and push soon.
Ruiling Song Aug. 3, 2018, 4:38 p.m. UTC | #3
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of

> Vittorio Giovara

> Sent: Wednesday, July 25, 2018 8:47 AM

> To: ffmpeg-devel@ffmpeg.org

> Subject: [FFmpeg-devel] [PATCH 1/4] vf_tonemap: Update the default peak

> values

> 

> When there is no metadata attached to a frame, take into account both

> the PQ and HLG transfers, and change the HLG default value to 10:

> the value of 12 is the maximum range in scene referred light, but

> the reference OOTF maps this from 0 to 1000 cd/m² on the ideal HLG

> monitor.

The patch-set looks good to me.

Ruiling
diff mbox

Patch

diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c
index 10308bdb16..10fd7ea016 100644
--- a/libavfilter/vf_tonemap.c
+++ b/libavfilter/vf_tonemap.c
@@ -131,10 +131,10 @@  static double determine_signal_peak(AVFrame *in)
             peak = av_q2d(metadata->max_luminance) / REFERENCE_WHITE;
     }
 
-    /* smpte2084 needs the side data above to work correctly
-     * if missing, assume that the original transfer was arib-std-b67 */
+    // For untagged source, use peak of 10000 if SMPTE ST.2084
+    // otherwise assume HLG with reference display peak 1000.
     if (!peak)
-        peak = 12;
+        peak = in->color_trc == AVCOL_TRC_SMPTE2084 ? 100.0f : 10.0f;
 
     return peak;
 }