Commit Graph

109495 Commits

Author SHA1 Message Date
James Darnley
eef763c705 checkasm/v210dec: add extra space to the destination arrays 2022-12-21 00:36:49 +01:00
Michael Niedermayer
b7d063951d
avcodec/apac: Sanity check bits_per_coded_sample
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 53931/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-6072913738727424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-12-20 18:35:13 +01:00
Michael Niedermayer
8374a747af
avcodec/wavpack: Avoid undefined shift in get_tail()
Fixes: left shift of 1208485947 by 1 places cannot be represented in type 'int'
Fixes: 54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-12-20 18:35:12 +01:00
James Darnley
6af453ca38 avcodec/x86: add avx512icl function for v210dec
Ice Lake (Xeon Silver 4316): 2.01x faster (1147±36.8 vs. 571±38.2 decicycles) compared with avx2
2022-12-20 15:02:45 +01:00
James Darnley
f30b4c2f47 avcodec/x86/v210: add some comments to the improved avx2 function 2022-12-20 15:02:45 +01:00
James Darnley
f1f41d6ff5 configure: support lsan as toolchain 2022-12-20 15:02:45 +01:00
Niklas Haas
a69b08790b avfilter/vf_tinterlace: support full-range YUV
This filter, when used in the "pad" mode, currently makes the
distinction between limited and full range solely by testing for YUVJ
pixel formats at link setup time. This is deprecated and should be
improved to perform the detection based on the per-frame metadata.

In order to make this distinction based on color range metadata, which
is only known at the time of filtering frames, for simplicity, we simply
allocate two copies of the "black" frame - one for limited range and the
other for full range metadata. This could be done more dynamically (e.g.
as-needed or simply by blitting the appropriate pixel value directly),
but this change is relatively simple and preserves the structure of the
existing code.

This commit actually fixes a bug in FATE - the new output is correct for
the first time. The previous md5 ref was of a frame that incorrectly
combined full-range pixel data with limited-range black fields. The
corresponding result has been updated.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-12-20 14:02:37 +01:00
Niklas Haas
8e2f61ef04 avfilter/vf_blackdetect: support full-range YUV
This filter currently makes the distinction between limited and full
range by testing for the deprecated YUVJ pixel formats at link setup
time. This is deprecated and should be improved to perform the detection
based on the per-frame metadata.

Rewrite it to calculate the black pixel threshold at the time of
filtering a frame, when metadata about the frame's color range is known.
Doing it this way has the small side benefit of being able to handle
streams with variable metadata, and is not a meaningful performance
cost.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-12-20 14:02:37 +01:00
Paul B Mahol
3b66757d7d avfilter: add adrc filter 2022-12-19 20:43:58 +01:00
Paul B Mahol
744100af62 avfilter/af_headphone: properly initialize scale 2022-12-19 18:45:56 +01:00
mail@nodoa.me
38b837e0e1 avfilter/vf_decimate: add mixed option to process input only partially to be decimated
Enabling the option will only decimate frames below dupthresh and output at
variable frame rate.
2022-12-19 16:24:25 +01:00
Zhao Zhili
48d5aecfc4 avcodec/mediacodec_wrapper: include stdbool.h
Since NDK failed to do that:
https://github.com/android/ndk/issues/1281

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-19 10:03:54 +08:00
Paul B Mahol
a350e68c83 avfilter/af_afir: fix some misc low priority issues
Remove double ;; and dead store.
2022-12-18 23:53:19 +01:00
Paul B Mahol
8c75e5fdd3 avfilter/af_afir: improve output when IR switching at runtime
Also improve normalization and add more gtype modes
2022-12-18 19:58:12 +01:00
James Almer
7af947c0c0 avcodec/libdav1d: honor the requested skip_frame level
This allows dropping non-reference, non-intra, or non-key frames on supported
libdav1d versions.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-17 21:37:23 -03:00
Saliev, Rafik F
8ad988ac37 libavfilter/dnn: fix openvino async mode
Bugfix: The OpenVino DNN backend in the 'async' mode sets
'task->inference_done' to 'complete' prior to data copy from
OpenVino output buffer to task's output frame.
This order causes task destroy in ff_dnn_get_result_common()
prior to model output processing.

