Commit Graph

5391 Commits

Author SHA1 Message Date
rcombs
5afc5661ac lavu/hwcontext_videotoolbox: use OS-provided mapping routines when available 2021-12-22 18:43:34 -06:00
rcombs
b7e1ec7bda lavu/videotoolbox: expose routine to set CVPixelBufferRef metadata 2021-12-22 18:43:17 -06:00
rcombs
69bd95dcd8 lavu/videotoolbox: expose conversion routines for color parameters
Also fixes symbol lookup errors on older macOS when built with a newer SDK,
introduced in 6cab5206b0
2021-12-22 18:42:51 -06:00
James Almer
e1d3ef9217 avutil/tests/cpu: add slowgather
Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-21 17:52:09 -03:00
James Almer
e68e379e0c avutil/cpu: add slowgather to av_parse_cpu_caps()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-21 17:51:27 -03:00
James Almer
8c2d2fd6cc avutil/cpu: move slow gather checks below in the function
Put them together with other similar slow flag checks.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-21 17:51:17 -03:00
Alan Kelly
ffbab99f2c libavutil/cpu: Add AV_CPU_FLAG_SLOW_GATHER.
This flag is set on Haswell and earlier and all AMD cpus.
2021-12-21 17:44:44 -03:00
Zhao Zhili
278068dc60 avutil/display: fix inverted doc
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-20 21:29:42 +01:00
Aman Karmani
9c590b76f4 avutil: add objc.h to SKIPHEADERS
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-12-19 09:41:16 -08:00
Sebastian Kirmayer
dfd06ee710 avutil/twofish: Fixed decryption
The previous implementation swapped the two halves of the plaintext. The
existing tests only decrypted data with a plaintext of all zeroes, which is
not affected by swapping the halves. Tests which detect the old buggy behavior
have been added.

Signed-off-by: Sebastian Kirmayer <ffmpeg@kirmayer.eu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-19 01:02:59 +01:00
Aman Karmani
edca1fa17c avutil: add obj-c helpers into header-only include
Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-12-18 11:55:47 -08:00
Shiyou Yin
6038a9eb92 avcodec: [loongarch] Optimize h264_chroma_mc with LASX.
./ffmpeg -i ../1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an
before:170
after :183

Change-Id: I42ff23cc2dc7c32bd1b7e4274da9d9ec87065f20
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Reviewed-by: guxiwei <guxiwei-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-15 18:37:40 +01:00
Shiyou Yin
9a840ffa17 avutil: [loongarch] Add support for loongarch SIMD.
LSX and LASX is loongarch SIMD extention.
They are enabled by default if compiler support it, and can be disabled
with '--disable-lsx' '--disable-lasx'.

Change-Id: Ie2608ea61dbd9b7fffadbf0ec2348bad6c124476
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Reviewed-by: guxiwei <guxiwei-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-15 18:37:40 +01:00
Lynne
0c1d47a6b3
hwcontext_vulkan: wait on semaphores when exporting to DRM
There is no synchronization method for DRM yet.
2021-12-10 17:16:49 +01:00
Lynne
f45cbb775e
lavu: bump minor version and add doc/APIchanges entry for Vulkan changes 2021-12-10 17:04:27 +01:00
Lynne
0747768728
hwcontext_vulkan: stricter semaphore number requirements
Always require one semaphore per sw_format plane. This is what
the implementation uses and relies upon throughout. This was
a leftover from an earlier revision that was never needed.
2021-12-10 17:04:22 +01:00
Wenbin Chen
83fe28221e hwcontext_vulkan: support creating DRM-tiled images and autodetecting modifiers
When vulkan image exports to drm, the tilling need to be
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT. Now add code to create vulkan
image using this format.

