Commit Graph

5050 Commits

Author SHA1 Message Date
Nicolas George 6b65c4ec54 lavu: add av_gcd_q(). 2020-05-23 15:51:44 +02:00
Marton Balint af9e622776 avutil/opt: add AV_OPT_FLAG_CHILD_CONSTS
This will be used for AVCodecContext->profile. By specifying constants in the
encoders we won't have to use the common AVCodecContext options table and
different encoders can use the same profile name even with different values.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-22 22:16:52 +02:00
Anton Khirnov f30a41a608 Stop hardcoding align=32 in av_frame_get_buffer() calls.
Use 0, which selects the alignment automatically.
2020-05-22 14:38:57 +02:00
Linjie Fu 9723d7d523 lavc/qsvdec: add decode support for HEVC 4:2:2 8-bit and 10-bit
Enables HEVC Range Extension decoding support (Linux) for 4:2:2 8/10 bit
on ICL+ (gen11 +) platform.

Restricted to linux only for now.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-05-18 13:32:50 +08:00
James Almer 84af196c65 avutil: bump version after addition of av_sat_add64 and av_sat_sub64
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-17 16:05:15 -03:00
Dale Curtis a7e1af3cb1 avutil/common: Add saturated add/sub operations for int64_t.
Many places are using their own custom code for handling overflow
around timestamps or other int64_t values. There are enough of these
now that having some common saturated math functions seems sound.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-15 22:03:36 +02:00
Martin Storsjö 07948f3d38 aarch64: Explicitly forbid using the x18 register
On windows and darwin (and modern android), the x18 register is reserved
and shouldn't be modified by user code, while it is freely available on
linux. Strictly avoid it, to keep the assembly code portable.

This would have helped catch the issue fixed in 872790b1f9
immediately.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 21:22:22 +03:00
Lynne 858f786eb9 hwcontext_vulkan: fix incorrect print argument 2020-05-14 21:06:24 +01:00
Lynne 4b7e13931f
hwcontext_vulkan: don't add the optional VK_KHR_surface extension by default
Both API and CLI users can enable any extension they'd like using the options.
2020-05-12 21:32:34 +01:00
Lynne 251e4ad0ad
hwcontext_vulkan: don't error on unavailable user-specified extensions
Only warn instead. API users can find out which extensions were unavailable
by using the enabled_inst_extensions and enabled_dev_extensions fields.
This eliminates having to trial-and-error to find which extensions were missing.
2020-05-12 21:32:32 +01:00
Lynne 6025e66f98
hwcontext_vulkan: use the maximum amount of queues for each family
Due to our AVHWDevice infrastructure, where API users are offered a way
to derive contexts rather than always create new one, our filterchains,
being supported by a single hardware device context, can grow to considerable
size.
Hence, in such situations, using the maximum amount of queues the device offers
can be benefitial to eliminating bottlenecks where queue submissions on the
same family have to wait for the previous one to finish.
2020-05-12 21:32:30 +01:00
Lynne 0e39fce1e1
hwcontext_vulkan: update prepare_frame() for multiple semaphores when exporting 2020-05-12 21:32:24 +01:00
Anton Khirnov ffae62d96c vp9dec: support exporting QP tables through the AVVideoEncParams API 2020-05-12 09:37:47 +02:00
Juan De León 991d417692 libavutil: add API for exporting video frame quantizers
This is intended to replace the deprecated the AV_FRAME_DATA_QP_TABLE*
API and extend it to a wider range of codecs.

In the future, it may also be extended to support other encoding
parameters such as motion vectors.

Additional changes by Anton Khirnov <anton@khirnov.net> with suggestions
by Lynne <dev@lynne.ee>.

Signed-off-by: Juan De León <juandl@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-05-12 09:37:47 +02:00
Lynne 70d396c8af Revert "hwcontext_vulkan: only use one semaphore per image"
This reverts commit 97b526c192.
It broke the API, and assumed no other APIs used multiple semaphores.
This also disallowed certain optimizations to happen.

