Commit Graph

100195 Commits

Author SHA1 Message Date
Lynne
b4f9d05301
hwcontext_vulkan: add VkExternalMemoryBufferCreateInfo to imported buffers
Its a validation layer thing.
2020-11-25 23:06:35 +01:00
Lynne
10b3c9b533
hwcontext_vulkan: do not use uninitialized variables on errors in CUDA code 2020-11-25 23:06:35 +01:00
Lynne
ae8fc9922e
lavfi/vulkan: allow calling glslang_uninit without a prior init
Allows us to uninit cleanly.
This assert was also somewhat pointless as we assert every other
function, so another assert would be triggered long before this
one is.
2020-11-25 23:06:34 +01:00
Lynne
993d8d9429
hwcontext_drm: issue DMA_BUF_IOCTL_SYNC when mapping FDs
This improves performance and helps a little when given FDs without
any synchronization fences.
2020-11-25 23:06:34 +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
Lynne
d243dd540a
libavcodec: add a new AV_CODEC_EXPORT_DATA_FILM_GRAIN flag and option
This introduces a new field to allow decoders to export their film grain
parameters.
Will be used by the next patch.
2020-11-25 23:06:33 +01:00
Lynne
4f9ee87253
libavutil: introduce AVFilmGrainParams side data
This patch introduces a new frame side data type AVFilmGrainParams for use
with video codecs which support it.

It can save a lot of memory used for duplicate processed reference frames and
reduce copies when applying film grain during presentation.
2020-11-25 23:06:33 +01:00
Paul B Mahol
5b1ccd748a avfilter/af_arnndn: add timeline support 2020-11-25 13:41:52 +01:00
Andreas Rheinhardt
3de3d2f5e2 avcodec/mpeg12enc: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-25 01:08:42 +01:00
Andreas Rheinhardt
bf5bfcdbd3 avcodec/mpeg12enc: Use ff_thread_once() for static initializations
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-25 01:05:26 +01:00
Andreas Rheinhardt
ef3c1670d4 avcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengths
The MPEG-1/2 encoders initialize several tables once during the first
time one of the encoders is initialized; the table for MPEG-2 intra VLC
lengths is only initialized if it is used for this encoder instance.
This implies that if the first MPEG-1/2 encoder to be initialized does
not use it, it will never be initialized even if a later encoder
instance makes use of them. Fix this by initializing this table
unconditionally.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-25 01:01:05 +01:00
Paul B Mahol
278984b343 avfilter/vf_readeia608: add support for slice threads 2020-11-24 22:34:18 +01:00
Paul B Mahol
97bc6900e6 avfilter/vf_readeia608: add support for commands 2020-11-24 22:34:18 +01:00
Musee Ullah
7bb8b81955 avfilter/vf_xfade: ensure metadata is copied to transition frames
I was having an issue where, using a filter chain of xfade -> ass, the
colors on the subtitles were incorrect only on the frames where xfade
was being used. This resolves that issue for me.

Signed-off-by: Musee Ullah <lae@lae.is>
2020-11-24 14:35:41 +01:00
Paul B Mahol
c6a7ca271b avfilter/af_biquads: make sure that biquad filter still works 2020-11-24 14:26:47 +01:00
Paul B Mahol
040e989223 avfilter/af_biquads: do not abort filtering on bogus options
Instead, continue returning unfiltered input.
2020-11-24 12:03:23 +01:00
Andreas Rheinhardt
08a992e018 avcodec/mlpdec: Avoid code duplication when initializing VLCs
Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:04 +01:00
Andreas Rheinhardt
34aa85cd91 avcodec/mlpdec: Make decoders init-threadsafe
Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:04 +01:00
Andreas Rheinhardt
1f0e27dd66 avcodec/mlp: Make initializing CRCs thread-safe
Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
79ab46ac6e avcodec/mpegaudiodec_template: Don't use unnecessarily many VLC bits
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
37f510d3f4 avcodec/mv30: Don't check for errors for complete VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
50d50653d1 avcodec/imm4: Don't use too big VLC table
Using more bits than the longest code has makes no sense.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
195d8ce85e avcodec/aac*: Make initializing ff_aac_pow*sf_tab thread-safe
This table is currently initialized up to three times: Once by the
encoder and twice by the decoders (once by the fixed and once by the
floating-point decoder); each of these initializations is guarded by an
AVOnce, yet the fact that there are three of them implies that there
might be data races (the fact that each entry is only written to once
(to its final value) when initializing means that this is safe in
practice, yet it is still undefined behaviour). Fix this by only
initializing the table from one place that is guarded by a single AVOnce.
This also avoids unnecessary duplications of the init code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
c4b4cd775a avcodec/aactab: Fix conflicting types for ff_aac_codebook*
The header missed that these are arrays of const pointers (to const
data).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
b81e6437ca avcodec/qdmc: Don't check for errors for complete VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
e68247d5cf avcodec/hqx: Don't check for errors for complete VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
a03caa384f avcodec/hqx: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
b1af617f51 avcodec/intrax8: Make ff_intrax8_common_init() thread-safe
In particular, don't reinitialize VLCs every time an IntraX8Context is
initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
802baf212d avcodec/intrax8: Replace always-false check by assert
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
164ce14e5c avcodec/atrac9tab: Add missing static to internal table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
6612d6d62e avcodec/atrac9dec: Replace av_free() by av_freep() in close function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
659c61ba7c avcodec/atrac9dec: Don't use unnecessarily large VLC tables
Using more bits for a VLC than the longest code has has no advantage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
4a9ffce91c avcodec/atrac9dec: Use least max_depth in calls to get_vlc2()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
92209cf4c9 avcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength
The whole point of VLCs with their tables is to read more than one bit
at a time; therefore max_depth, the number of times one has to
(maximally) read further bits is given by ceil(max_code_length / table_bits)
which in the case of ATRAC9's coefficient VLCs gives an upper bound of
two. Instead the maximum length of a code of the given VLC has been used
(which is not even a compile-time constant). Use two instead.

