1
0
Fork 0
Commit Graph

90 Commits

Author SHA1 Message Date
Niklas Haas d0392619a7 avcodec/dovi_rpu: store entire config record
And make it public.

For encoding, users may also be interested in the configured level and
compatibility ID. So generalize the dv_profile field and just expose the
whole configuration record.

This makes the already rather reductive ff_dovi_update_cfg() function
almost wholly redundant, since users can just directly assign
DOVIContext.cfg.
2024-04-22 12:17:05 +02:00
Andreas Rheinhardt 0dbf45120a avcodec/libdav1d: Don't cast const away unnecessarily
Possible since c89f6ae689.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-06 18:44:06 +02:00
Niklas Haas b90c18b38c avcodec/dovi_rpu: verify RPU data CRC32
The Dolby Vision RPU contains a CRC32 to validate the payload against.
The implementation is CRC32/MPEG-2.

The CRC is only verified with the AV_EF_CRCCHECK flag.

Co-authored-by: quietvoid <tcChlisop0@gmail.com>
2024-04-03 16:16:53 +02:00
Niklas Haas 1539efaacb avcodec/libdavv1d: signal new AVFilmGrainParams members
Not directly signalled by AV1, but we should still set this accordingly
so that users will know what the original intended video characteristics
and chroma resolution were.
2024-03-23 18:54:36 +01:00
Andreas Rheinhardt c89f6ae689 avcodec/libdav1d: Stop mangling AVPacket.opaque
Unnecessary since 67e7f0b05e
as there are no longer two opaque fields.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 16:33:53 +01:00
James Almer 61519cc654 avcodec/libdav1d: 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
Niklas Haas a5d1e69b3b avcodec/libdav1d: parse DV profile 10 T.35 OBU
This is thankfully passed through verbatim by libdav1d, so we can parse
it in our own code.

