]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavcodec: deprecate thread_safe_callbacks
Anton Khirnov [Fri, 22 May 2020 13:59:46 +0000 (15:59 +0200)]
avcodec: deprecate thread_safe_callbacks

They add considerable complexity to frame-threading implementation,
which includes an unavoidably leaking error path, while the advantages
of this option to the users are highly dubious.

It should be always possible and desirable for the callers to make their
get_buffer2() implementation thread-safe, so deprecate this option.

3 years agoavfilter/af_acrossover: fix single pole allpass coefficients
Paul B Mahol [Fri, 27 Nov 2020 14:33:13 +0000 (15:33 +0100)]
avfilter/af_acrossover: fix single pole allpass coefficients

3 years agodoc/filters: document adenorm commands support
Paul B Mahol [Fri, 27 Nov 2020 13:34:13 +0000 (14:34 +0100)]
doc/filters: document adenorm commands support

3 years agodoc/filters: add acrossover examples
Paul B Mahol [Fri, 27 Nov 2020 13:27:06 +0000 (14:27 +0100)]
doc/filters: add acrossover examples

3 years agoavfilter/af_acrossover: improve quality for odd order butterworth
Paul B Mahol [Fri, 27 Nov 2020 11:42:58 +0000 (12:42 +0100)]
avfilter/af_acrossover: improve quality for odd order butterworth

3 years agoavfilter/avf_showfreqs: implement phase display
Paul B Mahol [Thu, 26 Nov 2020 22:26:04 +0000 (23:26 +0100)]
avfilter/avf_showfreqs: implement phase display

3 years agohwcontext_vulkan: reduce priority for PACK32 formats
Lynne [Fri, 27 Nov 2020 01:54:23 +0000 (02:54 +0100)]
hwcontext_vulkan: reduce priority for PACK32 formats

Due to some endian-dependent overlap, these should be used last.

3 years agoavutil/film_grain_params: add more details to some AVFilmGrainAOMParams fields
James Almer [Thu, 26 Nov 2020 20:29:35 +0000 (17:29 -0300)]
avutil/film_grain_params: add more details to some AVFilmGrainAOMParams fields

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavu/film_grain_params: fix typo in type enum
Lynne [Fri, 27 Nov 2020 01:12:10 +0000 (02:12 +0100)]
lavu/film_grain_params: fix typo in type enum

Ref: xkcd #1015

3 years agoavformat/mpc8: correct integer overflow in mpc8_parse_seektable()
Michael Niedermayer [Fri, 30 Oct 2020 20:50:32 +0000 (21:50 +0100)]
avformat/mpc8: correct integer overflow in mpc8_parse_seektable()

Fixes: signed integer overflow: -4683718486770919638 * 2 cannot be represented in type 'long'
Fixes: 26704/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6327056939614208
Fixes: 27550/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6259212652642304
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mpc8: correct 32bit timestamp truncation
Michael Niedermayer [Tue, 3 Nov 2020 00:14:26 +0000 (01:14 +0100)]
avformat/mpc8: correct 32bit timestamp truncation

Fixes: left shift of 65536 by 15 places cannot be represented in type 'int'
Fixes: 26801/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-5164313092030464
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Fix memleak in dref reading
Michael Niedermayer [Fri, 30 Oct 2020 20:44:12 +0000 (21:44 +0100)]
avformat/mov: Fix memleak in dref reading

Fixes: leak in mov_read_dref()
Fixes: 26698/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5638785444085760
Fixes: 27554/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6256643054239744
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter: add asupercut filter
Paul B Mahol [Mon, 23 Nov 2020 17:45:54 +0000 (18:45 +0100)]
avfilter: add asupercut filter

3 years agoavfilter/af_acrossover: add missing allpass processing
Paul B Mahol [Thu, 26 Nov 2020 14:36:16 +0000 (15:36 +0100)]
avfilter/af_acrossover: add missing allpass processing

3 years agoavformat/flacenc: Fix memleak when writing attached pictures fails
Andreas Rheinhardt [Fri, 20 Nov 2020 16:36:39 +0000 (17:36 +0100)]
avformat/flacenc: Fix memleak when writing attached pictures fails

