1// Copyright 2018-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[encode-h265]] 6== Encode H.265 7 8The `apiext:VK_EXT_video_encode_h265` extension adds H.265 codec-specific 9structures/types needed to support H.265 video encoding. 10Unless otherwise noted, all references to the H.265 specification are to the 112013 edition published by the ITU-T, dated April 2013. 12This specification is available at https://www.itu.int/rec/T-REC-H.265. 13 14[NOTE] 15.Note 16==== 17Refer to the <<preamble, Preamble>> for information on how the Khronos 18Intellectual Property Rights Policy relates to normative references to 19external materials not created by Khronos. 20==== 21 22 23=== H.265 encode profile 24 25An H.265 encode profile is specified by including the 26slink:VkVideoEncodeH265ProfileInfoEXT structure in the pname:pNext chain of 27the slink:VkVideoProfileInfoKHR structure when 28slink:VkVideoProfileInfoKHR::pname:videoCodecOperation is 29ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT. 30 31[open,refpage='VkVideoEncodeH265ProfileInfoEXT',desc='Structure specifying H.265 encode profile',type='structs'] 32-- 33The sname:VkVideoEncodeH265ProfileInfoEXT structure is defined as: 34 35include::{generated}/api/structs/VkVideoEncodeH265ProfileInfoEXT.adoc[] 36 37 * pname:sType is the type of this structure. 38 * pname:pNext is `NULL` or a pointer to a structure extending this 39 structure. 40 * pname:stdProfileIdc is a code:StdVideoH265ProfileIdc value specifying 41 the H.265 codec profile IDC. 42 43include::{generated}/validity/structs/VkVideoEncodeH265ProfileInfoEXT.adoc[] 44-- 45 46 47=== Capabilities 48 49[open,refpage='VkVideoEncodeH265CapabilitiesEXT',desc='Structure specifying H.265 encode capabilities',type='structs'] 50-- 51When calling flink:vkGetPhysicalDeviceVideoCapabilitiesKHR with 52pname:pVideoProfile->videoCodecOperation specified as 53ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT, the 54slink:VkVideoEncodeH265CapabilitiesEXT structure must: be included in the 55pname:pNext chain of the slink:VkVideoCapabilitiesKHR structure to retrieve 56more capabilities specific to H.265 video encoding. 57 58The sname:VkVideoEncodeH265CapabilitiesEXT structure is defined as: 59 60include::{generated}/api/structs/VkVideoEncodeH265CapabilitiesEXT.adoc[] 61 62 * pname:sType is the type of this structure. 63 * pname:pNext is `NULL` or a pointer to a structure extending this 64 structure. 65 * pname:flags is a bitmask of elink:VkVideoEncodeH265CapabilityFlagBitsEXT 66 describing supported encoding tools. 67 * pname:inputModeFlags is a bitmask of 68 elink:VkVideoEncodeH265InputModeFlagBitsEXT describing the command 69 buffer input granularities/modes supported by the implementation. 70 * pname:outputModeFlags is a bitmask of 71 elink:VkVideoEncodeH265OutputModeFlagBitsEXT describing the output 72 (bitstream size reporting) granularities/modes supported by the 73 implementation. 74 * pname:ctbSizes is a bitmask of elink:VkVideoEncodeH265CtbSizeFlagBitsEXT 75 describing the supported CTB sizes. 76 * pname:transformBlockSizes is a bitmask of 77 elink:VkVideoEncodeH265TransformBlockSizeFlagBitsEXT describing the 78 supported transform block sizes. 79 * pname:maxPPictureL0ReferenceCount reports the maximum number of 80 reference pictures the implementation supports in the reference list L0 81 for P pictures. 82 * pname:maxBPictureL0ReferenceCount reports the maximum number of 83 reference pictures the implementation supports in the reference list L0 84 for B pictures. 85 The reported value is `0` if encoding of B pictures is not supported. 86 * pname:maxL1ReferenceCount reports the maximum number of reference 87 pictures the implementation supports in the reference list L1 if 88 encoding of B pictures is supported. 89 The reported value is `0` if encoding of B pictures is not supported. 90 * pname:maxSubLayersCount reports the maximum number of sublayers. 91 * pname:minLog2MinLumaCodingBlockSizeMinus3 reports the minimum value that 92 may be set for log2_min_luma_coding_block_size_minus3 in 93 StdVideoH265SequenceParameterSet. 94 * pname:maxLog2MinLumaCodingBlockSizeMinus3 reports the maximum value that 95 may be set for log2_min_luma_coding_block_size_minus3 in 96 StdVideoH265SequenceParameterSet. 97 * pname:minLog2MinLumaTransformBlockSizeMinus2 reports the minimum value 98 that may be set for log2_min_luma_transform_block_size_minus2 in 99 StdVideoH265SequenceParameterSet. 100 * pname:maxLog2MinLumaTransformBlockSizeMinus2 reports the maximum value 101 that may be set for log2_min_luma_transform_block_size_minus2 in 102 StdVideoH265SequenceParameterSet. 103 * pname:minMaxTransformHierarchyDepthInter reports the minimum value that 104 may be set for max_transform_hierarchy_depth_inter in 105 StdVideoH265SequenceParameterSet. 106 * pname:maxMaxTransformHierarchyDepthInter reports the maximum value that 107 may be set for max_transform_hierarchy_depth_inter in 108 StdVideoH265SequenceParameterSet. 109 * pname:minMaxTransformHierarchyDepthIntra reports the minimum value that 110 may be set for max_transform_hierarchy_depth_intra in 111 StdVideoH265SequenceParameterSet. 112 * pname:maxMaxTransformHierarchyDepthIntra reports the maximum value that 113 may be set for max_transform_hierarchy_depth_intra in 114 StdVideoH265SequenceParameterSet. 115 * pname:maxDiffCuQpDeltaDepth reports the maximum value that may be set 116 for diff_cu_qp_delta_depth in StdVideoH265PictureParameterSet. 117 * pname:minMaxNumMergeCand reports the minimum value that may be set for 118 MaxNumMergeCand in StdVideoEncodeH265SliceHeader. 119 * pname:maxMaxNumMergeCand reports the maximum value that may be set for 120 MaxNumMergeCand in StdVideoEncodeH265SliceHeader. 121 122include::{generated}/validity/structs/VkVideoEncodeH265CapabilitiesEXT.adoc[] 123-- 124 125[open,refpage='VkVideoEncodeH265CapabilityFlagsEXT',desc='Bitmask of VkVideoEncodeH265CapabilityFlagBitsEXT',type='flags'] 126-- 127include::{generated}/api/flags/VkVideoEncodeH265CapabilityFlagsEXT.adoc[] 128 129tname:VkVideoEncodeH265CapabilityFlagsEXT is a bitmask type for setting a 130mask of zero or more elink:VkVideoEncodeH265CapabilityFlagBitsEXT. 131-- 132 133[open,refpage='VkVideoEncodeH265CapabilityFlagBitsEXT',desc='Video encode H.265 capability flags',type='enums'] 134-- 135Bits which may: be set in 136slink:VkVideoEncodeH265CapabilitiesEXT::pname:flags, indicating the encoding 137tools supported, are: 138 139include::{generated}/api/enums/VkVideoEncodeH265CapabilityFlagBitsEXT.adoc[] 140 141 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT 142 reports if enabling separate_colour_plane_flag in StdVideoH265SpsFlags 143 is supported. 144 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_SCALING_LISTS_BIT_EXT reports if 145 enabling scaling_list_enabled_flag and 146 sps_scaling_list_data_present_flag in StdVideoH265SpsFlags, or enabling 147 pps_scaling_list_data_present_flag in StdVideoH265PpsFlags are 148 supported. 149 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_SAMPLE_ADAPTIVE_OFFSET_ENABLED_BIT_EXT 150 reports if enabling sample_adaptive_offset_enabled_flag in 151 StdVideoH265SpsFlags is supported. 152 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_PCM_ENABLE_BIT_EXT reports if 153 enabling pcm_enable_flag in StdVideoH265SpsFlags is supported. 154 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_SPS_TEMPORAL_MVP_ENABLED_BIT_EXT 155 reports if enabling sps_temporal_mvp_enabled_flag in 156 StdVideoH265SpsFlags is supported. 157 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_EXT reports if 158 the implementation guarantees generating a HRD compliant bitstream if 159 nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag, or 160 sub_pic_hrd_params_present_flag are enabled in StdVideoH265HrdFlags, or 161 vui_hrd_parameters_present_flag is enabled in StdVideoH265SpsVuiFlags. 162 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_INIT_QP_MINUS26_BIT_EXT reports if 163 setting non-zero init_qp_minus26 in StdVideoH265PictureParameterSet is 164 supported. 165 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_EXT 166 reports if setting non-zero value for log2_parallel_merge_level_minus2 167 in StdVideoH265PictureParameterSet is supported. 168 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_SIGN_DATA_HIDING_ENABLED_BIT_EXT 169 reports if enabling sign_data_hiding_enabled_flag in 170 StdVideoH265PpsFlags is supported. 171 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_ENABLED_BIT_EXT 172 reports if enabling transform_skip_enabled_flag in StdVideoH265PpsFlags 173 is supported. 174 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_DISABLED_BIT_EXT 175 reports if disabling transform_skip_enabled_flag in StdVideoH265PpsFlags 176 is supported. 177 Implementations must: report at least one of 178 ename:VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_ENABLED_BIT_EXT and 179 ename:VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_DISABLED_BIT_EXT as 180 supported. 181 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_BIT_EXT 182 reports if enabling pps_slice_chroma_qp_offsets_present_flag in 183 StdVideoH265PpsFlags is supported. 184 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_BIT_EXT reports if 185 enabling weighted_pred_flag in StdVideoH265PpsFlags is supported. 186 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_BIPRED_BIT_EXT reports if 187 enabling weighted_bipred_flag in StdVideoH265PpsFlags is supported. 188 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT 189 reports that when weighted_pred_flag or weighted_bipred_flag in 190 StdVideoH265PpsFlags are enabled, the implementation is able to 191 internally decide syntax for pred_weight_table. 192 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSQUANT_BYPASS_ENABLED_BIT_EXT 193 reports if enabling transquant_bypass_enabled_flag in 194 StdVideoH265PpsFlags is supported. 195 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_ENTROPY_CODING_SYNC_ENABLED_BIT_EXT 196 reports if enabling entropy_coding_sync_enabled_flag in 197 StdVideoH265PpsFlags is supported. 198 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_DEBLOCKING_FILTER_OVERRIDE_ENABLED_BIT_EXT 199 reports if enabling deblocking_filter_override_enabled_flag in 200 StdVideoH265PpsFlags is supported. 201 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_FRAME_BIT_EXT 202 reports if encoding multiple tiles per frame is supported. 203 If not set, the implementation is only able to encode a single tile for 204 each frame. 205 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_PER_TILE_BIT_EXT 206 reports if encoding multiple slices per tile is supported. 207 If not set, the implementation is only able to encode a single slice for 208 each tile. 209 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_SLICE_BIT_EXT 210 reports if encoding multiple tiles per slice is supported. 211 If not set, the implementation is only able to encode a single tile for 212 each slice. 213 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_SLICE_SEGMENT_CTB_COUNT_BIT_EXT 214 reports support for configuring 215 slink:VkVideoEncodeH265NaluSliceSegmentInfoEXT::pname:ctbCount and 216 slice_segment_address in StdVideoEncodeH265SliceSegmentHeader for each 217 slice segment in a frame with multiple slice segments. 218 If not supported, the implementation decides the number of CTBs in each 219 slice segment based on 220 slink:VkVideoEncodeH265VclFrameInfoEXT::pname:naluSliceSegmentEntryCount. 221 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_EXT 222 reports that each slice segment in a frame with a single or multiple 223 tiles per slice may begin or finish at any offset in a CTB row. 224 If not supported, all slice segments in such a frame must: begin at the 225 start of a CTB row (and hence each slice segment must: finish at the end 226 of a CTB row). 227 Also reports that each slice segment in a frame with multiple slices per 228 tile may begin or finish at any offset within the enclosing tile's CTB 229 row. 230 If not supported, slice segments in such a frame must: begin at the 231 start of the enclosing tile's CTB row (and hence each slice segment 232 must: finish at the end of the enclosing tile's CTB row). 233 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_DEPENDENT_SLICE_SEGMENT_BIT_EXT 234 reports if enabling dependent_slice_segment_flag in 235 StdVideoEncodeH265SliceHeaderFlags is supported. 236 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT 237 reports that when 238 ename:VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_PER_TILE_BIT_EXT is 239 supported and a frame is encoded with multiple slices, the 240 implementation allows encoding each slice segment with a different 241 code:StdVideoEncodeH265SliceSegmentHeader::slice_type. 242 If not supported, all slice segments of the frame must: be encoded with 243 the same code:slice_type which corresponds to the picture type of the 244 frame. 245 For example, all slice segments of a P-frame would be encoded as 246 P-slices. 247 * ename:VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT reports 248 support for using a B frame as L1 reference. 249-- 250 251[open,refpage='VkVideoEncodeH265InputModeFlagsEXT',desc='Bitmask of VkVideoEncodeH265InputModeFlagBitsEXT',type='flags'] 252-- 253include::{generated}/api/flags/VkVideoEncodeH265InputModeFlagsEXT.adoc[] 254 255tname:VkVideoEncodeH265InputModeFlagsEXT is a bitmask type for setting a 256mask of zero or more elink:VkVideoEncodeH265InputModeFlagBitsEXT. 257-- 258 259[open,refpage='VkVideoEncodeH265InputModeFlagBitsEXT',desc='Video encode H.265 input modes',type='enums'] 260-- 261Bits which may: be set in 262slink:VkVideoEncodeH265CapabilitiesEXT::pname:inputModeFlags, indicating the 263command buffer input granularities supported by the implementation, are: 264 265include::{generated}/api/enums/VkVideoEncodeH265InputModeFlagBitsEXT.adoc[] 266 267 * ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_FRAME_BIT_EXT indicates that a 268 single command buffer must: at least encode an entire frame. 269 Any non-VCL NALUs must: be encoded using the same command buffer as the 270 frame if ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT is not 271 supported. 272 * ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_SEGMENT_BIT_EXT indicates 273 that a single command buffer must: at least encode a single slice 274 segment. 275 Any non-VCL NALUs must: be encoded using the same command buffer as the 276 first slice segment of the frame if 277 ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT is not supported. 278 * ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT indicates that a 279 single command buffer may: encode a non-VCL NALU by itself. 280 281An implementation must: support at least one of 282ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_FRAME_BIT_EXT or 283ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_SEGMENT_BIT_EXT. 284 285If ename:VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_SEGMENT_BIT_EXT is not 286supported, the following two additional restrictions apply for frames 287encoded with multiple slice segments. 288First, all frame slice segments must: have the same pReferenceFinalLists. 289Second, the order in which slice segments appear in 290slink:VkVideoEncodeH265VclFrameInfoEXT::pname:pNaluSliceSegmentEntries or in 291the command buffer must: match the placement order of the slice segments in 292the frame. 293-- 294 295[open,refpage='VkVideoEncodeH265OutputModeFlagsEXT',desc='Bitmask of VkVideoEncodeH265OutputModeFlagBitsEXT',type='flags'] 296-- 297include::{generated}/api/flags/VkVideoEncodeH265OutputModeFlagsEXT.adoc[] 298 299tname:VkVideoEncodeH265OutputModeFlagsEXT is a bitmask type for setting a 300mask of zero or more elink:VkVideoEncodeH265OutputModeFlagBitsEXT. 301-- 302 303[open,refpage='VkVideoEncodeH265OutputModeFlagBitsEXT',desc='Video encode H.265 output modes',type='enums'] 304-- 305Bits which may: be set in 306slink:VkVideoEncodeH265CapabilitiesEXT::pname:outputModeFlags, indicating 307the minimum bitstream generation commands that must: be included between 308each flink:vkCmdBeginVideoCodingKHR and flink:vkCmdEndVideoCodingKHR pair 309(henceforth simply begin/end pair), are: 310 311include::{generated}/api/enums/VkVideoEncodeH265OutputModeFlagBitsEXT.adoc[] 312 313 * ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FRAME_BIT_EXT indicates that 314 calls to generate all NALUs of a frame must: be included within a single 315 begin/end pair. 316 Any non-VCL NALUs must: be encoded within the same begin/end pair if 317 ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT is not supported. 318 * ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_SLICE_SEGMENT_BIT_EXT indicates 319 that each begin/end pair must: encode at least one slice segment. 320 Any non-VCL NALUs must: be encoded within the same begin/end pair as the 321 first slice segment of the frame if 322 ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT is not supported. 323 * ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT indicates that 324 each begin/end pair may: encode only a non-VCL NALU by itself. 325 An implementation must: support at least one of 326 ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FRAME_BIT_EXT or 327 ename:VK_VIDEO_ENCODE_H265_OUTPUT_MODE_SLICE_SEGMENT_BIT_EXT. 328 329A single begin/end pair must: not encode more than a single frame. 330 331The bitstreams of NALUs generated within a single begin/end pair are written 332continuously into the same bitstream buffer (any padding between the NALUs 333must: be compliant to the H.265 standard). 334 335The supported input modes must: be coarser or equal to the supported output 336modes. 337For example, it is illegal to report slice segment input is supported but 338only frame output is supported. 339 340An implementation must: report one of the following combinations of 341input/output modes: 342 343 * Input: Frame, Output: Frame 344 * Input: Frame, Output: Frame and Non-VCL 345 * Input: Frame, Output: Slice Segment 346 * Input: Frame, Output: Slice Segment and Non-VCL 347 * Input: Slice Segment, Output: Slice Segment 348 * Input: Slice Segment, Output: Slice Segment and Non-VCL 349 * Input: Frame and Non-VCL, Output: Frame and Non-VCL 350 * Input: Frame and Non-VCL, Output: Slice Segment and Non-VCL 351 * Input: Slice Segment and Non-VCL, Output: Slice Segment and Non-VCL 352-- 353 354[open,refpage='VkVideoEncodeH265CtbSizeFlagsEXT',desc='Bitmask of VkVideoEncodeH265CtbSizeFlagBitsEXT',type='flags'] 355-- 356include::{generated}/api/flags/VkVideoEncodeH265CtbSizeFlagsEXT.adoc[] 357 358tname:VkVideoEncodeH265CtbSizeFlagsEXT is a bitmask type for setting a mask 359of zero or more elink:VkVideoEncodeH265CtbSizeFlagBitsEXT. 360Implementations must: set at least one of 361ename:VkVideoEncodeH265CtbSizeFlagBitsEXT. 362-- 363 364[open,refpage='VkVideoEncodeH265CtbSizeFlagBitsEXT',desc='Supported CTB sizes for H.265 video encode',type='enums'] 365-- 366Bits which may: be set in 367slink:VkVideoEncodeH265CapabilitiesEXT::pname:ctbSizes, indicating the CTB 368sizes supported by the implementation, are: 369 370include::{generated}/api/enums/VkVideoEncodeH265CtbSizeFlagBitsEXT.adoc[] 371 372 * ename:VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_EXT specifies that a CTB size 373 of 16x16 is supported. 374 * ename:VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_EXT specifies that a CTB size 375 of 32x32 is supported. 376 * ename:VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_EXT specifies that a CTB size 377 of 64x64 is supported. 378-- 379 380[open,refpage='VkVideoEncodeH265TransformBlockSizeFlagsEXT',desc='Bitmask of VkVideoEncodeH265TransformBlockSizeFlagBitsEXT',type='flags'] 381-- 382include::{generated}/api/flags/VkVideoEncodeH265TransformBlockSizeFlagsEXT.adoc[] 383 384tname:VkVideoEncodeH265TransformBlockSizeFlagsEXT is a bitmask type for 385setting a mask of zero or more 386elink:VkVideoEncodeH265TransformBlockSizeFlagBitsEXT. 387Implementations must: set at least one of 388ename:VkVideoEncodeH265TransformBlockSizeFlagBitsEXT. 389-- 390 391[open,refpage='VkVideoEncodeH265TransformBlockSizeFlagBitsEXT',desc='Supported transform block sizes for H.265 video encode',type='enums'] 392-- 393Bits which may: be set in 394slink:VkVideoEncodeH265CapabilitiesEXT::pname:transformBlockSizes, 395indicating the transform block sizes supported by the implementation, are: 396 397include::{generated}/api/enums/VkVideoEncodeH265TransformBlockSizeFlagBitsEXT.adoc[] 398 399 * ename:VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_EXT specifies that 400 a transform block size of 4x4 is supported. 401 * ename:VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_EXT specifies that 402 a transform block size of 8x8 is supported. 403 * ename:VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_EXT specifies 404 that a transform block size of 16x16 is supported. 405 * ename:VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_EXT specifies 406 that a transform block size of 32x32 is supported. 407-- 408 409 410=== Encoder H.265 Video Session Parameters Object 411 412When creating a Video Session Parameters object, add a 413slink:VkVideoEncodeH265SessionParametersCreateInfoEXT structure to the 414pname:pNext chain of the slink:VkVideoSessionParametersCreateInfoKHR 415structure passed to flink:vkCreateVideoSessionParametersKHR in order to 416specify the H.265-specific video encoder session parameters. 417 418[open,refpage='VkVideoEncodeH265SessionParametersCreateInfoEXT',desc='Structure specifies H.265 encoder parameter set info',type='structs'] 419-- 420The sname:VkVideoEncodeH265SessionParametersCreateInfoEXT structure is 421defined as: 422 423include::{generated}/api/structs/VkVideoEncodeH265SessionParametersCreateInfoEXT.adoc[] 424 425 * pname:sType is the type of this structure. 426 * pname:pNext is `NULL` or a pointer to a structure extending this 427 structure. 428 * pname:maxStdVPSCount is the maximum number of entries of type 429 code:StdVideoH265VideoParameterSet within 430 sname:VkVideoSessionParametersKHR. 431 * pname:maxStdSPSCount is the maximum number of entries of type 432 code:StdVideoH265SequenceParameterSet within 433 sname:VkVideoSessionParametersKHR. 434 * pname:maxStdPPSCount is the maximum number of entries of type 435 code:StdVideoH265PictureParameterSet within 436 sname:VkVideoSessionParametersKHR. 437 * pname:pParametersAddInfo is `NULL` or a pointer to a 438 slink:VkVideoEncodeH265SessionParametersAddInfoEXT structure specifying 439 the video session parameters to add upon creation of this object. 440 441When a slink:VkVideoSessionParametersKHR object contains 442pname:maxStdVPSCount code:StdVideoH265VideoParameterSet entries, no 443additional code:StdVideoH265VideoParameterSet entries can be added to it, 444and ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made 445to add these entries. 446When a slink:VkVideoSessionParametersKHR object contains 447pname:maxStdSPSCount code:StdVideoH265SequenceParameterSet entries, no 448additional code:StdVideoH265SequenceParameterSet entries can be added to it, 449and ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made 450to add these entries. 451When a slink:VkVideoSessionParametersKHR object contains 452pname:maxStdPPSCount code:StdVideoH265PictureParameterSet entries, no 453additional code:StdVideoH265PictureParameterSet entries can be added to it, 454and ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made 455to add these entries. 456 457include::{generated}/validity/structs/VkVideoEncodeH265SessionParametersCreateInfoEXT.adoc[] 458-- 459 460[open,refpage='VkVideoEncodeH265SessionParametersAddInfoEXT',desc='Structure specifies H.265 encoder parameter set info',type='structs'] 461-- 462The sname:VkVideoEncodeH265SessionParametersAddInfoEXT structure is defined 463as: 464 465include::{generated}/api/structs/VkVideoEncodeH265SessionParametersAddInfoEXT.adoc[] 466 467 * pname:sType is the type of this structure. 468 * pname:pNext is `NULL` or a pointer to a structure extending this 469 structure. 470 * pname:stdVPSCount is the number of VPS elements in pname:pStdVPSs. 471 * pname:pStdVPSs is a pointer to an array of pname:stdVPSCount 472 code:StdVideoH265VideoParameterSet structures representing H.265 video 473 parameter sets. 474 * pname:stdSPSCount is the number of SPS elements in pname:pStdSPSs. 475 * pname:pStdSPSs is a pointer to an array of pname:stdSPSCount 476 code:StdVideoH265SequenceParameterSet structures representing H.265 477 sequence parameter sets. 478 * pname:stdPPSCount is the number of PPS elements in pname:pStdPPSs. 479 * pname:pStdPPSs is a pointer to an array of pname:stdPPSCount 480 code:StdVideoH265PictureParameterSet structures representing H.265 481 picture parameter sets. 482 483include::{generated}/validity/structs/VkVideoEncodeH265SessionParametersAddInfoEXT.adoc[] 484 485.Valid Usage 486**** 487 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-stdVPSCount-06438]] 488 The values of pname:stdVPSCount, pname:stdSPSCount and pname:stdPPSCount 489 must: be less than or equal to the values of 490 slink:VkVideoEncodeH265SessionParametersCreateInfoEXT::pname:maxStdVPSCount, 491 slink:VkVideoEncodeH265SessionParametersCreateInfoEXT:pname:maxStdSPSCount, 492 and 493 slink:VkVideoEncodeH265SessionParametersCreateInfoEXT:pname:maxStdPPSCount, 494 respectively 495 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-pStdVPSs-06439]] 496 Each code:StdVideoH265VideoParameterSet entry in pname:pStdVPSs must: 497 have a unique H.265 VPS ID 498 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-pStdSPSs-06440]] 499 Each code:StdVideoH265SequenceParameterSet entry in pname:pStdSPSs must: 500 have a unique H.265 VPS-SPS ID pair 501 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-pStdPPSs-06441]] 502 Each code:StdVideoH265PictureParameterSet entry in pname:pStdPPSs must: 503 have a unique H.265 VPS-SPS-PPS ID tuple 504 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-None-06442]] 505 Each entry to be added must: have a unique, to the rest of the parameter 506 array entries and the existing parameters in the Video Session 507 Parameters Object that is being updated, VPS-SPS-PPS IDs 508 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-None-06443]] 509 Parameter entries that already exist in Video Session Parameters object 510 with a particular VPS-SPS-PPS IDs must: not be replaced nor updated 511 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-None-06444]] 512 When creating a new object using a Video Session Parameters as a 513 template, the array's parameters with the same VPS-SPS-PPS IDs as the 514 ones from the template take precedence 515 * [[VUID-VkVideoEncodeH265SessionParametersAddInfoEXT-None-06445]] 516 VPS/SPS/PPS parameters must: comply with the limits specified in 517 slink:VkVideoSessionCreateInfoKHR during Video Session creation 518**** 519-- 520 521 522=== Frame Encoding 523 524In order to encode a frame, add a slink:VkVideoEncodeH265VclFrameInfoEXT 525structure to the pname:pNext chain of the slink:VkVideoEncodeInfoKHR 526structure passed to the flink:vkCmdEncodeVideoKHR command. 527 528[open,refpage='VkVideoEncodeH265VclFrameInfoEXT',desc='Structure specifies H.265 encode frame parameters',type='structs'] 529-- 530The slink:VkVideoEncodeH265VclFrameInfoEXT structure representing a frame 531encode operation is defined as: 532 533include::{generated}/api/structs/VkVideoEncodeH265VclFrameInfoEXT.adoc[] 534 535 * pname:sType is the type of this structure. 536 * pname:pNext is `NULL` or a pointer to a structure extending this 537 structure. 538 * pname:pReferenceFinalLists is `NULL` or a pointer to a 539 slink:VkVideoEncodeH265ReferenceListsInfoEXT structure specifying the 540 reference lists to be used for the current picture. 541 * pname:naluSliceSegmentEntryCount is the number of slice segment NALUs in 542 the frame. 543 * pname:pNaluSliceSegmentEntries is a pointer to an array of 544 slink:VkVideoEncodeH265NaluSliceSegmentInfoEXT structures specifying the 545 division of the current picture into slice segments and the properties 546 of these slice segments. 547 * pname:pCurrentPictureInfo is a pointer to a 548 code:StdVideoEncodeH265PictureInfo structure specifying the syntax and 549 other codec-specific information from the H.265 specification, 550 associated with this picture. 551 552include::{generated}/validity/structs/VkVideoEncodeH265VclFrameInfoEXT.adoc[] 553-- 554 555[open,refpage='VkVideoEncodeH265NaluSliceSegmentInfoEXT',desc='Structure specifies H.265 encode slice segment NALU parameters',type='structs'] 556-- 557The slink:VkVideoEncodeH265NaluSliceSegmentInfoEXT structure representing a 558slice segment is defined as: 559 560include::{generated}/api/structs/VkVideoEncodeH265NaluSliceSegmentInfoEXT.adoc[] 561 562 * pname:sType is the type of this structure. 563 * pname:pNext is `NULL` or a pointer to a structure extending this 564 structure. 565 * pname:ctbCount is the number of CTBs in this slice segment. 566 * pname:pReferenceFinalLists is `NULL` or a pointer to a 567 slink:VkVideoEncodeH265ReferenceListsInfoEXT structure specifying the 568 reference lists to be used for the current slice segment. 569 If pname:pReferenceFinalLists is not `NULL`, these reference lists 570 override the reference lists provided in 571 slink:VkVideoEncodeH265VclFrameInfoEXT::pname:pReferenceFinalLists. 572 * pname:pSliceSegmentHeaderStd is a pointer to a 573 code:StdVideoEncodeH265SliceSegmentHeader structure specifying the slice 574 segment header for the current slice segment. 575 576include::{generated}/validity/structs/VkVideoEncodeH265NaluSliceSegmentInfoEXT.adoc[] 577-- 578 579[open,refpage='VkVideoEncodeH265DpbSlotInfoEXT',desc='Structure specifies H.265 encode decoded pic info',type='structs'] 580-- 581The slink:VkVideoEncodeH265DpbSlotInfoEXT structure, representing a 582reconstructed picture that is being used as a reference picture, is defined 583as: 584 585include::{generated}/api/structs/VkVideoEncodeH265DpbSlotInfoEXT.adoc[] 586 587 * pname:sType is the type of this structure. 588 * pname:pNext is `NULL` or a pointer to a structure extending this 589 structure. 590 * pname:slotIndex is the <<dpb-slot, DPB Slot>> index for this picture. 591 * pname:pStdReferenceInfo is a pointer to a 592 code:StdVideoEncodeH265ReferenceInfo structure specifying the syntax and 593 other codec-specific information from the H.265 specification, 594 associated with this reference picture. 595 596include::{generated}/validity/structs/VkVideoEncodeH265DpbSlotInfoEXT.adoc[] 597-- 598 599[open,refpage='VkVideoEncodeH265ReferenceListsInfoEXT',desc='Structure specifies H.265 reference frame lists',type='structs'] 600-- 601The slink:VkVideoEncodeH265ReferenceListsInfoEXT structure representing 602reference lists is defined as: 603 604include::{generated}/api/structs/VkVideoEncodeH265ReferenceListsInfoEXT.adoc[] 605 606 * pname:sType is the type of this structure. 607 * pname:pNext is `NULL` or a pointer to a structure extending this 608 structure. 609 * pname:referenceList0EntryCount is the number of reference pictures in 610 reference list L0 and is identical to 611 code:StdVideoEncodeH265SliceSegmentHeader::pname:num_ref_idx_l0_active_minus1 612 + 1. 613 * pname:pReferenceList0Entries is a pointer to an array of 614 pname:referenceList0EntryCount slink:VkVideoEncodeH265DpbSlotInfoEXT 615 structures specifying the reference list L0 entries for the current 616 picture. 617 * pname:referenceList1EntryCount is the number of reference pictures in 618 reference list L1 and is identical to 619 code:StdVideoEncodeH265SliceSegmentHeader::pname:num_ref_idx_l1_active_minus1 620 + 1. 621 * pname:pReferenceList1Entries is a pointer to an array of 622 pname:referenceList1EntryCount slink:VkVideoEncodeH265DpbSlotInfoEXT 623 structures specifying the reference list L1 entries for the current 624 picture. 625 * pname:pReferenceModifications is a pointer to a 626 code:StdVideoEncodeH265ReferenceModifications structure specifying 627 reference list modifications. 628 629include::{generated}/validity/structs/VkVideoEncodeH265ReferenceListsInfoEXT.adoc[] 630-- 631 632[open,refpage='VkVideoEncodeH265EmitPictureParametersInfoEXT',desc='Structure specifies H.265 encode VPS NALU insertion parameters',type='structs'] 633-- 634The slink:VkVideoEncodeH265EmitPictureParametersInfoEXT structure is defined 635as: 636 637include::{generated}/api/structs/VkVideoEncodeH265EmitPictureParametersInfoEXT.adoc[] 638 639 * pname:sType is the type of this structure. 640 * pname:pNext is `NULL` or a pointer to a structure extending this 641 structure. 642 * pname:vpsId is the H.265 VPS ID for the H.265 VPS to insert in the 643 bitstream. 644 The VPS ID must: match the VPS provided in pname:vpsStd of 645 slink:VkVideoEncodeH265SessionParametersCreateInfoEXT. 646 This is retrieved from the slink:VkVideoSessionParametersKHR object 647 provided in slink:VkVideoBeginCodingInfoKHR. 648 * pname:spsId is the H.265 SPS ID for the H.265 SPS to insert in the 649 bitstream. 650 The SPS ID must: match one of the IDs of the SPS(s) provided in 651 pname:pStdSPSs of slink:VkVideoEncodeH265SessionParametersCreateInfoEXT 652 to identify the SPS parameter set to insert in the bitstream. 653 This is retrieved from the slink:VkVideoSessionParametersKHR object 654 provided in slink:VkVideoBeginCodingInfoKHR. 655 * pname:emitVpsEnable enables the emitting of the VPS structure with id of 656 pname:vpsId. 657 * pname:emitSpsEnable enables the emitting of the SPS structure with id of 658 pname:spsId. 659 * pname:ppsIdEntryCount is the number of entries in the 660 pname:ppsIdEntries. 661 If this parameter is `0` then no pps entries are going to be emitted in 662 the bitstream. 663 * pname:ppsIdEntries is the H.265 PPS IDs for the H.265 PPS to insert in 664 the bitstream. 665 The PPS IDs must: match one of the IDs of the PPS(s) provided in 666 pname:pStdPPSs of slink:VkVideoEncodeH265SessionParametersCreateInfoEXT 667 to identify the PPS parameter set to insert in the bitstream. 668 This is retrieved from the slink:VkVideoSessionParametersKHR object 669 provided in slink:VkVideoBeginCodingInfoKHR. 670 671include::{generated}/validity/structs/VkVideoEncodeH265EmitPictureParametersInfoEXT.adoc[] 672-- 673 674 675=== Rate control 676 677[open,refpage='VkVideoEncodeH265RateControlInfoEXT',desc='Structure describing H.265 stream rate control parameters',type='structs'] 678-- 679The sname:VkVideoEncodeH265RateControlInfoEXT structure is defined as: 680 681include::{generated}/api/structs/VkVideoEncodeH265RateControlInfoEXT.adoc[] 682 683 * pname:sType is the type of this structure. 684 * pname:pNext is `NULL` or a pointer to a structure extending this 685 structure. 686 * pname:gopFrameCount is the number of frames contained within the group 687 of pictures (GOP), starting from an intra frame and until the next intra 688 frame. 689 If it is set to 0, the implementation chooses a suitable value. 690 If it is set to code:UINT32_MAX, the GOP length is treated as infinite. 691 * pname:idrPeriod is the interval, in terms of number of frames, between 692 two IDR frames. 693 If it is set to 0, the implementation chooses a suitable value. 694 If it is set to code:UINT32_MAX, the IDR period is treated as infinite. 695 * pname:consecutiveBFrameCount is the number of consecutive B-frames 696 between I- and/or P-frames within the GOP. 697 * pname:rateControlStructure is a 698 elink:VkVideoEncodeH265RateControlStructureEXT value specifying the 699 expected encode stream reference structure, to aid in rate control 700 calculations. 701 * pname:subLayerCount specifies the number of sub layers enabled in the 702 stream. 703 704In order to provide H.265-specific stream rate control parameters, add a 705sname:VkVideoEncodeH265RateControlInfoEXT structure to the pname:pNext chain 706of the slink:VkVideoEncodeRateControlInfoKHR structure in the pname:pNext 707chain of the slink:VkVideoCodingControlInfoKHR structure passed to the 708flink:vkCmdControlVideoCodingKHR command. 709 710The parameters from this structure act as a guidance for implementations to 711apply various rate control heuristics. 712 713It is possible to infer the picture type to be used when encoding a frame, 714on the basis of the values provided for pname:consecutiveBFrameCount, 715pname:idrPeriod, and pname:gopFrameCount, but this inferred picture type 716will not be used by implementations to override the picture type provided in 717flink:vkCmdEncodeVideoKHR. 718Additionally, it is not required for the video session to be reset if the 719inferred picture type does not match the actual picture type. 720 721include::{generated}/validity/structs/VkVideoEncodeH265RateControlInfoEXT.adoc[] 722-- 723 724[open,refpage='VkVideoEncodeH265RateControlStructureEXT',desc='Specifies the video encode H.265 rate control structure',type='enums'] 725-- 726Possible values of 727slink:VkVideoEncodeH265RateControlInfoEXT::pname:rateControlStructure, 728specifying a video stream reference structure as a hint for the rate control 729implementation, are: 730 731include::{generated}/api/enums/VkVideoEncodeH265RateControlStructureEXT.adoc[] 732 733 * ename:VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT specifies 734 a reference structure unknown at the time of stream rate control 735 configuration. 736 * ename:VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAT_EXT specifies a 737 flat reference structure. 738 * ename:VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_DYADIC_EXT specifies a 739 dyadic reference structure. 740-- 741 742[open,refpage='VkVideoEncodeH265RateControlLayerInfoEXT',desc='Structure describing H.265 per-layer rate control parameters',type='structs'] 743-- 744The sname:VkVideoEncodeH265RateControlLayerInfoEXT structure is defined as: 745 746include::{generated}/api/structs/VkVideoEncodeH265RateControlLayerInfoEXT.adoc[] 747 748 * pname:sType is the type of this structure. 749 * pname:pNext is `NULL` or a pointer to a structure extending this 750 structure. 751 * pname:temporalId specifies the H.265 temporal ID of the video coding 752 layer that settings provided in this structure and its parent 753 slink:VkVideoEncodeRateControlLayerInfoKHR structure apply to. 754 * pname:useInitialRcQp indicates whether the values within 755 pname:initialRcQp should be used by the implementation. 756 * pname:initialRcQp provides the QP values for each picture type, to be 757 used in rate control calculations at the start of video encode 758 operations on a newly-created video session, or immediately after a 759 session reset. 760 These values are ignored when 761 slink:VkVideoEncodeRateControlInfoKHR::pname:rateControlMode is 762 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR. 763 * pname:useMinQp indicates whether the values within pname:minQp should be 764 used by the implementation. 765 When it is set to ename:VK_FALSE, the implementation ignores the values 766 in pname:minQp and chooses suitable values. 767 * pname:minQp provides the lower bound on the QP values for each picture 768 type, to be used in rate control calculations. 769 * pname:useMaxQp indicates whether the values within pname:maxQp should be 770 used by the implementation. 771 When it is set to ename:VK_FALSE, the implementation ignores the values 772 in pname:maxQp and chooses suitable values. 773 * pname:maxQp provides the upper bound on the QP values for each picture 774 type, to be used in rate control calculations. 775 * pname:useMaxFrameSize indicates whether the values within 776 pname:maxFrameSize should be used by the implementation. 777 * pname:maxFrameSize provides the upper bound on the encoded frame size 778 for each picture type. 779 The implementation does not guarantee the encoded frame sizes will be 780 within the specified limits, however these limits may: be used as a 781 guide in rate control calculations. 782 If enabled and not set properly, the pname:maxQp limit may prevent the 783 implementation from respecting the pname:maxFrameSize limit. 784 785H.265-specific per-layer rate control parameters must: be specified by 786adding a sname:VkVideoEncodeH265RateControlLayerInfoEXT structure to the 787pname:pNext chain of each slink:VkVideoEncodeRateControlLayerInfoKHR 788structure in a call to flink:vkCmdControlVideoCodingKHR command, when the 789command buffer context has an active video encode H.265 session. 790 791.Valid Usage 792**** 793 * [[VUID-VkVideoEncodeH265RateControlLayerInfoEXT-rateControlMode-06476]] 794 When slink:VkVideoEncodeRateControlInfoKHR::pname:rateControlMode is 795 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR, both 796 pname:useMinQp and pname:useMaxQp must be set to ename:VK_TRUE 797 * [[VUID-VkVideoEncodeH265RateControlLayerInfoEXT-rateControlMode-06477]] 798 When slink:VkVideoEncodeRateControlInfoKHR::pname:rateControlMode is 799 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR, the values 800 provided in pname:minQP must be identical to those provided in 801 pname:maxQp 802**** 803 804include::{generated}/validity/structs/VkVideoEncodeH265RateControlLayerInfoEXT.adoc[] 805-- 806 807[open,refpage='VkVideoEncodeH265QpEXT',desc='Structure describing H.265 QP values per picture type',type='structs'] 808-- 809The sname:VkVideoEncodeH265QpEXT structure is defined as: 810 811include::{generated}/api/structs/VkVideoEncodeH265QpEXT.adoc[] 812 813 * pname:qpI is the QP to be used for I-frames. 814 * pname:qpP is the QP to be used for P-frames. 815 * pname:qpB is the QP to be used for B-frames. 816 817include::{generated}/validity/structs/VkVideoEncodeH265QpEXT.adoc[] 818-- 819 820[open,refpage='VkVideoEncodeH265FrameSizeEXT',desc='Structure describing frame size values per H.265 picture type',type='structs'] 821-- 822The sname:VkVideoEncodeH265FrameSizeEXT structure is defined as: 823 824include::{generated}/api/structs/VkVideoEncodeH265FrameSizeEXT.adoc[] 825 826 * pname:frameISize is the size in bytes to be used for I-frames. 827 * pname:framePSize is the size in bytes to be used for P-frames. 828 * pname:frameBSize is the size in bytes to be used for B-frames. 829 830include::{generated}/validity/structs/VkVideoEncodeH265FrameSizeEXT.adoc[] 831-- 832 833