1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

52 Commits

Author SHA1 Message Date
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
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
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
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
Jun Zhao
b53b3a4f6a lavc/vaapi_encode_h264: disable B frames in baseline profile
Disable B frames when using baseline/constrained baseline profile,
following H.264 spec Annex A.2.1.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Yi A Wang <yi.a.wang@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-01-09 00:28:08 +00:00
Mark Thompson
f242e0a0ff vaapi_encode: Fix format specifier for bitrate logging
Same as e0df56f25d.  This was accidentally
reintroduced while merging c8241e730f.
2016-11-21 22:59:58 +00:00
Jun Zhao
e72662e131 lavc/vaapi_encode_h264: fix poc incorrect issue after meeting idr frame.
when meeting IDR frame, vaapi_encode_h264 poc number don't reset, now fix
this issue based on h264 spec. Some decoder don't care this case, but this
fix will enhance the encoder action. Before this fix, poc number is
negative in some case.

Reviewed-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>
2016-11-21 22:37:02 +00:00
Mark Thompson
6796e6ea84 vaapi_h264: Write bitstream restriction fields
(cherry picked from commit ec17ab381e)
2016-11-21 22:13:41 +00:00
Mark Thompson
658c5afaa0 vaapi_h264: Fix CFR mode with frame_rate set in AVCodecContext
(cherry picked from commit 17a0f9481c)
2016-11-21 22:13:41 +00:00
Mark Thompson
ee1d04f970 vaapi_h264: Set max_num_ref_frames to 1 when not using B frames
(cherry picked from commit 956a54129d)
2016-11-21 22:13:41 +00:00
Mark Thompson
478a4b7e6d vaapi_encode: Check packed header capabilities
This improves behaviour with drivers which do not support packed
headers, such as AMD VCE on mesa/gallium.

(cherry picked from commit 892bbbcdc1)
2016-11-21 22:13:41 +00:00
Mark Thompson
c8241e730f vaapi_encode: Refactor initialisation
This allows better checking of capabilities and will make it easier
to add more functionality later.

It also commonises some duplicated code around rate control setup
and adds more comments explaining the internals.

(cherry picked from commit 80a5d05108)
2016-11-21 22:13:41 +00:00
Mark Thompson
06d73d002e vaapi_h264: Fix HRD bit_rate/cpb_size scaling
There should be an extra offset of 6 on bit_rate_scale and of 4 on
cpb_size_scale which were not accounted for here.

(cherry picked from commit 3a9662af6c)
2016-11-21 22:13:41 +00:00
Carl Eugen Hoyos
82e53b3cef lavc/vaapi_encode_h26x: Fix a crash if "." is not the decimal separator.
Fixes Debian bugs #831529, #831909, #832964.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2016-08-05 21:24:54 +01:00
James Almer
f41048f6ec Merge commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c'
* commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c':
  h264: add H264_ prefix to the NAL unit types