The FLAC muxer currently stores an attached picture corresponding to an
AVStream in AVStream.priv_data. The AVPacket contained therein is
unreferenced after it has been written. The AVPacket structure itself is
then freed generically as AVStream.priv_data.

And this can lead to memleaks if an attached picture is not written:
It might be because the trailer is never written or because writing
a previous attached picture failed in case error_recognition is set
to explode.

Therefore free the packets properly (i.e. with av_packet_free())
in the muxer's deinit function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_acrossover: add missing inverter as last step
Paul B Mahol [Thu, 26 Nov 2020 12:13:42 +0000 (13:13 +0100)]
avfilter/af_acrossover: add missing inverter as last step

3 years agoavfilter/af_acrossover: simplify coefficients
Paul B Mahol [Thu, 26 Nov 2020 10:53:17 +0000 (11:53 +0100)]
avfilter/af_acrossover: simplify coefficients

3 years agoavfilter/af_acrossover: add even more orders
Paul B Mahol [Thu, 26 Nov 2020 10:19:51 +0000 (11:19 +0100)]
avfilter/af_acrossover: add even more orders

3 years agoavfilter/af_acrossover: use transposed direct II form
Paul B Mahol [Wed, 25 Nov 2020 21:23:50 +0000 (22:23 +0100)]
avfilter/af_acrossover: use transposed direct II form

3 years agoavfilter/af_acrossover: rewrite code so it performs faster
Paul B Mahol [Wed, 25 Nov 2020 21:01:53 +0000 (22:01 +0100)]
avfilter/af_acrossover: rewrite code so it performs faster

3 years agoavfilter/af_acrossover: add higher orders
Paul B Mahol [Wed, 25 Nov 2020 19:56:17 +0000 (20:56 +0100)]
avfilter/af_acrossover: add higher orders

3 years agodoc/filters: fix typo in overlay_cuda
Gyan Doshi [Thu, 26 Nov 2020 10:46:01 +0000 (16:16 +0530)]
doc/filters: fix typo in overlay_cuda

3 years agolibdav1d: correctly copy ar_coeffs_uv to our struct
Lynne [Wed, 25 Nov 2020 22:46:29 +0000 (23:46 +0100)]
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.

3 years agohwcontext_vulkan: optionally enable more functionality
Niklas Haas [Wed, 25 Nov 2020 11:50:33 +0000 (12:50 +0100)]
hwcontext_vulkan: optionally enable more functionality

These two extensions and two features are both optionally used by
libplacebo to speed up rendering, so it makes sense for libavutil to
automatically enable them as well.

3 years agohwcontext_vulkan: support additional pixel formats
Lynne [Mon, 23 Nov 2020 21:10:24 +0000 (22:10 +0100)]
hwcontext_vulkan: support additional pixel formats

We support every single packed format possible now.
There are some fringe leftover mappings which are uninteresting.

3 years agohwcontext_vulkan: fix incorrect A/0BGR mapping
Lynne [Mon, 23 Nov 2020 21:07:25 +0000 (22:07 +0100)]
hwcontext_vulkan: fix incorrect A/0BGR mapping

Vulkan formats with a PACK suffix define native endianess.
Vulkan formats without a PACK suffix are in bytestream order.

Pixel formats with a LE/BE suffix define endianess.
Pixel formats without LE/BE suffix are in bytestream order.

3 years agohwcontext_vulkan: simplify plane size calculations and support 4-plane formats
Lynne [Wed, 25 Nov 2020 21:32:48 +0000 (22:32 +0100)]
hwcontext_vulkan: simplify plane size calculations and support 4-plane formats

Needed to support YUVA.

3 years agohwcontext_vulkan: do not segfault when failing to init a AVHWFramesContext
Lynne [Wed, 25 Nov 2020 11:06:00 +0000 (12:06 +0100)]
hwcontext_vulkan: do not segfault when failing to init a AVHWFramesContext

frames_uninit is always called on failure, and the free_exec_ctx function
did not zero the pool when freeing it, so it resulted in a double free.

3 years agohwcontext_vulkan: always attempt to map host memory when transferring
Lynne [Tue, 24 Nov 2020 23:20:06 +0000 (00:20 +0100)]
hwcontext_vulkan: always attempt to map host memory when transferring

