Commit Graph

103815 Commits

Author SHA1 Message Date
Paul B Mahol d18b445689 avcodec/mlpenc: remove unused item 2021-09-05 00:09:55 +02:00
James Almer 7453d3482a ffmpeg: let AVFilterGraph parse the filter_threads option
This way the CLI accepts for "filter_threads" the same values as for the
libavcodec specific option "threads".

Fixes FATE with THREADS=auto which was broken in bdc1bdf3f5.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-04 10:35:07 -03:00
James Almer f599ae88c2 avfilter/avfiltergraph: add an "auto" constant to the threads option
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-04 10:35:01 -03:00
Andreas Rheinhardt f58939affe avfilter/vf_xmedian: Split portion of init unique to xmedian off
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 15:24:59 +02:00
Paul B Mahol 19b52a7cc4 avcodec/mlpenc: remove log messages when allocation fails at init 2021-09-04 14:46:40 +02:00
Paul B Mahol 30c213fa6c avcodec/mlpenc: allocate filter buffers once at init 2021-09-04 14:46:40 +02:00
Paul B Mahol 57988fc496 avcodec/mlpenc: simplify allocations in mlp_encode_init() 2021-09-04 14:46:40 +02:00
Andreas Rheinhardt 70f06dd63c fftools/cmdutils: Use %c, not %s, to write single char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:12:56 +02:00
Andreas Rheinhardt 23b83adb6d fftools/cmdutils: Don't access AV(In|Out)putformat.get_device_list
It is not part of the public API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:12:56 +02:00
Andreas Rheinhardt bc75fb5423 avcodec/omx: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:04:22 +02:00
Andreas Rheinhardt 5c0e2f839a avcodec/omx: Check initializing mutexes/conditions
The earlier code did not properly check these initializations:
It only recorded whether the part of init where these initializations
are has been reached, but it did not check whether the initializations
were successful, although destroying them would be undefined behaviour
if they had not been initialized successfully.
Furthermore cleanup() always locked a mutex regardless of whether there
was any attempt to initialize these mutexes at all.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:04:04 +02:00
Andreas Rheinhardt 16fc8cef74 avcodec/frame_thread_encoder: Mark init and free functions as av_cold
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:33 +02:00
Andreas Rheinhardt 5f6fcb0395 avcodec/frame_thread_encoder: Return proper error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:33 +02:00
Andreas Rheinhardt f1847dbc1f avcodec/frame_thread_encoder: Don't shadow variables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:33 +02:00
Andreas Rheinhardt 2e574235b0 avcodec/frame_thread_encoder: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:33 +02:00
Andreas Rheinhardt 754b8454b7 avcodec/frame_thread_encoder: Check initializing mutexes/conditions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:33 +02:00
Andreas Rheinhardt 95b681eafd avcodec/vp9: Remove vp9_free_entries()
Now that the mutexes and conditions are only initialized and destroyed
once, said function only had one purpose: free the entries array.
Given that vp9_alloc_entries() already does this if the array is already
allocated it is unnecessary to call vp9_free_entries() anywhere except
when closing. And then one can just inline the one free into
vp9_decode_free().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:33 +02:00
Andreas Rheinhardt b0ee627ef9 avcodec/vp9: Use av_freep() instead of av_free()
Otherwise the context would be in an inconsistent state
if vp9_alloc_entries() failed (and if this would be checked).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:19 +02:00
Andreas Rheinhardt 84f716ccff avcodec/vp9: Don't free buffer known to be NULL
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:19 +02:00
Andreas Rheinhardt 0e09067261 avcodec/vp9: Check initializing conditions/mutexes
Also don't destroy uninitialized conditions/mutexes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:19 +02:00
Andreas Rheinhardt a4f7fabc26 avcodec/pthread_frame: Move (init|free)_pthread() to pthread.c
We have more mutexes/condition variables whose initialization is
unchecked.
Also use a proper namespace for these functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:03:19 +02:00
Andreas Rheinhardt bd95f2f599 avcodec/vp9: Do not destroy uninitialized mutexes/conditions
Also do not destroy and reinitialize mutexes and conditions when
certain input parameters change. Given that the decoder did not
create these variables at all during init, uninitialized mutexes
and conditions are destroyed before the very first initialization.
This is undefined behaviour and certain threading implementations
like pthreadGC2 crash when it is attempted.