Dealing with APIs that give or expect single semaphores is easier when
we use per-image semaphores.
2020-05-11 23:48:26 +01:00
Lynne fc99a24782
hwcontext_vulkan: convert to general layout and transfer queue when exporting
The specs note that images should be in the GENERAL layout when exporting
for maximum compatibility.
CUDA exported images are handled differently, and the queue is the same,
so we don't need to do that there.
2020-05-10 23:20:49 +01:00
Lynne 875c1707e5
hwcontext_vulkan: create all images with concurrent sharing mode
As it turns out, we were already assuming and treating all images as if they had
concurrent access mode. This just changes the flag to CONCURRENT, which has less
restrictions than EXCLUSIVE, and fixed validation messages on machines with
multiple queues.
The validation layer didn't pick this up because the machine I was testing on
had only a single queue.
2020-05-10 23:20:49 +01:00
Lynne 7c080dc190
hwcontext_vulkan: fix inverted condition when exporting images to drm_prime
Calling vkGetImageSubresourceLayout is only legal for linear and drm images.
2020-05-10 23:20:49 +01:00
Lynne acfef378b7
hwcontext_vulkan: update debugging layer name 2020-05-10 23:20:48 +01:00
Lynne 030a565baf
hwcontext_vulkan: remove unused internal REQUIRED extension flag
This is a leftover from an old version which used the 1.0 Vulkan API
with the maintenance extensions being required.
2020-05-10 23:20:48 +01:00
Lynne dccd07f66d
hwcontext_vulkan: expose enabled device and instance extensions
This solves a huge oversight - it lets users reliably use their own
AVVulkanDeviceContext. Otherwise, the extensions supplied and enabled
are not discoverable by anything outside of hwcontext_vulkan.
Also clarifies that any user-supplied VkInstance must be at least 1.1.
2020-05-10 23:20:48 +01:00
Lynne 3c5e5a5095
hwcontext_vulkan: let users enable device and instance extensions using options
Also documents all options supported by the hwdevice.
This lets users enable all extensions they need without writing their own
instance initialization code.
2020-05-10 23:20:47 +01:00
Lynne b69f5a72ce hwcontext_vulkan: optionally enable the VK_KHR_surface extension if available
This allows any phys_device derived to be used as a display rendering device.
2020-05-10 11:23:10 +01:00
Marton Balint 6847affcb7 avutil/opt: only skip evaluation for rational options
Fixes problems when non-rational options were set using rational expressions,
causing rounding errors and the option range limits not to be enforced
properly.

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-01 17:22:58 +02:00
Jun Zhao 5a2a199031 lavu/version: bump minor version for DOVI sidedata
bump minor version for DOVI sidedata, because added the dovi_meta.h
as lavu API part. Also update APIchanges.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-04-25 09:40:52 +08:00
vacingfang 103885d955 lavutil: add DOVI related header
add DOVI related struct

Signed-off-by: vacingfang <vacingfang@tencent.com>
2020-04-23 08:05:15 +08:00
Lynne e3c7b22451
hwcontext_vulkan: correctly download and upload flipped images
We derive the destination buffer stride from the input stride,
which meant if the image was flipped with a negative stride,
we'd be FFALIGNING a negative number which ends up being huge,
thus making the Vulkan buffer allocation fail and the whole
image transfer fail.

Only found out about this as OpenGL compositors can copy an entire
image with a single call if its flipped, rather than iterate over
each line.
2020-04-21 19:00:51 +01:00
Marton Balint d1e52e396b avutil/log: update text requesting samples
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-17 00:08:56 +02:00
Carl Eugen Hoyos b7d9507bb8 lavu/mem: Make other alloc functions more similar to av_malloc().
Do not limit the array allocation functions and av_calloc() to allocations
of INT_MAX, instead depend on max_alloc_size like av_malloc().

Allows a workaround for ticket #7140.
2020-04-12 22:32:03 +02:00
Lynne 97b526c192 hwcontext_vulkan: only use one semaphore per image
The idea was to allow separate planes to be filtered independently, however,
in hindsight, literaly nothing uses separate per-plane semaphores and it
would only work when each plane is backed by separate device memory.
2020-04-07 12:52:56 +01:00
Timo Rothenpieler 30b28f9a83 avutil/hwcontext_cuda: Only handle CUDA hardware frames 2020-04-06 19:33:01 +02:00
Andreas Rheinhardt a500b975a8 avutil/opt: Don't use NULL for %s string in a log message
If one calls av_opt_set() with an incorrect string to set the value of
an option of type AV_OPT_TYPE_VIDEO_RATE, the given string is used in a
log message via %s. This also happens when the string is actually a
nullpointer in which case using it for %s is forbidden.

This commit changes this by erroring out early in case of a nullpointer.

