Commit Graph

103477 Commits

Author SHA1 Message Date
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
Andreas Rheinhardt
6e0823ab83 avformat/utils: Allocate AVStream.info only for input streams
This structure is only used for demuxers (mostly in
avformat_find_stream_info()), so only allocate it for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
10646d30a3 avformat/utils: Don't initialize AVStreamInternal.info multiple times
It has been allocated and initialized in avformat_find_stream_info()
until fd0368e7ca when the structure
was moved to AVStreamInternal and its allocation to avformat_new_stream.
In order to also initialize the struct for new streams that only get
created during avformat_find_stream_info() said the initialization has
been added to avformat_new_stream() later. Due to the Libav-FFmpeg split
this has been done twice: In 4cda8aa1c5
and in 30c26c2442. The initialization in
avformat_find_stream_info() has not been removed at all despite being
redundant. This commit removes it and the duplicated initialization in
avformat_new_stream().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
2c3c83663d avformat/utils: Remove redundant flushing of packet queue
The packet queue is already flushed in avformat_free_context() which
is called a few lines below.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
bafb65ba2a avformat/mux: Don't access AVStream's internal AVCodecContext
An AVStream's internal AVCodecContext is pretty much unused for muxing:
The only place where any of its fields are set is
avformat_transfer_internal_stream_timing_info() where its time base is
set based upon the desired output format. The max_b_frames field is
never set at all, so don't read it in mux.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
c6d780b92e avformat/utils: Make ff_compute_frame_duration() static
Since 1c0885334d ff_compute_frame_duration
is only called from within utils.c and only for demuxers. So make it
static and remove the code in it that deals with muxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
3f991325b5 avformat/utils: Remove obsolete todo
Also initialize the AVCodecContexts directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
f265374bc0 avformat/utils: Remove always-false check
AVFormatContext.internal is already allocated by
avformat_alloc_context() on success; and on error,
avformat_alloc_context() cleans up manually without
avformat_free_context().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 16:12:22 +02:00
Andreas Rheinhardt
9abf0e0419 avformat/yuv4mpegdec: Don't call avio_tell() twice
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 15:48:11 +02:00
Andreas Rheinhardt
9634e6b0b0 avcodec/tiff_common: Fix AVBPrint error checks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 15:48:11 +02:00
Andreas Rheinhardt
b2d61d0f02 avformat/matroskadec: Fix heap-buffer overflow upon gigantic timestamps
The WebM DASH Manifest demuxer creates a comma-delimited list of
all the timestamps of index entries. It allocates 20 bytes per
timestamp; yet the largest 64bit numbers have 20 decimal digits
(for int64_t it can be '-'+ 19 digits), so that one needs 21B
per entry because of the comma (resp. the final NUL).

The code uses snprintf, but snprintf returns the strlen of the string
that would have been written had the supplied buffer been big enough.
And if this is 21, then the next entry is written at an offset of 21
from the current position. So if enough such entries exist, the buffer
won't suffice.

This commit fixes this by replacing the allocation of buffer for
the supposedly worst-case with dynamic allocations by using an AVBPrint.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-30 15:48:11 +02:00
Linjie Fu
7352c370fa Revert "fftools/ffmpeg_filter: fix the flags parsing for scaler"
This reverts commit b3a0548a98.

This breaks the usage of swscale options, scale_sws_opts should be
passed to auto-inserted scale-filters.

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-08-30 21:27:50 +08:00
Michael Niedermayer
4de4bc06fd avformat/mov: Check dts for overflow in mov_read_trun()
Fixes: signed integer overflow: 9223372034248226491 + 3275247799 cannot be represented in type 'long'
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4538729166077952

Reported-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-29 21:34:38 +02:00
Jan Ekström
06ce821bc7 avcodec/libx265: only call av_pix_fmt_desc_get once in init
Now both current usages utilize an already found descriptor.
2021-08-29 21:09:21 +03:00
Wu Jianhua
133b2767cf tests/checkasm/vf_gblur.c: update check_horiz_slice for the new ff_horiz_slice_avx2/512
Co-authored-by: Cheng Yanfei <yanfei.cheng@intel.com>
Co-authored-by: Jin Jun <jun.i.jin@intel.com>
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-08-29 19:58:33 +02:00
Wu Jianhua
4041c1029b libavfilter/x86/vf_gblur: add localbuf and ff_horiz_slice_avx2/512()
We introduced a ff_horiz_slice_avx2/512() implemented on a new algorithm.
In a nutshell, the new algorithm does three things, gathering data from
8/16 rows, blurring data, and scattering data back to the image buffer.
Here we used a customized transpose 8x8/16x16 to avoid the huge overhead
brought by gather and scatter instructions, which is dependent on the
temporary buffer called localbuf added newly.

Performance data:
ff_horiz_slice_avx2(old): 109.89
ff_horiz_slice_avx2(new): 666.67
ff_horiz_slice_avx512: 1000

