1// Copyright 2018-2021 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[decode-h264]] 6== Video Decode of AVC (ITU-T H.264) 7 8This extension adds H.264 codec specific structures needed for decode 9session to execute decode jobs which include H.264 sequence header, picture 10parameter header and quantization matrix etc. 11Unless otherwise noted, all references to the H.264 specification are to the 122010 edition published by the ITU-T, dated March 2010. 13This specification is available at http://www.itu.int/rec/T-REC-H.264. 14 15 16=== H.264 decode profile 17 18A H.264 decode profile is specified using slink:VkVideoDecodeH264ProfileEXT 19chained to slink:VkVideoProfileKHR when the codec-operation in 20slink:VkVideoProfileKHR is 21ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT. 22 23[open,refpage='VkVideoDecodeH264ProfileEXT',desc='Structure specifying H.264 decode profile',type='structs'] 24-- 25The sname:VkVideoDecodeH264ProfileEXT structure is defined as: 26 27include::{generated}/api/structs/VkVideoDecodeH264ProfileEXT.txt[] 28 29 * pname:sType is the type of this structure. 30 * pname:pNext is `NULL` or a pointer to a structure extending this 31 structure. 32 * pname:stdProfileIdc is a code:StdVideoH264ProfileIdc value specifying 33 the H.264 codec profile IDC 34 * pname:pictureLayout is a bitmask of 35 elink:VkVideoDecodeH264PictureLayoutFlagBitsEXT specifying the layout of 36 the decoded picture's contents depending on the nature (progressive vs. 37 interlaced) of the input content. 38 39[NOTE] 40.Note 41==== 42When passing sname:VkVideoDecodeH264ProfileEXT to 43flink:vkCreateVideoSessionKHR in the pname:pNext chain of 44slink:VkVideoSessionCreateInfoKHR, requests for a pname:pictureLayout not 45supported by the implementation will result in failure of the command. 46==== 47 48.Valid Usage 49**** 50 * [[VUID-VkVideoDecodeH264ProfileEXT-pNext-06259]] 51 If the slink:VkVideoDecodeH264ProfileEXT structure is included in the 52 pname:pNext chain of the slink:VkVideoCapabilitiesKHR structure passed 53 to flink:vkGetPhysicalDeviceVideoCapabilitiesKHR, the value in 54 pname:pictureLayout is treated as a bitmask of requested picture 55 layouts. 56 It is always valid to use the value 57 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT as the 58 implementation is guaranteed to support decoding of progressive content. 59 * [[VUID-VkVideoDecodeH264ProfileEXT-pNext-06260]] 60 If the slink:VkVideoDecodeH264ProfileEXT structure is included in the 61 pname:pNext chain of the slink:VkVideoSessionCreateInfoKHR structure 62 passed to flink:vkCreateVideoSessionKHR, the value in 63 pname:pictureLayout must: be exactly one of 64 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT, 65 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_EXT 66 or 67 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_EXT. 68**** 69 70include::{generated}/validity/structs/VkVideoDecodeH264ProfileEXT.txt[] 71-- 72 73[open,refpage='VkVideoDecodeH264PictureLayoutFlagsEXT',desc='Bitmask of VkVideoDecodeH264PictureLayoutFlagBitsEXT',type='flags'] 74-- 75include::{generated}/api/flags/VkVideoDecodeH264PictureLayoutFlagsEXT.txt[] 76 77tname:VkVideoDecodeH264PictureLayoutFlagsEXT is a bitmask type for setting a 78mask of zero or more elink:VkVideoDecodeH264PictureLayoutFlagBitsEXT. 79-- 80 81[open,refpage='VkVideoDecodeH264PictureLayoutFlagBitsEXT',desc='H.264 video decode picture layout flags',type='enums'] 82-- 83The H.264 video decode picture layout flags are defined with the following 84enum: 85 86include::{generated}/api/enums/VkVideoDecodeH264PictureLayoutFlagBitsEXT.txt[] 87 88 * ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT specifies 89 support for progressive content. 90 This flag has the value `0`. 91 * ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_EXT 92 specifies support for or use of a picture layout for interlaced content 93 where all lines belonging to the first field are decoded to the 94 even-numbered lines within the picture resource, and all lines belonging 95 to the second field are decoded to the odd-numbered lines within the 96 picture resource. 97 * ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_EXT 98 specifies support for or use of a picture layout for interlaced content 99 where all lines belonging to the first field are grouped together in a 100 single plane, followed by another plane containing all lines belonging 101 to the second field. 102-- 103 104 105=== Selecting a H.264 decode profile 106 107When using flink:vkGetPhysicalDeviceVideoCapabilitiesKHR to query the 108capabilities for the input pname:pVideoProfile with 109pname:videoCodecOperation specified as 110ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT, a 111slink:VkVideoDecodeH264ProfileEXT structure must: be chained to 112slink:VkVideoProfileKHR to select a H.264 decode profile. 113If supported, the implementation returns the capabilities associated with 114the specified H.264 decode profile. 115The requirement is similar when querying supported image formats using 116flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR. 117 118A supported H.264 decode profile must: be selected when creating a video 119session by chaining slink:VkVideoDecodeH264ProfileEXT to the 120slink:VkVideoProfileKHR field of slink:VkVideoSessionCreateInfoKHR. 121 122 123=== Capabilities 124 125[open,refpage='VkVideoDecodeH264CapabilitiesEXT',desc='Structure specifying H.264 decode capabilities',type='structs'] 126-- 127When using flink:vkGetPhysicalDeviceVideoCapabilitiesKHR to query the 128capabilities for the input pname:pVideoProfile with 129pname:videoCodecOperation specified as 130ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT, a 131slink:VkVideoDecodeH264CapabilitiesEXT structure must: be chained to 132slink:VkVideoCapabilitiesKHR to get this H.264 decode profile specific 133capabilities. 134 135The slink:VkVideoDecodeH264CapabilitiesEXT structure is defined as: 136 137include::{generated}/api/structs/VkVideoDecodeH264CapabilitiesEXT.txt[] 138 139 * pname:sType is the type of this structure. 140 * pname:pNext is `NULL` or a pointer to a structure extending this 141 structure. 142 * pname:maxLevel is the maximum H.264 level supported by the device. 143 * pname:fieldOffsetGranularity - if Interlaced Video Content is suported, 144 the maximum field offset granularity supported for the picture resource. 145 * pname:stdExtensionVersion is a slink:VkExtensionProperties structure 146 specifying the H.264 extension name and version supported by this 147 implementation. 148 149include::{generated}/validity/structs/VkVideoDecodeH264CapabilitiesEXT.txt[] 150-- 151 152 153=== Create Information 154 155[open,refpage='VkVideoDecodeH264SessionCreateInfoEXT',desc='Structure specifies H.264 decode session creation parameters',type='structs'] 156-- 157A slink:VkVideoDecodeH264SessionCreateInfoEXT structure can: be chained to 158slink:VkVideoSessionCreateInfoKHR when the function 159flink:vkCreateVideoSessionKHR is called to create a video session for H.264 160decode. 161 162The slink:VkVideoDecodeH264SessionCreateInfoEXT structure is defined as: 163 164include::{generated}/api/structs/VkVideoDecodeH264SessionCreateInfoEXT.txt[] 165 166 * pname:sType is the type of this structure. 167 * pname:pNext is `NULL` or a pointer to a structure extending this 168 structure. 169 * pname:flags is reserved for future use. 170 * pname:pStdExtensionVersion is a pointer to a slink:VkExtensionProperties 171 structure specifying the H.264 codec extensions defined in 172 code:StdVideoH264Extensions. 173 174include::{generated}/validity/structs/VkVideoDecodeH264SessionCreateInfoEXT.txt[] 175-- 176 177[open,refpage='VkVideoDecodeH264CreateFlagsEXT',desc='Reserved for future use',type='flags'] 178-- 179include::{generated}/api/flags/VkVideoDecodeH264CreateFlagsEXT.txt[] 180 181tname:VkVideoDecodeH264CreateFlagsEXT is a bitmask type for setting a mask, 182but is currently reserved for future use. 183-- 184 185 186=== Decoder Parameter Sets 187 188To reduce parameter traffic during decoding, the decoder parameter set 189object supports storing H.264 SPS/PPS parameter sets that may: be later 190referenced during decoding. 191 192[open,refpage='VkVideoDecodeH264SessionParametersCreateInfoEXT',desc='Structure specifies H.264 decoder parameter set information',type='structs'] 193-- 194A slink:VkVideoDecodeH264SessionParametersCreateInfoEXT structure holding 195one H.264 SPS and at least one H.264 PPS paramater set must: be chained to 196slink:VkVideoSessionParametersCreateInfoKHR when calling 197flink:vkCreateVideoSessionParametersKHR to store these parameter set(s) with 198the decoder parameter set object for later reference. 199The provided H.264 SPS/PPS parameters must: be within the limits specified 200during decoder creation for the decoder specified in 201slink:VkVideoSessionParametersCreateInfoKHR. 202 203The slink:VkVideoDecodeH264SessionParametersCreateInfoEXT structure is 204defined as: 205 206include::{generated}/api/structs/VkVideoDecodeH264SessionParametersCreateInfoEXT.txt[] 207 208 * pname:sType is the type of this structure. 209 * pname:pNext is `NULL` or a pointer to a structure extending this 210 structure. 211 * pname:maxSpsStdCount is the maximum number of SPS parameters that the 212 sname:VkVideoSessionParametersKHR can contain. 213 * pname:maxPpsStdCount is the maximum number of PPS parameters that the 214 sname:VkVideoSessionParametersKHR can contain. 215 * pname:pParametersAddInfo is `NULL` or a pointer to a 216 slink:VkVideoDecodeH264SessionParametersAddInfoEXT structure specifying 217 H.264 parameters to add upon object creation. 218 219include::{generated}/validity/structs/VkVideoDecodeH264SessionParametersCreateInfoEXT.txt[] 220-- 221 222[open,refpage='VkVideoDecodeH264SessionParametersAddInfoEXT',desc='Structure specifies H.264 decoder parameter set information',type='structs'] 223-- 224include::{generated}/api/structs/VkVideoDecodeH264SessionParametersAddInfoEXT.txt[] 225 226 * pname:sType is the type of this structure. 227 * pname:pNext is `NULL` or a pointer to a structure extending this 228 structure. 229 * pname:spsStdCount is the number of SPS elements in pname:pSpsStd. 230 Its value must: be less than or equal to the value of 231 pname:maxSpsStdCount. 232 * pname:pSpsStd is a pointer to an array of 233 code:StdVideoH264SequenceParameterSet structures representing H.264 234 sequence parameter sets. 235 Each element of the array must: have a unique H.264 SPS ID. 236 * pname:ppsStdCount is the number of PPS provided in pname:pPpsStd. 237 Its value must: be less than or equal to the value of 238 pname:maxPpsStdCount. 239 * pname:pPpsStd is a pointer to an array of 240 code:StdVideoH264PictureParameterSet structures representing H.264 241 picture parameter sets. 242 Each element of the array must: have a unique H.264 SPS-PPS ID pair. 243 244.Valid Usage 245**** 246 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-spsStdCount-04822]] 247 The values of pname:spsStdCount and pname:ppsStdCount must: be less than 248 or equal to the values of pname:maxSpsStdCount and pname:maxPpsStdCount, 249 respectively 250 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-maxSpsStdCount-04823]] 251 When the pname:maxSpsStdCount number of parameters of type 252 StdVideoH264SequenceParameterSet in the Video Session Parameters object 253 is reached, no additional parameters of that type can be added to this 254 object. 255 ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made 256 to add additional data to this object at this point 257 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-maxPpsStdCount-04824]] 258 When the pname:maxPpsStdCount number of parameters of type 259 StdVideoH264PictureParameterSet in the Video Session Parameters object 260 is reached, no additional parameters of that type can be added to this 261 object. 262 ename:VK_ERROR_TOO_MANY_OBJECTS will be returned if an attempt is made 263 to add additional data to this object at this point 264 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-None-04825]] 265 Each entry to be added must: have a unique, to the rest of the parameter 266 array entries and the existing parameters in the Video Session 267 Parameters Object that is being updated, SPS-PPS IDs 268 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-None-04826]] 269 Parameter entries that already exist in Video Session Parameters object 270 with a particular SPS-PPS IDs cannot: be replaced nor updated 271 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-None-04827]] 272 When creating a new object using a Video Session Parameters as a 273 template, the array's parameters with the same SPS-PPS IDs as the ones 274 from the template take precedence 275 * [[VUID-VkVideoDecodeH264SessionParametersAddInfoEXT-None-04828]] 276 SPS/PPS parameters must: comply with the limits specified in 277 slink:VkVideoSessionCreateInfoKHR during Video Session creation 278**** 279 280include::{generated}/validity/structs/VkVideoDecodeH264SessionParametersAddInfoEXT.txt[] 281-- 282 283 284=== Picture Decoding 285 286To decode a picture, the structure slink:VkVideoDecodeH264PictureInfoEXT 287may: be chained to slink:VkVideoDecodeInfoKHR when calling 288flink:vkCmdDecodeVideoKHR. 289 290[open,refpage='VkVideoDecodeH264PictureInfoEXT',desc='Structure specifies H.264 decode picture parameters when decoding a picture',type='structs'] 291-- 292The structure slink:VkVideoDecodeH264PictureInfoEXT representing a picture 293decode operation is defined as: 294 295include::{generated}/api/structs/VkVideoDecodeH264PictureInfoEXT.txt[] 296 297 * pname:sType is the type of this structure. 298 * pname:pNext is `NULL` or a pointer to a structure extending this 299 structure. 300 * pname:pStdPictureInfo is a pointer to a 301 code:StdVideoDecodeH264PictureInfo structure specifying the codec 302 standard specific picture information from the H.264 specification. 303 * pname:slicesCount is the number of slices in this picture. 304 * pname:pSlicesDataOffsets is a pointer to an array of pname:slicesCount 305 offsets indicating the start offset of each slice within the bitstream 306 buffer. 307 308include::{generated}/validity/structs/VkVideoDecodeH264PictureInfoEXT.txt[] 309-- 310 311[open,refpage='VkVideoDecodeH264DpbSlotInfoEXT',desc='Structure specifies H.264 decode DPB picture information',type='structs'] 312-- 313The slink:VkVideoDecodeH264DpbSlotInfoEXT structure correlates a DPB Slot 314index with codec-specific information and is defined as: 315 316include::{generated}/api/structs/VkVideoDecodeH264DpbSlotInfoEXT.txt[] 317 318 * pname:sType is the type of this structure. 319 * pname:pStdReferenceInfo is a pointer to a 320 code:StdVideoDecodeH264ReferenceInfo structure specifying the codec 321 standard specific picture reference information from the H.264 322 specification. 323 324include::{generated}/validity/structs/VkVideoDecodeH264DpbSlotInfoEXT.txt[] 325-- 326 327[open,refpage='VkVideoDecodeH264MvcEXT',desc='Structure specifies parameters of mvc views',type='structs'] 328-- 329The slink:VkVideoDecodeH264MvcEXT structure is defined as: 330 331include::{generated}/api/structs/VkVideoDecodeH264MvcEXT.txt[] 332 333 * pname:sType is the type of this structure. 334 * pname:pNext is `NULL` or a pointer to a structure extending this 335 structure. 336 * pname:pStdMvc is a pointer to a code:StdVideoDecodeH264Mvc structure 337 specifying H.264 codec specification information for MVC. 338 339When the content type is H.264 MVC, a slink:VkVideoDecodeH264MvcEXT 340structure must: be chained to slink:VkVideoDecodeH264PictureInfoEXT. 341 342include::{generated}/validity/structs/VkVideoDecodeH264MvcEXT.txt[] 343-- 344