This relies on the fact that host memory is always going to be required
to be aligned to the platform's page size, which means we can adjust
the pointers when we map them to buffers and therefore skip an entire
copy. This has already had extensive testing in libplacebo without
problems, so its safe to use here as well.

Speeds up downloads and uploads on platforms which do not pool their
memory hugely, but less so on platforms that do.

We can pool the buffers ourselves, but that can come as a later patch
if necessary.

3 years agohwcontext_vulkan: check for memory size before choosing type
Lynne [Tue, 24 Nov 2020 22:36:08 +0000 (23:36 +0100)]
hwcontext_vulkan: check for memory size before choosing type

It makes allocation a bit more robust in case some weird device with
weird drivers which segments memory in weird ways appears.

3 years agohwcontext_vulkan: correctly access the p->extensions bitmask
Lynne [Tue, 24 Nov 2020 13:05:22 +0000 (14:05 +0100)]
hwcontext_vulkan: correctly access the p->extensions bitmask

Its a 64-bit bitfield being put directly into an int.

3 years agohwcontext_vulkan: unify download/upload functions
Lynne [Tue, 24 Nov 2020 12:36:23 +0000 (13:36 +0100)]
hwcontext_vulkan: unify download/upload functions

They were identical, save for variable names and order.

3 years agohwcontext_vulkan: add VkExternalMemoryBufferCreateInfo to imported buffers
Lynne [Sun, 22 Nov 2020 21:48:14 +0000 (22:48 +0100)]
hwcontext_vulkan: add VkExternalMemoryBufferCreateInfo to imported buffers

Its a validation layer thing.

3 years agohwcontext_vulkan: do not use uninitialized variables on errors in CUDA code
Lynne [Sun, 22 Nov 2020 21:56:33 +0000 (22:56 +0100)]
hwcontext_vulkan: do not use uninitialized variables on errors in CUDA code

3 years agolavfi/vulkan: allow calling glslang_uninit without a prior init
Lynne [Sun, 22 Nov 2020 22:08:33 +0000 (23:08 +0100)]
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.

3 years agohwcontext_drm: issue DMA_BUF_IOCTL_SYNC when mapping FDs
Lynne [Fri, 20 Nov 2020 17:23:42 +0000 (18:23 +0100)]
hwcontext_drm: issue DMA_BUF_IOCTL_SYNC when mapping FDs

This improves performance and helps a little when given FDs without
any synchronization fences.

3 years agolibdav1d: use film grain export flag to export AVFilmGrainParams side data
Lynne [Thu, 12 Nov 2020 11:48:20 +0000 (12:48 +0100)]
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.

3 years agolibavcodec: add a new AV_CODEC_EXPORT_DATA_FILM_GRAIN flag and option
Lynne [Thu, 12 Nov 2020 16:46:09 +0000 (17:46 +0100)]
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.

3 years agolibavutil: introduce AVFilmGrainParams side data
Lynne [Thu, 12 Nov 2020 11:44:30 +0000 (12:44 +0100)]
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.

3 years agoavfilter/af_arnndn: add timeline support
Paul B Mahol [Wed, 25 Nov 2020 12:36:57 +0000 (13:36 +0100)]
avfilter/af_arnndn: add timeline support

3 years agoavcodec/mpeg12enc: Reindentation
Andreas Rheinhardt [Tue, 24 Nov 2020 13:43:46 +0000 (14:43 +0100)]
avcodec/mpeg12enc: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpeg12enc: Use ff_thread_once() for static initializations
Andreas Rheinhardt [Tue, 24 Nov 2020 13:39:47 +0000 (14:39 +0100)]
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>
3 years agoavcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengths
Andreas Rheinhardt [Tue, 24 Nov 2020 12:29:29 +0000 (13:29 +0100)]
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>
3 years agoavfilter/vf_readeia608: add support for slice threads
Paul B Mahol [Tue, 24 Nov 2020 21:14:14 +0000 (22:14 +0100)]
avfilter/vf_readeia608: add support for slice threads

