mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
avcodec/h2645_sei: loosen up min luminance requirements
The H.265 specification is quite clear on this case: > When min_display_mastering_luminance is not in the range of 1 to > 50000, the nominal maximum display luminance of the mastering display > is unknown or unspecified or specified by other means not specified in > this Specification. And so the current code is correct in marking luminance data as invalid if min luminance is set to 0. However, this breaks playback of at least several real-world Blu-ray releases, for example La La Land, Planet of the Apes, and quite possibly a lot more. These come with ostensibly valid max_luminance tags (1000 nits), but min_luminance set to 0. Loosen up this requirement by guarding it behind FF_COMPLIANCE_STRICT. We still reject blatantly invalid metadata (wrong value range on luminance, max set to 0, max below min, min above 50 nits etc.), so this shouldn't cause any unintended regressions. Fixes: https://github.com/mpv-player/mpv/issues/14177
This commit is contained in:
parent
b2b23f353a
commit
9fd88bd092
@ -619,11 +619,15 @@ static int h2645_sei_to_side_data(AVCodecContext *avctx, H2645SEI *sei,
|
|||||||
|
|
||||||
metadata->min_luminance.num = sei->mastering_display.min_luminance;
|
metadata->min_luminance.num = sei->mastering_display.min_luminance;
|
||||||
metadata->min_luminance.den = luma_den;
|
metadata->min_luminance.den = luma_den;
|
||||||
metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 &&
|
metadata->has_luminance &= sei->mastering_display.min_luminance <= 50000 &&
|
||||||
sei->mastering_display.min_luminance <= 50000 &&
|
|
||||||
sei->mastering_display.min_luminance <
|
sei->mastering_display.min_luminance <
|
||||||
sei->mastering_display.max_luminance;
|
sei->mastering_display.max_luminance;
|
||||||
|
|
||||||
|
/* Real (blu-ray) releases in the wild come with minimum luminance
|
||||||
|
* values of 0.000 cd/m2, so permit this edge case */
|
||||||
|
if (avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT)
|
||||||
|
metadata->has_luminance &= sei->mastering_display.min_luminance >= 1;
|
||||||
|
|
||||||
if (metadata->has_luminance || metadata->has_primaries)
|
if (metadata->has_luminance || metadata->has_primaries)
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n");
|
av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n");
|
||||||
if (metadata->has_primaries) {
|
if (metadata->has_primaries) {
|
||||||
|
Loading…
Reference in New Issue
Block a user