This also fixes a warning from GCC 9.2:
"‘%s’ directive argument is null [-Wformat-overflow=]"

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-01 04:09:18 +02:00
Timo Rothenpieler 77d5ea1c7c avutil/frame: make frame copy functions hwframe aware 2020-03-28 17:59:32 +01:00
Timo Rothenpieler b06ae06e6a avutil/hwcontext: correctly set extended_data on hwframe_get_buffer 2020-03-28 17:59:29 +01:00
Lynne 2465fe1302 lavu/tx: add 2-point FFT transform
By itself, this allows 6-point, 10-point and 30-point transforms.
When the 9-point transform is added it allows for 18-point FFT,
and also for a 36-point MDCT (used by MP3).
2020-03-23 21:26:25 +00:00
Lynne 9f494d1397 lavu/tx: improve documentation 2020-03-23 21:26:25 +00:00
Daniel Playfair Cal fa41be5743 hwcontext_opencl: include header file in HEADERS
This matches the inclusion of the other hwcontext_<hwaccel>.h headers.
The skipping of the header depending on build flags is already present.

Signed-off-by: Daniel Playfair Cal: <daniel.playfair.cal@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-03-20 09:16:05 +01:00
Timo Rothenpieler d9a37af070 avutil/hwcontext_cuda: combine transfer functions
Gets rid of some mostly duplicated code and adds the ability to do
hardware to hardware transfers.
2020-03-19 17:38:36 +01:00
Yaroslav Pogrebnyak 08d46cb586 avutil/hwcontext_cuda: add YUVA420P pixel format
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-03-19 16:38:08 +01:00
Lynne ecc3dceff4 hwcontext_vulkan: fix imported image bitmask 2020-03-17 22:52:00 +00:00
Lynne 6353b9e4ab hwcontext_vulkan: support more than one plane per DMABUF layer
Requires the dmabuf modifiers extension.
Allows for importing of compressed images with a second plane.
2020-03-12 18:59:12 +00:00
Lynne b31959d776 hwcontext_vulkan: duplicate DMABUF objects before importing them
The specifications are very vague about who has ownership, and in this case,
Vulkan takes ownership of all DMABUF FDs passed to it, causing errors
to occur if someone gave us images for mapping which were meant to be kept.
The old behavior worked with one-way VAAPI and DMABUF imports, but was broken
with clients like wlroots' dmabuf-capture.
2020-03-12 18:16:11 +00:00
Lynne 501bd57bdb hwcontext_vulkan: initialize semaphores of DMABUF imports
There was a recent change in Intel's driver that triggered a driver-internal
error if the semaphore given to the command buffer wasn't initialized.
Given that the specifications require the semaphore to be initialized,
this is within spec. Unlike what's causing it in the first place, which is
that there are no ways to extract/import dma sync objects from DMABUFs,
so we must leave our semaphores bare.
2020-03-12 18:16:11 +00:00
Lynne 9086af2a0a hwcontext_vulkan: only convert image layout for transfers if necessary 2020-03-12 18:16:11 +00:00
Lynne 08d0a8992d hwcontext_vulkan: minor corrections for DMABUF mapping
We need to consider the amount of layers instead of the image's planes.
2020-03-12 18:16:11 +00:00
Mark Thompson bc9b6358fb hwcontext_vaapi: Only accept a render node when deriving from DRM device
If we are given a non-render node, try to find the matching render node and
fail if that isn't possible.

libva will not accept a non-render device which is not DRM master, because
it requires legacy DRM authentication to succeed in that case:
<https://github.com/intel/libva/blob/master/va/drm/va_drm.c#L68-L75>.  This
is annoying for kmsgrab because in most recording situations DRM master is
already held by something else (such as a windowing system), leading to
device derivation not working and forcing the user to create the target
VAAPI device separately.
2020-02-24 00:09:51 +00:00
Linjie Fu f4cd4017bf lavu/hwcontext_vaapi: add vaapi_format_map support for Y210
VA_RT_FORMAT describes the desired sampling format for surface.

When creating surface, VA_RT_FORMAT will be used firstly to choose
the expected fourcc/media_format for the surface. And the fourcc
will be revised by the value of VASurfaceAttribPixelFormat.

Add vaapi_format_map support for new pixel_format Y210.
This is fundamental for both VA-API and QSV.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-02-24 00:09:51 +00:00
Linjie Fu 1c37cad084 lavu/pix_fmt: add new pixel format y210
Add some packed 4:2:2 10-bit pixel formats for hardware decode support
in VAAPI and QSV.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-02-24 00:09:51 +00:00
Matt Oliver f0c0ad4455 avutil/hwcontext_d3d11va: Use secure dlopen.
dlopen contains additional security to prevent dll hijacking compared to standard LoadLibrary.
2020-02-15 23:53:54 +11:00
Lynne e1c84856bb lavu/tx: improve 3-point fixed precision
There's just no reason not to when its so easy (albeit messy) and its also
reducing the precision of all non-power-of-two transforms that use it.
2020-02-14 19:58:14 +00:00