3 years agoavfilter/vf_readeia608: add support for commands
Paul B Mahol [Tue, 24 Nov 2020 19:52:22 +0000 (20:52 +0100)]
avfilter/vf_readeia608: add support for commands

3 years agoavfilter/vf_xfade: ensure metadata is copied to transition frames
Musee Ullah [Mon, 23 Nov 2020 19:52:01 +0000 (13:52 -0600)]
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>
3 years agoavfilter/af_biquads: make sure that biquad filter still works
Paul B Mahol [Tue, 24 Nov 2020 13:24:18 +0000 (14:24 +0100)]
avfilter/af_biquads: make sure that biquad filter still works

3 years agoavfilter/af_biquads: do not abort filtering on bogus options
Paul B Mahol [Tue, 24 Nov 2020 10:49:19 +0000 (11:49 +0100)]
avfilter/af_biquads: do not abort filtering on bogus options

Instead, continue returning unfiltered input.

3 years agoavcodec/mlpdec: Avoid code duplication when initializing VLCs
Andreas Rheinhardt [Fri, 20 Nov 2020 23:24:33 +0000 (00:24 +0100)]
avcodec/mlpdec: Avoid code duplication when initializing VLCs

Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mlpdec: Make decoders init-threadsafe
Andreas Rheinhardt [Fri, 20 Nov 2020 23:15:49 +0000 (00:15 +0100)]
avcodec/mlpdec: Make decoders init-threadsafe

Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mlp: Make initializing CRCs thread-safe
Andreas Rheinhardt [Fri, 20 Nov 2020 23:11:18 +0000 (00:11 +0100)]
avcodec/mlp: Make initializing CRCs thread-safe

Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegaudiodec_template: Don't use unnecessarily many VLC bits
Andreas Rheinhardt [Tue, 17 Nov 2020 13:29:58 +0000 (14:29 +0100)]
avcodec/mpegaudiodec_template: Don't use unnecessarily many VLC bits

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mv30: Don't check for errors for complete VLCs
Andreas Rheinhardt [Mon, 16 Nov 2020 13:50:49 +0000 (14:50 +0100)]
avcodec/mv30: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/imm4: Don't use too big VLC table
Andreas Rheinhardt [Mon, 16 Nov 2020 12:27:22 +0000 (13:27 +0100)]
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>
3 years agoavcodec/aac*: Make initializing ff_aac_pow*sf_tab thread-safe
Andreas Rheinhardt [Thu, 19 Nov 2020 15:54:45 +0000 (16:54 +0100)]
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>
3 years agoavcodec/aactab: Fix conflicting types for ff_aac_codebook*
Andreas Rheinhardt [Thu, 19 Nov 2020 15:50:44 +0000 (16:50 +0100)]
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>
3 years agoavcodec/qdmc: Don't check for errors for complete VLCs
Andreas Rheinhardt [Sun, 8 Nov 2020 09:15:31 +0000 (10:15 +0100)]
avcodec/qdmc: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/hqx: Don't check for errors for complete VLCs
Andreas Rheinhardt [Sat, 7 Nov 2020 09:33:30 +0000 (10:33 +0100)]
avcodec/hqx: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/hqx: Inline constants
Andreas Rheinhardt [Sat, 7 Nov 2020 09:31:59 +0000 (10:31 +0100)]
avcodec/hqx: Inline constants

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/intrax8: Make ff_intrax8_common_init() thread-safe
Andreas Rheinhardt [Mon, 16 Nov 2020 21:00:34 +0000 (22:00 +0100)]
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>
3 years agoavcodec/intrax8: Replace always-false check by assert
Andreas Rheinhardt [Fri, 6 Nov 2020 12:15:24 +0000 (13:15 +0100)]
avcodec/intrax8: Replace always-false check by assert

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9tab: Add missing static to internal table
Andreas Rheinhardt [Mon, 9 Nov 2020 13:59:13 +0000 (14:59 +0100)]
avcodec/atrac9tab: Add missing static to internal table

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Replace av_free() by av_freep() in close function
Andreas Rheinhardt [Thu, 5 Nov 2020 02:51:50 +0000 (03:51 +0100)]
avcodec/atrac9dec: Replace av_free() by av_freep() in close function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Don't use unnecessarily large VLC tables
Andreas Rheinhardt [Wed, 4 Nov 2020 04:38:31 +0000 (05:38 +0100)]
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>
3 years agoavcodec/atrac9dec: Use least max_depth in calls to get_vlc2()
Andreas Rheinhardt [Wed, 4 Nov 2020 04:33:33 +0000 (05:33 +0100)]
avcodec/atrac9dec: Use least max_depth in calls to get_vlc2()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength
Andreas Rheinhardt [Wed, 4 Nov 2020 04:20:10 +0000 (05:20 +0100)]
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>
3 years agoavcodec/truemotion2: Mark decoder as init-threadsafe
Andreas Rheinhardt [Tue, 17 Nov 2020 10:22:09 +0000 (11:22 +0100)]
avcodec/truemotion2: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/g2meet: Use least max_depth in get_vlc2()
Andreas Rheinhardt [Sun, 1 Nov 2020 01:17:43 +0000 (02:17 +0100)]
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>
3 years agoavcodec/sheervideo: Add av_cold to build_vlc()
Andreas Rheinhardt [Sun, 1 Nov 2020 00:14:36 +0000 (01:14 +0100)]
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>
3 years agoavcodec/mss4: Mark decoder as init-threadsafe
Andreas Rheinhardt [Fri, 20 Nov 2020 02:53:42 +0000 (03:53 +0100)]
avcodec/mss4: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/rv40vlc2: Make VLC smaller
Andreas Rheinhardt [Sat, 31 Oct 2020 19:32:25 +0000 (20:32 +0100)]
avcodec/rv40vlc2: Make VLC smaller

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/qdm2: Remove outdated comment
Andreas Rheinhardt [Tue, 17 Nov 2020 12:31:44 +0000 (13:31 +0100)]
avcodec/qdm2: Remove outdated comment