In theory, taking the DV profile from the packet-level configuration
struct is redundant since there is currently only one possible DV level
for AV1 (and all others would fail parsing), but this marginally
future-proofs it against possible new AV1-specific profiles being added
in the future.
2024-03-11 11:40:09 +01:00
Anton Khirnov 6169bd0fea lavc/*dec: use side data preference for mastering display/content light metadata 2024-03-08 07:38:38 +01:00
Niklas Haas 0b7aefe698 avcodec/libdav1d: respect side data preference
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:37:56 +01:00
James Almer 67e7f0b05e avutil: remove deprecated FF_API_REORDERED_OPAQUE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 48f4a29bae avcodec/libdav1d: print libdav1d version in verbose level
info level will be too noisy if several instances of the decoder are fired
at the same time, as will be the case with tiled AVIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-06 10:34:50 -03:00
Anton Khirnov 08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt 0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
James Almer 5ad78a2684 avcodec/libdav1d: remove FF_CODEC_CAP_SETS_PKT_DTS flag
It has no effect on receive_frame() decoders.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-11 14:26:43 -03:00
James Almer f209614290 avcodec/libdav1d: only return EAGAIN when there are no buffered packets
Fixes decoding packets containing split temporal units, as generated for example
by the av1_frame_split bsf.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-22 16:19:10 -03:00
James Almer 1b05d27346 avcodec/libdav1d: export decoder frame delay
As this is an AV_CODEC_CAP_OTHER_THREADS decoder, threading is handled by the
underlying library. In this case, the frame delay is calculated by libdav1d
based on the values from avctx->thread_count and the private max_frame_delay
option.
Export said delay reported by the library in AVCodecContext.delay

Reviewed-by: Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-19 15:29:31 -03:00
Anton Khirnov 9d70e74d25 lavc/libdav1d: fix exporting framerate
Same issues as in the previous commit.
2023-05-15 14:45:46 +02:00
James Almer 09b2ca93b4 avcodec/libdav1d: support parsing multiple ITU-T T.35 entries in a picture
This requires the newest libdav1d release.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-05 14:26:52 -03:00
James Almer dc7bd7c5a5 avcodec: use the new AVFrame key_frame flag in all decoders and encoders
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:48:22 -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
James Almer 0d35634eaa avcodec/libdav1d: Fix unintended fallthrough
Based on a patch by Andreas Rheinhardt

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-15 12:42:43 -03:00
James Almer 7dc0944ce2 avcodec/libdav1d: reindent after previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-08 12:44:37 -03:00
James Almer b465e6fed0 avcodec/libdav1d: export Dynamic HDR10+ frame metadata
As defined in https://aomediacodec.github.io/av1-hdr10plus/

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-08 12:44:27 -03:00
Anton Khirnov bdc76f467f lavu/frame: deprecate reordered_opaque
It is only used in libavcodec, where it's been superseded by
AV_CODEC_CAP_COPY_OPAQUE.
2023-02-04 13:40:20 +01:00
Anton Khirnov d02340b9e3 lavc/decode: allow using AV_CODEC_FLAG_COPY_OPAQUE for decoding
Use it to propagate AVPacket.opaque[_ref] to corresponding AVFrame
fields. This is a more convenient alternative to reordered_opaque.
2023-02-04 13:14:20 +01:00
James Almer 7af947c0c0 avcodec/libdav1d: honor the requested skip_frame level
This allows dropping non-reference, non-intra, or non-key frames on supported
libdav1d versions.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-17 21:37:23 -03:00
James Almer 048f369f1b avcodec/libdav1d: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer b27f3f9b50 avcodec/libdav1d: set frame props from the reordered packet
Attach the AVPacket instead of only a few values to the corresponding Dav1dData
struct and use it to set all output frame props.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer 81bea2e98b avcodec/libdav1d: don't use AVCodecInternal.in_pkt
Allocate an AVPacket instead, which will be used in the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer bd5b59deea avcodec/libdav1d: add an option to set max frame delay
Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-15 15:24:51 -03:00
Andreas Rheinhardt 48286d4d98 avcodec/codec_internal: Add macro to set AVCodec.long_name
It reduces typing: Before this patch, there were 105 codecs
whose long_name-definition exceeded the 80 char line length
limit. Now there are only nine of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:42:57 +02:00
Anton Khirnov ac2cda4296 lavc: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
Andreas Rheinhardt 21b23ceab3 avcodec: Make init-threadsafety the default
and remove FF_CODEC_CAP_INIT_THREADSAFE
All our native codecs are already init-threadsafe
(only wrappers for external libraries and hwaccels
are typically not marked as init-threadsafe yet),
so it is only natural for this to also be the default state.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-18 20:04:59 +02:00
James Almer 3e186148ca avcodec/libdav1d: don't depend on the event flags API to init sequence params the first time
A bug was found in dav1d <= 1.0.0 where the event flag New Sequence Header would
not be signaled for some samples using delayed random access points.
It has since been fixed, but nonetheless it's best to ensure the AVCodecContext
is filled with parameters when parsing the first frame, regardless of what events
were signaled.

Fixes ticket #9694.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-07 15:28:50 -03:00
Andreas Rheinhardt 4243da4ff4 avcodec/codec_internal: Use union for FFCodec decode/encode callbacks
This is possible, because every given FFCodec has to implement
exactly one of these. Doing so decreases sizeof(FFCodec) and
therefore decreases the size of the binary.
Notice that in case of position-independent code the decrease
is in .data.rel.ro, so that this translates to decreased
memory consumption.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-05 20:02:37 +02:00
Andreas Rheinhardt 20f9727018 avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts
of AVCodec. This exposes the internals of AVCodec to users
and leads them into the temptation of actually using them
and forces us to forward-declare structures and types that
users can't use at all.

This commit changes this by adding a new structure FFCodec to
codec_internal.h that extends AVCodec, i.e. contains the public
AVCodec as first member; the private fields of AVCodec are moved
to this structure, leaving codec.h clean.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt a688f3c13c avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.h
Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault.
This reduces the amount of files that have to include internal.h
(which comes with quite a lot of indirect inclusions), as e.g.
most encoders don't need it. It is furthemore in preparation
for moving the private part of AVCodec out of the public codec.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
James Almer 61b104caaa avcodec/libdav1d: free the Dav1dData packet on dav1d_send_data() failure
We still own it on failure, and there's no point trying to feed it again.

This should address the issue reported in dav1d #383 and part of VLC #26259.

Signed-off-by: James Almer <jamrial@gmail.com>
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-02-01 13:03:12 -03:00
James Almer 6c4074e423 avcodec/libdav1d: explicitly set Dav1dSettings.apply_grain
Don't depend on its default value being 1, as that could change anytime.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-10 12:20:48 -03:00
James Almer 3e17e0e5ef avcodec/libdav1d: honor the requested strict_std_compliance level on supported builds
Signed-off-by: James Almer <jamrial@gmail.com>
2022-01-06 22:57:46 -03:00
Andreas Rheinhardt 7c5ee237be avcodec/libdav1d: Use av_memdup() where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-07 17:38:22 +01:00
Andreas Rheinhardt 31d0487ba2 avcodec/libdav1d: Use AVCodecInternal.in_pkt instead of stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-07 17:34:33 +01:00
Andreas Rheinhardt 776e9f9e2a avcodec/libdav1d: Don't leak side-data-only packets
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-07 17:32:52 +01:00
James Almer 9a7fe439d9 avcodec/libdav1d: let libdav1d choose optimal max frame delay
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-21 15:11:20 -03:00
James Almer d873b5fffc avcodec/libdav1d: pass auto threads value to libdav1d
libdav1d 1.0.0 will be the first version supporting Dav1dSettings.n_threads == 0.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-20 22:30:35 -03:00
James Almer e204846ec1 avcodec/libdav1d: fix compilation after recent libdav1d API changes
They were done in preparation for an upcoming 1.0 release.
Keep supporting previous releases for the time being.

Reviewed-by: BBB
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-03 15:01:35 -03:00
James Almer 651fed3860 avcodec/libdav1d: signal the presence of Film Grain in the decoder context
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-24 10:00:20 -03:00
Andreas Rheinhardt 69f120ead7 avcodec/avcodec: Don't include cpu.h
It is not used here at all; instead, add it where it is used without
including it or any of the arch-specific CPU headers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 12:59:07 +02:00
James Almer 1349de10b2 avcodec/libdav1d: parse sequence headers in extradata if available
This allows the decoder context to be initialized with all stream parameters
before a packet is parsed.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-14 13:11:51 -03:00
James Almer 7ee17ec7e4 avcodec/libdav1d: don't repeatedly parse the same sequence header
Look at the event flag that signals a new sequence header was found
in the bitstream on supported libdav1d versions for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-09 11:07:29 -03:00