Commit Graph

5470 Commits

Author SHA1 Message Date
James Almer ff145498b2 avutil: make lzo always compile
Having optionally installed headers is a bad idea as there's no way to know
if they are present or not (unless a define is added to avconfig.h, but that's
just ugly).

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-26 14:17:00 -03:00
Andreas Rheinhardt 636631d9db Remove unnecessary libavutil/(avutil|common|internal).h inclusions
Some of these were made possible by moving several common macros to
libavutil/macros.h.

While just at it, also improve the other headers a bit.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 84f16bb5e6 avutil/avassert: Don't include avutil.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 155cd6baa4 Remove obsolete version.h inclusions
Forgotten in e7bd47e657.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt b389ff9a85 avutil/display: Don't include avutil.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 2c2d76b50d avutil/integer: Don't include common.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 94d5892bea avutil/pixelutils: Don't include common.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 8e7d2e4621 avutil/samplefmt: Don't include attributes.h, avutil.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt e82d94ee46 avutil/imgutils: Don't include avutil.h
It is a remnant of an FF_API_* inclusion (back from when they were in
avutil.h and not in version.h).

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 9d78acd861 avutil/eval: Don't include avutil.h
It has been added for an FF_API_* at a time when these were in avutil.h.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt eaba16ba70 avutil/file: Don't include avutil.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 0a1a8fcd56 avutil/fifo: Don't include avutil.h
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 99b5956af1 avutil/audio_fifo: Avoid avutil.h inclusion
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt 321a3c244d avutil/log: Don't include avutil.h
It has been included since af5f434f8c
for deprecation reasons, but removing it has been forgotten after
it had served is purpose. So remove it.

For convenience, include version.h instead as LIBAVUTIL_VERSION_INT
is supposed to be used when creating AVClasses.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Lynne 9e2deba9a9
lavu/vulkan: avoid using strlen as a loop condition
Whatever.
2022-02-22 06:30:12 +01:00
Andreas Rheinhardt 6c694074e1 avutil/x86/emms: Don't unnecessarily include lavu/cpu.h
Only include it if it is needed, namely if __MMX__ is undefined.

X86 is currently the only arch where lavu/cpu.h is basically
automatically included (for internal development): #if ARCH_X86
is true, lavu/internal.h (which is basically included everywhere)
includes lavu/x86/emms.h which can mask missing inclusions
of lavu/cpu.h if the developer works on x86/x64. This has happened
in 8e825ec3ab and also earlier
(see 6d2365882f).
By including said header only if necessary ordinary developer machines
will behave like non-x86 arches, so that missing inclusions of cpu.h
won't go unnoticed any more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-21 12:37:51 +01:00
Anton Khirnov 09ca2f1950 lavu/hwcontext: clarify behavior on av_hwframe_map() failure
Clear anything that av_hwframe_map() might have done to the destination
frame, but leave caller-provided fields unchanged.
2022-02-17 11:05:44 +01:00
Anton Khirnov 6fc5e5a52c lavu/hwcontext_opencl: clear dangling pointers on map failure 2022-02-17 11:05:44 +01:00
Anton Khirnov d512115267 lavu/fifo: add a test for _cb functions
Makes an auto-growing FIFO and performs a sequence of randomly-sized
writes/peeks/reads.
2022-02-15 10:16:16 +01:00
Anton Khirnov e9acff8a01 lavu/fifo: fix a corner case in av_fifo_grow2()
When the fifo is grown by exactly the current write offset, it would end
up with offset_w = nb_elems. If av_fifo_write_from_cb() is called in
such a state, the user callback would get callled with *nb_elems=0,
which will then cause the write to return without writing anything.
2022-02-15 10:16:16 +01:00
Anton Khirnov 73b01844c2 lavu/hwcontext_qsv: fix a potential infinite loop
Current code will loop forever if MFXVideoVPP_Init() fails.
Also, simplify the code.
2022-02-15 10:16:16 +01:00
Anton Khirnov cefa595361 lavu/pixfmt: deprecate AV_PIX_FMT_XVMC
It is no longer used for anything.
2022-02-15 10:16:16 +01:00
Andreas Rheinhardt d75c4cc7c1 avutil/tx: Fix documentation of av_tx_uninit()
Adapt it to the actual (sane) behaviour.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-11 19:38:41 +01:00
Haihao Xiang 2727ff069e lavu/fifo: fix regression
offset_w might be updated after growing the FIFO

