1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

96 Commits

Author SHA1 Message Date
Mark Thompson
a769e72c75 vaapi_encode_h264: Enable multiple-slice support 2018-10-27 19:35:35 +01:00
Mark Thompson
4b2e3de8c0 cbs_h264: Fix default value for max mv lengths
A recent version of the standard changed the max and default to 15, from
16 in older versions.  This updates the default to 15 to match, but the
max stays as 16 so that we don't reject older streams.
2018-09-23 14:42:34 +01:00
Mark Thompson
bb3503164e vaapi_encode_h264: Set level based on stream if not set by user 2018-09-23 14:42:34 +01:00
Mark Thompson
91534786fa vaapi_encode_h26[45]: Make the AUD option a boolean 2018-09-23 14:42:34 +01:00
Mark Thompson
4cc367bf9d vaapi_encode_h264: Properly set constraint flags
constraint_set1_flag should be set for constrained baseline and main
profiles, because the stream conforms to main profile.

constraint_set3_flag should be set for high profile when the stream
is intra-only.

constraint_set4_flag should always be set for main and high profiles
because interlaced encoding is not supported.

constraint_set5_flag should be set for main and high profiles when
B-frames are not used.

Also fix the setting of max_num_ref_frames - use the gop_size value
to check for intra-only rather than the constraint flag (which is not
necessarily set).
2018-09-23 14:42:34 +01: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
ac31d84506 vaapi_encode: Clean up the encode quality configuration 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
2fd962efba vaapi_encode_h264: Move options and common structures into context
This will make it easier to support options in common between different
encoders.  It also cleans up some of the field naming.
2018-08-27 16:21:37 +01:00
Haihao Xiang
314994051b vaapi_encode_h264: Take VAAPIEncodeH264Context::sei_needed as an ORed value
We may check priv->sei_needed only when writing SEI messages.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2018-05-03 23:11:23 +01:00
Mark Thompson
0cc8e34a94 Merge commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2'
* commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2':
  cbs: Refcount all the things!

Some changes for bitstream API.

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-02-21 22:22:54 +00:00
Mark Thompson
ce5870a3a8 cbs: Refcount all the things!
This makes it easier for users of the CBS API to get alloc/free right -
all subelements use the buffer API so that it's clear how to free them.
It also allows eliding some redundant copies: the packet -> fragment copy
disappears after this change if the input packet is refcounted, and more
codec-specific cases are now possible (but not included in this patch).
2018-02-20 22:04:12 +00:00
Mark Thompson
2651352988 cbs: Allocate the context inside the init function
... instead of making callers allocate it themselves.  This is more
consistent with other APIs in libav.
2018-02-20 22:04:12 +00: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
wm4
47687a2f8a 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>.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-12-14 16:58:45 +01:00
Mark Thompson
6679654efe vaapi_h264: Add named options for setting profile and level 2017-12-06 22:33:52 +00:00
Mark Thompson
c490fc9536 vaapi_h264: Add named options for setting profile and level 2017-12-04 23:25:32 +00:00
Jun Zhao
4b57f06447 vaapi_h264: Fix VUI max_dec_frame_buffering
This should refer to the existing SPS structure, not the VAAPI sequence
parameter buffer (which is not yet initialised).

From ffmpeg commit f31478ba14.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-12-02 15:21:31 +00:00
Mark Thompson
4251e25272 Merge commit 'ff007e30d8d45ba1ff2b2a4615f1cd5bafb50626'
* commit 'ff007e30d8d45ba1ff2b2a4615f1cd5bafb50626':
  vaapi_h264: Add workaround for bad SEI in old Intel drivers

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-11-15 23:52:21 +00:00
Mark Thompson
620f88a0b9 vaapi_h264: Add missing return value check 2017-11-12 16:00:52 +00:00
Mark Thompson
ff007e30d8 vaapi_h264: Add workaround for bad SEI in old Intel drivers
With pre-2.0 Intel drivers in CBR mode, if an explicit SEI message with
the old (now deprecated) type is not included, the driver generates and
inserts some timing SEI which is almost certainly invlaid.  Before
7a4fac5e91 we always inserted our own SEI
so this would not be visible, but since then it has been possible to
disable that.  We would also like to avoid using the deprecated type,
and using the new type, while working in old drivers, does not suppress
the spurious message like the old type does.

Therefore, suppress the bad SEI insertion by providing a zero-length
buffer with the old type, which the driver can insert harmlessly.
2017-11-12 15:59:45 +00:00
Mark Thompson
c77da21e5d vaapi_h264: Do not use deprecated header type
SEI headers should be inserted as generic raw data (the old specific
type has been deprecated in libva2).
2017-11-12 15:59:45 +00:00
Mark Thompson
f0a978a519 vaapi: Remove H.264 baseline profile
This has been deprecated in libva2 because hardware does not and will not
support it.  Therefore never consider it for decode, and for encode assume
the user meant constrained baseline profile instead.
2017-10-24 23:55:29 +01:00
Jun Zhao
f31478ba14 lavc/vaapi_encode_h264: correct VUI max_dec_frame_buffering setting
This should refer to the existing SPS structure, not the VAAPI sequence
parameter buffer (which is not yet initialised).

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-10-24 23:06:26 +01:00
Mark Thompson
32a618a948 vaapi_h264: Do not use deprecated header type
SEI headers should be inserted as generic raw data (the old specific
type has been deprecated in libva2).
2017-10-18 20:05:11 +01:00
Mark Thompson
03b1470088 vaapi_h264: Add missing return value check
Fixes CID 1419829.
2017-10-18 20:05:11 +01:00
Mark Thompson
94a4048619 vaapi_h264: Fix CPB/DPB delays
This should be ticks, not time_scale steps - it was wrong for all
framerates not a multiple of 1/2.

