[FFmpeg-devel] [PATCH v2] avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
Niklas Haas
ffmpeg at haasn.xyz
Mon Feb 26 14:04:15 EET 2024
On Sun, 25 Feb 2024 03:17:55 +0100 Kacper Michajłow <kasper93 at gmail.com> wrote:
> - av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n");
> - av_log(avctx, AV_LOG_DEBUG,
> - "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n",
> - av_q2d(metadata->display_primaries[0][0]),
> - av_q2d(metadata->display_primaries[0][1]),
> - av_q2d(metadata->display_primaries[1][0]),
> - av_q2d(metadata->display_primaries[1][1]),
> - av_q2d(metadata->display_primaries[2][0]),
> - av_q2d(metadata->display_primaries[2][1]),
> - av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]));
> - av_log(avctx, AV_LOG_DEBUG,
> - "min_luminance=%f, max_luminance=%f\n",
> - av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
> + metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 &&
> + sei->mastering_display.min_luminance <= 50000;
... &&
sei->mastering.display.min_luminance <
sei->mastering_display.max_luminance;
According to spec, at least. Handles the edge case of min = max = 50000.
More information about the ffmpeg-devel
mailing list