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