(cherry picked from commit 30645174e3)
2017-10-17 20:56:30 +01:00
Mark Thompson
0bc7575ced vaapi_h264: Add support for SEI recovery points
Included by default with non-IDR intra frames.

(cherry picked from commit a49ee60d5f)
2017-10-17 20:56:30 +01:00
Mark Thompson
281b68b026 vaapi_h264: Add support for AUD NAL units
Adds a new private option to enable them (off by default).

(cherry picked from commit 820a4483af)
2017-10-17 20:56:30 +01:00
Mark Thompson
2e29ca2a9f vaapi_h264: Convert to use coded bitstream infrastructure
(cherry picked from commit 7a4fac5e91)
2017-10-17 20:56:30 +01:00
Mark Thompson
bd211bb866 vaapi: Remove H.264 baseline profile
This has been deprecated in libva2 because hardware does not and will not
support it.  Therefore never consider it for decode, and for encode assume
the user meant constrained baseline profile instead.
2017-10-09 00:11:53 +01:00
Mark Thompson
6eb102a616 h264_sei: Add namespace prefix to all SEI values
This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.

(cherry picked from commit 6ea220cbee)
2017-09-12 22:29:31 +01:00
Mark Thompson
30645174e3 vaapi_h264: Fix CPB/DPB delays
This should be ticks, not time_scale steps - it was wrong for all
framerates not a multiple of 1/2.
2017-09-12 22:11:55 +01:00
Jun Zhao
c6a8c2a4f7 lavc/vaapi_encode_h264: add "coder" option support
Follow libx264 style to support "coder" option, and set it to
cabac by default.

Signed-off-by: Yi A Wang <yi.a.wang@intel.com>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-08-20 14:24:21 +01:00
Mark Thompson
9c878651db vaapi_encode: Move quality option to common code
Use AVCodecContext.compression_level rather than a private option,
replacing the H.264-specific quality option (which stays only for
compatibility).

This now works with the H.265 encoder in the i965 driver, as well as
the existing cases with the H.264 encoder.

(cherry picked from commit 19388a7200)
2017-08-20 12:56:24 +01:00
Mark Thompson
a49ee60d5f vaapi_h264: Add support for SEI recovery points
Included by default with non-IDR intra frames.
2017-08-13 17:55:02 +01:00
Mark Thompson
820a4483af vaapi_h264: Add support for AUD NAL units
Adds a new private option to enable them (off by default).
2017-08-13 17:55:02 +01:00
Mark Thompson
7a4fac5e91 vaapi_h264: Convert to use coded bitstream infrastructure 2017-08-13 17:55:02 +01:00
Mark Thompson
19388a7200 vaapi_encode: Move quality option to common code
Use AVCodecContext.compression_level rather than a private option,
replacing the H.264-specific quality option (which stays only for
compatibility).

This now works with the H.265 encoder in the i965 driver, as well as
the existing cases with the H.264 encoder.
2017-08-06 14:42:04 +01:00
Mark Thompson
b658b5399e vaapi_encode: Use gop_size consistently in RC parameters
The non-H.26[45] codecs already use this form.  Since we don't
currently generate I frames for codecs which support them separately
to IDR, the p_per_i variable is set to infinity by default so that it
doesn't interfere with any other calculation.  (All the code for I
frames still exists, and it works for H.264 if set manually.)

(cherry picked from commit 6af014f402)
2017-06-14 22:26:32 +01:00
Mark Thompson
6ea220cbee h264_sei: Add namespace prefix to all SEI values
This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.
2017-05-16 22:23:14 +01:00
Mark Thompson
6af014f402 vaapi_encode: Use gop_size consistently in RC parameters
The non-H.26[45] codecs already use this form.  Since we don't
currently generate I frames for codecs which support them separately
to IDR, the p_per_i variable is set to infinity by default so that it
doesn't interfere with any other calculation.  (All the code for I
frames still exists, and it works for H.264 if set manually.)
2017-04-26 22:00:33 +01:00
Mark Thompson
2201c02e6d vaapi_h264: Enable VBR mode
Default to using VBR when a target bitrate is set, unless the max rate
is also set and matches the target.  Changes to the Intel driver mean
that min_qp is also respected in this case, so set a codec default to
unset the value rather than using the current default inherited from
the MPEG-4 part 2 encoder.

(cherry picked from commit eddfb57210)
2017-02-08 19:14:05 +00:00
Mark Thompson
eefa4b76ee vaapi_h264: Scale log2_max_pic_order_cnt_lsb with max_b_frames
Before this change, it was possible to overflow pic_order_cnt_lsb and
generate a stream with invalid POC numbering.  This makes sure that
the field is large enough that a single IDR B* P sequence uses fewer
than half the available POC lsb values.

(cherry picked from commit 89725a8512)
2017-02-08 19:14:05 +00:00
Mark Thompson
eddfb57210 vaapi_h264: Enable VBR mode
Default to using VBR when a target bitrate is set, unless the max rate
is also set and matches the target.  Changes to the Intel driver mean
that min_qp is also respected in this case, so set a codec default to
unset the value rather than using the current default inherited from
the MPEG-4 part 2 encoder.
2017-01-30 22:52:54 +00:00