Fix this by initializing these objects once during init and freeing
them in close.

Reported-by: Steve Lhomme <robux4@ycbcr.xyz>
Reviewed-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:02:56 +02:00
Andreas Rheinhardt 0172deccc4 avcodec/h264_levels, h265_profile_level: Avoid relocations
H.264 and H.265 levels' names are usually of the form "x" or "x.y"
with x and y being single digits; the one exception are the H.264 1b
levels. All of those levels' names fit into a char[4] and it is likely
that this future levels will do so, too.

Therefore this commit changes the H26(4|5)LevelDescriptor structures
to use such a char [4] instead of a pointer to a const char. This makes
the structures smaller (when sizeof(char*) == 8) and avoids relocations,
thereby moving the corresponding arrays from .data.rel.ro into .rodata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 07:56:40 +02:00
Paul B Mahol a590dfc242 avcodec/interplayacm: fix draining and last frame number of samples 2021-09-04 00:01:10 +02:00
Paul B Mahol 584cd16ad0 avcodec/wmaprodec: unbreak old xma2 decoding 2021-09-03 20:09:28 +02: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
Andreas Rheinhardt bc046b715e fftools/ffmpeg: Remove unused fields
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-03 19:43:53 +02:00
Andreas Rheinhardt 2f710734c8 avformat/mux: Fix double-free when using AVPacket.opaque_ref
Up until now, ff_write_chained() copied the packet (manually, not with
av_packet_move_ref()) from a packet given to it to a stack packet whose
timing and stream_index is then modified before being sent to another
muxer via av_(interleaved_)write_frame(). Afterwards it is intended to
sync the fields of the packet relevant to freeing again; yet this only
encompasses buf, side_data and side_data_elems and not the newly added
opaque_ref. The other fields are not synced so that the returned packet
can have a size > 0 and data != NULL despite its buf being NULL (this
always happens in the interleaved codepath; before commit
fe251f77c8 it could also happen in the
noninterleaved one). This leads to double-frees if the interleaved
codepath is used and opaque_ref is set.

This commit therefore changes this by directly reusing the packet
instead of a spare packet. Given that av_write_frame() does not
change the packet given to it, one only needs to restore the timing
information to return it as it was; for the interleaved codepath
it is not possible to do likewise*, because av_interleaved_write_frame()
takes ownership of the packets given to it and returns blank packets.
But precisely because of this users of the interleaved codepath
have no legitimate expectation that their packet will be returned
unchanged. In line with av_interleaved_write_frame() ff_write_chained()
therefore returns blank packets when using the interleaved codepath.

Making the only user of said codepath compatible with this was trivial.

