Commit Graph

111162 Commits

Author SHA1 Message Date
Michael Niedermayer
1ec4553e35
avformat/jpegxl_probe: check length instead of blindly reading
Enable the checked bitreader to avoid overread.
Also add a few checks in loops and between blocks so we exit instead of continued
execution.
Alternatively we could add manual checks so that no overread can happen. This would be
slightly faster but a bit more work and a bit more fragile

Fixes: Out of array accesses
Fixes: 59640/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-6584117345779712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-11 21:11:21 -04:00
Michael Niedermayer
25c937c0e0
avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-11 21:11:02 -04:00
Martin Storsjö
d78bffbf3d libavutil: Add version bump for new aarch64 cpu flags
This was missed in 397cb623c8.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-10 00:21:58 +03:00
Paul B Mahol
18b2ecc247 avcodec/wavarc: add 5elp mode support 2023-06-09 17:05:26 +02:00
Paul B Mahol
024c30aa3b avcodec/exr: remove wrong scaling for 32bit DWA compression 2023-06-08 12:08:01 +02:00
Zhao Zhili
b7e79ba395 avformat/mov: decrease probe score for a random tag
The tag comes from samples/ffmpeg/mov/unrecognized/bartjones.mov
really looks like some random data. Now the random tag matched
another file, which isn't a mov.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 11:16:46 +08:00
Zhao Zhili
32a749c7a6 avfilter/dnn_backend_openvino: fix log message
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:44 +08:00
Zhao Zhili
6220252f42 configure: add pkg-config check for libopenvino
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:37 +08:00
Zhao Zhili
3a5d95e3fa avfilter/dnn_backend_tf: silence implicit cast warning
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:24 +08:00
Zhao Zhili
b0c0fedcda avfilter/dnn_backend_tf: fix use of uninitialized value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:24 +08:00
Zhao Zhili
d9f41a343e avfilter/dnn_backend_tf: check TF_OperationOutputType return value
This also fixed a warning: implicit conversion from enumeration
type 'TF_DataType' (aka 'enum TF_DataType') to different
enumeration type 'DNNDataType'.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:24 +08:00
Zhao Zhili
f3495ef4f8 avfilter/dnn_backend_tf: remove unused define
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
e67af9e7f7 avfilter/vf_dnn_processing: replace magic number by enum value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
e7e80e2083 avfilter/vf_dnn_detect: replace magic number by enum value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
a887bc4ff1 avfilter/vf_dnn_classify: replace magic number by enum value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
016f2f61c3 avfilter/dnn: add log context to ff_get_dnn_module
Print backend type when failed.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
505c43bb65 avfilter/dnn: refactor ff_get_dnn_module to remove allocation
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
3f52b7eedc avfilter/dnn: define each backend as a DNNModule
To avoid export multiple functions for each backend
implementation.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Dave Airlie
2c4b6976d5 vulkan/hevc: fix 32x32 scaling list indexing
This fixes another problem in the hevc scaling lists and aligns
the code with what other hwaccels do.
2023-06-08 02:42:02 +02:00
Paul B Mahol
bfd5090628 avfilter/af_rubberband: rewrite EOF handling
Also pass correct EOF timestamp.
2023-06-08 02:31:19 +02:00
Paul B Mahol
1d7a6eaee6 avcodec/proresenc_kostya: set avctx->profile from ctx
Otherwise muxers may not be able to guess it.
Option is still set by user, but via private codec option.
2023-06-08 00:48:21 +02:00
Lynne
eff565dc19
hwcontext_vulkan: tune execution pools
Having less in-flight resources is better in this case.
2023-06-07 23:59:17 +02:00
Lynne
24c4307b80
vulkan_decode: halve execution pool size
Determined experimentally, on various videos and hardware.
On Intel, using less resources in-flight is around 15% faster,
with similar results on Nvidia hardware.
2023-06-07 23:59:17 +02:00
Lynne
5f1be341c2
vulkan: discard dependencies when explicitly waiting for execution
This reduces memory needed dramatically, as unneeded resources
can be immediately returned to the pool.
Although waitforfences is threadsafe, we add a mutex wait around
it, as the mutex fence in combination with waitforfences assures
us that no other thread will reset the fence in the meanwhile
whilst the mutex is locked. This allows is to call
ff_vk_exec_discard_deps.
2023-06-07 23:59:16 +02:00
Lynne
975cd48bb3
vulkan: synchronize access to execution pool fences
vkResetFences is specified as being user-synchronized
(yet vkWaitFences, is not).
2023-06-07 23:59:16 +02:00
Lynne
697382168d
hevcdec: remove redundant bits_used_for_short_term_rps field
It was introduced for Vulkan, but it is equivalent to
short_term_ref_pic_set_size when !short_term_ref_pic_set_sps_flag,
and when !!short_term_ref_pic_set_sps_flag, Vulkan hardcodes a zero
anyway.
2023-06-07 23:59:12 +02:00
Marvin Scholz
d8c7fea8ef lavfi/vf_blend_vulkan: fix leak on error 2023-06-07 23:59:06 +02:00
Marvin Scholz
dae393fe72 libavfilter: add vf_xfade_vulkan
This is an initial version of vf_xfade_vulkan based
on vf_xfade_opencl, for now only a subset of transitions
are supported.
2023-06-07 23:59:06 +02:00
Paul B Mahol
f11515c77f avcodec: add RTV1 decoder 2023-06-07 09:00:18 +02:00
Marvin Scholz
e62824835d lavfi/vf_xfade: rewrite activate inputs handling
The old code was not properly handling a bunch of edge-cases with
streams terminating earlier and also did not properly report back EOF
to the first input.