Fix ticket #9630

Tested-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: mkver
Reviewed-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-02-09 11:04:47 +08:00
Alexander Kanavin 91326dc942 libavutil: include assembly with full path from source root
Otherwise nasm writes the full host-specific paths into .o
output, which breaks binary reproducibility.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-02-08 10:42:26 +01:00
Aman Karmani 2f299c0b8b avutil: use getauxval(3) for CPU capabilities on linux/android ARM
getauxval is marginally faster, and works even when procfs is not mounted

support on Linux was added in glibc 2.16
support on Android was added in 4.4 (API 20)
fixes #6578

Signed-off-by: Aman Karmani <aman@tmm1.net>
2022-02-07 13:42:40 -08:00
Lynne 04cc7a5548
lavu/tx: wrap missed string in NULL_IF_CONFIG_SMALL
It's the only one that isn't defined through the macros used elsewhere.
2022-02-07 04:23:31 +01:00
Lynne eac4c3574b
lavu/tx: disable debugging information when CONFIG_SMALL 2022-02-07 03:56:47 +01:00
Lynne 3bbe9c5e38
lavu/tx: refactor assembly codelet definition
This commit does some refactoring to make defining assembly codelets
smaller, and fixes compiler redefinition warnings. It also allows
for other assembly versions to reuse the same boilerplate code as
x86.

Finally, it also adds the out_of_place flag to all assembly codelets.
This changes nothing, as out-of-place operation was assumed to be
available anyway, but this makes it more explicit.
2022-02-07 03:56:45 +01:00
Anton Khirnov a10f1aec1f avutil/fifo: Deprecate old FIFO API
Users should switch to the superior AVFifo API.

Unfortunately AVFifoBuffer fields cannot be marked as deprecated because
it would trigger a warning wherever fifo.h is #included, due to
inlined av_fifo_peek2().
2022-02-07 00:31:49 +01:00
Anton Khirnov 90eef1c3de lavu/threadmessage: switch to new FIFO API 2022-02-07 00:31:23 +01:00
Anton Khirnov d1bd189c63 lavu/audio_fifo: switch to new FIFO API 2022-02-07 00:31:23 +01:00
Anton Khirnov 082136209c lavu/audio_fifo: drop an unnecessary include
Nothing in audio_fifo.h uses anything from fifo.h
2022-02-07 00:31:23 +01:00
Anton Khirnov 93ed375574 lavu/tests/fifo: switch to the new API 2022-02-07 00:31:23 +01:00
Anton Khirnov 14429f8fec lavu/fifo: add a flag for automatically growing the FIFO as needed
This will not increase the FIFO beyond 1MB, unless the caller explicitly
specifies otherwise.
2022-02-07 00:31:23 +01:00
Anton Khirnov 7329b22c05 lavu/fifo: Add new AVFifo API based upon the notion of element size
Many AVFifoBuffer users operate on fixed-size elements (e.g. pointers),
but the current FIFO API deals exclusively in bytes, requiring extra
complexity in all these callers.

Add a new AVFifo API creating a FIFO with an element size
that may be larger than a byte. All operations on such a FIFO then
operate on complete elements.

This API does not reuse AVFifoBuffer and its API at all, but instead uses
an opaque struct called AVFifo. The AVFifoBuffer API will be deprecated
in a future commit once all of its users have been switched to the new
API.