Signed-off-by: Rafik Saliev <rafik.f.saliev@intel.com>
2022-12-17 09:55:14 +08:00
Zhao Zhili
10a56363a7 avcodec/mediacodecenc: add pts_as_dts option
It works since most of Android devices don't output B frames by
default. The behavior is documented by Android now, although there
is some exception in history, which should have been fixed now.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:32:57 +08:00
Zhao Zhili
a86bb1d2ce avcodec/mediacodecenc: add max-bframes support
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:31:04 +08:00
Zhao Zhili
7da1adfc02 avcodec/mediacodecenc: remove the strategy to create DTS
Use input PTS as DTS has multiple problems:
1. If there is no reordering, it's better to just use the output
PTS as DTS, since encoder may change the timestamp value (do it
on purpose or rounding error).

2. If there is reordering, input PTS should be shift a few frames
as DTS to satisfy the requirement of PTS >= DTS. I can't find a
reliable way to determine how many frames to be shift. For example,
we don't known if the encoder use hierarchical B frames. The
max_num_reorder_frames can be get from VUI, but VUI is optional.

3. Encoder dropping frames makes the case worse. Android has an
BITRATE_MODE_CBR_FD option to allow it explicitly.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:30:36 +08:00
Zhao Zhili
e3f2d01d70 avcodec/mediacodecenc: use bsf to handle crop
It's well known that mediacodec encoder requires 16x16 alignment.
Use our bsf to fix the crop info.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:28:27 +08:00
Zhao Zhili
f0c296f578 avcodec/mediacodecenc: add level option
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:27:43 +08:00
Zhao Zhili
2b5d1b423a avcodec/mediacodecenc: add bitrate_mode option
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:27:00 +08:00
Zhao Zhili
0a0f2d1a8c avcodec/mediacodecenc: make each encoder has its own option
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-12-17 04:24:56 +08:00
Gyan Doshi
9adf02247c avformat/movenc: correct write_colr warning placement
The old warning is no longer applicable in the inner block after
c5b20cfe19.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2022-12-15 15:28:23 +05:30
Andreas Rheinhardt
262e7439c6 avcodec/x86/Makefile: Don't build empty files
simple_idct.asm is 32 bit-only since
bfb28b5ce8,
whereas simple_idct10.asm is x64-only. So don't build
the ultimately unneeded and empty files, as some linkers
complain about this: "ranlib: file:
libavcodec/libavcodec.a(simple_idct.o) has no symbols"
(this is from an Xcode toolchain as reported by Ronald S. Bultje).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-13 16:16:40 +01:00
Tristan Matthews
40984af0c5 av1dec: fix comment typo
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-12-13 08:48:59 -05:00
Tristan Matthews
fb5e9dbc90 av1dec: fix typo in logged error
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-12-13 08:39:51 -05:00
Derek Buitenhuis
5a46647f00 doc/protocols: Remove IPFS urls to specific content in examples
We shouldn't be providing links to unverified and non-FFmpeg-controlled
content in our documentation.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-12-12 21:47:02 +00:00
Derek Buitenhuis
27b5ce2805 doc/protocols: Remove third party server
We do not endorse or recommend specific third party servers or companies
that users' data will be funneled through.

It is also incorrectly describing how FFmpeg currently works.

