summaryrefslogtreecommitdiffstats
path: root/libavcodec/vaapi_encode_h264.c
Commit message (Collapse)AuthorAgeFilesLines
* cbs: Refcount all the things!Mark Thompson2018-02-201-1/+1
| | | | | | | | 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).
* cbs: Allocate the context inside the init functionMark Thompson2018-02-201-7/+7
| | | | | ... instead of making callers allocate it themselves. This is more consistent with other APIs in libav.
* avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-141-1/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* vaapi_h264: Add named options for setting profile and levelMark Thompson2017-12-061-2/+46
|
* vaapi_h264: Fix VUI max_dec_frame_bufferingJun Zhao2017-12-021-1/+1
| | | | | | | | | This should refer to the existing SPS structure, not the VAAPI sequence parameter buffer (which is not yet initialised). From ffmpeg commit f31478ba1472afe5c1eed60f219ae331816425a2. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* vaapi_h264: Add missing return value checkMark Thompson2017-11-121-1/+3
|
* vaapi_h264: Do not use deprecated header typeMark Thompson2017-11-121-1/+1
| | | | | SEI headers should be inserted as generic raw data (the old specific type has been deprecated in libva2).
* vaapi_h264: Add workaround for bad SEI in old Intel driversMark Thompson2017-11-121-0/+18
| | | | | | | | | | | | | | 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 7a4fac5e91789b73e07bd4ad20493cfde028df76 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.
* vaapi: Remove H.264 baseline profileMark Thompson2017-10-241-3/+4
| | | | | | 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.
* vaapi_h264: Fix CPB/DPB delaysMark Thompson2017-09-121-4/+2
| | | | | This should be ticks, not time_scale steps - it was wrong for all framerates not a multiple of 1/2.
* vaapi_h264: Add support for SEI recovery pointsMark Thompson2017-08-131-1/+19
| | | | Included by default with non-IDR intra frames.
* vaapi_h264: Add support for AUD NAL unitsMark Thompson2017-08-131-0/+33
| | | | Adds a new private option to enable them (off by default).
* vaapi_h264: Convert to use coded bitstream infrastructureMark Thompson2017-08-131-874/+547
|
* vaapi_encode: Move quality option to common codeMark Thompson2017-08-061-23/+2
| | | | | | | | | 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.
* h264_sei: Add namespace prefix to all SEI valuesMark Thompson2017-05-161-3/+3
| | | | | This avoids confusion with equivalent H.265 SEI values when both are being used at the same time.
* vaapi_encode: Use gop_size consistently in RC parametersMark Thompson2017-04-261-2/+2
| | | | | | | | 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.)
* vaapi_h264: Enable VBR modeMark Thompson2017-01-301-5/+11
| | | | | | | | 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.
* vaapi_h264: Scale log2_max_pic_order_cnt_lsb with max_b_framesMark Thompson2017-01-111-0/+2
| | | | | | | 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.
* vaapi_h264: Fix POC on IDR framesJun Zhao2017-01-041-5/+7
| | | | | | | | | | In H.264 section 8.2.1, we have that "The bitstream shall not contain data that result in Min(TopFieldOrderCnt, BottomFieldOrderCnt) not equal to 0 for a coded IDR frame". This fixes the encoder to always conform to this - previously the POC values formed an unbroken sequence, not resetting to zero on IDR frames. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* vaapi_h264: Write bitstream restriction fieldsMark Thompson2016-10-021-2/+23
|
* vaapi_h264: Fix CFR mode with frame_rate set in AVCodecContextMark Thompson2016-10-021-2/+2
|
* vaapi_h264: Set max_num_ref_frames to 1 when not using B framesMark Thompson2016-09-281-1/+1
|
* vaapi_encode: Check packed header capabilitiesMark Thompson2016-09-281-0/+4
| | | | | This improves behaviour with drivers which do not support packed headers, such as AMD VCE on mesa/gallium.
* vaapi_encode: Refactor initialisationMark Thompson2016-09-281-161/+92
| | | | | | | | 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.
* vaapi_h264: Fix HRD bit_rate/cpb_size scalingMark Thompson2016-09-141-4/+4
| | | | | 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.
* h264: add H264_ prefix to the NAL unit typesAnton Khirnov2016-06-211-5/+5
| | | | | This will prevent conflicts e.g. in code that deals with both h264 and hevc.
* h264: create a new header for common h264 definitionsAnton Khirnov2016-06-211-1/+1
| | | | | | 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.
* h264: rename h264.[ch] to h264dec.[ch]Anton Khirnov2016-06-211-1/+1
| | | | This is more consistent with the naming of other decoders.
* vaapi_h264: Add source version identifier as unregistered SEIMark Thompson2016-06-091-0/+29
| | | | | Contains the libavcodec version, the VAAPI version and the libva driver vendor string.
* vaapi_h264: Add support for SEI messagesMark Thompson2016-06-091-1/+206
| | | | | Send buffering_period and pic_timing messages when in modes targetting bitrate. Also adds NAL HRD parameters to VUI.
* vaapi_h264: Add support for VUI parametersMark Thompson2016-06-091-2/+124
| | | | Supports aspect ratio, colour format and timing information.
* vaapi_h264: Add trivial support for low-power encodingMark Thompson2016-05-271-2/+16
| | | | | | 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).
* vaapi_h264: Fix frame_num after non-reference framesMark Thompson2016-05-271-7/+11
| | | | | | | 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.
* cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-4/+4
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* vaapi_h264: Add encode quality option (for quality-speed tradeoff)Mark Thompson2016-04-151-0/+28
| | | | | | Only supported on VAAPI 0.36 and higher. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* vaapi_h264: Add -qp option, use it to replace use of -global_qualityMark Thompson2016-04-151-3/+18
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* vaapi_h264: Add constant-bitrate encode supportMark Thompson2016-04-151-25/+110
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* vaapi_encode: Refactor slightly to allow easier setting of global optionsMark Thompson2016-04-151-14/+16
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc: VAAPI H.264 encoderMark Thompson2016-03-301-0/+847
Signed-off-by: Anton Khirnov <anton@khirnov.net>
OpenPOWER on IntegriCloud