1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-26 06:01:30 +02:00
Commit Graph

20 Commits

Author SHA1 Message Date
Andreas Rheinhardt
a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
James Almer
a1cd4191e0 avcodec/vaapi_encode: use AVCodecContext.get_encode_buffer()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 13:44:16 -03:00
James Almer
827d6fe73d avcodec/encode: restructure the core encoding code
This commit follows the same logic as 061a0c14bb, but for the encode API: The
new public encoding API will no longer be a wrapper around the old deprecated
one, and the internal API used by the encoders now consists of a single
receive_packet() callback that pulls frames as required.

amf encoders adapted by James Almer
librav1e encoder adapted by James Almer
nvidia encoders adapted by James Almer
MediaFoundation encoders adapted by James Almer
vaapi encoders adapted by Linjie Fu
v4l2_m2m encoders adapted by Andriy Gelman

Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-18 17:11:37 -03:00
Linjie Fu
2b32068916 lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders
ff_vaapi_encode_close() is not enough to free the resources like cbs
if initialization failure happens after codec->configure (except for
vp8/vp9).

We need to call avctx->codec->close() to deallocate, otherwise memory
leak happens.

Add FF_CODEC_CAP_INIT_CLEANUP for vaapi encoders and deallocate the
resources at free_and_end inside avcodec_open2().

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-05-04 12:33:30 -03:00
Mark Thompson
344e6c3ff1 lavc/vaapi_encode: Add hardware config metadata
These encoders all accept VAAPI surfaces in a hardware frames context.
2020-04-26 18:38:25 +01:00
Mark Thompson
3387147860 vaapi_encode: Add ROI support 2019-07-28 22:34:26 +01:00
Mark Thompson
c4c2c4df76 vaapi_encode_vp9: Fix whitespace after previous patch 2019-02-25 23:34:14 +00:00
Mark Thompson
28e619e268 vaapi_encode_vp9: Enable support for more RC modes 2019-02-25 23:34:14 +00:00
Mark Thompson
916b3b9079 vaapi_encode_vp9: Support more complex reference structures 2019-01-23 23:04:12 +00:00
Mark Thompson
5fdcf85bbf vaapi_encode: Convert to send/receive API
This attaches the logic of picking the mode of for the next picture to
the output, which simplifies some choices by removing the concept of
the picture for which input is not yet available.  At the same time,
we allow more complex reference structures and track more reference
metadata (particularly the contents of the DPB) for use in the
codec-specific code.

It also adds flags to explicitly track the available features of the
different codecs.  The new structure also allows open-GOP support, so
that is now available for codecs which can do it.
2019-01-23 23:04:11 +00:00
Mark Thompson
851a63c22a vaapi_encode: Clean up the packed header configuration
Add a larger warning more clearly explaining the consequences of missing
packed header support in the driver.  Also only write the extradata if the
user actually requests it via the GLOBAL_HEADER flag.
2018-09-23 14:42:34 +01:00
Mark Thompson
bf726c26fd vaapi_encode: Clean up the GOP structure configuration
Choose what types of reference frames will be used based on what types
are available, and make the intra-only mode explicit (GOP size one,
which must be used for MJPEG).
2018-09-23 14:42:33 +01:00
Mark Thompson
8479f99c7d vaapi_encode: Add support for max QP in rate control
This was added in libva 2.1.0 (VAAPI 1.1.0).  Use AVCodecContext.qmax,
matching the existing behaviour for qmin, and clean up the defaults so
that we only pass min/max when explicitly set.
2018-09-23 14:42:33 +01:00
Mark Thompson
af532c9215 vaapi_encode: Clean up rate control configuration
Query which modes are supported and select between VBR and CBR based
on that - this removes all of the codec-specific rate control mode
selection code.
2018-09-23 14:42:33 +01:00
Mark Thompson
aa2563aecc vaapi_encode: Add common options between all encoders
The only common option here is low_power - it was previously supported
for H.264 only, that specific option is removed.
2018-09-23 14:42:33 +01:00
Mark Thompson
3b188666f1 vaapi_encode: Choose profiles dynamically
Previously there was one fixed choice for each codec (e.g. H.265 -> Main
profile), and using anything else then required an explicit option from
the user.  This changes to selecting the profile based on the input format
and the set of profiles actually supported by the driver (e.g. P010 input
will choose Main 10 profile for H.265 if the driver supports it).

The entrypoint and render target format are also chosen dynamically in the
same way, removing those explicit selections from the per-codec code.
2018-09-23 14:42:33 +01:00
Mark Thompson
c5b4ad247b vaapi_encode: Remove common priv_data and options fields
The codec-specific context now contains both the common context and the
codec-specific options directly.
2018-08-27 16:21:38 +01:00
Mark Thompson
1616106f11 vaapi_encode_vp9: Move options and common structures into context 2018-08-27 16:21:37 +01:00
wm4
b945fed629 avcodec: add metadata to identify wrappers and hardware decoders
Explicitly identify decoder/encoder wrappers with a common name. This
saves API users from guessing by the name suffix. For example, they
don't have to guess that "h264_qsv" is the h264 QSV implementation, and
instead they can just check the AVCodec .codec and .wrapper_name fields.

Explicitly mark AVCodec entries that are hardware decoders or most
likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing
API users listing hardware decoders in a more generic way. The proposed
AVCodecHWConfig does not provide this information fully, because it's
concerned with decoder configuration, not information about the fact
whether the hardware is used or not.

AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software
implementations in case the hardware is not capable.

Based on a patch by Philip Langdale <philipl@overt.org>.

Merges Libav commit 47687a2f8a.
2017-12-14 19:37:56 +01:00
Mark Thompson
bde0460406 vaapi_encode: Add VP9 support
(cherry picked from commit 0fd91e4bfc)
2017-06-24 17:41:55 +01:00