1// Copyright 2018-2023 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[decode-h264]] 6== H.264 Decode Operations 7 8Video decode operations using an <<decode-h264-profile,H.264 decode 9profile>> can: be used to decode elementary video stream sequences compliant 10to the <<itu-t-h264,ITU-T H.264 Specification>>. 11 12[NOTE] 13.Note 14==== 15Refer to the <<preamble,Preamble>> for information on how the Khronos 16Intellectual Property Rights Policy relates to normative references to 17external materials not created by Khronos. 18==== 19 20This process is performed according to the <<decode-operation-steps,video 21decode operation steps>> with the codec-specific semantics defined in 22section 8 of the <<itu-t-h264,ITU-T H.264 Specification>> as follows: 23 24 * Syntax elements, derived values, and other parameters are applied from 25 the following structures: 26 ** The code:StdVideoH264SequenceParameterSet structure corresponding to 27 the <<decode-h264-active-sps,active SPS>> specifying the 28 <<decode-h264-sps, H.264 sequence parameter set>>. 29 ** The code:StdVideoH264PictureParameterSet structure corresponding to the 30 <<decode-h264-active-pps,active PPS>> specifying the <<decode-h264-pps, 31 H.264 picture parameter set>>. 32 ** The code:StdVideoDecodeH264PictureInfo structure specifying the 33 <<decode-h264-picture-info,H.264 picture information>>. 34 ** The code:StdVideoDecodeH264ReferenceInfo structures specifying the 35 <<decode-h264-reference-info,H.264 reference information>> 36 corresponding to the optional <<reconstructed-picture,reconstructed 37 picture>> and any <<active-reference-pictures,active reference 38 pictures>>. 39 * The contents of the provided video bitstream buffer range are 40 interpreted as defined in the <<decode-h264-bitstream-data-access,H.264 41 Decode Bitstream Data Access>> section. 42 * Picture data in the <<video-picture-resources,video picture resources>> 43 corresponding to the used <<decode-h264-active-reference-picture-info, 44 active reference pictures>>, <<decode-h264-output-picture-info,decode 45 output picture>>, and optional <<decode-h264-reconstructed-picture-info, 46 reconstructed picture>> is accessed as defined in the 47 <<decode-h264-picture-data-access,H.264 Decode Picture Data Access>> 48 section. 49 50If the parameters and the bitstream adhere to the syntactic and semantic 51requirements defined in the corresponding sections of the <<itu-t-h264,ITU-T 52H.264 Specification>>, as described above, and the <<dpb-slot,DPB slots>> 53associated with the <<active-reference-pictures,active reference pictures>> 54all refer to <<dpb-slot-states,valid picture references>>, then the video 55decode operation will complete successfully. 56Otherwise, the video decode operation may: complete 57<<decode-unsuccessful,unsuccessfully>>. 58 59 60[[decode-h264-bitstream-data-access]] 61=== H.264 Decode Bitstream Data Access 62 63If the target <<decode-h264-output-picture-info,decode output picture>> is a 64frame, then the video bitstream buffer range should: contain a VCL NAL unit 65comprised of the slice headers and data of a picture representing an entire 66frame, as defined in sections 7.3.3 and 7.3.4, and this data is interpreted 67as defined in sections 7.4.3 and 7.4.4 of the <<itu-t-h264,ITU-T H.264 68Specification>>, respectively. 69 70If the target <<decode-h264-output-picture-info,decode output picture>> is a 71field, then the video bitstream buffer range should contain a VCL NAL unit 72comprised of the slice headers and data of a picture representing a field, 73as defined in sections 7.3.3 and 7.3.4, and this data is interpreted as 74defined in sections 7.4.3 and 7.4.4 of the <<itu-t-h264,ITU-T H.264 75Specification>>, respectively. 76 77The offsets provided in 78slink:VkVideoDecodeH264PictureInfoKHR::pname:pSliceOffsets should: specify 79the starting offsets corresponding to each slice header within the video 80bitstream buffer range. 81 82 83[[decode-h264-picture-data-access]] 84=== H.264 Decode Picture Data Access 85 86The effective pname:imageOffset and pname:imageExtent corresponding to a 87<<decode-output-picture,decode output picture>>, 88<<reference-picture,reference picture>>, or 89<<reconstructed-picture,reconstructed picture>> used in video decode 90operations with an <<decode-h264-profile,H.264 decode profile>> are defined 91as follows: 92 93 * pname:imageOffset is [eq]#(pname:codedOffset.x,pname:codedOffset.y)# and 94 pname:imageExtent is [eq]#(pname:codedExtent.width, 95 pname:codedExtent.height)#, if the picture represents a frame. 96 * pname:imageOffset is [eq]#(pname:codedOffset.x,pname:codedOffset.y)# and 97 pname:imageExtent is [eq]#(pname:codedExtent.width, 98 pname:codedExtent.height)#, if the picture represents a field and the 99 picture layout of the used <<decode-h264-profile,H.264 decode profile>> 100 is 101 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR. 102 * pname:imageOffset is [eq]#(pname:codedOffset.x,pname:codedOffset.y)# and 103 pname:imageExtent is [eq]#(pname:codedExtent.width, 104 pname:codedExtent.height / 2)#, if the picture represents a field and 105 the picture layout of the used <<decode-h264-profile,H.264 decode 106 profile>> is 107 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR. 108 109Where pname:codedOffset and pname:codedExtent are the members of the 110slink:VkVideoPictureResourceInfoKHR structure corresponding to the picture. 111 112However, accesses to image data within a video picture resource happen at 113the granularity indicated by 114slink:VkVideoCapabilitiesKHR::pname:pictureAccessGranularity, as returned by 115flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the used <<video-profiles, 116video profile>>. 117This means that the complete image subregion accessed by video coding 118operations using an <<decode-h264-profile,H.264 decode profile>> for the 119video picture resource is defined as the set of texels within the coordinate 120range: 121 122 {empty}:: [eq]#([pname:startX,pname:endX),[pname:startY,pname:endY))# 123 124Where: 125 126 * [eq]#pname:startX# equals pname:imageOffset.x rounded down to the 127 nearest integer multiple of pname:pictureAccessGranularity.width; 128 * [eq]#pname:endX# equals [eq]#pname:imageOffset.x {plus} 129 pname:imageExtent.width# rounded up to the nearest integer multiple of 130 pname:pictureAccessGranularity.width and clamped to the width of the 131 image subresource <<video-image-subresource-reference,referred>> to by 132 the corresponding slink:VkVideoPictureResourceInfoKHR structure; 133 * [eq]#startY# equals pname:imageOffset.y rounded down to the nearest 134 integer multiple of pname:pictureAccessGranularity.height; 135 * [eq]#endY# equals [eq]#pname:imageOffset.y {plus} 136 pname:imageExtent.height# rounded up to the nearest integer multiple of 137 pname:pictureAccessGranularity.height and clamped to the height of the 138 image subresource <<video-image-subresource-reference,referred>> to by 139 the corresponding slink:VkVideoPictureResourceInfoKHR structure. 140 141In case of video decode operations using an <<decode-h264-profile,H.264 142decode profile>>, any access to a picture at the coordinates 143[eq]#(pname:x,pname:y)#, as defined by the <<itu-t-h264,ITU-T H.264 144Specification>>, is an access to the image subresource 145<<video-image-subresource-reference,referred>> to by the corresponding 146slink:VkVideoPictureResourceInfoKHR structure at the texel coordinates 147specified below: 148 149 * [eq]#(pname:x,pname:y)#, if the accessed picture represents a frame. 150 * [eq]#(pname:x,pname:y {times} 2)#, if the accessed picture represents a 151 top field and the picture layout of the used <<decode-h264-profile,H.264 152 decode profile>> is 153 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR. 154 * [eq]#(pname:x,pname:y {times} 2 {plus} 1)#, if the accessed picture 155 represents a bottom field and the picture layout of the used 156 <<decode-h264-profile,H.264 decode profile>> is 157 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR. 158 * [eq]#(pname:x,pname:y)#, if the accessed picture represents a top field 159 and the picture layout of the used <<decode-h264-profile,H.264 decode 160 profile>> is 161 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR. 162 * [eq]#(pname:codedOffset.x {plus} pname:x,pname:codedOffset.y {plus} 163 pname:y)#, if the accessed picture represents a bottom field and the 164 picture layout of the used <<decode-h264-profile,H.264 decode profile>> 165 is 166 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR. 167 168Where pname:codedOffset is the member of the corresponding 169slink:VkVideoPictureResourceInfoKHR structure. 170 171 172[[decode-h264-profile]] 173=== H.264 Decode Profile 174 175[open,refpage='VkVideoDecodeH264ProfileInfoKHR',desc='Structure specifying H.264 decode-specific video profile parameters',type='structs'] 176-- 177A video profile supporting H.264 video decode operations is specified by 178setting slink:VkVideoProfileInfoKHR::pname:videoCodecOperation to 179ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and adding a 180sname:VkVideoDecodeH264ProfileInfoKHR structure to the 181slink:VkVideoProfileInfoKHR::pname:pNext chain. 182 183The sname:VkVideoDecodeH264ProfileInfoKHR structure is defined as: 184 185include::{generated}/api/structs/VkVideoDecodeH264ProfileInfoKHR.adoc[] 186 187 * pname:sType is a elink:VkStructureType value identifying this structure. 188 * pname:pNext is `NULL` or a pointer to a structure extending this 189 structure. 190 * pname:stdProfileIdc is a code:StdVideoH264ProfileIdc value specifying 191 the H.264 codec profile IDC, as defined in section A.2 of the 192 <<itu-t-h264,ITU-T H.264 Specification>>. 193 * pname:pictureLayout is a elink:VkVideoDecodeH264PictureLayoutFlagBitsKHR 194 value specifying the picture layout used by the H.264 video sequence to 195 be decoded. 196 197include::{generated}/validity/structs/VkVideoDecodeH264ProfileInfoKHR.adoc[] 198-- 199 200[open,refpage='VkVideoDecodeH264PictureLayoutFlagBitsKHR',desc='H.264 video decode picture layout flags',type='enums'] 201-- 202The H.264 video decode picture layout flags are defined as follows: 203 204include::{generated}/api/enums/VkVideoDecodeH264PictureLayoutFlagBitsKHR.adoc[] 205 206 * ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR specifies 207 support for progressive content. 208 This flag has the value `0`. 209 * ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR 210 specifies support for or use of a picture layout for interlaced content 211 where all lines belonging to the top field are decoded to the 212 even-numbered lines within the picture resource, and all lines belonging 213 to the bottom field are decoded to the odd-numbered lines within the 214 picture resource. 215 * ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR 216 specifies support for or use of a picture layout for interlaced content 217 where all lines belonging to a field are grouped together in a single 218 image subregion, and the two fields comprising the frame can: be stored 219 in separate image subregions of the same image subresource or in 220 separate image subresources. 221-- 222 223[open,refpage='VkVideoDecodeH264PictureLayoutFlagsKHR',desc='Bitmask of VkVideoDecodeH264PictureLayoutFlagBitsKHR',type='flags'] 224-- 225include::{generated}/api/flags/VkVideoDecodeH264PictureLayoutFlagsKHR.adoc[] 226 227tname:VkVideoDecodeH264PictureLayoutFlagsKHR is a bitmask type for setting a 228mask of zero or more elink:VkVideoDecodeH264PictureLayoutFlagBitsKHR. 229-- 230 231 232=== H.264 Decode Capabilities 233 234[open,refpage='VkVideoDecodeH264CapabilitiesKHR',desc='Structure describing H.264 decode capabilities',type='structs'] 235-- 236When calling flink:vkGetPhysicalDeviceVideoCapabilitiesKHR to query the 237capabilities for an <<decode-h264-profile,H.264 decode profile>>, the 238slink:VkVideoCapabilitiesKHR::pname:pNext chain must: include a 239sname:VkVideoDecodeH264CapabilitiesKHR structure that will be filled with 240the profile-specific capabilities. 241 242The sname:VkVideoDecodeH264CapabilitiesKHR structure is defined as: 243 244include::{generated}/api/structs/VkVideoDecodeH264CapabilitiesKHR.adoc[] 245 246 * pname:sType is a elink:VkStructureType value identifying this structure. 247 * pname:pNext is `NULL` or a pointer to a structure extending this 248 structure. 249 * pname:maxLevelIdc is a code:StdVideoH264LevelIdc value specifying the 250 maximum H.264 level supported by the profile, where enum constant 251 `STD_VIDEO_H264_LEVEL_IDC_<major>_<minor>` identifies H.264 level 252 `<major>.<minor>` as defined in section A.3 of the <<itu-t-h264,ITU-T 253 H.264 Specification>>. 254 * pname:fieldOffsetGranularity is the minimum alignment for 255 slink:VkVideoPictureResourceInfoKHR::pname:codedOffset specified for a 256 <<video-picture-resources,video picture resource>> when using the 257 picture layout 258 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR. 259 260include::{generated}/validity/structs/VkVideoDecodeH264CapabilitiesKHR.adoc[] 261-- 262 263 264[[decode-h264-parameter-sets]] 265=== H.264 Decode Parameter Sets 266 267<<video-session-parameters,Video session parameters>> objects created with 268the video codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR 269can: contain the following types of parameters: 270 271[[decode-h264-sps]] 272H.264 Sequence Parameter Sets (SPS):: 273 274Represented by code:StdVideoH264SequenceParameterSet structures and 275interpreted as follows: 276 277 * code:reserved1 and code:reserved2 are used only for padding purposes and 278 are otherwise ignored; 279 * code:seq_parameter_set_id is used as the key of the SPS entry; 280 * code:level_idc is one of the enum constants 281 `STD_VIDEO_H264_LEVEL_IDC_<major>_<minor>` identifying the H.264 level 282 `<major>.<minor>` as defined in section A.3 of the <<itu-t-h264,ITU-T 283 H.264 Specification>>; 284 * if code:flags.seq_scaling_matrix_present_flag is set, then the 285 code:StdVideoH264ScalingLists structure pointed to by code:pScalingLists 286 is interpreted as follows: 287 ** code:scaling_list_present_mask is a bitmask where bit index [eq]#i# 288 corresponds to `seq_scaling_list_present_flag[i]` as defined in section 289 7.4.2.1 of the <<itu-t-h264,ITU-T H.264 Specification>>; 290 ** code:use_default_scaling_matrix_mask is a bitmask where bit index 291 [eq]#i# corresponds to `UseDefaultScalingMatrix4x4Flag[i]`, when [eq]#i 292 < 6#, or corresponds to `UseDefaultScalingMatrix8x8Flag[i-6]`, 293 otherwise, as defined in section 7.3.2.1 of the <<itu-t-h264,ITU-T 294 H.264 Specification>>; 295 ** code:ScalingList4x4 and code:ScalingList8x8 correspond to the 296 identically named syntax elements defined in section 7.3.2.1 of the 297 <<itu-t-h264,ITU-T H.264 Specification>>; 298 * if code:flags.vui_parameters_present_flag is set, then 299 code:pSequenceParameterSetVui is a pointer to a 300 code:StdVideoH264SequenceParameterSetVui structure that is interpreted 301 as follows: 302 ** code:reserved1 is used only for padding purposes and is otherwise 303 ignored; 304 ** if code:flags.nal_hrd_parameters_present_flag or 305 code:flags.vcl_hrd_parameters_present_flag is set, then the 306 code:StdVideoH264HrdParameters structure pointed to by 307 code:pHrdParameters is interpreted as follows: 308 *** code:reserved1 is used only for padding purposes and is otherwise 309 ignored; 310 *** all other members of code:StdVideoH264HrdParameters are interpreted as 311 defined in section E.2.2 of the <<itu-t-h264,ITU-T H.264 312 Specification>>; 313 ** all other members of code:StdVideoH264SequenceParameterSetVui are 314 interpreted as defined in section E.2.1 of the <<itu-t-h264,ITU-T H.264 315 Specification>>; 316 * all other members of code:StdVideoH264SequenceParameterSet are 317 interpreted as defined in section 7.4.2.1 of the <<itu-t-h264,ITU-T 318 H.264 Specification>>. 319 320[[decode-h264-pps]] 321H.264 Picture Parameter Sets (PPS):: 322 323Represented by code:StdVideoH264PictureParameterSet structures and 324interpreted as follows: 325 326 * the pair constructed from code:seq_parameter_set_id and 327 code:pic_parameter_set_id is used as the key of the PPS entry; 328 * if code:flags.pic_scaling_matrix_present_flag is set, then the 329 code:StdVideoH264ScalingLists structure pointed to by code:pScalingLists 330 is interpreted as follows: 331 ** code:scaling_list_present_mask is a bitmask where bit index [eq]#i# 332 corresponds to `pic_scaling_list_present_flag[i]` as defined in section 333 7.4.2.2 of the <<itu-t-h264,ITU-T H.264 Specification>>; 334 ** code:use_default_scaling_matrix_mask is a bitmask where bit index 335 [eq]#i# corresponds to `UseDefaultScalingMatrix4x4Flag[i]`, when [eq]#i 336 < 6#, or corresponds to `UseDefaultScalingMatrix8x8Flag[i-6]`, 337 otherwise, as defined in section 7.3.2.2 of the <<itu-t-h264,ITU-T 338 H.264 Specification>>; 339 ** code:ScalingList4x4 and code:ScalingList8x8 correspond to the 340 identically named syntax elements defined in section 7.3.2.2 of the 341 <<itu-t-h264,ITU-T H.264 Specification>>; 342 * all other members of code:StdVideoH264PictureParameterSet are 343 interpreted as defined in section 7.4.2.2 of the <<itu-t-h264,ITU-T 344 H.264 Specification>>. 345 346[open,refpage='VkVideoDecodeH264SessionParametersCreateInfoKHR',desc='Structure specifies H.264 decoder parameter set information',type='structs'] 347-- 348When a <<video-session-parameters,video session parameters>> object is 349created with the codec operation 350ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, the 351slink:VkVideoSessionParametersCreateInfoKHR::pname:pNext chain must: include 352a sname:VkVideoDecodeH264SessionParametersCreateInfoKHR structure specifying 353the capacity and initial contents of the object. 354 355The sname:VkVideoDecodeH264SessionParametersCreateInfoKHR structure is 356defined as: 357 358include::{generated}/api/structs/VkVideoDecodeH264SessionParametersCreateInfoKHR.adoc[] 359 360 * pname:sType is a elink:VkStructureType value identifying this structure. 361 * pname:pNext is `NULL` or a pointer to a structure extending this 362 structure. 363 * pname:maxStdSPSCount is the maximum number of <<decode-h264-sps,H.264 364 SPS>> entries the created sname:VkVideoSessionParametersKHR can: 365 contain. 366 * pname:maxStdPPSCount is the maximum number of <<decode-h264-pps,H.264 367 PPS>> entries the created sname:VkVideoSessionParametersKHR can: 368 contain. 369 * pname:pParametersAddInfo is `NULL` or a pointer to a 370 slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure specifying 371 H.264 parameters to add upon object creation. 372 373include::{generated}/validity/structs/VkVideoDecodeH264SessionParametersCreateInfoKHR.adoc[] 374-- 375 376[open,refpage='VkVideoDecodeH264SessionParametersAddInfoKHR',desc='Structure specifies H.264 decoder parameter set information',type='structs'] 377-- 378The sname:VkVideoDecodeH264SessionParametersAddInfoKHR structure is defined 379as: 380 381include::{generated}/api/structs/VkVideoDecodeH264SessionParametersAddInfoKHR.adoc[] 382 383 * pname:sType is a elink:VkStructureType value identifying this structure. 384 * pname:pNext is `NULL` or a pointer to a structure extending this 385 structure. 386 * pname:stdSPSCount is the number of elements in the pname:pStdSPSs array. 387 * pname:pStdSPSs is a pointer to an array of 388 code:StdVideoH264SequenceParameterSet structures describing the 389 <<decode-h264-sps,H.264 SPS>> entries to add. 390 * pname:stdPPSCount is the number of elements in the pname:pStdPPSs array. 391 * pname:pStdPPSs is a pointer to an array of 392 code:StdVideoH264PictureParameterSet structures describing the 393 <<decode-h264-pps,H.264 PPS>> entries to add. 394 395This structure can: be specified in the following places: 396 397 * In the pname:pParametersAddInfo member of the 398 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure 399 specified in the pname:pNext chain of 400 slink:VkVideoSessionParametersCreateInfoKHR used to create a 401 <<video-session-parameters,video session parameters>> object. 402 In this case, if the video codec operation the video session parameters 403 object is created with is 404 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then it defines the 405 set of initial parameters to add to the created object (see 406 <<creating-video-session-parameters,Creating Video Session 407 Parameters>>). 408 * In the pname:pNext chain of slink:VkVideoSessionParametersUpdateInfoKHR. 409 In this case, if the video codec operation the 410 <<video-session-parameters,video session parameters>> object to be 411 updated was created with is 412 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then it defines the 413 set of parameters to add to it (see 414 <<video-session-parameters-update,Updating Video Session Parameters>>). 415 416.Valid Usage 417**** 418 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoKHR-None-04825]] 419 The pname:seq_parameter_set_id member of each 420 code:StdVideoH264SequenceParameterSet structure specified in the 421 elements of pname:pStdSPSs must: be unique within pname:pStdSPSs 422 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoKHR-None-04826]] 423 The pair constructed from the pname:seq_parameter_set_id and 424 pname:pic_parameter_set_id members of each 425 code:StdVideoH264PictureParameterSet structure specified in the elements 426 of pname:pStdPPSs must: be unique within pname:pStdPPSs 427**** 428 429include::{generated}/validity/structs/VkVideoDecodeH264SessionParametersAddInfoKHR.adoc[] 430-- 431 432 433=== H.264 Decoding Parameters 434 435[open,refpage='VkVideoDecodeH264PictureInfoKHR',desc='Structure specifies H.264 decode picture parameters when decoding a picture',type='structs'] 436-- 437The sname:VkVideoDecodeH264PictureInfoKHR structure is defined as: 438 439include::{generated}/api/structs/VkVideoDecodeH264PictureInfoKHR.adoc[] 440 441 * pname:sType is a elink:VkStructureType value identifying this structure. 442 * pname:pNext is `NULL` or a pointer to a structure extending this 443 structure. 444 * pname:pStdPictureInfo is a pointer to a 445 code:StdVideoDecodeH264PictureInfo structure specifying 446 <<decode-h264-picture-info,H.264 picture information>>. 447 * pname:sliceCount is the number of elements in pname:pSliceOffsets. 448 * pname:pSliceOffsets is a pointer to an array of pname:sliceCount offsets 449 specifying the start offset of the slices of the picture within the 450 video bitstream buffer range specified in slink:VkVideoDecodeInfoKHR. 451 452This structure is specified in the pname:pNext chain of the 453slink:VkVideoDecodeInfoKHR structure passed to flink:vkCmdDecodeVideoKHR to 454specify the codec-specific picture information for an <<decode-h264,H.264 455decode operation>>. 456 457[[decode-h264-output-picture-info]] 458Decode Output Picture Information:: 459 460When this structure is specified in the pname:pNext chain of the 461slink:VkVideoDecodeInfoKHR structure passed to flink:vkCmdDecodeVideoKHR, 462the information related to the <<decode-output-picture-info,decode output 463picture>> is defined as follows: 464 465 * If pname:pStdPictureInfo->flags.field_pic_flag is not set, then the 466 picture represents a frame. 467 * If pname:pStdPictureInfo->flags.field_pic_flag is set, then the picture 468 represents a field. 469 Specifically: 470 ** If pname:pStdPictureInfo->flags.bottom_field_flag is not set, then the 471 picture represents the top field of the frame. 472 ** If pname:pStdPictureInfo->flags.bottom_field_flag is set, then the 473 picture represents the bottom field of the frame. 474 * The image subregion used is determined according to the 475 <<decode-h264-picture-data-access,H.264 Decode Picture Data Access>> 476 section. 477 * The decode output picture is associated with the 478 <<decode-h264-picture-info,H.264 picture information>> provided in 479 pname:pStdPictureInfo. 480 481[[decode-h264-picture-info]] 482Std Picture Information:: 483 484The members of the code:StdVideoDecodeH264PictureInfo structure pointed to 485by pname:pStdPictureInfo are interpreted as follows: 486 487 * code:reserved1 and code:reserved2 are used only for padding purposes and 488 are otherwise ignored; 489 * code:flags.is_intra as defined in section 3.73 of the <<itu-t-h264,ITU-T 490 H.264 Specification>>; 491 * code:flags.is_reference as defined in section 3.136 of the <<itu-t-h264, 492 ITU-T H.264 Specification>>; 493 * code:flags.complementary_field_pair as defined in section 3.35 of the 494 <<itu-t-h264,ITU-T H.264 Specification>>; 495 * code:seq_parameter_set_id and code:pic_parameter_set_id are used to 496 identify the active parameter sets, as described below; 497 * all other members are interpreted as defined in section 7.4.3 of the 498 <<itu-t-h264,ITU-T H.264 Specification>>. 499 500Active Parameter Sets:: 501 502The members of the code:StdVideoDecodeH264PictureInfo structure pointed to 503by pname:pStdPictureInfo are used to select the active parameter sets to use 504from the bound video session parameters object, as follows: 505 506 * [[decode-h264-active-sps]] The _active SPS_ is the 507 <<decode-h264-sps,SPS>> identified by the key specified in 508 code:StdVideoDecodeH264PictureInfo::code:seq_parameter_set_id. 509 * [[decode-h264-active-pps]] The _active PPS_ is the 510 <<decode-h264-pps,PPS>> identified by the key specified by the pair 511 constructed from 512 code:StdVideoDecodeH264PictureInfo::code:seq_parameter_set_id and 513 code:StdVideoDecodeH264PictureInfo::code:pic_parameter_set_id. 514 515include::{generated}/validity/structs/VkVideoDecodeH264PictureInfoKHR.adoc[] 516-- 517 518[open,refpage='VkVideoDecodeH264DpbSlotInfoKHR',desc='Structure specifies H.264 decode DPB picture information',type='structs'] 519-- 520The sname:VkVideoDecodeH264DpbSlotInfoKHR structure is defined as: 521 522include::{generated}/api/structs/VkVideoDecodeH264DpbSlotInfoKHR.adoc[] 523 524 * pname:sType is a elink:VkStructureType value identifying this structure. 525 * pname:pNext is `NULL` or a pointer to a structure extending this 526 structure. 527 * pname:pStdReferenceInfo is a pointer to a 528 code:StdVideoDecodeH264ReferenceInfo structure specifying 529 <<decode-h264-reference-info,H.264 reference information>>. 530 531This structure is specified in the pname:pNext chain of 532slink:VkVideoDecodeInfoKHR::pname:pSetupReferenceSlot, if not `NULL`, and 533the pname:pNext chain of the elements of 534slink:VkVideoDecodeInfoKHR::pname:pReferenceSlots to specify the 535codec-specific reference picture information for an <<decode-h264,H.264 536decode operation>>. 537 538[[decode-h264-active-reference-picture-info]] 539Active Reference Picture Information:: 540 541When this structure is specified in the pname:pNext chain of the elements of 542slink:VkVideoDecodeInfoKHR::pname:pReferenceSlots, one or two elements are 543added to the list of <<decode-active-reference-picture-info,active reference 544pictures>> used by the video decode operation for each element of 545slink:VkVideoDecodeInfoKHR::pname:pReferenceSlots as follows: 546 547 * If neither pname:pStdReferenceInfo->flags.top_field_flag nor 548 pname:pStdReferenceInfo->flags.bottom_field_flag is set, then the 549 picture is added as a frame reference to the list of active reference 550 pictures. 551 * If pname:pStdReferenceInfo->flags.top_field_flag is set, then the 552 picture is added as a top field reference to the list of active 553 reference pictures. 554 * If pname:pStdReferenceInfo->flags.bottom_field_flag is set, then the 555 picture is added as a bottom field reference to the list of active 556 reference pictures. 557 * For each added reference picture, the corresponding image subregion used 558 is determined according to the <<decode-h264-picture-data-access,H.264 559 Decode Picture Data Access>> section. 560 * Each added reference picture is associated with the <<dpb-slot,DPB 561 slot>> index specified in the pname:slotIndex member of the 562 corresponding element of 563 slink:VkVideoDecodeInfoKHR::pname:pReferenceSlots. 564 * Each added reference picture is associated with the 565 <<decode-h264-reference-info,H.264 reference information>> provided in 566 pname:pStdReferenceInfo. 567 568[NOTE] 569.Note 570==== 571When both the top and bottom field of an interlaced frame currently 572associated with a DPB slot is intended to be used as an active reference 573picture and both fields are stored in the same image subregion (which is the 574case when using 575ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR 576which stores the two fields at even and odd scanlines of the same image 577subregion), both references have to be provided through a single 578slink:VkVideoReferenceSlotInfoKHR structure that has both 579code:flags.top_field_flag and code:flags.bottom_field_flag set in the 580code:StdVideoDecodeH264ReferenceInfo structure pointed to by the 581pname:pStdReferenceInfo member of the slink:VkVideoDecodeH264DpbSlotInfoKHR 582structure included in the corresponding slink:VkVideoReferenceSlotInfoKHR 583structure's pname:pNext chain. 584However, this approach can only be used when both fields are stored in the 585same image subregion. 586If that is not the case (e.g. when using 587ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR 588which requires separate pname:codedOffset values for the two fields and also 589allows storing the two fields of a frame in separate image layers or 590entirely separate images), then a separate slink:VkVideoReferenceSlotInfoKHR 591structure needs to be provided for referencing the two fields, each only 592setting one of code:flags.top_field_flag or code:flags.bottom_field_flag, 593and providing the appropriate video picture resource information in 594slink:VkVideoReferenceSlotInfoKHR::pname:pPictureResource. 595==== 596 597[[decode-h264-reconstructed-picture-info]] 598Reconstructed Picture Information:: 599 600When this structure is specified in the pname:pNext chain of 601slink:VkVideoDecodeInfoKHR::pname:pSetupReferenceSlot, the information 602related to the <<decode-reconstructed-picture-info,reconstructed picture>> 603is defined as follows: 604 605 * If neither pname:pStdReferenceInfo->flags.top_field_flag nor 606 pname:pStdReferenceInfo->flags.bottom_field_flag is set, then the 607 picture represents a frame. 608 * If pname:pStdReferenceInfo->flags.top_field_flag is set, then the 609 picture represents a field, specifically, the top field of the frame. 610 * If pname:pStdReferenceInfo->flags.bottom_field_flag is set, then the 611 picture represents a field, specifically, the bottom field of the frame. 612 * The image subregion used is determined according to the 613 <<decode-h264-picture-data-access,H.264 Decode Picture Data Access>> 614 section. 615 * The reconstructed picture is used to <<dpb-slot-states,activate>> the 616 <<dpb-slot,DPB slot>> with the index specified in 617 slink:VkVideoDecodeInfoKHR::pname:pSetupReferenceSlot->slotIndex. 618 * The reconstructed picture is associated with the 619 <<decode-h264-reference-info,H.264 reference information>> provided in 620 pname:pStdReferenceInfo. 621 622[[decode-h264-reference-info]] 623Std Reference Information:: 624 625The members of the code:StdVideoDecodeH264ReferenceInfo structure pointed to 626by pname:pStdReferenceInfo are interpreted as follows: 627 628 * code:flags.top_field_flag is used to indicate whether the reference is 629 used as top field reference; 630 * code:flags.bottom_field_flag is used to indicate whether the reference 631 is used as bottom field reference; 632 * code:flags.used_for_long_term_reference is used to indicate whether the 633 picture is marked as "`used for long-term reference`" as defined in 634 section 8.2.5.1 of the <<itu-t-h264,ITU-T H.264 Specification>>; 635 * code:flags.is_non_existing is used to indicate whether the picture is 636 marked as "`non-existing`" as defined in section 8.2.5.2 of the 637 <<itu-t-h264,ITU-T H.264 Specification>>; 638 * all other members are interpreted as defined in section 8.2 of the 639 <<itu-t-h264,ITU-T H.264 Specification>>. 640 641include::{generated}/validity/structs/VkVideoDecodeH264DpbSlotInfoKHR.adoc[] 642-- 643 644 645[[decode-h264-requirements]] 646=== H.264 Decode Requirements 647 648This section describes the required: H.264 decoding capabilities for 649physical devices that have at least one queue family that supports the video 650codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, as 651returned by flink:vkGetPhysicalDeviceQueueFamilyProperties2 in 652slink:VkQueueFamilyVideoPropertiesKHR::pname:videoCodecOperations. 653 654.Required <<video-std-header-version,Video Std Header Versions>> 655[options="header"] 656|==== 657| Video Std Header Name | Version 658| `vulkan_video_codec_h264std_decode` | 1.0.0 659|==== 660