*: Unless one wanted to create a full new reference.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-03 19:23:18 +02:00
Paul B Mahol c0be596fc1 avcodec/wmaprodec: improve flushing for >2 channels in XMA 2021-09-03 19:10:20 +02:00
Paul B Mahol 094397ce06 avcodec/wmaprodec: improve xma2 extradata parsing 2021-09-03 19:10:20 +02:00
Paul B Mahol a3fd78db12 avcodec/pnm_parser: add support for PFM parsing 2021-09-03 19:10:20 +02:00
Andreas Rheinhardt f3f9041302 fftools: Remove remnants of resample_opts
These were intended to pass options to auto-inserted avresample
resampling filters. Yet FFmpeg uses swresample for this purpose
(with its own AVDictionary swr_opts similar to resample_opts).
Therefore said options were not forwarded any more since commit
911417f0b34e611bf084319c5b5a4e4e630da940; moreover since commit
420cedd497 avresample options are
not even recognized and ignored any more. Yet there are still
remnants of all of this. This commit gets rid of them.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-03 16:08:19 +02:00
Paul B Mahol 11d39873ab avformat/cafdec: try skipping various chunks only when seeking is possible 2021-09-03 01:21:51 +02:00
Paul B Mahol 646afae00f avcodec/wmaprodec: unbreak xma >2 channel decoding after last change 2021-09-03 00:51:10 +02:00
Paul B Mahol a4101dca6c avfilter/af_silencedetect: add planar sample formats support 2021-09-02 21:34:17 +02:00
Paul B Mahol ba3c09b84a avfilter/af_silencedetect: support all channel counts 2021-09-02 20:25:48 +02:00
Andreas Rheinhardt a311dfc3c4 fate/wma: Account for trimmed samples in wmapro-ism test
Fixes FATE failures after 61c2c9ef8e.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-02 19:59:34 +02:00
Michael Niedermayer 31f03120e8 avcodec/pictordec: Optimize more odd cases for picmemset()
Fixes: Timeout
Fixes: 36875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-4842960888922112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Tested-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-02 19:28:53 +02:00
Andreas Rheinhardt cbf111059d avcodec/avcodec: Allow up to seven codec ids per parser
ff_pnm_parser and ff_vp3_parser already hit the current limit;
an addition to the former (to handle pfm) is planned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-02 19:02:35 +02:00
Paul B Mahol 2bb9d2be5e avcodec/mlpenc: add support for 24bit encoding 2021-09-02 18:02:22 +02:00
Paul B Mahol 61c2c9ef8e avcodec/wmaprodec: add gapless support 2021-09-02 18:00:43 +02:00
James Almer 8a6beccf0d avformat: add an AV1 Low overhead bitstream format muxer
Suggested-by: BBB
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-01 19:55:30 -03:00
Jan Ekström 2818b14392 avfilter/vf_scale: set the RGB matrix coefficients in case of RGB
This fixes the passing through of non-RGB matrix from input to
output when conversion from YCbCr to RGB happens.
2021-09-01 23:29:27 +03:00
Jan Ekström 9b2281a4a3 avcodec/libx265: add support for setting chroma sample location
Unlike libx264, libx265 does not handle the chroma format check
on its own side, so in order to not write out values which are
supposed to be ignored according to the specification, we limit
the writing out of chroma sample location to 4:2:0 only.
2021-09-01 23:27:19 +03:00
Limin Wang c500dc7cca fftools/cmdutils: Fix warning for initialization makes integer from pointer without a cast
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-01 09:32:24 +08:00
Paul B Mahol 034133a0df avcodec/mlpdec: reset lossless crc checking when stream ends
Fixes invalid reports of bad lossless crc.
While here make end of stream message into debug level as it is
not really important to user.
Also wait for new major sync frame as invalid concating of files
may produce invalid files, which cause various errors.
2021-08-31 21:22:17 +02:00
Paul B Mahol 9f420163c6 avcodec/mlpenc: fix encoding last samples when not within full interval
Also implement shorten_by in bitstream.
2021-08-31 21:22:02 +02:00
Andreas Rheinhardt fea4f953b5 avformat/utils: Use av_memdup to duplicate array of AVChapter *
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-31 17:01:38 +02:00
Andreas Rheinhardt bcbd84f435 avformat/utils: Don't allocate zero-sized array
It is unnecessary and also ill-defined: av_malloc() returns a 1-byte
block of memory in this case, but this is not documented.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-31 17:01:04 +02:00
Andreas Rheinhardt e04ddba64f avformat/utils: Don't compare pointers when sorting chapters
The chapters are independently allocated, so that comparing
the pointers is undefined behaviour. Furthermore, its result
is not platform-independent (and may not even be deterministic
on a particular platform). So compare the chapters' ids instead.
(avpriv_new_chapter() ensures that there are no duplicate ids.)

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-31 17:00:42 +02:00