1
0
Fork 0
Commit Graph

20 Commits

Author SHA1 Message Date
Niklas Haas 9fd88bd092 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
2024-05-28 18:11:57 +02:00
Michael Niedermayer fdaa6ae2b6
avcodec/h2645_sei: Remove dead checks
Fixes: CID1596534 Dereference after null check

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-13 03:40:17 +02:00
Kacper Michajłow 1c45104f74 avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
As we can read in ST 2086:

Values outside the specified ranges of luminance and chromaticity values
are not reserved by SMPTE, and can be used for purposes outside the
scope of this standard.

This is further acknowledged by ITU-T H.264 and ITU-T H.265. Which says
that values out of range are unknown or unspecified or specified by
other means not specified in this Specification.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-04-13 17:50:49 +02:00
James Almer 6d0c89980c avcodec/hevcdec: export global side data in AVCodecContext
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-11 11:48:39 -03:00
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Niklas Haas 2e24c12aa1 avcodec/h2645_sei: decode AFGS1 T.35 SEI
I restricted this SEI to HEVC for now, until I see a H.264 sample.
2024-03-23 18:55:21 +01:00
Niklas Haas ad7f059180 avcodec/h2645_sei: signal new AVFilmGrainParams members
H.274 specifies that film grain parameters are signalled as intended for
4:4:4 frames, so we always signal this, regardless of the frame's actual
subsampling.
2024-03-23 18:54:36 +01:00
James Almer a1f714d197 avcodec/h2645_sei: use named constants for ITU-T T.35 metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-19 09:44:59 -03:00
Anton Khirnov 6169bd0fea lavc/*dec: use side data preference for mastering display/content light metadata 2024-03-08 07:38:38 +01:00
Jan Ekström 43e63ff20a avcodec: move content light level SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2023-07-27 21:45:43 +03:00
Jan Ekström 33358b862c avcodec: move mastering display colour volume SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2023-07-27 21:45:43 +03:00
Raphaël Zumer 6f2413a203 avcodec/avutil: move dynamic HDR10+ metadata parsing to libavutil
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-21 13:52:36 -03:00
Jan Ekström 5de565107a avcodec/h2645_sei: add support for Ambient Viewing Environment SEI
Defined by H.274, this SEI message is utilized by iPhones to save
the nominal ambient viewing environment for the display of recorded
HDR content. The contents of the message are exposed to API users
as AVFrame side data containing AVAmbientViewingEnvironment.

As the DV RPU test sample is from an iPhone and includes Ambient
Viewing Environment SEI messages, its test result gets updated.
2023-01-13 21:26:27 +02:00
Andreas Rheinhardt 7b450bafd7 avcodec/h2645_sei: Factor attaching film grain side-data to frame out
This unfortunately involved adding some parameters
to ff_h2645_sei_to_frame() that will be mostly unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
Andreas Rheinhardt a5bba606a0 avcodec/h2645_sei: Also support Active Format Descriptor for HEVC
It is valid for HEVC; in fact, the ATSC-HEVC spec [1] simply
refers to the relevant H.264 spec.

It is also trivial to implement now: Just move applying AFD
to ff_h2645_sei_to_frame() and stop ignoring AFD when parsing
a HEVC SEI containing it.

A FATE-test for this has been added.

[1]: https://www.atsc.org/atsc-documents/a3412017-video-hevc/

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
Andreas Rheinhardt 01e775f4b7 avcodec/h2645_sei: Attach AVStereo3D side data generically
There are only slight differences between H.264 and HEVC
for this side data, so it makes sense to share the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
Andreas Rheinhardt 3bafc4ead4 avcodec/h2645_sei: Factor out applying SEIs to frames
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:41 +01:00
Andreas Rheinhardt f89825e60a avcodec/h2645_sei: Factor out freeing common SEI parts
This commit only factors out freeing the common SEI parts,
not whether the fields indicating whether an SEI is present
shall be reset. H.264 and HEVC differ in this regard
(ff_h264_sei_uninit() really resets, whereas ff_hevc_reset_sei()
only uninits.) and neither actually honours the persistency
as prescribed by the relevant specs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:40 +01:00
Andreas Rheinhardt de5891d371 avcodec/h2645_sei: Factor updating H.2645 SEIs out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:40 +01:00
Andreas Rheinhardt 33239ebd07 avcodec/h2645_sei: Factor parsing common SEI messages out
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:00:40 +01:00