Forgotten in f054e309c58894450a5d18cce9799ef58aab9f14.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegaudiodsp: Make initializing synth windows thread-safe
Andreas Rheinhardt [Sun, 15 Nov 2020 19:56:22 +0000 (20:56 +0100)]
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>
3 years agoavcodec/mpegaudiodsp: Make ff_mpadsp_init() thread-safe
Andreas Rheinhardt [Sun, 15 Nov 2020 15:01:49 +0000 (16:01 +0100)]
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>
3 years agoavcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe
Andreas Rheinhardt [Wed, 18 Nov 2020 20:38:45 +0000 (21:38 +0100)]
avcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe

Commit 1af615683e4a1a858407afbaa2fd686842da7e49 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>
3 years agoavcodec/mpegaudiodsp: Combine initializing float and int tables
Andreas Rheinhardt [Sun, 15 Nov 2020 14:53:34 +0000 (15:53 +0100)]
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>
3 years agoavcodec/motionpixels: Make decoder init-threadsafe
Andreas Rheinhardt [Tue, 17 Nov 2020 09:50:01 +0000 (10:50 +0100)]
avcodec/motionpixels: Make decoder init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motionpixels: Use symbols table
Andreas Rheinhardt [Thu, 29 Oct 2020 09:56:32 +0000 (10:56 +0100)]
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>
3 years agoavcodec/motionpixels: Don't check for errors for complete VLC
Andreas Rheinhardt [Thu, 29 Oct 2020 09:25:09 +0000 (10:25 +0100)]
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>
3 years agoavcodec/motionpixels: Be more strict when parsing Huffman trees
Andreas Rheinhardt [Thu, 29 Oct 2020 09:41:01 +0000 (10:41 +0100)]
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>
3 years agoavcodec/motionpixels: Only create VLC iff it is going to be used
Andreas Rheinhardt [Thu, 29 Oct 2020 08:46:34 +0000 (09:46 +0100)]
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 41b7389cade702383e59343561776f83bb26e17f 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>
3 years agoavcodec/mimic: Mark decoder as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 12:41:41 +0000 (13:41 +0100)]
avcodec/mimic: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mimic: Cleanup generically upon init failure
Andreas Rheinhardt [Sun, 15 Nov 2020 12:34:57 +0000 (13:34 +0100)]
avcodec/mimic: Cleanup generically upon init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/rv10: Make initializing static RV10 VLCs thread-safe
Andreas Rheinhardt [Tue, 17 Nov 2020 09:09:34 +0000 (10:09 +0100)]
avcodec/rv10: Make initializing static RV10 VLCs thread-safe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/smacker: Mark decoders as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 09:27:04 +0000 (10:27 +0100)]
avcodec/smacker: Mark decoders as init-threadsafe