Should have been part of 412922cc6f but was
missed.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-12-12 21:47:02 +00:00
James Almer
048f369f1b avcodec/libdav1d: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer
b27f3f9b50 avcodec/libdav1d: set frame props from the reordered packet
Attach the AVPacket instead of only a few values to the corresponding Dav1dData
struct and use it to set all output frame props.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer
81bea2e98b avcodec/libdav1d: don't use AVCodecInternal.in_pkt
Allocate an AVPacket instead, which will be used in the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer
56966f2eb2 avcodec/decode: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer
bff86f31cc avcodec/decode: add a function to set frame props from a user provided packet
It will be useful for decoders that don't rely on last_pkt_props to set frame
props.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:31:28 -03:00
James Almer
261cd929e0 avcodec/mpeg4videodec: duplicate the last decoded frame when the last coded frame was skipped
This ensures the video stream duration is not lost after decoding.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-12-12 18:30:17 -03:00
Paul B Mahol
69ac78da9b avfilter/afir_template: avoid indirect accessing nb_partitions value 2022-12-12 20:29:07 +01:00
Paul B Mahol
a73f4ca49b avfilter/afir_template: skip wet gain if its 1 2022-12-12 20:29:07 +01:00
Paul B Mahol
91abbb9d02 avfilter/af_afir: reduce output gain with default parameters
It was unreasonably high. Also change scaling to reduce
rare quantization errors.
2022-12-12 20:29:07 +01:00
Paul B Mahol
c3e20f78b0 doc/filters: add more advanced and useful afir example 2022-12-11 20:53:26 +01:00
Paul B Mahol
8556006984 avfilter/af_afir: improve output quality with small minp
Remove direct convolution implementation as its give worse
results. Simplifies code too.
2022-12-11 18:33:24 +01:00
Andreas Rheinhardt
07e0732a9a avcodec/mjpegdec: Move smv_process_frame() to other SMV stuff
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
05086a6c93 avcodec/mjpegdec: Only use receive_frame for SMVJPEG
Only one codec using mjpegdec.c actually creates multiple
frames from a single packet, namely SMVJPEG. The other can
use the ordinary decode callback just fine. This e.g. has
the advantage of confining the special SP5X/AMV code to sp5xdec.c.

This reverts most of commit e9a2a8777317d91af658f774c68442ac4aa726ec;
of course it is not a simple revert: Way too much has changed;
furthermore, outright reverting the sp5xdec.c changes would readd
a stack packet to sp5x_decode_frame() which is not desired.
In order to avoid this without modifying the given AVPacket,
a variant of ff_mjpeg_decode_frame() with explicit buf and size
parameters has been added.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
ec2d582cb0 avcodec/mjpegdec: Avoid checks whose results are known at compile-time
Namely the result of the check for smv_next_frame > 0 in
smv_process_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
b640cda95d avcodec/mjpegdec: Move special SMVJPEG-code to SMVJPEG-only function
This automatically avoids runtime checks for whether
the decoder is SMVJPEG.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:15:27 +01:00
Andreas Rheinhardt
9cdecba3bd avcodec/mjpegdec: Restrict AVID MJPEG to non-SMVJPEG
AVID content is not supposed to be SMVJPEG; given that
both these codecs involve manipulating image dimensions
and cropping dimensions, it makes sense to restrict
the AVID codepaths to non-SMVJPEG codecs in order not
to have to think about what if SMVJPEG happens to
have a codec tag indicating AVID.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-10 21:14:48 +01:00
Paul B Mahol
442bbdb3c5 avfilter/drawutils: rgb48/bgr48 is supported 2022-12-10 14:57:05 +01:00
Timo Rothenpieler
7e8b539389 avcodec/nvdec: make explicit copy of frames unless user requested otherwise 2022-12-10 00:52:34 +01:00
Timo Rothenpieler
7a8d78f7e3 lavc: add new unsafe_output hwaccel_flag 2022-12-10 00:52:33 +01:00
Philip Langdale
9651f873f8 lavu/pixdesc: handle xv30be in av_[read|write]_image_line
xv30be is an obnoxious format that I shouldn't have included in the
first place. xv30 packs 3 10bit channels into 32bits and while our
byte-oriented logic can handle Little Endian correctly, it cannot
handle Big Endian. To avoid that, I marked xv30be as a bitstream
format, but while that didn't produce FATE errors, it turns out that
the existing read/write code silently produces incorrect results, which
can be revealed via ubsan.

In all likelyhood, the correct fix here is to remove the format. As
this format is only used by Intel vaapi, it's only going to show up
in LE form, so we could just drop the BE version. But I don't want to
deal with creating a hole in the pixfmt list and all the weirdness that
comes from that. Instead, I decided to write the correct read/write
code for it.

And that code isn't too bad, as long as it's specialised for this
format, as the channels are all bit-aligned inside a 32bit word.
2022-12-08 21:15:44 -08:00
Paul B Mahol
55753fc712 avcodec/mjpegdec: check that component linesize is always valid 2022-12-08 23:54:07 +01:00