1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

18 Commits

Author SHA1 Message Date
wm4
e724bdfffb lavc: fix hw_device_ctx operation
Commit b46a77f19d accidentally broke this (requested change that was
added to the patch later and which was not fully tested).

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-10-23 23:35:31 +01:00
wm4
b46a77f19d lavc: external hardware frame pool initialization
This adds a new API, which allows the API user to query the required
AVHWFramesContext parameters. This also reduces code duplication across
the hwaccels by introducing ff_decode_get_hw_frames_ctx(), which uses
the new API function. It takes care of initializing the hw_frames_ctx
if needed, and does additional error handling and API usage checking.

Support for VDA and Cuvid missing.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-10-19 17:10:59 +02:00
Anton Khirnov
704311b294 decode: add a per-frame private data for hwaccel use
This will be useful in the CUVID hwaccel. It should also eventually
replace current decoder-specific mechanisms used by various other
hwaccels.
2017-07-26 23:24:14 +02:00
Anton Khirnov
badf0951f5 decode: add a mechanism for performing delayed processing on the decoded frames
This will be useful in the CUVID hwaccel.
2017-07-26 23:24:07 +02:00
Anton Khirnov
359a8a3e2d decode: add a method for attaching lavc-internal data to frames
Use the AVFrame.opaque_ref field. The original user's opaque_ref is
wrapped in the lavc struct and then unwrapped before the frame is
returned to the caller.

This new struct will be useful in the following commits.
2017-07-26 23:23:58 +02:00
Anton Khirnov
de77671438 decode: avoid leaks on failure in ff_get_buffer()
If the get_buffer() call fails, the frame might have some side data
already set. Make sure it gets freed.

CC: libav-stable@libav.org
2017-07-26 23:23:47 +02:00
wm4
47399ccdfd lavc, lavu: move frame cropping to a convenience function
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:20:40 +02:00
Anton Khirnov
3fdf50f9e8 hwframe: Allow hwaccel frame allocators to align surface sizes
Hardware accelerated decoding generally uses AVHWFramesContext for pool
allocation of hardware surfaces. These are setup to allocate surfaces
aligned to hardware and hwaccel API requirements. Due to the
architecture, av_hwframe_get_buffer() will return AVFrames with
the dimensions set to the aligned sizes.

This causes some decoders (like hevc) return these aligned size as
final frame size, instead of cropping them to the video's actual
dimensions. To make sure this doesn't happen, crop the frame to the
size the decoder expects when ff_get_buffer() is called.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00
wm4
bd747b9226 lavc: set avctx->hwaccel before init
So a hwaccel can access avctx->hwaccel in init for whatever reason. This
is for the new d3d hwaccel API. We could create separate entrypoints for
each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this
seems nicer.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-08 20:55:45 +02:00
Anton Khirnov
8652a2c248 decode: fix the code reducing cropping to preserve alignment
Currently it does not work at all.

Bug-Id: 1058
2017-05-20 09:41:30 +02:00
Vittorio Giovara
efddf2c09a decode: Initialize ret before using it
libavcodec/decode.c:608:9: warning: variable 'ret' is
      used uninitialized whenever 'if' condition is false
2017-04-10 09:04:41 -04:00
Vittorio Giovara
c43a96fe16 lavc: Drop deprecated time_base variable for decoding
Deprecated in 10/2015.
2017-03-23 10:09:16 +01:00
Anton Khirnov
019ab88a95 lavc: add an option for exporting cropping information to the caller
Also, add generic code for handling cropping, so the decoders can export
just the cropping size and not bother with the rest.
2017-01-12 16:24:15 +01:00
Anton Khirnov
972c71e9cb lavc: add support for filtering packets before decoding 2016-12-14 09:06:45 +01:00
Anton Khirnov
061a0c14bb decode: restructure the core decoding code
Currently, the new decoding API is pretty much just a wrapper around the
old deprecated one. This is problematic, since it interferes with making
full use of the flexibility added by the new API. The old API should
also be removed at some future point.

Reorganize the code so that the new send_packet/receive_frame functions
call the actual decoding directly and change the old deprecated
avcodec_decode_* functions into wrappers around the new API.

The new internal API for decoders is now changing as well. Before this
commit, it mirrors the public API, so the decoders need to implement
send_packet() and receive_frame() callbacks. This turns out to require
awkward constructs in both the decoders and the generic code. After this
commit, the decoders only implement the receive_frame() callback and
call a new internal function, ff_decode_get_packet() to obtain input
data, in the same manner to how the bitstream filters now work.

avcodec will now always make a reference to the input packet, which means
that non-refcounted input packets will be copied. Keeping the previous
behaviour, where this copy could sometimes be avoided, would make the
code significantly more complex and fragile for only dubious gains,
since packets are typically small and everyone who cares about
performance should use refcounted packets anyway.
2016-12-14 09:06:44 +01:00
Anton Khirnov
549d0bdca5 decode: be more explicit about storing the last packet properties
The current code stores a pointer to the packet passed to the decoder,
which is then used during get_buffer() for timestamps and side data
passthrough. However, since this is a pointer to user data which we do
not own, storing it is potentially dangerous. It is also ill defined for
the new decoding API with split input/output.

Fix this problem by making an explicit internally owned copy of the
packet properties.
2016-12-14 09:06:44 +01:00
Vittorio Giovara
2fb6acd9c2 lavc: Add spherical packet side data API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-07 14:34:34 -05:00
Anton Khirnov
3fe2a01df7 lavc: move decoding-related code from utils.c to a new file 2016-11-29 10:39:20 +01:00