Now the following command line works:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format \
vaapi -i input_1080p.264 -vf "hwmap=derive_device=vulkan,format=vulkan, \
scale_vulkan=1920:1080,hwmap=derive_device=vaapi,format=vaapi" -c:v h264_vaapi output.264

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Further-modifications-by: Lynne <dev@lynne.ee>
2021-12-10 17:03:48 +01:00
Wenbin Chen
0d524b170e hwcontext_vulkan: add support for mapping frames with planes in a single VkDeviceMemory
Add support to map vulkan frames to software frames when
using contiguous_planes flag.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Further-modifications-by: Lynne <dev@lynne.ee>
2021-12-10 17:03:48 +01:00
Wenbin Chen
bd6ef73399 hwcontext_vulkan: add support for allocating all planes in a single allocation
VAAPI on Intel can import external frame, but the planes of the external
frames should be in the same drm object. A new option "contiguous_planes"
is added to device. This flag tells device to allocate places in one
memory. When device is derived from vaapi this flag will be enabled.
A new flag frame_flag is also added to AVVulkanFramesContext. User
can use this flag to force enable or disable this behaviour.
A new variable "offset "is added to AVVKFrame. It describe describe the
offset from the memory currently bound to the VkImage.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Further-modifications-by: Lynne <dev@lynne.ee>
2021-12-10 17:03:48 +01:00
Wenbin Chen
f3c9847c27 libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame
Vulkan will map nv12 to R8 and GR88, so add this map to vaapi to support
vulkan frame.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2021-12-10 17:03:48 +01:00
Bas Nieuwenhuizen
e050959103 hwcontext_vaapi: Use PRIME_2 memory type for modifiers.
This way we can pass explicit modifiers in. Sometimes the
modifier matters for the number of memory planes that
libva accepts, in particular when dealing with
driver-compressed textures. Furthermore the driver might
not actually be able to determine the implicit modifier
if all the buffer-passing has used explicit modifier.
All these issues should be resolved by passing in the
modifier, and for that we switch to using the PRIME_2
memory type.

Tested with experimental radeonsi patches for modifiers
and kmsgrab. Also tested with radeonsi without the
patches to double-check it works without PRIME_2 support.

v2:
  Cache PRIME_2 support to avoid doing two calls every time on
  libva drivers that do not support it.

v3:
  Remove prime2_vas usage.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2021-12-10 17:03:39 +01:00
Andreas Rheinhardt
fbbe7729f0 avutil/aes_ctr: Avoid allocation of AVAES struct
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:14:00 +01:00
Andreas Rheinhardt
6c57e0b4a8 avutil/frame: Treat frame as uninitialized in get_frame_defaults()
Currently, it also tests whether extended_data points to something
different than the AVFrame's data array and frees extended_data
if it is different. Yet this is only necessary for one of its three
callers, namely av_frame_unref(); meanwhile the other two callers
took measures to avoid this (or rather, to make it to an av_free(NULL)).

This commit moves this chunk to av_frame_unref() (so that
get_frame_defaults() now treats its input as uninitialized)
and removes the now superfluous code in the other two callers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Anton Khirnov
3a9861e22c lavu/frame: clarify doxy
AVFrame.data[] elements not used by the format should ALWAYS be null,
hwaccel formats are not an exception.
2021-12-04 14:29:06 +01:00
Anton Khirnov
3b8efec3c5 lavu/frame: drop mentions of non-refcounted frames
All frames we deal with should always be refcounted now.
2021-12-04 14:28:23 +01:00
nyanmisaka
64467cbca2 libavutil/hwcontext_qsv: fix a bug for mapping vaapi frame to qsv
The data stored in data[3] in VAAPI AVFrame is VASurfaceID while
the data stored in pair->first is the pointer of VASurfaceID, so
we need to do cast to make following commandline works:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi -i input.264 \
-vf "hwmap=derive_device=qsv,format=qsv" -c:v h264_qsv output.264

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2021-12-04 14:06:30 +01:00
Lynne
b236ef0a59
lavu/avframe: add a time_base field
This adds a time_base field to AVFrame, as an analogue to the
AVPacket.time_base field.
2021-12-03 22:41:00 +01:00
Andreas Rheinhardt
a4798a5d51 all: Use av_memdup() where appropriate
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:07:02 +01:00
rcombs
350eb59f8c videotoolbox: add alpha support 2021-11-28 16:40:58 -06:00
rcombs
d2229eca51 lavu/videotoolbox: add 422 and 444 pixel format mappings 2021-11-28 16:40:43 -06:00
rcombs
b2cd1fb2ec lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats
These are used by VideoToolbox hardware decoders.
2021-11-28 16:40:43 -06:00
Lynne
c90b3661fa
hwcontext_vulkan: use correct return value for allocation failure 2021-11-27 04:46:41 +01:00
Wu Jianhua
b3624069f0 avutil/hwcontext_vulkan: fully support customizable validation layers
Validation layer is an indispensable part of developing on Vulkan.

The following commands is on how to enable validation layers:

ffmpeg -init_hw_device vulkan=0,debug=1,validation_layers=VK_LAYER_LUNARG_monitor+VK_LAYER_LUNARG_api_dump

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-26 10:36:39 +01:00
Wu Jianhua
7e9e2cf93b avutil/hwcontext_vulkan: check if created before destroying the instance
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-24 11:09:49 +01:00
Wu Jianhua
c2a356d583 avutil/hwcontext_vulkan: check if created before destroying the device
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-24 11:09:49 +01:00
Timo Rothenpieler
2de6cd4ba4 avutil/hwcontext_cuda: return more useful error codes from init functions 2021-11-22 23:03:21 +01:00
Timo Rothenpieler
b1f1de0844 avutil/hwcontext_cuda: add option to use primary device context 2021-11-22 23:03:21 +01:00
Lynne
b159975e80
hwcontext_vulkan: check for non-flagged transfer queue families
"All commands that are allowed on a queue that supports transfer
operations are also allowed on a queue that supports either
graphics or compute operations. Thus, if the capabilities of a
queue family include VK_QUEUE_GRAPHICS_BIT or VK_QUEUE_COMPUTE_BIT,
then reporting the VK_QUEUE_TRANSFER_BIT capability separately for
that queue family is optional."
2021-11-20 02:37:41 +01:00
Lynne
135e1c0adf
lavu/vulkan: check for initialization when freeing buffers
What happens on startup is that ffmpeg.c initializes the filter,
then frees it without feeding a single frame through. With no
input frame, the filter lacks a hardware device. The rest of the
uninit code checks if Vulkan objects exist, which they must if there's
a hardware device, but vk->DeviceWaitIdle does not require an object.
So, add a check for it.
2021-11-20 01:48:45 +01:00
Wu Jianhua
ff82bd5a00 avutil/vulkan_glslang: fix compiling failure issue
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:48 +01:00
Lynne
da72aca7b0
lavu/vulkan: add support for using libshaderc as a GLSL compiler
It's got a much better API that's actually maintained, it eliminates
race conditions, it comes with a pkg-config file by default, and
unfortunately isn't currently packaged by Debian or other large
distributions.
2021-11-19 16:47:30 +01:00
Lynne
1d06084171
vulkan: fix checkheaders 2021-11-19 16:47:28 +01:00
Lynne
f6dd30df24
lavfi/vulkan: split off lavfi-specific code into vulkan_filter.c
The issue is that libavfilter depends on libavcodec, and when doing a
static build, if libavcodec also includes "libavfilter/vulkan.c", then
during link-time, compiling programs will fail as there would be multiple
definitions of the same symbols in both libavfilter and libavcodec's
object files.
Linkers are, however, more permitting if both files that include
a common file that's used as a template are one-to-one identical.
Hence, to make both files the same in the future, export all avfilter
specific functions to a separate file.
There is some work in progress to make templated files like this be
compiled only once, so this is not a long-term solution.

This also removes a macro that could be used to toggle SPIRV compilation
capability on #include-time, as this could cause the files to be different.
2021-11-19 16:47:26 +01:00
James Almer
67b92d68c6 x86/intmath: add VEX encoded versions of av_clipf() and av_clipd()
Prevents mixing inlined SSE instructions and AVX instructions when the compiler
generates the latter.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-19 11:21:03 -03:00
Lynne
b2aec70bd6
lavu/vulkan: add option to switch between shader compilers and cleanup glslang 2021-11-19 13:44:47 +01:00
Lynne
d1133e8c44
lavu/vulkan: move common Vulkan code from libavfilter to libavutil 2021-11-19 13:44:45 +01:00
Soft Works
daef8cbff7 avutil/frame: Document the possibility of negative line sizes
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-18 20:40:24 +01:00
Andreas Rheinhardt
9181b9ec7c avutil/hwcontext_qsv: Remove redundant check
It has already been checked immediately before that said
AVDictionaryEntry exists; checking again is redundant.
Furthermore, av_hwdevice_find_type_by_name() requires its argument
to be non-NULL, so adding a codepath that automatically calls it
with that parameter is nonsense. The same goes for the argument
corresponding to %s.

Fixes Coverity issue 1491394.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-18 19:50:08 +01:00
Andreas Rheinhardt
bd5ec3601f avutil/hwcontext_qsv: Fix leak of AVBuffer and AVBufferRef
This av_buffer_create() does nothing but leak an AVBuffer and an
AVBufferRef (except on allocation error).

Fixes Coverity issue 1491393.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-18 19:50:00 +01:00
Lynne
85a6b7f7b7
vulkan_loader: fix typo in error message 2021-11-18 06:40:52 +01:00