Co-authored-by: Cheng Yanfei <yanfei.cheng@intel.com>
Co-authored-by: Jin Jun <jun.i.jin@intel.com>
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-08-29 19:58:33 +02:00
Wu Jianhua
0c54ab20c2 tests/checkasm/vf_gblur.c: add check_verti_slice() for unit test
Co-authored-by: Cheng Yanfei <yanfei.cheng@intel.com>
Co-authored-by: Jin Jun <jun.i.jin@intel.com>
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-08-29 19:58:33 +02:00
Wu Jianhua
68a2722aee libavfilter/x86/vf_gblur: add ff_verti_slice_avx2/512()
The new vertical slice with AVX2/512 acceleration can significantly
improve the performance of Gaussian Filter 2D.

Performance data:
ff_verti_slice_c: 32.57
ff_verti_slice_avx2: 476.19
ff_verti_slice_avx512: 833.33

Co-authored-by: Cheng Yanfei <yanfei.cheng@intel.com>
Co-authored-by: Jin Jun <jun.i.jin@intel.com>
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-08-29 19:58:33 +02:00
Wu Jianhua
4a5e24721c libavfilter/x86/vf_gblur: add ff_postscale_slice_avx512()
Co-authored-by: Cheng Yanfei <yanfei.cheng@intel.com>
Co-authored-by: Jin Jun <jun.i.jin@intel.com>
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-08-29 19:58:33 +02:00
Anton Khirnov
fdc0bb78fe lavu/slicethread: return ENOSYS rather than EINVAL in the dummy func
EINVAL is the wrong error code here, since the arguments passed to the
function are valid. The error is that the function is not implemented in
the build, which corresponds to ENOSYS.
2021-08-29 18:45:04 +02:00
Anton Khirnov
ca32d0462c lavfi/vf_scale: remove the nb_slices option
It was intended for debugging only and has been superseded by the
standalone tool for testing sliced scaling.
2021-08-29 18:44:54 +02:00
Anton Khirnov
03f3680080 fate/pixfmt: test xyz12le 2021-08-29 18:44:46 +02:00
Anton Khirnov
bdc1bdf3f5 FATE: allow multithreaded filtering 2021-08-29 18:44:38 +02:00
Anton Khirnov
834b8ad8a3 ffmpeg_filter: do not override -filter_threads with -threads
When both -filter_threads and -threads are specified, the latter takes
effect. Since -threads is an encoder option and -filter_threads is a
filter option, it makes sense for the -filter_threads to take
precedence.
2021-08-29 18:44:09 +02:00
Anton Khirnov
4a0d918c9e ffmpeg: reset the dict iterator before use 2021-08-29 18:43:01 +02:00
Jan Ekström
2f0113be3f avcodec/libx264: add support for setting chroma sample location 2021-08-29 15:05:37 +03:00
Paul Buxton
e07ada3dac avfilter: add grayworld video filter
Implements a gray world color correction algorithm
using a log scale LAB colorspace.

Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2021-08-29 13:31:37 +02:00
Paul B Mahol
02fcd485f9 avfilter/af_acrossover: check for rest of sample formats 2021-08-29 10:29:15 +02:00
Paul B Mahol
fdb4c03555 avfilter/vf_tpad: rescale EOF pts for case outlink time_base differs 2021-08-29 01:47:23 +02:00
Paul B Mahol
3b780e818a avfilter/af_crystalizer: refactor some code 2021-08-29 00:09:29 +02:00
Paul B Mahol
5f55467c0b avfilter/af_crystalizer: fix some minor issues
Do multiplications instead of divisions and use floats
where makes sense.
2021-08-29 00:09:29 +02:00
Paul B Mahol
5673a48425 avcodec/mlpdec: add flush support
Fixes spurious lossless check failures when seeking.
2021-08-29 00:09:29 +02:00
Michael Niedermayer
a4c98c507e avformat/avidec: Use 64bit for frame number in odml index parsing
Fixes: signed integer overflow: 1179337772 + 1392508928 cannot be represented in type 'int'
Fixes: 34088/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5846945303232512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-28 20:47:24 +02:00
Michael Niedermayer
104a8399ae avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg
Fixes: NULL pointer dereference
Fixes: 36342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-4579188072906752
Fixes: 36344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5049579300061184
Fixes: 36345/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5301149845553152
Fixes: 36374/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6056312352931840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-28 20:03:54 +02:00
Michael Niedermayer
909faca929 avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac()
Fixes: Timeout
Fixes: 36262/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-4969052454912000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-28 20:03:21 +02:00
maryam ebrahimzadeh
2c0d522963 avcodec/wmaprodec: return value check for init_get_bits
Also replace init_get_bits with init_get_bits8().
2021-08-28 19:18:45 +02:00
Paul B Mahol
8c1b65feb6 avfilter/af_afreqshift: do not forget to update coeffs at runtime 2021-08-28 18:52:08 +02:00
Paul B Mahol
1da2dd5c77 avfilter: add atilt filter 2021-08-28 18:51:04 +02:00
Paul B Mahol
b53a7d2d4d avfilter: add adecorrelate filter 2021-08-28 18:46:39 +02:00