Commit Graph

51 Commits

Author SHA1 Message Date
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
James Almer
48eaf8ba1c avcodec/libdav1d: use ff_decode_frame_props() to fill frame properties
The main benefit comes from propagating container level metadata like hdr,
which is more commonly used than the relevant Metadata OBUs.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-09 11:07:29 -03:00
Andreas Rheinhardt
a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
Andreas Rheinhardt
6e30b35b85 avutil/frame: Remove deprecated AVFrame.pkt_pts field
Deprecated in 32c8359093.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Anton Khirnov
7d09579190 lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
This cap is currently used to mark multithreading-capable codecs that
wrap external libraries with their own multithreading code. The name is
highly confusing for our API users, since libavcodec ALWAYS handles
thread_count=0 (see commit message in previous commit). Therefore rename
the cap and update its documentation to make its meaning clear.

The old name is kept deprecated until next+1 major bump.
2021-03-16 10:38:41 +01:00
Anton Khirnov
8a129077cc lavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal cap
AV_CODEC_CAP_AUTO_THREADS was originally added in b4d44a45f9 to mark
codecs that spawn threads internally and are able to select an optimal
threads count by themselves (all such codecs are wrappers around
external libraries). It is used by lavc generic code to check whether it
should handle thread_count=0 itself or pass the zero directly to the
codec implementation. Within this meaning, it is clearly supposed to be
an internal cap rather than a public one, since from the viewpoint of a
libavcodec user, lavc ALWAYS handles thread_count=0. Whether it happens
in the generic code or within the codec internals is not a meaningful
difference for the caller.

External aspects of this flag will be dealt with in the following
commit.
2021-03-16 10:34:29 +01:00
James Almer
081a17990b avcodec/libdav1d: stop setting AVFrame->best_effort_timestamp
It's now set by the generic decode code.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-13 12:14:57 -03:00
Lynne
2ba04670c3
lavu/film_grain_params: fix typo in type enum
Ref: xkcd #1015
2020-11-27 02:30:01 +01:00
Lynne
18933dbde0
libdav1d: correctly copy ar_coeffs_uv to our struct
Our struct is a [2][25], libdav1d's is a [2][25 + 3] so the last 3
v coefficients were missing.
Copy each plane's coefficients separately.
2020-11-26 01:08:03 +01:00
Lynne
dd34861018
libdav1d: use film grain export flag to export AVFilmGrainParams side data
This patch is relatively straightforward with one exception:
the decoder option flag.
The option was introduced to troubleshoot but its existence is conflicting
and redundant now that we have a codec-generic flag.
Hence this patch deprecates it.

The way it interacts with AV_CODEC_EXPORT_DATA_FILM_GRAIN is as follows:

If filmgrain is unset and AV_CODEC_EXPORT_DATA_FILM_GRAIN is
present, disable film grain application and export side data.

If filmgrain is set to 0, disable film grain and export side data.

If filmgrain is set to 1, apply film grain but export side data if
the AV_CODEC_EXPORT_DATA_FILM_GRAIN flag is set. This may result in
double film grain application, but the user has requested it by setting
both.
2020-11-25 23:06:33 +01:00
Derek Buitenhuis
649a6969f7 avcodec/libdav1d: Call ff_set_sar in addition to setting the frame SAR
Similar to what we do in libaomdec.c.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-08-26 16:44:03 +01:00
James Almer
6c1bf7c02e avcodec/libdav1d: add support for A53 Closed Captions
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-15 13:01:08 -03:00
James Almer
5eb4405fc5 avcodec/libdav1d: use av_image_get_buffer_size() to calculate frame size
Calling av_image_fill_arrays() with NULL as src argument may result in UB.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-22 11:42:54 -03:00
James Almer
49220869a8 avcodec/libdav1d: export frame sample aspect ratio
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-18 12:28:03 -03:00
Thierry Foucu
eaf566ce0b Add options for spatial layers.
Disable by default to output all the layers, to match libaomdec wrapper.
Add option to select the operating point for the spatial layers.
Update the documentation with the new options.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-11-28 10:21:20 -03:00
James Almer
97d9cff251 avcodec/libdav1d: export bitstream timing info when available
Signed-off-by: James Almer <jamrial@gmail.com>
2019-11-12 22:21:45 -03:00
James Almer
a34d06222f avcodec/libdav1d: fix setting AVFrame reordered_opaque
Actually reorder the values.

Should effectively fix ticket #8300.

