vf_tonemap: Fix logic for detecting the maximum peak of untagged sources

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.
This commit is contained in:
Vittorio Giovara 2018-07-25 17:21:04 +02:00
parent 076b19660e
commit ce7ca726b2
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}