Conflicts:
libavcodec/h264_parse.c
libavcodec/h264_parser.c
libavcodec/h264_slice.c
libavcodec/h264dec.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 15:11:05 -03:00
Clément Bœsch
ecf65c30cf Merge commit '251cbb44003caf179fb17afbb8a6c56643c2a646'
* commit '251cbb44003caf179fb17afbb8a6c56643c2a646':
  h264: create a new header for common h264 definitions

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:13:44 +02:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Michael Niedermayer
e98ab799be avcodec/vaapi_encode_h264: Use av_clip_uintp2()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-10 00:36:20 +02:00
Clément Bœsch
4b90413cb2 Merge commit '02fa1ad9266f9b1ea11565ac2f93f45853e351e8'
* commit '02fa1ad9266f9b1ea11565ac2f93f45853e351e8':
  vaapi_h264: Add source version identifier as unregistered SEI

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:40 +02:00
Clément Bœsch
cc3de390b7 Merge commit '48e2967cd50c2e1a2a539fd697d20ead2c5c4cc8'
* commit '48e2967cd50c2e1a2a539fd697d20ead2c5c4cc8':
  vaapi_h264: Add support for SEI messages

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:28 +02:00
Clément Bœsch
3e71e34333 Merge commit '081961f819c0b16c7a860d7da7d39f1fd91bd2f0'
* commit '081961f819c0b16c7a860d7da7d39f1fd91bd2f0':
  vaapi_h264: Add support for VUI parameters

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:06 +02:00
Hendrik Leppkes
f2a3798ea4 Merge commit 'a86aa16088ad7f22a8918d71adb8c040d6033d84'
* commit 'a86aa16088ad7f22a8918d71adb8c040d6033d84':
  vaapi_h264: Add trivial support for low-power encoding

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 15:44:43 +02:00
Hendrik Leppkes
d3327b7eda Merge commit 'b51c7c6b8a5b35cfd06cb9655f9ec4c9f0ddd81b'
* commit 'b51c7c6b8a5b35cfd06cb9655f9ec4c9f0ddd81b':
  vaapi_h264: Fix frame_num after non-reference frames

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 15:44:35 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Anton Khirnov
5c2fb561d9 h264: add H264_ prefix to the NAL unit types
This will prevent conflicts e.g. in code that deals with both h264 and
hevc.
2016-06-21 11:17:28 +02:00
Anton Khirnov
251cbb4400 h264: create a new header for common h264 definitions
Move the NAL unit types into it. This will allow to stop including the
whole decoder-specific h264dec.h in some code that is unrelated to the
decoder and only needs some enum values.
2016-06-21 11:12:41 +02:00
Anton Khirnov
9df889a5f1 h264: rename h264.[ch] to h264dec.[ch]
This is more consistent with the naming of other decoders.
2016-06-21 11:11:26 +02:00
Mark Thompson
d4cd8e7f6a vaapi_encode_h26[45]: Reject bitrate targets higher than 2^31 2016-06-10 21:18:58 +01:00
Mark Thompson
02fa1ad926 vaapi_h264: Add source version identifier as unregistered SEI
Contains the libavcodec version, the VAAPI version and the libva
driver vendor string.
2016-06-09 21:15:39 +01:00
Mark Thompson
48e2967cd5 vaapi_h264: Add support for SEI messages
Send buffering_period and pic_timing messages when in modes
targetting bitrate.  Also adds NAL HRD parameters to VUI.
2016-06-09 21:15:39 +01:00
Mark Thompson
081961f819 vaapi_h264: Add support for VUI parameters
Supports aspect ratio, colour format and timing information.
2016-06-09 21:15:39 +01:00
Matthieu Bouron
e0df56f25d lavc/vaapi_encoder_{h264,h265}: fix bad format warning 2016-06-03 10:09:39 +02:00
Mark Thompson
a86aa16088 vaapi_h264: Add trivial support for low-power encoding
Experimental; requires Skylake and VAAPI 0.39.1 (not yet released).
Also increases the allowed range of the quality option - in low-power
mode, the Intel driver supports levels 1-8 (and 0 meaning default).
2016-05-27 10:57:00 +01:00
Mark Thompson
b51c7c6b8a vaapi_h264: Fix frame_num after non-reference frames
Non-reference frames (nal_ref_idc == 0) should be discardable, so
frame_num does not advance after them.  Before this change, a stream
containing unreferenced B-frames would be rejected by the reference
decoder.
2016-05-27 10:56:55 +01:00
Derek Buitenhuis
8ed427f9f9 Merge commit '92fdea37477b5a2d1329e5ef0773e24473fa8f12'
These are all trivial to merge.

* commit '92fdea37477b5a2d1329e5ef0773e24473fa8f12':
  vaapi_h265: Add -qp option, use it to replace use of -global_quality
  vaapi_h265: Add constant-bitrate encode support
  vaapi_h264: Add encode quality option (for quality-speed tradeoff)
  vaapi_h264: Add -qp option, use it to replace use of -global_quality
  vaapi_encode: Add support for codec-local options
  vaapi_h264: Add constant-bitrate encode support
  vaapi_encode: Refactor slightly to allow easier setting of global options

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:40:39 +01:00
Derek Buitenhuis
b975aeec02 Merge commit '2c62fcdf5d617791a653d7957d449f75569eede0'
* commit '2c62fcdf5d617791a653d7957d449f75569eede0':
  lavc: VAAPI H.264 encoder

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-08 22:43:52 +01:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Mark Thompson
fcf536b130 vaapi_h264: Add encode quality option (for quality-speed tradeoff)
Only supported on VAAPI 0.36 and higher.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-15 10:07:05 +02:00
Mark Thompson
9629701ce9 vaapi_h264: Add -qp option, use it to replace use of -global_quality
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-15 10:07:05 +02:00
Mark Thompson
6e8f66fc93 vaapi_h264: Add constant-bitrate encode support
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-15 10:07:05 +02:00