aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vaapi_encode_h265.c
Commit message (Collapse)AuthorAgeFilesLines
* all: fix typos found by codespellTimo Rothenpieler33 hours1-1/+1
|
* avcodec/codec_internal, all: Use macros to set deprecated AVCodec fieldsAndreas Rheinhardt2025-03-101-4/+1
| | | | | | | | | | | | | | The aim of this is twofold: a) Clang warns when setting a deprecated field in a definition and because several of the widely set AVCodec fields are deprecated, one gets several hundred warnings from Clang for an ordinary build. Yet fortunately Clang (unlike GCC) allows to disable deprecation warnings inside a definition, so that one can create simple macros to set these fields that also suppress deprecation warnings for Clang. This has already been done in fdff1b9cbfd8cf5a9810c29efa4baf13a4786742 for AVCodec.channel_layouts. b) Using macros will allow to easily migrate these fields to internal ones. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vaapi_encode_h265: Use surface alignmentDavid Rosca2024-12-171-2/+4
| | | | | | This is needed to correctly set conformance window crop with Mesa AMD. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/vaapi_encode_h265: fix missing slice_block_cols assignmentMarvin Scholz2024-09-201-1/+1
| | | | | | | | | | | Instead of assigning to unit_opts.slice_block_cols, the slice_block_cols value from the context was incorrectly assigned to slice_block_rows. Regression from 12f158ca8f2ecc172f27569af88426d0e39ce995 Fixes CID1619479 Unused value Reviewed-by: Fei Wang <fei.w.wang@intel.com>
* hw_base_encode_h265: split off SPS/PPS/VPS generation from VAAPILynne2024-09-171-338/+38
| | | | | This commit splits off the base unit generation from VAAPI to allow sharing with other encoders.
* hw_base_encode: refactor picture allocation/freeingLynne2024-09-091-12/+12
| | | | | | | | | | | | This commit cleans up and refactors the mess of private state upon private state that used to be. Now, FFHWBaseEncodePicture is fully initialized upon call-time, and, most importantly, this lets APIs which require initialization data for frames (VkImageViews) to initialize this for both the input image, and the reconstruction (DPB) image. Signed-off-by: Tong Wu <wutong1208@outlook.com>
* avcodec/internal: add FFCodec.color_rangesNiklas Haas2024-09-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I went through all codecs and put them into five basic categories: 1. JPEG range only 2. MPEG range only 3. Explicitly tagged 4. Broken (codec supports both but encoder ignores tags) 5. N/A (headerless or pseudo-formats) Filters in category 5 remain untouched. The rest gain an explicit assignment of their supported color ranges, with codecs in category 4 being set to MPEG-only for safety. It might be considered redundant to distinguish between 0 (category 5) and MPEG+JPEG (category 3), but in doing so we effectively communicate that we can guarantee that these tags will be encoded, which is distinct from the situation where there are some codecs that simply don't have tagging or implied semantics (e.g. rawvideo). A full list of codecs follows: JPEG range only: - amv - roqvideo MPEG range only: - asv1, asv2 - avui - cfhd - cljr - dnxhd - dvvideo - ffv1 - flv - h261, h263, h263p - {h263,vp8}_v4l2m2m - huffyuv, ffvhuff - jpeg2000 - libopenjpeg - libtheora - libwebp, libwebp_anim - libx262 - libxavs, libxavs2 - libxvid - mpeg1video, mpeg2video - mpeg2_qsv - mpeg2_vaapi - mpeg4, msmpeg4, msmpeg4v2, wmv1, wmv2 - mpeg4_omx - prores, prores_aw, prores_ks - rv10, rv20 - snow - speedhq - svq1 - tiff - utvideo Explicitly tagged (MPEG/JPEG): - {av1,h264,hevc}_nvenc - {av1,h264,hevc}_vaapi - {av1,h264,hevc,vp8,vp9,mpeg4}_mediacodec - {av1,h264,hevc,vp9}_qsv - h264_amf - {h264,hevc,prores}_videotoolbox - libaom-av1 - libkvazaar - libopenh264 - librav1e - libsvtav1 - libvpx, libvpx-vp9 - libx264 - libx265 - ljpeg - mjpeg - vc2 Broken (encoder ignores tags): - {av1,hevc}_amf - {h264,hevc,mpeg4}_v4l2m2m - h264_omx - libxeve - magicyuv - {vp8,vp9,mjpeg}_vaapi N/A: - ayuv, yuv4, y41p, v308, v210, v410, v408 (headerless) - pgmyuv (headerless) - rawvideo, bitpacked (headerless) - vnull, wrapped_avframe (pseudocodecs)
* avcodec/hw_base_encode: avoid getting FFHWBaseEncodeContext from avctxTong Wu2024-07-021-1/+1
| | | | | | | | | | This patch is to make FFHWBaseEncodeContext a standalone component and avoid getting FFHWBaseEncodeContext from avctx->priv_data. This patch also removes some unnecessary AVCodecContext arguments. For receive_packet call, a small wrapper is introduced. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avcodec/vaapi_encode: extract a get_recon_format function to base layerTong Wu2024-07-021-12/+13
| | | | | | Surface size and block size parameters are also moved to base layer. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avcodec/vaapi_encode: extract the init and close function to base layerTong Wu2024-07-021-1/+1
| | | | | | | Related parameters such as device context, frame context are also moved to base layer. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avcodec/vaapi_encode: move the dpb logic from VAAPI to base layerTong Wu2024-07-021-25/+28
| | | | | | | | | | Move receive_packet function to base. This requires adding *alloc, *issue, *output, *free as hardware callbacks. HWBaseEncodePicture is introduced as the base layer structure. The related parameters in VAAPIEncodeContext are also extracted to HWBaseEncodeContext. Then DPB management logic can be fully extracted to base layer as-is. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avcodec/vaapi_encode: add async_depth to common optionsTong Wu2024-07-021-0/+1
| | | | Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avcodec/hw_base_encode: add FF_HW_ prefix for two enumsTong Wu2024-07-021-22/+22
| | | | | | | PICTURE_TYPE_* and FLAG_* are added FF_HW_ prefix after being moved to base layer. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* lavc/hevc*: move to hevc/ subdirAnton Khirnov2024-06-041-1/+2
|
* avcodec/vaapi_encode_h265: use is_reference to fill reference_pic_flagTong Wu2024-04-181-4/+1
| | | | | | | This codec supports FLAG_B_PICTURE_REFERENCES. We need to fill reference_pic_flag with pic->is_reference. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-2/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-141-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+1
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-1/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vaapi_encode: Separate reference frame into previous/future listFei Wang2023-09-221-31/+45
| | | | | | | To support more reference frames from different directions. Signed-off-by: Fei Wang <fei.w.wang@intel.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-071-21/+21
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vaapi_encode*: handle frame durations and ↵Anton Khirnov2023-01-291-1/+1
| | | | | | | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE Except for the mjpeg_vaapi encoder, which is already handled generically.
* avcodec/vaapi_encode_h26x: passthrough A53 CC data as H264/HEVC SEIAman Karmani2023-01-171-1/+34
| | | | Signed-off-by: Aman Karmani <aman@tmm1.net>
* avcodec/h264data: Deduplicate H.26[45] aspect ratio tableAndreas Rheinhardt2022-12-011-11/+5
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vaapi: Add support for remaining 10/12bit profilesPhilip Langdale2022-09-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the necessary pixel formats defined, we can now expose support for the remaining 10/12bit combinations that VAAPI can handle. Specifically, we are adding support for: * HEVC ** 12bit 420 ** 10bit 422 ** 12bit 422 ** 10bit 444 ** 12bit 444 * VP9 ** 10bit 444 ** 12bit 444 These obviously require actual hardware support to be usable, but where that exists, it is now enabled. Note that unlike YUVA/YUVX, the Intel driver does not formally expose support for the alphaless formats XV30 and XV360, and so we are implicitly discarding the alpha from the decoder and passing undefined values for the alpha to the encoder. If a future encoder iteration was to actually do something with the alpha bits, we would need to use a formal alpha capable format or the encoder would need to explicitly accept the alphaless format.
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vaapi: Switch preferred 8bit 444 format to VUYXPhilip Langdale2022-08-251-2/+1
| | | | | | | | | As vaapi doesn't actually do anything useful with the alpha channel, and we have an alphaless format available, let's use that instead. The changes here are mostly 1:1 switching, but do note the explicit change in the number of declared channels from 4 to 3 to reflect that the alpha is being ignored.
* lavc/vaapi_encode: enable 8bit 4:4:4 encoding for HEVC and VP9Philip Langdale2022-08-091-0/+2
| | | | | | | | | | Sufficiently recent Intel hardware is able to do encoding of 8bit 4:4:4 content in HEVC and VP9. The main requirement here is that the frames must be provided in the AYUV format. Enabling support is done by adding the appropriate encoding profiles and noting that AYUV is officially a four channel format with alpha so we must state that we expect all four channels.
* avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFEAndreas Rheinhardt2022-07-181-1/+2
| | | | | | | This is in preparation of switching the default init-thread-safety to a codec being init-thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* vaapi_encode_h265: Query encoding block sizes and featuresMark Thompson2022-04-111-6/+108
| | | | Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* vaapi_encode_h265: Explicitly set and correct some flagsMark Thompson2022-04-111-4/+9
| | | | | | | | | | | | | max_14bit_constraint_flag should be set if the bit depth is not greater than 14 (currently always true). one_picture_only_flag should not be set because we don't support the still picture profiles. general_profile_compatibility_flag should be set according to general_profile_idc instead of bit depth. Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* vaapi_encode: Move block size calculation after entrypoint selectionMark Thompson2022-04-111-6/+26
| | | | | | | | The block size can be dependent on the profile and entrypoint selected. It defaults to 16x16, with codecs able to override this choice with their own function. Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* lavc/vaapi_encode_h265: Add GPB frame support for hevc_vaapiLinjie Fu2022-04-111-0/+15
| | | | | | | | | | | | | Use GPB frames to replace regular P/B frames if backend driver does not support it. - GPB: Generalized P and B picture. Regular P/B frames replaced by B frames with previous-predict only, L0 == L1. Normal B frames still have 2 different ref_lists and allow bi-prediction Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-1/+1
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Rename AVCodecDefault->FFCodecDefaultAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | This structure is no longer declared in a public header, so using an FF-prefix is more appropriate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-9/+9
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | 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>
* avcodec/vaapi_encode: use AVCodecContext.get_encode_buffer()James Almer2021-03-171-1/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* cbs_h2645: Merge SEI message handling in common between codecsMark Thompson2021-01-211-27/+11
|
* hevc: Use common SEI typesMark Thompson2021-01-211-2/+2
|
* cbs_h2645: Merge SEI messages in common between codecsMark Thompson2021-01-211-5/+6
| | | | | Make a new template file for common SEI messages - this will also apply to H.266.
* vaapi_encode_h265: Fix setting colour propertiesMark Thompson2020-11-031-22/+12
| | | | | | | 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-011-11/+30
| | | | | 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-011-10/+3
| | | | | | | 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-011-4/+0
| | | | | | | 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-241-0/+4
|
* lavc/vaapi_encode_h265: add h265 tile encoding supportLinjie Fu2020-07-201-1/+37
| | | | | | | | | | | | | | 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-071-7/+6
| | | | | | | | 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-181-1/+0
| | | | | | | | | | | | | | | | 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>