Tested-by: Andrey Semashev <andrey.semashev@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-22 12:00:49 -03:00
James Almer
39d5acbd09 avcodec/libdav1d: set AVFrame reordered_opaque
Fixes ticket #8300

Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-17 12:35:28 -03:00
James Almer
6c0167f6f6 avcodec/libdav1d: use the library default for the filmgrain option
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-15 11:09:39 -03:00
James Almer
03ba386833 avcodec/libdav1d: allow setting frame size limit in pixels
Signed-off-by: James Almer <jamrial@gmail.com>
2019-08-14 22:01:05 -03:00
James Almer
f78172b29a avcodec/libdav1d: add support for RGB streams
Signed-off-by: James Almer <jamrial@gmail.com>
2019-05-27 13:21:52 -03:00
James Almer
254da41531 avcodec/libdav1d: assert Dav1dPicture allocator_data is set before referencing its data
To ensure the custom allocator is effectively used.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-05-27 12:49:01 -03:00
James Almer
0e07b767c8 avcodec/libdav1d: export level from the Sequence Header
Signed-off-by: James Almer <jamrial@gmail.com>
2019-05-27 12:47:33 -03:00
James Almer
fbc5a27694 avcodec/libdav1d: fine tune thread distribution
As suggested by Ronald, don't map auto threads to frame threads only, and
instead distribute them between frame and tile more efficiently.
Add a new framethreads override option, similar to the tilethreads one.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-05-20 16:20:04 -03:00
James Almer
9e62e1a110 avcodec/libdav1d: use a reference to the allocated buffer instead of wrapping the Dav1dPicture
Removes an av_malloc() per frame.

Reviewed-by: BBB
Reviewed-by: nevcairiel
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-19 14:04:08 -03:00
James Almer
5cd60b6f2e avcodec/libdav1d: reset pool size on allocation failure
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-19 14:03:39 -03:00
James Almer
f6803cfbd2 avcodec/libdav1d: unref the frame on failure
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-12 19:45:10 -03:00
Vittorio Giovara
38a4132132 libdav1d: Add support for reading hdr10 metadata
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-12 19:36:30 -03:00
James Almer
36bb2cc200 avcodec/libdav1d: consistently use AVERROR return values
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-12 19:18:14 -03:00
James Almer
28746a0e20 avcodec/libdav1d: use a custom picture allocator
Replaces the libdav1d internal allocator. It uses an AVBufferPool to reduce the
amount of allocated buffers.
About 5% speed up when decoding 720p or higher streams.

Reviewed-by: "Vittorio Giovara <vittorio.giovara@gmail.com>"
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-12 19:17:45 -03:00
James Almer
2a31bf2a35 avcodec/libdav1d: move the pix_fmt enum array up in the file
This is in preparation for the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-12 19:09:43 -03:00
James Almer
dcf64b599d avcodec/libdav1d: route dav1d internal logs through av_log()
Bump the minimum required version to the first one with the logger API callback.

Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-03-12 19:07:50 -03:00
James Almer
10931a0661 avcodec/libdav1d: properly free all output picture references
Dav1dPictures contain more than one buffer reference, so we're forced to use the
API properly to free them all.

Reviewed-by: BBB
Signed-off-by: James Almer <jamrial@gmail.com>
2019-01-08 15:40:50 -03:00
James Almer
0e833f615b avcodec/libdav1d: add support for 12bit streams
Signed-off-by: James Almer <jamrial@gmail.com>
2018-12-12 00:07:13 -03:00
James Almer
e695b0beba avcodec/libdav1d: add an option to toggle Film Grain
Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-28 23:05:10 -03:00
James Almer
0fca2f60da avcodec/libdav1d: read profile from the sequence header referenced by the ouput picture
Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-28 23:04:22 -03:00
James Almer
3cd275bcde avcodec/libdav1d: use constants defined in the public API to limit thread count
Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-28 23:04:21 -03:00
James Almer
53ca505acc avcodec/libdav1d: remove init cleanup internal codec cap
It's no longer needed now that the AVFifoBuffer was removed.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-28 23:04:03 -03:00
James Almer
cc25529420 avcodec/libdav1d: update the API usage after upstream changes
The color fields were moved to another struct, and a way to propagate
timestamps and other input metadata was introduced, so the packet fifo
can be removed.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-25 21:42:10 -03:00
James Almer
752659327d avcodec/libdav1d: fix build after a recent API break
Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-14 10:05:25 -03:00