// Copyright 2018-2022 The Khronos Group Inc. // // SPDX-License-Identifier: CC-BY-4.0 [[encode-h264]] == Encode H.264 The `apiext:VK_EXT_video_encode_h264` extension adds H.264 codec specific structures/types needed to support H.264 encoding. Unless otherwise noted, all references to the H.264 specification are to the 2010 edition published by the ITU-T, dated March 2010. This specification is available at https://www.itu.int/rec/T-REC-H.264. [NOTE] .Note ==== Refer to the <> for information on how the Khronos Intellectual Property Rights Policy relates to normative references to external materials not created by Khronos. ==== === H.264 encode profile [open,refpage='VkVideoEncodeH264ProfileInfoEXT',desc='Structure specifying H.264 encode profile',type='structs'] -- The sname:VkVideoEncodeH264ProfileInfoEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264ProfileInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:stdProfileIdc is a code:StdVideoH264ProfileIdc value specifying the H.264 codec profile IDC. An H.264 encode profile is specified by including a sname:VkVideoEncodeH264ProfileInfoEXT structure in the pname:pNext chain of the slink:VkVideoProfileInfoKHR structure when slink:VkVideoProfileInfoKHR::pname:videoCodecOperation is ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT. include::{generated}/validity/structs/VkVideoEncodeH264ProfileInfoEXT.adoc[] -- === Capabilities [open,refpage='VkVideoEncodeH264CapabilitiesEXT',desc='Structure specifying H.264 encode capabilities',type='structs'] -- When calling flink:vkGetPhysicalDeviceVideoCapabilitiesKHR with pname:pVideoProfile->videoCodecOperation specified as ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, the slink:VkVideoEncodeH264CapabilitiesEXT structure must: be included in the pname:pNext chain of the slink:VkVideoCapabilitiesKHR structure to retrieve more capabilities specific to H.264 video encoding. The slink:VkVideoEncodeH264CapabilitiesEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264CapabilitiesEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:flags is a bitmask of elink:VkVideoEncodeH264CapabilityFlagBitsEXT describing supported encoding tools. * pname:inputModeFlags is a bitmask of elink:VkVideoEncodeH264InputModeFlagBitsEXT describing supported command buffer input granularities/modes. * pname:outputModeFlags is a bitmask of elink:VkVideoEncodeH264OutputModeFlagBitsEXT describing supported output (bitstream size reporting) granularities/modes. * pname:maxPPictureL0ReferenceCount reports the maximum number of reference pictures the implementation supports in the reference list L0 for P pictures. * pname:maxBPictureL0ReferenceCount reports the maximum number of reference pictures the implementation supports in the reference list L0 for B pictures. The reported value is `0` if encoding of B pictures is not supported. * pname:maxL1ReferenceCount reports the maximum number of reference pictures the implementation supports in the reference list L1 if encoding of B pictures is supported. The reported value is `0` if encoding of B pictures is not supported. * pname:motionVectorsOverPicBoundariesFlag if ename:VK_TRUE, indicates motion_vectors_over_pic_boundaries_flag will be enabled if bitstream_restriction_flag is enabled in StdVideoH264SpsVuiFlags. * pname:maxBytesPerPicDenom reports the value that will be used for max_bytes_per_pic_denom if bitstream_restriction_flag is enabled in StdVideoH264SpsVuiFlags. * pname:maxBitsPerMbDenom reports the value that will be used for max_bits_per_mb_denom if bitstream_restriction_flag is enabled in StdVideoH264SpsVuiFlags. * pname:log2MaxMvLengthHorizontal reports the value that will be used for log2_max_mv_length_horizontal if bitstream_restriction_flag is enabled in StdVideoH264SpsVuiFlags. * pname:log2MaxMvLengthVertical reports the value that will be used for log2_max_mv_length_vertical if bitstream_restriction_flag is enabled in StdVideoH264SpsVuiFlags. When flink:vkGetPhysicalDeviceVideoCapabilitiesKHR is called to query the capabilities with parameter pname:videoCodecOperation specified as ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT, a sname:VkVideoEncodeH264CapabilitiesEXT structure can: be chained to slink:VkVideoCapabilitiesKHR to retrieve H.264 extension specific capabilities. include::{generated}/validity/structs/VkVideoEncodeH264CapabilitiesEXT.adoc[] -- [open,refpage='VkVideoEncodeH264CapabilityFlagsEXT',desc='Bitmask of VkVideoEncodeH264CapabilityFlagBitsEXT',type='flags'] -- include::{generated}/api/flags/VkVideoEncodeH264CapabilityFlagsEXT.adoc[] tname:VkVideoEncodeH264CapabilityFlagsEXT is a bitmask type for setting a mask of zero or more elink:VkVideoEncodeH264CapabilityFlagBitsEXT. -- [open,refpage='VkVideoEncodeH264CapabilityFlagBitsEXT',desc='Video encode H.264 capability flags',type='enums'] -- Bits which may: be set in slink:VkVideoEncodeH264CapabilitiesEXT::pname:flags, indicating the encoding tools supported, are: include::{generated}/api/enums/VkVideoEncodeH264CapabilityFlagBitsEXT.adoc[] * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_ENABLED_BIT_EXT reports if enabling direct_8x8_inference_flag in StdVideoH264SpsFlags is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_DISABLED_BIT_EXT reports if disabling direct_8x8_inference_flag in StdVideoH264SpsFlags is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT reports if enabling separate_colour_plane_flag in StdVideoH264SpsFlags is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_BIT_EXT reports if enabling qpprime_y_zero_transform_bypass_flag in StdVideoH264SpsFlags is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_SCALING_LISTS_BIT_EXT reports if enabling seq_scaling_matrix_present_flag in StdVideoH264SpsFlags or pic_scaling_matrix_present_flag in StdVideoH264PpsFlags are supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_EXT reports if the implementation guarantees generating a HRD compliant bitstream if nal_hrd_parameters_present_flag or vcl_hrd_parameters_present_flag are enabled in StdVideoH264SpsVuiFlags. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_CHROMA_QP_OFFSET_BIT_EXT reports if setting non-zero chroma_qp_index_offset in StdVideoH264PictureParameterSet is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_SECOND_CHROMA_QP_OFFSET_BIT_EXT reports if setting non-zero second_chroma_qp_index_offset in StdVideoH264PictureParameterSet is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_PIC_INIT_QP_MINUS26_BIT_EXT reports if setting non-zero pic_init_qp_minus26 in StdVideoH264PictureParameterSet is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_BIT_EXT reports if enabling weighted_pred_flag in StdVideoH264PpsFlags is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_EXPLICIT_BIT_EXT reports if using STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT from StdVideoH264WeightedBipredIdc is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_IMPLICIT_BIT_EXT reports if using STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT from StdVideoH264WeightedBipredIdc is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT reports that when weighted_pred_flag is enabled or STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT from StdVideoH264WeightedBipredIdc is used, the implementation is able to internally decide syntax for pred_weight_table. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_TRANSFORM_8X8_BIT_EXT reports if enabling transform_8x8_mode_flag in StdVideoH264PpsFlags is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT reports if CABAC entropy coding is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT reports if CAVLC entropy coding is supported. An implementation must: support at least one entropy coding mode. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_DISABLED_BIT_EXT reports if using STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_DISABLED from StdVideoH264DisableDeblockingFilterIdc is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_ENABLED_BIT_EXT reports if using STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_ENABLED from StdVideoH264DisableDeblockingFilterIdc is supported. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT reports if using STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_PARTIAL from StdVideoH264DisableDeblockingFilterIdc is supported. An implementation must: support at least one deblocking filter mode. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DISABLE_DIRECT_SPATIAL_MV_PRED_BIT_EXT reports if disabling code:StdVideoEncodeH264SliceHeaderFlags::direct_spatial_mv_pred_flag is supported when it is present in the slice header. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT reports if encoding multiple slices per frame is supported. If not set, the implementation is only able to encode a single slice for the entire frame. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_SLICE_MB_COUNT_BIT_EXT reports support for configuring slink:VkVideoEncodeH264NaluSliceInfoEXT::pname:mbCount and first_mb_in_slice in StdVideoEncodeH264SliceHeader for each slice in a frame with multiple slices. If not supported, the implementation decides the number of macroblocks in each slice based on slink:VkVideoEncodeH264VclFrameInfoEXT::pname:naluSliceEntryCount. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_EXT reports that each slice in a frame with multiple slices may begin or finish at any offset in a macroblock row. If not supported, all slices in the frame must: begin at the start of a macroblock row (and hence each slice must: finish at the end of a macroblock row). * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT reports that when ename:VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT is supported and a frame is encoded with multiple slices, the implementation allows encoding each slice with a different code:StdVideoEncodeH264SliceHeader::slice_type. If not supported, all slices of the frame must: be encoded with the same code:slice_type which corresponds to the picture type of the frame. For example, all slices of a P-frame would be encoded as P-slices. * ename:VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT reports support for using a B frame as L1 reference. -- [open,refpage='VkVideoEncodeH264InputModeFlagsEXT',desc='Bitmask of VkVideoEncodeH264InputModeFlagBitsEXT',type='flags'] -- include::{generated}/api/flags/VkVideoEncodeH264InputModeFlagsEXT.adoc[] tname:VkVideoEncodeH264InputModeFlagsEXT is a bitmask type for setting a mask of zero or more elink:VkVideoEncodeH264InputModeFlagBitsEXT. -- [open,refpage='VkVideoEncodeH264InputModeFlagBitsEXT',desc='Video encode H.264 input modes',type='enums'] -- The pname:inputModeFlags field reports the various command buffer input granularities supported by the implementation as follows: include::{generated}/api/enums/VkVideoEncodeH264InputModeFlagBitsEXT.adoc[] * ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT indicates that a single command buffer must: at least encode an entire frame. Any non-VCL NALUs must: be encoded using the same command buffer as the frame if ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_NON_VCL_BIT_EXT is not supported. * ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_SLICE_BIT_EXT indicates that a single command buffer must: at least encode a single slice. Any non-VCL NALUs must: be encoded using the same command buffer as the first slice of the frame if ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_NON_VCL_BIT_EXT is not supported. * ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_NON_VCL_BIT_EXT indicates that a single command buffer may: encode a non-VCL NALU by itself. An implementation must: support at least one of ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT or ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_SLICE_BIT_EXT. If ename:VK_VIDEO_ENCODE_H264_INPUT_MODE_SLICE_BIT_EXT is not supported, the following two additional restrictions apply for frames encoded with multiple slices. First, all frame slices must: have the same pRefList0ModOperations and the same pRefList1ModOperations. Second, the order in which slices appear in slink:VkVideoEncodeH264VclFrameInfoEXT::pname:pNaluSliceEntries or in the command buffer must: match the placement order of the slices in the frame. -- [open,refpage='VkVideoEncodeH264OutputModeFlagsEXT',desc='Bitmask of VkVideoEncodeH264OutputModeFlagBitsEXT',type='flags'] -- include::{generated}/api/flags/VkVideoEncodeH264OutputModeFlagsEXT.adoc[] tname:VkVideoEncodeH264OutputModeFlagsEXT is a bitmask type for setting a mask of zero or more elink:VkVideoEncodeH264InputModeFlagBitsEXT. -- [open,refpage='VkVideoEncodeH264OutputModeFlagBitsEXT',desc='Video encode H.264 output modes',type='enums'] -- Bits which may: be set in slink:VkVideoEncodeH264CapabilitiesEXT::pname:outputModeFlags, indicating the minimum bitstream generation commands that must: be included between each flink:vkCmdBeginVideoCodingKHR and flink:vkCmdEndVideoCodingKHR pair (henceforth simply begin/end pair), are: include::{generated}/api/enums/VkVideoEncodeH264OutputModeFlagBitsEXT.adoc[] * ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FRAME_BIT_EXT indicates that calls to generate all NALUs of a frame must: be included within a single begin/end pair. Any non-VCL NALUs must: be encoded within the same begin/end pair if ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_NON_VCL_BIT_EXT is not supported. * ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_SLICE_BIT_EXT indicates that each begin/end pair must: encode at least one slice. Any non-VCL NALUs must: be encoded within the same begin/end pair as the first slice of the frame if ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_NON_VCL_BIT_EXT is not supported. * ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_NON_VCL_BIT_EXT indicates that each begin/end pair may: encode only a non-VCL NALU by itself. An implementation must: support at least one of ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FRAME_BIT_EXT or ename:VK_VIDEO_ENCODE_H264_OUTPUT_MODE_SLICE_BIT_EXT. A single begin/end pair must: not encode more than a single frame. The bitstreams of NALUs generated within a single begin/end pair are written continuously into the same bitstream buffer (any padding between the NALUs must: be compliant to the H.264 standard). The supported input modes must: be coarser or equal to the supported output modes. For example, it is illegal to report slice input is supported but only frame output is supported. An implementation must: report one of the following combinations of input/output modes: ** Input: Frame, Output: Frame ** Input: Frame, Output: Frame and Non-VCL ** Input: Frame, Output: Slice ** Input: Frame, Output: Slice and Non-VCL ** Input: Slice, Output: Slice ** Input: Slice, Output: Slice and Non-VCL ** Input: Frame and Non-VCL, Output: Frame and Non-VCL ** Input: Frame and Non-VCL, Output: Slice and Non-VCL ** Input: Slice and Non-VCL, Output: Slice and Non-VCL -- === Encoder Parameter Sets To reduce parameter traffic during encoding, the encoder parameter set object supports storing H.264 SPS/PPS parameter sets that may: be later referenced during encoding. [open,refpage='VkVideoEncodeH264SessionParametersCreateInfoEXT',desc='Structure specifies H.264 encoder parameter set information',type='structs'] -- The slink:VkVideoEncodeH264SessionParametersCreateInfoEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264SessionParametersCreateInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:maxStdSPSCount is the maximum number of SPS parameters that the sname:VkVideoSessionParametersKHR can contain. * pname:maxStdPPSCount is the maximum number of PPS parameters that the sname:VkVideoSessionParametersKHR can contain. * pname:pParametersAddInfo is `NULL` or a pointer to a sname:VkVideoEncodeH264SessionParametersAddInfoEXT structure specifying H.264 parameters to add upon object creation. A sname:VkVideoEncodeH264SessionParametersCreateInfoEXT structure holding one H.264 SPS and at least one H.264 PPS parameter set must: be chained to slink:VkVideoSessionParametersCreateInfoKHR when calling flink:vkCreateVideoSessionParametersKHR to store these parameter set(s) with the encoder parameter set object for later reference. The provided H.264 SPS/PPS parameters must: be within the limits specified during encoder creation for the encoder specified in slink:VkVideoSessionParametersCreateInfoKHR. include::{generated}/validity/structs/VkVideoEncodeH264SessionParametersCreateInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264SessionParametersAddInfoEXT',desc='Structure specifies H.264 encoder parameter set information',type='structs'] -- The sname:VkVideoEncodeH264SessionParametersAddInfoEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264SessionParametersAddInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:stdSPSCount is the number of SPS elements in the pname:pStdSPSs. Its value must: be less than or equal to the value of pname:maxStdSPSCount. * pname:pStdSPSs is a pointer to an array of code:StdVideoH264SequenceParameterSet structures representing H.264 sequence parameter sets. Each element of the array must: have a unique H.264 SPS ID. * pname:stdPPSCount is the number of PPS provided in pname:pStdPPSs. Its value must: be less than or equal to the value of pname:maxStdPPSCount. * pname:pStdPPSs is a pointer to an array of code:StdVideoH264PictureParameterSet structures representing H.264 picture parameter sets. Each element of the array must: have a unique H.264 SPS-PPS ID pair. .Valid Usage **** * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-stdSPSCount-04837]] The values of pname:stdSPSCount and pname:stdPPSCount must: be less than or equal to the values of pname:maxStdSPSCount and pname:maxStdPPSCount, respectively * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-maxStdSPSCount-04838]] When the pname:maxStdSPSCount number of parameters of type StdVideoH264SequenceParameterSet in the Video Session Parameters object is reached, no additional parameters of that type can be added to the object. ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made to add additional data to this object at this point * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-maxStdPPSCount-04839]] When the pname:maxStdPPSCount number of parameters of type StdVideoH264PictureParameterSet in the Video Session Parameters object is reached, no additional parameters of that type can be added to the object. ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made to add additional data to this object at this point * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-None-04840]] Each entry to be added must: have a unique, to the rest of the parameter array entries and the existing parameters in the Video Session Parameters Object that is being updated, SPS-PPS IDs * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-None-04841]] Parameter entries that already exist in Video Session Parameters object with a particular SPS-PPS IDs cannot: be replaced nor updated * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-None-04842]] When creating a new object using a Video Session Parameters as a template, the array's parameters with the same SPS-PPS IDs as the ones from the template take precedence * [[VUID-VkVideoEncodeH264SessionParametersAddInfoEXT-None-04843]] SPS/PPS parameters must: comply with the limits specified in slink:VkVideoSessionCreateInfoKHR during Video Session creation **** include::{generated}/validity/structs/VkVideoEncodeH264SessionParametersAddInfoEXT.adoc[] -- === Frame Encoding In order to encode a frame, add a slink:VkVideoEncodeH264VclFrameInfoEXT structure to the pname:pNext chain of the slink:VkVideoEncodeInfoKHR structure passed to the flink:vkCmdEncodeVideoKHR command. [open,refpage='VkVideoEncodeH264VclFrameInfoEXT',desc='Structure specifies H.264 encode frame parameters',type='structs'] -- The slink:VkVideoEncodeH264VclFrameInfoEXT structure representing a frame encode operation is defined as: include::{generated}/api/structs/VkVideoEncodeH264VclFrameInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:pReferenceFinalLists is `NULL` or a pointer to a slink:VkVideoEncodeH264ReferenceListsInfoEXT structure specifying the reference lists to be used for the current picture. * pname:naluSliceEntryCount is the number of slice NALUs in the frame. * pname:pNaluSliceEntries is a pointer to an array of pname:naluSliceEntryCount slink:VkVideoEncodeH264NaluSliceInfoEXT structures specifying the division of the current picture into slices and the properties of these slices. This is an ordered sequence; the NALUs are generated consecutively in slink:VkVideoEncodeInfoKHR::pname:dstBitstreamBuffer in the same order as in this array. * pname:pCurrentPictureInfo is a pointer to a code:StdVideoEncodeH264PictureInfo structure specifying the syntax and other codec-specific information from the H.264 specification associated with this picture. The information provided must: reflect the decoded picture marking operations that are applicable to this frame. include::{generated}/validity/structs/VkVideoEncodeH264VclFrameInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264NaluSliceInfoEXT',desc='Structure specifies H.264 encode slice NALU parameters',type='structs'] -- The slink:VkVideoEncodeH264NaluSliceInfoEXT structure representing a slice is defined as: include::{generated}/api/structs/VkVideoEncodeH264NaluSliceInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:mbCount is the number of macroblocks in this slice. * pname:pReferenceFinalLists is `NULL` or a pointer to a slink:VkVideoEncodeH264ReferenceListsInfoEXT structure specifying the reference lists to be used for the current slice. If pname:pReferenceFinalLists is not `NULL`, these reference lists override the reference lists provided in slink:VkVideoEncodeH264VclFrameInfoEXT::pname:pReferenceFinalLists. * pname:pSliceHeaderStd is a pointer to a code:StdVideoEncodeH264SliceHeader structure specifying the slice header for the current slice. include::{generated}/validity/structs/VkVideoEncodeH264NaluSliceInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264DpbSlotInfoEXT',desc='Structure specifies H.264 encode DPB picture information',type='structs'] -- The slink:VkVideoEncodeH264DpbSlotInfoEXT structure, representing a reconstructed picture that is being used as a reference picture, is defined as: include::{generated}/api/structs/VkVideoEncodeH264DpbSlotInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:slotIndex is the <> index for this picture. pname:slotIndex must: match the pname:slotIndex in pname:pSetupReferenceSlot of slink:VkVideoEncodeInfoKHR in the command used to encode the corresponding picture. * pname:pStdReferenceInfo is a pointer to a code:StdVideoEncodeH264ReferenceInfo structure specifying the syntax and other codec-specific information from the H.264 specification associated with this reference picture. include::{generated}/validity/structs/VkVideoEncodeH264DpbSlotInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264ReferenceListsInfoEXT',desc='Structure specifies H.264 reference frame lists',type='structs'] -- The slink:VkVideoEncodeH264ReferenceListsInfoEXT structure representing reference lists is defined as: include::{generated}/api/structs/VkVideoEncodeH264ReferenceListsInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:referenceList0EntryCount is the number of reference pictures in reference list L0 and is identical to code:StdVideoEncodeH264SliceHeader::pname:num_ref_idx_l0_active_minus1 + 1. * pname:pReferenceList0Entries is a pointer to an array of pname:referenceList0EntryCount slink:VkVideoEncodeH264DpbSlotInfoEXT structures specifying the reference list L0 entries for the current picture. The entries provided must: be ordered after all reference list L0 modification operations are applied (i.e. final list order). The entries provided must: not reflect decoded picture marking operations in this frame that are applicable to references; the impact of such operations must: be reflected in future frame encode commands. The slot index in each entry must: match one of the slot indexes provided in the pname:pReferenceSlots of the parent slink:VkVideoEncodeInfoKHR structure. * pname:referenceList1EntryCount is the number of reference pictures in reference list L1 and is identical to code:StdVideoEncodeH264SliceHeader::pname:num_ref_idx_l1_active_minus1 + 1. * pname:pReferenceList1Entries is a pointer to an array of pname:referenceList1EntryCount slink:VkVideoEncodeH264DpbSlotInfoEXT structures specifying the reference list L1 entries for the current picture. The entries provided must: be ordered after all reference list L1 modification operations are applied (i.e. final list order). The entries provided must: not reflect decoded picture marking operations in this frame that are applicable to references; the impact of such operations must: be reflected in future frame encode commands. The slot index in each entry must: match one of the slot indexes provided in the pname:pReferenceSlots of the parent slink:VkVideoEncodeInfoKHR structure. * pname:pMemMgmtCtrlOperations is a pointer to a code:StdVideoEncodeH264RefMemMgmtCtrlOperations structure specifying reference lists modifications and decoded picture marking operations. include::{generated}/validity/structs/VkVideoEncodeH264ReferenceListsInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264EmitPictureParametersInfoEXT',desc='Structure specifies H.264 encode SPS NALU insertion parameters',type='structs'] -- The sname:VkVideoEncodeH264EmitPictureParametersInfoEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264EmitPictureParametersInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:spsId is the H.264 SPS ID for the H.264 SPS to insert in the bitstream. The SPS ID must: match the SPS provided in pname:spsStd of slink:VkVideoEncodeH264SessionParametersCreateInfoEXT. This is retrieved from the slink:VkVideoSessionParametersKHR object provided in slink:VkVideoBeginCodingInfoKHR. * pname:emitSpsEnable enables the emitting of the SPS structure with id of pname:spsId. * pname:ppsIdEntryCount is the number of entries in the pname:ppsIdEntries. If this parameter is `0` then no pps entries are going to be emitted in the bitstream. * pname:ppsIdEntries is a pointer to an array of H.264 PPS IDs for the H.264 PPS to insert in the bitstream. The PPS IDs must: match one of the IDs of the PPS(s) provided in pname:pStdPPSs of slink:VkVideoEncodeH264SessionParametersCreateInfoEXT to identify the PPS parameter set to insert in the bitstream. This is retrieved from the slink:VkVideoSessionParametersKHR object provided in slink:VkVideoBeginCodingInfoKHR. include::{generated}/validity/structs/VkVideoEncodeH264EmitPictureParametersInfoEXT.adoc[] -- === Rate control [open,refpage='VkVideoEncodeH264RateControlInfoEXT',desc='Structure describing H.264 stream rate control parameters',type='structs'] -- The sname:VkVideoEncodeH264RateControlInfoEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264RateControlInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:gopFrameCount is the number of frames contained within the group of pictures (GOP), starting from an intra frame and until the next intra frame. If it is set to 0, the implementation chooses a suitable value. If it is set to code:UINT32_MAX, the GOP length is treated as infinite. * pname:idrPeriod is the interval, in terms of number of frames, between two IDR frames. If it is set to 0, the implementation chooses a suitable value. If it is set to code:UINT32_MAX, the IDR period is treated as infinite. * pname:consecutiveBFrameCount is the number of consecutive B-frames between I- and/or P-frames within the GOP. * pname:rateControlStructure is a elink:VkVideoEncodeH264RateControlStructureEXT value specifying the expected encode stream reference structure, to aid in rate control calculations. * pname:temporalLayerCount specifies the number of temporal layers enabled in the stream. In order to provide H.264-specific stream rate control parameters, add a sname:VkVideoEncodeH264RateControlInfoEXT structure to the pname:pNext chain of the slink:VkVideoEncodeRateControlInfoKHR structure in the pname:pNext chain of the slink:VkVideoCodingControlInfoKHR structure passed to the flink:vkCmdControlVideoCodingKHR command. The parameters from this structure act as a guidance for implementations to apply various rate control heuristics. It is possible to infer the picture type to be used when encoding a frame, on the basis of the values provided for pname:consecutiveBFrameCount, pname:idrPeriod, and pname:gopFrameCount, but this inferred picture type will not be used by implementations to override the picture type provided in flink:vkCmdEncodeVideoKHR. Additionally, it is not required for the video session to be reset if the inferred picture type does not match the actual picture type. include::{generated}/validity/structs/VkVideoEncodeH264RateControlInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264RateControlStructureEXT',desc='Specifies the video encode H.264 rate control structure',type='enums'] -- The pname:rateControlStructure in slink:VkVideoEncodeH264RateControlInfoEXT specifies one of the following video stream reference structures as a hint for the rate control implementation: include::{generated}/api/enums/VkVideoEncodeH264RateControlStructureEXT.adoc[] * ename:VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT specifies a reference structure unknown at the time of stream rate control configuration. * ename:VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAT_EXT specifies a flat reference structure. * ename:VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_DYADIC_EXT specifies a dyadic reference structure. -- [open,refpage='VkVideoEncodeH264RateControlLayerInfoEXT',desc='Structure describing H.264 per-layer rate control parameters',type='structs'] -- The sname:VkVideoEncodeH264RateControlLayerInfoEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264RateControlLayerInfoEXT.adoc[] * pname:sType is the type of this structure. * pname:pNext is `NULL` or a pointer to a structure extending this structure. * pname:temporalLayerId specifies the H.264 temporal layer ID of the video coding layer that settings provided in this structure and its parent slink:VkVideoEncodeRateControlLayerInfoKHR structure apply to. * pname:useInitialRcQp indicates whether the values within pname:initialRcQp should be used by the implementation. * pname:initialRcQp provides the QP values for each picture type, to be used in rate control calculations at the start of video encode operations on a newly-created video session, or immediately after a session reset. These values are ignored when slink:VkVideoEncodeRateControlInfoKHR::pname:rateControlMode is ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR. * pname:useMinQp indicates whether the values within pname:minQp should be used by the implementation. When it is set to ename:VK_FALSE, the implementation ignores the values in pname:minQp and chooses suitable values. * pname:minQp provides the lower bound on the QP values for each picture type, to be used in rate control calculations. * pname:useMaxQp indicates whether the values within pname:maxQp should be used by the implementation. When it is set to ename:VK_FALSE, the implementation ignores the values in pname:maxQp and chooses suitable values. * pname:maxQp provides the upper bound on the QP values for each picture type, to be used in rate control calculations. * pname:useMaxFrameSize indicates whether the values within pname:maxFrameSize should be used by the implementation. * pname:maxFrameSize provides the upper bound on the encoded frame size for each picture type. The implementation does not guarantee the encoded frame sizes will be within the specified limits, however these limits may: be used as a guide in rate control calculations. If enabled and not set properly, the pname:maxQp limit may prevent the implementation from respecting the pname:maxFrameSize limit. H.264-specific per-layer rate control parameters must: be specified by adding a sname:VkVideoEncodeH264RateControlLayerInfoEXT structure to the pname:pNext chain of each slink:VkVideoEncodeRateControlLayerInfoKHR structure in a call to flink:vkCmdControlVideoCodingKHR command, when the command buffer context has an active video encode H.264 session. .Valid Usage **** * [[VUID-VkVideoEncodeH264RateControlLayerInfoEXT-rateControlMode-06474]] When slink:VkVideoEncodeRateControlInfoKHR::pname:rateControlMode is ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR, both pname:useMinQp and pname:useMaxQp must be set to ename:VK_TRUE * [[VUID-VkVideoEncodeH264RateControlLayerInfoEXT-rateControlMode-06475]] When slink:VkVideoEncodeRateControlInfoKHR::pname:rateControlMode is ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR, the values provided in pname:minQP must be identical to those provided in pname:maxQp **** include::{generated}/validity/structs/VkVideoEncodeH264RateControlLayerInfoEXT.adoc[] -- [open,refpage='VkVideoEncodeH264QpEXT',desc='Structure describing H.264 QP values per picture type',type='structs'] -- The sname:VkVideoEncodeH264QpEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264QpEXT.adoc[] * pname:qpI is the QP to be used for I-frames. * pname:qpP is the QP to be used for P-frames. * pname:qpB is the QP to be used for B-frames. include::{generated}/validity/structs/VkVideoEncodeH264QpEXT.adoc[] -- [open,refpage='VkVideoEncodeH264FrameSizeEXT',desc='Structure describing frame size values per H.264 picture type',type='structs'] -- The sname:VkVideoEncodeH264FrameSizeEXT structure is defined as: include::{generated}/api/structs/VkVideoEncodeH264FrameSizeEXT.adoc[] * pname:frameISize is the size in bytes to be used for I-frames. * pname:framePSize is the size in bytes to be used for P-frames. * pname:frameBSize is the size in bytes to be used for B-frames. include::{generated}/validity/structs/VkVideoEncodeH264FrameSizeEXT.adoc[] --