[FFmpeg-devel] [PATCH] lavfi: a minor fix to tonemap peak detection.

Ruiling Song ruiling.song at intel.com
Mon May 21 09:58:33 EEST 2018


If the transfer was SMPTE2084, use the peak of 10000 even if not tagged.
Otherwise, we would assume it is HLG with a peak of 1200.
Based on suggestion by Niklas Haas.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 libavfilter/vf_tonemap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c
index 10308bd..ab45f2e 100644
--- a/libavfilter/vf_tonemap.c
+++ b/libavfilter/vf_tonemap.c
@@ -131,10 +131,9 @@ 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 */
+    /* if not SMPTE2084, we would assume HLG */
     if (!peak)
-        peak = 12;
+        peak = in->color_trc == AVCOL_TRC_SMPTE2084 ? 100 : 12;
 
     return peak;
 }
-- 
2.7.4



More information about the ffmpeg-devel mailing list