Not reusing AVFifoBuffer also allowed to use the full range of size_t
from the beginning.
2022-02-07 00:30:22 +01:00
Anton Khirnov 5939c8d361 lavu/fifo: disallow overly large fifo sizes
The API currently allows creating FIFOs up to
- UINT_MAX: av_fifo_alloc(), av_fifo_realloc(), av_fifo_grow()
- SIZE_MAX: av_fifo_alloc_array()
However the usable limit is determined by
- rndx/wndx being uint32_t
- av_fifo_[size,space] returning int
so no FIFO should be larger than the smallest of
- INT_MAX
- UINT32_MAX
- SIZE_MAX
(which should be INT_MAX an all commonly used platforms).
Return an error on trying to allocate FIFOs larger than this limit.
2022-02-07 00:29:05 +01:00
Andreas Rheinhardt 2d71f93c7c avutil/fifo: Use av_fifo_generic_peek_at() for av_fifo_generic_peek()
Avoids code duplication. It furthermore properly checks
for buf_size to be > 0 before doing anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-07 00:29:05 +01:00
Lynne 2e82c61055
x86/tx_float: avoid redefining macros
FFT16_FN was used for fft8 and for fft16 afterwards.
2022-02-02 07:51:45 +01:00
Zhao Zhili b5a8b3d45a hwcontext_vulkan: use VkPhysicalDeviceTimelineSemaphoreFeatures
VkPhysicalDeviceVulkan12Features isn't implemented on MoltenVK yet.
VkPhysicalDeviceTimelineSemaphoreFeatures is less versatile but
simple. None of device_features_1_1 nor device_features_1_2 has real
usage yet, keep the code for future.
2022-02-01 22:54:24 +01:00
Andreas Rheinhardt 98cef1ebbe avutil/tests/adler32: Remove unnecessary volatile
And use an ordinary stack variable.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 21:26:26 +01:00
Timo Rothenpieler 2f323b1978 avutil/hwcontext_qsv: fix typo 2022-01-29 15:37:38 +01:00
nyanmisaka 4cc7239d8b libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
Now the following commandline works:

ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
-init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl \
-hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \
-i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
-c:v h264_qsv output.264

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-01-29 12:02:52 +08:00
Lynne 35080149ef
x86/tx_float: mark AVX2 functions as AVXSLOW
Makes Bulldozer prefer AVX functions rather than AVX2,
which are 64% slower:

AVX:  117653 decicycles in av_tx (fft), 1048535 runs,     41 skips
AVX2: 193385 decicycles in av_tx (fft), 1048561 runs,     15 skips

The only difference between both is that vgatherdpd is used in
the former. We don't want to mark them with the new SLOW_GATHER
flag however, since gathers are still faster on Haswell/Zen 2/3
than plain loads.
2022-01-29 03:08:16 +01:00
Lynne 7e35e0224c
lavu/tx: do not unconditionally free subcontexts if initialization fails
If a codelet initializes 2 subtransforms, and the second one fails,
the failure would free all subcontexts.
Instead, if there are subcontexts still left, don't free the array.
If all initializations fail, the init() function will return,
and reset_ctx() from the previous step will clean up all contained
subtransforms.
2022-01-29 01:02:37 +01:00
Lynne 265731f201
lavu/tx: reset subcontext pointer if initialization fails
Thanks to mkver for pointing this out.
2022-01-29 00:53:35 +01:00
Lynne 95f02e43e1
lavu/tx: print debug info even if no transforms are found 2022-01-28 08:28:02 +01:00
Steven Liu 9887ec3e9b avutil/tx: add null pointer check after av_mallocz
Fix CID: 1497863
there will get null pointer in attempt to initialize each if alloc memory failed.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-01-28 08:27:48 +01:00
Steven Liu f0044d886f avutil/tx: remove deadcode of the control flow
Fix CID: 1497864
The control flow should return ENOSYS if nb_cd_matches is 0 at before
and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
control flow if (ret >= 0) before end label.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-01-28 08:27:46 +01:00
Lynne 3c831847a8
hwcontext_vulkan: avoid using 64-bit enums
MSVC (2016, but possibly more) still force enums to be basic ints.
2022-01-27 10:27:09 +01:00