Both Smacker audio and video decoders don't use/modify any global state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/tscc2: Mark tscc2 decoder as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 08:53:00 +0000 (09:53 +0100)]
avcodec/tscc2: Mark tscc2 decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_adenorm: add timeline and slice threading support
Paul B Mahol [Tue, 24 Nov 2020 10:27:14 +0000 (11:27 +0100)]
avfilter/af_adenorm: add timeline and slice threading support

3 years agoavfilter/af_asubboost: add timeline and slice threading support
Paul B Mahol [Tue, 24 Nov 2020 09:00:34 +0000 (10:00 +0100)]
avfilter/af_asubboost: add timeline and slice threading support

3 years agoavcodec: add SpeedHQ encoder
Jean-Baptiste Kempf [Mon, 9 Nov 2020 11:25:02 +0000 (12:25 +0100)]
avcodec: add SpeedHQ encoder

3 years agoavformat/av1: add support for passing through MP4/Matroska av1c
Jan Ekström [Mon, 23 Nov 2020 16:00:44 +0000 (18:00 +0200)]
avformat/av1: add support for passing through MP4/Matroska av1c

3 years agoavcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codec
Jan Ekström [Mon, 23 Nov 2020 15:36:20 +0000 (17:36 +0200)]
avcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codec

This lets us re-utilize the extradata-related checks in the CBS
to add support for passing the AV1CodecConfigurationRecord
as extradata as-is without further filtering.

3 years agoavcodec/cbs_av1: add support for standard MP4/Matroska extradata
Jan Ekström [Mon, 23 Nov 2020 17:37:38 +0000 (19:37 +0200)]
avcodec/cbs_av1: add support for standard MP4/Matroska extradata

This way API clients can just pass the AV1CodecConfigurationRecord
as extradata as-is without further filtering.

3 years agocbs: Add function to read extradata from an AVCodecContext
Mark Thompson [Mon, 23 Nov 2020 17:53:57 +0000 (17:53 +0000)]
cbs: Add function to read extradata from an AVCodecContext

This is useful in decoders and parsers, matching the way that bitstream
filters read extradata from AVCodecParameters.

3 years agoavdevice/decklink_dec: fix warning for unused variable
Limin Wang [Thu, 19 Nov 2020 14:35:02 +0000 (22:35 +0800)]
avdevice/decklink_dec: fix warning for unused variable

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices
Limin Wang [Sun, 22 Nov 2020 13:34:16 +0000 (21:34 +0800)]
avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavdevice/decklink: use boolean for list_devices option
Limin Wang [Thu, 19 Nov 2020 13:57:52 +0000 (21:57 +0800)]
avdevice/decklink: use boolean for list_devices option

For the document(indevs.texi and outdevs.texi) used it as boolean.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/af_aiir: add support for arbitrary order lattice-ladder filter format
Paul B Mahol [Sun, 22 Nov 2020 20:57:39 +0000 (21:57 +0100)]
avfilter/af_aiir: add support for arbitrary order lattice-ladder filter format

3 years agoavcodec/exr: skip bottom clearing loop when its outside the image
Michael Niedermayer [Sat, 24 Oct 2020 22:23:12 +0000 (00:23 +0200)]
avcodec/exr: skip bottom clearing loop when its outside the image

Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in type 'int'
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/exr: Check ymin vs. h
Michael Niedermayer [Sat, 24 Oct 2020 20:21:48 +0000 (22:21 +0200)]
avcodec/exr: Check ymin vs. h

Fixes: out of array access
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/avs: Use 64bit for the avio_tell() output
Michael Niedermayer [Sat, 24 Oct 2020 22:23:10 +0000 (00:23 +0200)]
avformat/avs: Use 64bit for the avio_tell() output

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>