Furthermore, given that this was the only usage of the field containing
the maximum of all the code lengths of a given VLC the field has been
removed from its containing struct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
0339af05a4 avcodec/truemotion2: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
73b3ea5728 avcodec/g2meet: Use least max_depth in get_vlc2()
The longest AC codes of the standard JPEG tables are 16 bits long; for
the DC tables, the maximum is 11, so using max_depth of two is
sufficient.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
e74621b0a8 avcodec/sheervideo: Add av_cold to build_vlc()
It is an init function even when called from decode_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
f1919dc8fa avcodec/mss4: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
9a61326b0f avcodec/rv40vlc2: Make VLC smaller
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
278a27f651 avcodec/qdm2: Remove outdated comment
Forgotten in f054e309c5.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
16bb8247b4 avcodec/mpegaudiodsp: Make initializing synth windows thread-safe
These arrays are used by the Musepack decoders, the MPEG audio decoders
as well as qdm2 and up until now, these arrays might be initialized more
than once, leading to potential data races as well as unnecessary
initializations. Therefore this commit ensures that each array will only
be initialized once.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
ead3134150 avcodec/mpegaudiodsp: Make ff_mpadsp_init() thread-safe
The only thing missing for this is to make ff_mpadsp_init_x86()
thread-safe; it currently isn't because a static table is initialized
every time ff_mpadsp_init() is called (when ARCH_X86 is true). Solve
this by initializing this table only once, namely together with the
ordinary not-arch specific tables. This also allows to reuse their AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
b9c1ab8907 avcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe
Commit 1af615683e put initializing
the ff_fft_offsets_lut (which is typically used if FFT_FIXED_32)
behind an ff_thread_once() to make ff_fft_init() thread-safe; yet
there is a second place where said table may be initialized which
is not guarded by this AVOnce: ff_fft_init_mips(). MIPS uses this LUT
even for ordinary floating point FFTs, so that ff_fft_init() is not
thread-safe (on MIPS) for both 32bit fixed-point as well as
floating-point FFTs; e.g. ff_mdct_init() inherits this flaw and
therefore initializing e.g. the AAC decoders is not thread-safe (on
MIPS) despite them having FF_CODEC_CAP_INIT_CLEANUP set.

This commit fixes this by moving the AVOnce to fft_init_table.c and
using it to guard all initializations of ff_fft_offsets_lut.

(It is not that bad in practice, because every entry of
ff_fft_offsets_lut is never read during initialization and is only once
ever written to (namely to its final value); but even these are
conflicting actions which are (by definition) data races and lead to
undefined behaviour.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
5c45f7e156 avcodec/mpegaudiodsp: Combine initializing float and int tables
This avoids code duplication in the functions used to initialize them
and allows to remove an AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
af7acbb4b8 avcodec/motionpixels: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
cc18bcdd52 avcodec/motionpixels: Use symbols table
If allows us to directly store the deltas in the VLC table and therefore
avoids a level of indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
d3fba74803 avcodec/motionpixels: Don't check for errors for complete VLC
The algorithm used here always creates a complete VLC, so it is
unnecessary to check this again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
3d95b1a828 avcodec/motionpixels: Be more strict when parsing Huffman trees
This ensures that the number of leafs in the Huffman tree equals the
number it is supposed to be and therefore ensures that the VLC tree is
complete, allowing us to remove checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
e246ea2535 avcodec/motionpixels: Only create VLC iff it is going to be used
If the Huffman tree consists of only one entry (which has length zero),
no tree is used at all for parsing as the VLC API currently can't handle
this. So it makes no sense to create a VLC in this case.

Commit 41b7389cad added a check for
whether creating the VLC should be skipped, but it also skipped decoding
the packet and it used the wrong check: It checked max_codes_bits,
the maximum length of a code; but this value is only updated iff there is
more than one Huffman entry. So if there is only one Huffman entry, and
there was a previous frame with more than one entry, then a VLC was
created unnecessarily; yet if there was no previous frame with more than
one entry, then this frame will be skipped which is probably
spec-incompliant. I have no sample for the latter.

This commit improves the check to create a VLC iff it is going to be
used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00
Andreas Rheinhardt
97da1b4341 avcodec/mimic: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-24 11:35:03 +01:00