This fixes at least one case where the filter could stop doing
anything:

ffmpeg -f lavfi -i "color=blue:d=10" -f lavfi -i "color=aqua:d=0" -filter_complex "[0][1]xfade=duration=2:offset=0:transition=wiperight" -f null -
2023-06-07 08:56:24 +02:00
Michael Niedermayer
0889ebc577
avcodec/noise_bsf: Check for wrapped frames
Wrapped frames contain pointers so they need specific code to
noise them, the generic code would lead to segfaults

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-06 21:38:02 +02:00
Michael Niedermayer
8d5de4e12f
tools/target_dec_fuzzer: Test lowres
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-06 21:37:53 +02:00
Roman Arzumanyan
402d98c9d4 libavcodec/cuviddec: determine amount of decoded surfaces from within cuvid parser
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-06-06 15:32:41 +02:00
James Almer
20584cdd89 avformat/av1: reduce the scope of a variable
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 09:26:19 -03:00
James Almer
a5e45988ac avformat/av1dec: don't return EIO when the input file is truncated
There was no problem reading the file, so EIO is not correct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 09:26:19 -03:00
James Almer
da61ed80fd avformat/av1dec: fix EOF check in Annex-B demuxer
And return any packet buffered by the bsf.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-06 09:26:19 -03:00
Dave Airlie
65a1e8ee2c vulkan/hevc: fix scaling lists sizes. 2023-06-06 12:27:02 +02:00
Logan Lyu
e79686be96 lavc/aarch64: new optimization for 8-bit hevc_qpel_h hevc_qpel_uni_w_hv
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:18 +03:00
Logan Lyu
15972cce8c lavc/aarch64: new optimization for 8-bit hevc_qpel_uni_w_h
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:18 +03:00
Logan Lyu
0b7356c1b4 lavc/aarch64: new optimization for 8-bit hevc_pel_uni_w_pixels and qpel_uni_w_v
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:18 +03:00
Martin Storsjö
c76643021e aarch64: Add Windows runtime detection of the dotprod instructions
For Windows, there's no publicly defined constant for checking for
the i8mm extension yet.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:50:15 +03:00
Martin Storsjö
9b0052200a aarch64: Add Apple runtime detection of dotprod and i8mm using sysctl
For now, there's not much value in this since Clang don't support
enabling the dotprod or i8mm features with either .arch_extension
or .arch (it has to be enabled by the base arch flags passed to
the compiler). But it may be supported in the future.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:41:20 +03:00
Martin Storsjö
493fcde50a aarch64: Add Linux runtime cpu feature detection using HWCAP_CPUID
Based partially on code by Janne Grunau.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:57 +03:00
Martin Storsjö
397cb623c8 aarch64: Add cpu flags for the dotprod and i8mm extensions
Set these available if they are available unconditionally for
the compiler.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:42 +03:00
Martin Storsjö
fb1b88af77 configure: aarch64: Support assembling the dotprod and i8mm arch extensions
These are available since ARMv8.4-a and ARMv8.6-a respectively,
but can also be available optionally since ARMv8.2-a.

Check if ".arch armv8.2-a" and ".arch_extension {dotprod,i8mm}" are
supported, and check if the instructions can be assembled.

Current clang versions fail to support the dotprod and i8mm
features in the .arch_extension directive, but do support them
if enabled with -march=armv8.4-a on the command line. (Curiously,
lowering the arch level with ".arch armv8.2-a" doesn't make the
extensions unavailable if they were enabled with -march; if that
changes, Clang should also learn to support these extensions via
.arch_extension for them to remain usable here.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-06-06 12:40:26 +03:00
Leo Izen
fa11c4c7fa
avformat/jpegxl_anim_dec: add animated JPEG XL demuxer
Animated JPEG XL files requires a separate demuxer than image2, because
the timebase information is set by the demuxer. Should the timebase of
an animated JPEG XL file be incompatible with the timebase set by the
image2pipe demuxer (usually 1/25 unless set otherwise), rescaling will
fail. Adding a separate demuxer for animated JPEG XL files allows the
timebase to be set correctly.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-05 12:15:05 -04:00
Leo Izen
99da411322
avcodec/libjxldec: add animated decode support
Migrate the libjxl decoder wrapper from the decode_frame method to the
receive_frame method, which allows sending more than one frame from a
single packet. This allows the libjxl decoder to decode JPEG XL files
that are animated, and emit every frame of the animation. Now, clients
that feed the libjxl decoder with an animated JPEG XL file will be able
to receieve the full animation.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-05 12:14:43 -04:00
Anton Khirnov
141d11cb3c fftools/ffmpeg_mux: make OutputStream.pkt private
It is no longer used outside of muxing code.
2023-06-05 16:16:13 +02:00
Anton Khirnov
730a2221af fftools/ffmpeg_enc: use a private AVPacket instance for encoding
The code currently uses OutputStream.pkt, which complicates its
ownership semantics.
2023-06-05 16:16:12 +02:00
Anton Khirnov
f94957e8f4 fftools/ffmpeg_mux: simplify calling of_output_packet()
Use NULL packets to signal EOF instead of a separate variable. This is
made possible by the previous commit.
2023-06-05 16:16:12 +02:00