summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_encode_h265.c
Commit message (Collapse)AuthorAge
* vaapi_encode_h265: Fix setting colour propertiesMark Thompson2020-11-03
| | | | | | | Matching the previous commit for H.264. Reviewed-By: Jan Ekström <jeebjp@gmail.com> Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
* vaapi_encode_h265: Don't require uniform_spacing_flagMark Thompson2020-08-01
| | | | | Though still use it if the tile arrangement matches. Also try to keep the fields in the same order as the standard.
* vaapi_encode_h265: Fix ordering of tile dimensionsMark Thompson2020-08-01
| | | | | | | Dimensions are normally specified as width x height, and this will match the same option to libaom-av1. Remove the indirection through the private context at the same time.
* vaapi_encode_h265: Remove confusing and redundant tile optionsMark Thompson2020-08-01
| | | | | | | The tile_rows/cols options currently do a confusingly different thing to the options of the same name on other encoders like libvpx and libaom. There is no backward-compatibility reason to implement the log2 behaviour as there was for libaom, so just get rid of them entirely.
* vaapi_encode_h265: Enable 4:2:2 supportMark Thompson2020-07-24
|
* lavc/vaapi_encode_h265: add h265 tile encoding supportLinjie Fu2020-07-20
| | | | | | | | | | | | | | Default to enable uniform_spacing_flag. Guess level by the tile rows/cols. Supported for ICL+ platforms. Also add documentations. To encode with 4 rows 2 columns: ffmpeg ... -c:v hevc_vaapi -tiles 4x2 ... ffmpeg ... -c:v hevc_vaapi -tile_rows 4 -tile_cols 2 ... Suggested-by: Jun Zhao <mypopydev@gmail.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/cbs: Remove unused function parametersAndreas Rheinhardt2020-07-07
| | | | | | | | Several cbs-functions had an unused CodedBitstreamContext parameter. This commit removes these. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/encode: restructure the core encoding codeJames Almer2020-06-18
| | | | | | | | | | | | | | | | 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>
* lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encodersLinjie Fu2020-05-04
| | | | | | | | | | | | | | | 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>
* lavc/vaapi_encode: Add hardware config metadataMark Thompson2020-04-26
| | | | These encoders all accept VAAPI surfaces in a hardware frames context.
* lavc/vaapi_encode_h265: fix conf_win_xxx_offset for 4:2:2/4:4:4 encodingLinjie Fu2020-03-09
| | | | | | | | | | | | | | | | Use desc->log2_chroma_w/h to calculate the sps->conf_win_right/bottom_offset. Based on Table 6-1, SubWidthC and SubHeightC depend on chroma format(log2_chroma_w/h). Based on D-28 and D-29, set the correct cropped width/height. croppedWidth = pic_width_in_luma_samples − SubWidthC * ( conf_win_right_offset + conf_win_left_offset ); croppedHeight = pic_height_in_luma_samples − SubHeightC * ( conf_win_bottom_offset + conf_win_top_offset ); Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* vaapi_encode: Add ROI supportMark Thompson2019-07-28
|
* vaapi_encode_h265: Enable support for more RC modesMark Thompson2019-02-25
| | | | | Also fixes QP going out of range when modified by the quant factor/offset values, and clarifies the QP behaviour for >8-bit modes.
* vaapi_encode: Do not zero access unit structuresMark Thompson2019-02-25
| | | | | | | Following b8c45bbcbc207293f955e838ea66106f4b65b1ac they contain allocated unit arrays which will get leaked. These operations were inconsistently applied and never actually needed (the old uninit left them in the correct state), so just drop them entirely.
* libavcodec/cbs: Stop needlessly reallocating the units arrayAndreas Rheinhardt2019-02-25
| | | | | | | | | | | | | | | | | Currently, a fragment's unit array is constantly reallocated during splitting of a packet. This commit changes this: One can keep the units array by distinguishing between the number of allocated and the number of valid units in the units array. The more units a packet is split into, the bigger the benefit. So MPEG-2 benefits the most; for a video coming from an NTSC-DVD (usually 32 units per frame) the average cost of cbs_insert_unit (for a single unit) went down from 6717 decicycles to 450 decicycles (based upon 10 runs with 4194304 runs each); if each packet consists of only one unit, it went down from 2425 to 448; for a H.264 video where most packets contain nine units, it went from 4431 to 450. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* vaapi_encode_h265: Ensure that ref pics are always in the RPSMark Thompson2019-01-27
| | | | | | | | | | | | When making a new P-frame when B-frames are present the previous P-frame is normally in the DPB because it will be referred to by subsequent B-frames. However, this is not true if there are no B-frames, or in edge cases where a GOP ends with two P-frames. Fix this by adding the direct ref pics to the RPS explicitly. Fixes #7699. Tested-by: Ullysses A Eoff <ullysses.a.eoff@intel.com>
* vaapi_encode_h265: Support more complex reference structuresMark Thompson2019-01-23
| | | | | The reference picture sets are now constructed directly from the DPB information.
* vaapi_encode: Convert to send/receive APIMark Thompson2019-01-23
| | | | | | | | | | | | | 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.
* vaapi_encode_h265: Reduce SAR to valid rangeMark Thompson2018-11-18
| | | | Matching previous commit for H.264.
* vaapi_encode_h265: Enable multiple-slice supportMark Thompson2018-10-27
|
* vaapi_encode_h265: Add missing error returnMark Thompson2018-09-24
| | | | Fixes CID #1439657.
* vaapi_encode_h265: Set level based on stream if not set by userMark Thompson2018-09-23
| | | | | | Sets the level based on the stream properties if it is not explicitly set by the user. Also add a tier option to set general_tier_flag, since that affects the level choice.
* vaapi_encode_h265: Improve profile supportMark Thompson2018-09-23
| | | | | | | | Set profile compatibility/constraint flags properly (including the constraint flags used for RExt profiles, as all streams we can currently generate are RExt-compatible), and use that to add support for the "Main Intra" and "Main 10 Intra" RExt subprofiles (for which we can re-use the existing Main and Main10 VAAPI profiles).
* vaapi_encode_h26[45]: Make the AUD option a booleanMark Thompson2018-09-23
|
* vaapi_encode: Clean up the packed header configurationMark Thompson2018-09-23
| | | | | | 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.
* vaapi_encode: Clean up the GOP structure configurationMark Thompson2018-09-23
| | | | | | 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).
* vaapi_encode: Add support for max QP in rate controlMark Thompson2018-09-23
| | | | | | 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.
* vaapi_encode: Clean up rate control configurationMark Thompson2018-09-23
| | | | | | 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.
* vaapi_encode: Add common options between all encodersMark Thompson2018-09-23
| | | | | The only common option here is low_power - it was previously supported for H.264 only, that specific option is removed.
* vaapi_encode: Choose profiles dynamicallyMark Thompson2018-09-23
| | | | | | | | | | | 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.
* vaapi_encode: Remove common priv_data and options fieldsMark Thompson2018-08-27
| | | | | The codec-specific context now contains both the common context and the codec-specific options directly.
* vaapi_encode_h265: Move options and common structures into contextMark Thompson2018-08-27
| | | | Matching previous commit for H.264.
* vaapi_encode_h265: Insert content light level informationHaihao Xiang2018-05-10
| | | | Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* vaapi_encode_h265: Insert mastering display colour volumeHaihao Xiang2018-05-10
| | | | | | | '-sei xxx' is added to control SEI insertion, so far only mastering display colour volume is available for testing. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* Merge commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2'Mark Thompson2018-02-21
|\ | | | | | | | | | | | | | | | | * commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2': cbs: Refcount all the things! Some changes for bitstream API. Merged-by: Mark Thompson <sw@jkqxz.net>
| * cbs: Refcount all the things!Mark Thompson2018-02-20
| | | | | | | | | | | | | | | | 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).
* | Merge commit '67eb2b16daa77f6ba3e04a28ca18e53193723b7f'Mark Thompson2018-02-21
|\| | | | | | | | | | | | | * commit '67eb2b16daa77f6ba3e04a28ca18e53193723b7f': vaapi_h265: Mark unused entries in RefPicList[01] as explicitly invalid Merged-by: Mark Thompson <sw@jkqxz.net>
| * vaapi_h265: Mark unused entries in RefPicList[01] as explicitly invalidMark Thompson2018-02-20
| | | | | | | | | | The iHD driver looks at entries beyond num_ref_idx_l[01]_active_minus1 for unknown reasons.
| * cbs: Allocate the context inside the init functionMark Thompson2018-02-20
| | | | | | | | | | ... 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-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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_h265: Add named options for setting profile and levelMark Thompson2017-12-06
| | | | | | | | Also fixes the default, which previously contained a nonsense value.
| * vaapi_h265: Enable VBR modeJun Zhao2017-12-02
| | | | | | | | | | | | | | | | To match vaapi_h264. From ffmpeg commit 385cafb07ac1e46433931ea9749a134efd7350be. Signed-off-by: Mark Thompson <sw@jkqxz.net>
* | avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 47687a2f8aca3f65b6fdd117b1cb66a7409a7fd1.
* | vaapi_h265: Add named options for setting profile and levelMark Thompson2017-12-04
| | | | | | | | Also fixes the default, which previously contained a nonsense value.
* | Merge commit 'f940c859c23ae201b0170cf541ea8f6b7a52dd49'James Almer2017-11-11
|\| | | | | | | | | | | | | * commit 'f940c859c23ae201b0170cf541ea8f6b7a52dd49': Revert "vaapi_h265: Reduce the amount of padding in the stream" Merged-by: James Almer <jamrial@gmail.com>
| * Revert "vaapi_h265: Reduce the amount of padding in the stream"Mark Thompson2017-09-12
| | | | | | | | | | | | | | This reverts commit a14a12ca137bf1526452b97bedfc9f7b301d4e04. The CTU size is always 32x32; the surface size is what actually sets the desired property, and it is already correct.
* | Merge commit 'a14a12ca137bf1526452b97bedfc9f7b301d4e04'James Almer2017-11-11
|\| | | | | | | | | | | | | * commit 'a14a12ca137bf1526452b97bedfc9f7b301d4e04': vaapi_h265: Reduce the amount of padding in the stream Merged-by: James Almer <jamrial@gmail.com>
| * vaapi_h265: Reduce the amount of padding in the streamMark Thompson2017-08-13
| | | | | | | | | | | | It is not necessary to pad to the CTU size. The CB size of 8x8 should be sufficient, but due to constraints in the Intel driver (the one usable implementation of this) it has to be padded to 16x16 like in H.264.
| * vaapi_h265: Add support for AUD NAL unitsMark Thompson2017-08-13
| | | | | | | | Matching the H.264 encoder.
| * vaapi_h265: Convert to use coded bitstream infrastructureMark Thompson2017-08-13
| | | | | | | | | | Also improves the metadata and generally makes the configuration a bit cleaner.