summaryrefslogtreecommitdiff
path: root/chapters/videocoding.adoc
blob: d6717d0cbfabd796942705c45c57ffc897a25f15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
// Copyright 2018-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[[video-coding]]
= Video Coding

Vulkan implementations may: expose one or more queue families supporting
video coding operations.
These operations are performed by recording them into a command buffer
within a <<video-coding-scope,video coding scope>>, and submitting them to
queues with compatible video coding capabilities.

The Vulkan video functionalities are designed to be made available through a
set of APIs built on top of each other, consisting of:

  * A core API providing common video coding functionalities,
  * APIs providing codec-independent video decode and video encode related
    functionalities, respectively,
  * Additional codec-specific APIs built on top of those.

This chapter details the fundamental components and operations of these.


[[video-picture-resources]]
== Video Picture Resources

In the context of video coding, multidimensional arrays of image data that
can: be used as the source or target of video coding operations are referred
to as _video picture resources_.
They may: store additional metadata that includes implementation-private
information used during the execution of video coding operations, as
discussed later.

Video picture resources are backed by slink:VkImage objects.
Individual subregions of slink:VkImageView objects created from such
resources can: be used as
ifdef::VK_KHR_video_decode_queue[]
<<decode-output-picture,decode output pictures>>,
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
<<encode-input-picture,encode input pictures>>,
endif::VK_KHR_video_encode_queue[]
<<reconstructed-picture,reconstructed pictures>>, and/or
<<reference-picture, reference pictures>>.

The parameters of a video picture resource are specified using a
sname:VkVideoPictureResourceInfoKHR structure.

[open,refpage='VkVideoPictureResourceInfoKHR',desc='Structure specifying the parameters of a video picture resource',type='structs']
--
The sname:VkVideoPictureResourceInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoPictureResourceInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:codedOffset is the offset in texels of the image subregion to use.
  * pname:codedExtent is the size in pixels of the coded image data.
  * pname:baseArrayLayer is the array layer of the image view specified in
    pname:imageViewBinding to use as the video picture resource.
  * pname:imageViewBinding is an image view representing the video picture
    resource.

[[video-image-subresource-reference]]
The image subresource referred to by such a structure is defined as the
image array layer index specified in pname:baseArrayLayer relative to the
image subresource range the image view specified in pname:imageViewBinding
was created with.

The meaning of the pname:codedOffset and pname:codedExtent depends on the
command and context the video picture resource is used in, as well as on the
used <<video-profiles,video profile>> and corresponding codec-specific
semantics, as described later.

[[video-picture-resource-uniqueness]]
A video picture resource is uniquely defined by the image subresource
referred to by an instance of this structure, together with the
pname:codedOffset and pname:codedExtent members that identify the image
subregion within the image subresource referenced corresponding to the video
picture resource according to the particular codec-specific semantics.

Accesses to image data within a video picture resource happen at the
granularity indicated by
slink:VkVideoCapabilitiesKHR::pname:pictureAccessGranularity, as returned by
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the used <<video-profiles,
video profile>>.
As a result, given an effective image subregion corresponding to a video
picture resource, the actual image subregion accessed may: be larger than
that as it may: include additional padding texels due to the picture access
granularity.
Any writes performed by video coding operations to such padding texels will
result in undefined: texel values.

[[video-picture-resource-matching]]
Two video picture resources match if they refer to the same image
subresource and they specify identical pname:codedOffset and
pname:codedExtent values.

.Valid Usage
****
  * [[VUID-VkVideoPictureResourceInfoKHR-baseArrayLayer-07175]]
    pname:baseArrayLayer must: be less than the
    slink:VkImageViewCreateInfo::pname:subresourceRange.layerCount specified
    when the image view pname:imageViewBinding was created
****

include::{generated}/validity/structs/VkVideoPictureResourceInfoKHR.adoc[]
--


[[dpb]]
== Decoded Picture Buffer

[[reconstructed-picture]]
An integral part of video coding pipelines is the reconstruction of pictures
from a compressed video bitstream.
A _reconstructed picture_ is a <<video-picture-resources,video picture
resource>> resulting from this process.

[[reference-picture]]
Such reconstructed pictures can: be used as _reference pictures_ in
subsequent video coding operations to provide predictions of the values of
samples of subsequently decoded or encoded pictures.
The correct use of such reconstructed pictures as reference pictures is
driven by the video compression standard, the implementation, and the
application-specific use cases.

[[active-reference-pictures]]
The list of reference pictures used to provide such predictions within a
single video coding operation is referred to as the list of _active
reference pictures_.

The _decoded picture buffer (DPB)_ is an indexed data structure that
maintains the set of reference pictures available to be used in video coding
operations.
[[dpb-slot]] Individual indexed entries of the DPB are referred to as the
_decoded picture buffer (DPB) slots_.
[[dpb-capacity]] The range of valid DPB slot indices is between zero and
`N-1`, where `N` is the capacity of the DPB.
Each DPB slot can: refer to a reference picture containing a _video frame_
ifdef::VK_KHR_video_decode_h264[]
or can: refer to up to two reference pictures containing the top and/or
bottom _fields_ that, when both present, together represent a full _video
frame_
endif::VK_KHR_video_decode_h264[]
.

[[dpb-state-and-backing-store]]
In Vulkan, the state and the backing store of the DPB is separated as
follows:

  * The state of individual DPB slots is maintained by <<video-session,video
    session>> objects.
  * The backing store of DPB slots is provided by subregions of
    slink:VkImage objects used as <<video-picture-resources,video picture
    resources>>.

In addition, the implementation may: also maintain opaque metadata
associated with DPB slots, including:

  * [[reference-metadata]] _Reference picture metadata_ corresponding to the
    video picture resource associated with the DPB slot.

Such metadata may: be stored by the implementation as part of the DPB slot
state maintained by the video session, or as part of the video picture
resource backing the DPB slot.

Any metadata stored in the video picture resources backing DPB slots are
independent of the video session used to store it, hence such video picture
resources can: be shared with other video sessions.
Correspondingly, any metadata that is dependent on the video session will
always be stored as part of the DPB slot state maintained by that video
session.

The responsibility of managing the DPB is split between the application and
the implementation as follows:

  * The application maintains the association between <<dpb-slot,DPB slot>>
    indices and corresponding <<video-picture-resources,video picture
    resources>>.
  * The implementation maintains global and per-slot opaque
    <<reference-metadata,reference picture metadata>>.

In addition, the application is also responsible for managing the mapping
between the codec-specific picture IDs and DPB slots, and any other
codec-specific states unless otherwise specified.

[[dpb-slot-states]]
=== DPB Slot States

At a given time, each DPB slot is either in _active_ or _inactive_ state.
Initially, all DPB slots managed by a <<video-session,video session>> are in
_inactive_ state.

A DPB slot can: be _activated_ by using it as the target of picture
reconstruction in a video coding operation with the reconstructed picture
requested to be set up as a reference picture, according to the
codec-specific semantics, changing its state to _active_ and associating it
with a _picture reference_ to the <<reconstructed-picture,reconstructed
pictures>>.

Some video coding standards allow multiple picture references to be
associated with a single DPB slot.
In this case the state of the individual picture references can: be
independently updated.

ifdef::VK_KHR_video_decode_h264[]
[NOTE]
.Note
====
As an example, H.264 decoding allows associating a separate top field and
bottom field picture with the same DPB slot.
====
endif::VK_KHR_video_decode_h264[]

As part of reference picture setup, the implementation may: also generate
<<reference-metadata,reference picture metadata>>.
Such reference picture metadata is specific to each picture reference
associated with the DPB slot.

If such a video coding operation completes successfully, the activated DPB
slot will have a _valid picture reference_ and the <<reconstructed-picture,
reconstructed picture>> is associated with the DPB slot.
ifdef::VK_KHR_video_decode_h264[]
This is true even if the DPB slot is used as the target of a picture
reconstruction that only sets up a top field or bottom field reference
picture and thus does not yet refer to a complete frame.
endif::VK_KHR_video_decode_h264[]
However, if any data provided as input to such a video coding operation is
not compliant to the video compression standard used, that video coding
operation may: complete unsuccessfully, in which case the activated DPB slot
will have an _invalid picture reference_.
ifdef::VK_KHR_video_decode_h264[]
This is true even if the DPB slot previously had a valid picture reference
to a top field or bottom field reference picture, but the reconstruction of
the other field corresponding to the DPB slot failed.
endif::VK_KHR_video_decode_h264[]

The application can: use <<queries,queries>> to get feedback about the
outcome of video coding operations and use the resulting
elink:VkQueryResultStatusKHR value to determine whether the video coding
operation completed successfully (result status is positive) or
unsuccessfully (result status is negative).

Using a <<reference-picture,reference picture>> associated with a DPB slot
that has an _invalid picture reference_ as an <<active-reference-pictures,
active reference picture>> in subsequent video coding operations is legal,
however, the contents of the outputs of such operations are undefined:, and
any DPB slots activated by such video coding operations will also have an
_invalid picture reference_.
This is true even if such video coding operations may: otherwise complete
successfully.

A DPB slot can: also be _deactivated_ by the application, changing its state
to _inactive_ and invalidating any picture references and
<<reference-metadata,reference picture metadata>> associated with the DPB
slot.

If an already active DPB slot is used as the target of picture
reconstruction in a video coding operation, but the decoded picture is not
requested to be set up as a reference picture, according to the
codec-specific semantics, no reference picture setup happens and the
corresponding picture reference and <<reference-metadata,reference picture
metadata>> is invalidated within the DPB slot.
If the DPB slot no longer has any associated picture references after such
an operation, the DPB slot is implicitly deactivated.

ifdef::VK_KHR_video_decode_h264[]
If an already active DPB slot is used as the target of picture
reconstruction when decoding a field picture that is not marked as
reference, then the behavior is as follows:

  * If the DPB slot is currently associated with a frame, then the DPB slot
    is deactivated.
  * If the DPB slot is not currently associated with a top field picture and
    the decoded picture is a top field picture, or if the DPB slot is not
    currently associated with a bottom field picture and the decoded picture
    is a bottom field picture, then the other field picture association of
    the DPB slot, if any, is not disturbed.
  * If the DPB slot is currently associated with a top field picture and the
    decoded picture is a top field picture, or if the DPB slot is currently
    associated with a bottom field picture and the decoded picture is a
    bottom field picture, then that picture association is invalidated,
    without disturbing the other field picture association, if any.
    If the DPB slot no longer has any associated picture references after
    such an operation, the DPB slot is implicitly deactivated.
endif::VK_KHR_video_decode_h264[]

A DPB slot can: be activated with a new frame even if it is already active.
In this case all previous associations of the DPB slots with
<<reference-picture,reference pictures>> are replaced with an association
with the <<reconstructed-picture,reconstructed picture>> used to activate
it.

ifdef::VK_KHR_video_decode_h264[]
If an already active DPB slot is activated with a reconstructed field
picture, then the behavior is as follows:

  * If the DPB slot is currently associated with a frame, then that
    association is replaced with an association with the reconstructed field
    picture used to activate it.
  * If the DPB slot is not currently associated with a top field picture and
    the DPB slot is activated with a top field picture, or if the DPB slot
    is not currently associated with a bottom field picture and the DPB slot
    is activated with a bottom field picture, then the DPB slot is
    associated with the reconstructed field picture used to activate it,
    without disturbing the other field picture association, if any.
  * If the DPB slot is currently associated with a top field picture and the
    DPB slot is activated with a new top field picture, or if the DPB slot
    is currently associated with a bottom field picture and the DPB slot is
    activated with a new bottom field picture, then that association is
    replaced with an association with the reconstructed field picture used
    to activate it, without disturbing the other field picture association,
    if any.
endif::VK_KHR_video_decode_h264[]


[[video-profiles]]
== Video Profiles

[open,refpage='VkVideoProfileInfoKHR',desc='Structure specifying a video profile',type='structs']
--
The sname:VkVideoProfileInfoKHR structure is defined as follows:

include::{generated}/api/structs/VkVideoProfileInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:videoCodecOperation is a elink:VkVideoCodecOperationFlagBitsKHR
    value specifying a video codec operation.
  * pname:chromaSubsampling is a bitmask of
    elink:VkVideoChromaSubsamplingFlagBitsKHR specifying video chroma
    subsampling information.
  * pname:lumaBitDepth is a bitmask of
    elink:VkVideoComponentBitDepthFlagBitsKHR specifying video luma bit
    depth information.
  * pname:chromaBitDepth is a bitmask of
    elink:VkVideoComponentBitDepthFlagBitsKHR specifying video chroma bit
    depth information.

Video profiles are provided as input to video capability queries such as
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR or
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR, as well as when creating
resources to be used by video coding operations such as images, buffers,
query pools, and video sessions.

The full description of a video profile is specified by an instance of this
structure, and the codec-specific and auxiliary structures provided in its
pname:pNext chain.

[[video-profile-error-codes]]
When this structure is specified as an input parameter to
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR, or through the
pname:pProfiles member of a slink:VkVideoProfileListInfoKHR structure in the
pname:pNext chain of the input parameter of a query command such as
flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR or
flink:vkGetPhysicalDeviceImageFormatProperties2, the following error codes
indicate specific causes of the failure of the query operation:

  * ename:VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR indicates that the
    requested video picture layout
ifdef::VK_KHR_video_decode_h264[]
    (e.g. through the pname:pictureLayout member of a
    slink:VkVideoDecodeH264ProfileInfoKHR structure included in the
    pname:pNext chain of sname:VkVideoProfileInfoKHR)
endif::VK_KHR_video_decode_h264[]
    is not supported.
  * ename:VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR indicates that
    a video profile operation specified by pname:videoCodecOperation is not
    supported.
  * ename:VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR indicates that
    video format parameters specified by pname:chromaSubsampling,
    pname:lumaBitDepth, or pname:chromaBitDepth are not supported.
  * ename:VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR indicates that the
    codec-specific parameters corresponding to the video codec operation are
    not supported.

.Valid Usage
****
  * [[VUID-VkVideoProfileInfoKHR-chromaSubsampling-07013]]
    pname:chromaSubsampling must: have a single bit set
  * [[VUID-VkVideoProfileInfoKHR-lumaBitDepth-07014]]
    pname:lumaBitDepth must: have a single bit set
  * [[VUID-VkVideoProfileInfoKHR-chromaSubsampling-07015]]
    If pname:chromaSubsampling is not
    ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR, then
    pname:chromaBitDepth must: have a single bit set
ifdef::VK_KHR_video_decode_h264[]
  * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07179]]
    If pname:videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext
    chain must: include a slink:VkVideoDecodeH264ProfileInfoKHR structure
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07180]]
    If pname:videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext
    chain must: include a slink:VkVideoDecodeH265ProfileInfoKHR structure
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-09256]]
    If pname:videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR, then the pname:pNext
    chain must: include a slink:VkVideoDecodeAV1ProfileInfoKHR structure
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07181]]
    If pname:videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pname:pNext
    chain must: include a slink:VkVideoEncodeH264ProfileInfoKHR structure
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07182]]
    If pname:videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pname:pNext
    chain must: include a slink:VkVideoEncodeH265ProfileInfoKHR structure
endif::VK_KHR_video_encode_h265[]
****

include::{generated}/validity/structs/VkVideoProfileInfoKHR.adoc[]
--

[open,refpage='VkVideoCodecOperationFlagBitsKHR',desc='Video codec operation bits',type='enums']
--
Possible values of slink:VkVideoProfileInfoKHR::pname:videoCodecOperation,
specifying the type of video coding operation and video compression standard
used by a video profile, are:

include::{generated}/api/enums/VkVideoCodecOperationFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_CODEC_OPERATION_NONE_KHR indicates no support for any
    video codec operations.
ifdef::VK_KHR_video_decode_h264[]
  * ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR specifies support for
    <<decode-h264,H.264 decode operations>>.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR specifies support for
    <<decode-h265,H.265 decode operations>>.
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR specifies support for
    <<decode-av1,AV1 decode operations>>.
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_h264[]
  * ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR specifies support for
    <<encode-h264,H.264 encode operations>>.
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR specifies support for
    <<encode-h265,H.265 encode operations>>.
endif::VK_KHR_video_encode_h265[]
--

[open,refpage='VkVideoCodecOperationFlagsKHR',desc='Bitmask of VkVideoCodecOperationFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoCodecOperationFlagsKHR.adoc[]

tname:VkVideoCodecOperationFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoCodecOperationFlagBitsKHR.
--

[open,refpage='VkVideoChromaSubsamplingFlagBitsKHR',desc='Video format chroma subsampling bits',type='enums']
--
The video format chroma subsampling is defined with the following enums:

include::{generated}/api/enums/VkVideoChromaSubsamplingFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR specifies that the
    format is monochrome.
  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR specified that the format
    is 4:2:0 chroma subsampled, i.e. the two chroma components are sampled
    horizontally and vertically at half the sample rate of the luma
    component.
  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR - the format is 4:2:2
    chroma subsampled, i.e. the two chroma components are sampled
    horizontally at half the sample rate of luma component.
  * ename:VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR - the format is 4:4:4
    chroma sampled, i.e. all three components of the {YCbCr} format are
    sampled at the same rate, thus there is no chroma subsampling.
--

Chroma subsampling is described in more detail in the
<<textures-chroma-reconstruction,Chroma Reconstruction>> section.

[open,refpage='VkVideoChromaSubsamplingFlagsKHR',desc='Bitmask of VkVideoChromaSubsamplingFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoChromaSubsamplingFlagsKHR.adoc[]

tname:VkVideoChromaSubsamplingFlagsKHR is a bitmask type for setting a mask
of zero or more elink:VkVideoChromaSubsamplingFlagBitsKHR.
--

[open,refpage='VkVideoComponentBitDepthFlagBitsKHR',desc='Video format component bit depth',type='enums']
--
Possible values for the video format component bit depth are:

include::{generated}/api/enums/VkVideoComponentBitDepthFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR specifies a component bit
    depth of 8 bits.
  * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR specifies a component bit
    depth of 10 bits.
  * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR specifies a component bit
    depth of 12 bits.
--

[open,refpage='VkVideoComponentBitDepthFlagsKHR',desc='Bitmask of VkVideoComponentBitDepthFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoComponentBitDepthFlagsKHR.adoc[]

tname:VkVideoComponentBitDepthFlagsKHR is a bitmask type for setting a mask
of zero or more elink:VkVideoComponentBitDepthFlagBitsKHR.
--

ifdef::VK_KHR_video_decode_queue[]
[open,refpage='VkVideoDecodeUsageInfoKHR',desc='Structure specifying video decode usage information',type='structs']
--
Additional information about the video decode use case can: be provided by
adding a sname:VkVideoDecodeUsageInfoKHR structure to the pname:pNext chain
of slink:VkVideoProfileInfoKHR.

The sname:VkVideoDecodeUsageInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoDecodeUsageInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:videoUsageHints is a bitmask of
    elink:VkVideoDecodeUsageFlagBitsKHR specifying hints about the intended
    use of the video decode profile.

include::{generated}/validity/structs/VkVideoDecodeUsageInfoKHR.adoc[]
--

[open,refpage='VkVideoDecodeUsageFlagBitsKHR',desc='Video decode usage flags',type='enums']
--
The following bits can: be specified in
slink:VkVideoDecodeUsageInfoKHR::pname:videoUsageHints as a hint about the
video decode use case:

include::{generated}/api/enums/VkVideoDecodeUsageFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR specifies that video
    decoding is intended to be used in conjunction with video encoding to
    transcode a video bitstream with the same and/or different codecs.
  * ename:VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR specifies that video
    decoding is intended to be used to consume a local video bitstream.
  * ename:VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR specifies that video
    decoding is intended to be used to consume a video bitstream received as
    a continuous flow over network.

[NOTE]
.Note
====
There are no restrictions on the combination of bits that can: be specified
by the application.
However, applications should: use reasonable combinations in order for the
implementation to be able to select the most appropriate mode of operation
for the particular use case.
====
--

[open,refpage='VkVideoDecodeUsageFlagsKHR',desc='Bitmask specifying the video decode usage flags',type='flags']
--
include::{generated}/api/flags/VkVideoDecodeUsageFlagsKHR.adoc[]

tname:VkVideoDecodeUsageFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoDecodeUsageFlagBitsKHR.
--
endif::VK_KHR_video_decode_queue[]

ifdef::VK_KHR_video_encode_queue[]
[open,refpage='VkVideoEncodeUsageInfoKHR',desc='Structure specifying video encode usage information',type='structs']
--
Additional information about the video encode use case can: be provided by
adding a sname:VkVideoEncodeUsageInfoKHR structure to the pname:pNext chain
of slink:VkVideoProfileInfoKHR.

The sname:VkVideoEncodeUsageInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoEncodeUsageInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:videoUsageHints is a bitmask of
    elink:VkVideoEncodeUsageFlagBitsKHR specifying hints about the intended
    use of the video encode profile.
  * pname:videoContentHints is a bitmask of
    elink:VkVideoEncodeContentFlagBitsKHR specifying hints about the content
    to be encoded using the video encode profile.
  * pname:tuningMode is a elink:VkVideoEncodeTuningModeKHR value specifying
    the tuning mode to use when encoding with the video profile.

include::{generated}/validity/structs/VkVideoEncodeUsageInfoKHR.adoc[]
--

[open,refpage='VkVideoEncodeUsageFlagBitsKHR',desc='Video encode usage flags',type='enums']
--
The following bits can: be specified in
slink:VkVideoEncodeUsageInfoKHR::pname:videoUsageHints as a hint about the
video encode use case:

include::{generated}/api/enums/VkVideoEncodeUsageFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR specifies that video
    encoding is intended to be used in conjunction with video decoding to
    transcode a video bitstream with the same and/or different codecs.
  * ename:VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR specifies that video
    encoding is intended to be used to produce a video bitstream that is
    expected to be sent as a continuous flow over network.
  * ename:VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR specifies that video
    encoding is intended to be used for real-time recording for offline
    consumption.
  * ename:VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR specifies that video
    encoding is intended to be used in a video conferencing scenario.

[NOTE]
.Note
====
There are no restrictions on the combination of bits that can: be specified
by the application.
However, applications should: use reasonable combinations in order for the
implementation to be able to select the most appropriate mode of operation
for the particular use case.
====
--

[open,refpage='VkVideoEncodeUsageFlagsKHR',desc='Bitmask specifying the video encode usage flags',type='flags']
--
include::{generated}/api/flags/VkVideoEncodeUsageFlagsKHR.adoc[]

tname:VkVideoEncodeUsageFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoEncodeUsageFlagBitsKHR.
--

[open,refpage='VkVideoEncodeContentFlagBitsKHR',desc='Video encode content flags',type='enums']
--
The following bits can: be specified in
slink:VkVideoEncodeUsageInfoKHR::pname:videoContentHints as a hint about the
encoded video content:

include::{generated}/api/enums/VkVideoEncodeContentFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR specifies that video
    encoding is intended to be used to encode camera content.
  * ename:VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR specifies that video
    encoding is intended to be used to encode desktop content.
  * ename:VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR specified that video
    encoding is intended to be used to encode rendered (e.g. game) content.

[NOTE]
.Note
====
There are no restrictions on the combination of bits that can: be specified
by the application.
However, applications should: use reasonable combinations in order for the
implementation to be able to select the most appropriate mode of operation
for the particular content type.
====
--

[open,refpage='VkVideoEncodeContentFlagsKHR',desc='Bitmask specifying the video encode content flags',type='flags']
--
include::{generated}/api/flags/VkVideoEncodeContentFlagsKHR.adoc[]

tname:VkVideoEncodeContentFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoEncodeContentFlagBitsKHR.
--

[open,refpage='VkVideoEncodeTuningModeKHR',desc='Video encode tuning mode',type='enums']
--
Possible video encode tuning mode values are as follows:

include::{generated}/api/enums/VkVideoEncodeTuningModeKHR.adoc[]

  * ename:VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR specifies the default
    tuning mode.
  * ename:VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR specifies that video
    encoding is tuned for high quality.
    When using this tuning mode, the implementation may: compromise the
    latency of video encoding operations to improve quality.
  * ename:VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR specifies that video
    encoding is tuned for low latency.
    When using this tuning mode, the implementation may: compromise quality
    to increase the performance and lower the latency of video encode
    operations.
  * ename:VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR specifies that
    video encoding is tuned for ultra-low latency.
    When using this tuning mode, the implementation may: compromise quality
    to maximize the performance and minimize the latency of video encoding
    operations.
  * ename:VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR specifies that video
    encoding is tuned for lossless encoding.
    When using this tuning mode, video encode operations produce lossless
    output.

--
endif::VK_KHR_video_encode_queue[]

[open,refpage='VkVideoProfileListInfoKHR',desc='Structure specifying one or more video profiles used in conjunction',type='structs']
--
The sname:VkVideoProfileListInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoProfileListInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:profileCount is the number of elements in the pname:pProfiles
    array.
  * pname:pProfiles is a pointer to an array of slink:VkVideoProfileInfoKHR
    structures.

[NOTE]
.Note
====
Video transcoding is an example of a use case that necessitates the
specification of multiple profiles in various contexts.
====

When the application provides a video decode profile and one or more video
encode profiles in the profile list, the implementation ensures that any
capabilitities returned or resources created are suitable for the video
transcoding use cases without the need for manual data transformations.

.Valid Usage
****
  * [[VUID-VkVideoProfileListInfoKHR-pProfiles-06813]]
    pname:pProfiles must: not contain more than one element whose
    pname:videoCodecOperation member specifies a decode operation
****

include::{generated}/validity/structs/VkVideoProfileListInfoKHR.adoc[]
--


[[video-capabilities]]
== Video Capabilities


[[video-coding-capabilities]]
=== Video Coding Capabilities

[open,refpage='vkGetPhysicalDeviceVideoCapabilitiesKHR',desc='Query video coding capabilities',type='protos']
--
To query video coding capabilities for a specific video profile, call:

include::{generated}/api/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.adoc[]

  * pname:physicalDevice is the physical device from which to query the
    video decode or encode capabilities.
  * pname:pVideoProfile is a pointer to a slink:VkVideoProfileInfoKHR
    structure.
  * pname:pCapabilities is a pointer to a slink:VkVideoCapabilitiesKHR
    structure in which the capabilities are returned.

[[video-profile-support]]
If the <<video-profiles,video profile>> described by pname:pVideoProfile is
supported by the implementation, then this command returns ename:VK_SUCCESS
and pname:pCapabilities is filled with the capabilities supported with the
specified video profile.
Otherwise, one of the <<video-profile-error-codes, video-profile-specific
error codes>> are returned.

.Valid Usage
****
ifdef::VK_KHR_video_decode_queue[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07183]]
    If pname:pVideoProfile->videoCodecOperation specifies a decode
    operation, then the pname:pNext chain of pname:pCapabilities must:
    include a slink:VkVideoDecodeCapabilitiesKHR structure
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_decode_h264[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07184]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext
    chain of pname:pCapabilities must: include a
    slink:VkVideoDecodeH264CapabilitiesKHR structure
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07185]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext
    chain of pname:pCapabilities must: include a
    slink:VkVideoDecodeH265CapabilitiesKHR structure
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-09257]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR, then the pname:pNext
    chain of pname:pCapabilities must: include a
    slink:VkVideoDecodeAV1CapabilitiesKHR structure
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07186]]
    If pname:pVideoProfile->videoCodecOperation specifies an encode
    operation, then the pname:pNext chain of pname:pCapabilities must:
    include a slink:VkVideoEncodeCapabilitiesKHR structure
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07187]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pname:pNext
    chain of pname:pCapabilities must: include a
    slink:VkVideoEncodeH264CapabilitiesKHR structure
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07188]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pname:pNext
    chain of pname:pCapabilities must: include a
    slink:VkVideoEncodeH265CapabilitiesKHR structure
endif::VK_KHR_video_encode_h265[]
****

include::{generated}/validity/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.adoc[]
--


[open,refpage='VkVideoCapabilitiesKHR',desc='Structure describing general video capabilities for a video profile',type='structs']
--
The sname:VkVideoCapabilitiesKHR structure is defined as:

include::{generated}/api/structs/VkVideoCapabilitiesKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is a bitmask of elink:VkVideoCapabilityFlagBitsKHR
    specifying capability flags.
  * pname:minBitstreamBufferOffsetAlignment is the minimum alignment for
    bitstream buffer offsets.
  * pname:minBitstreamBufferSizeAlignment is the minimum alignment for
    bitstream buffer range sizes.
  * pname:pictureAccessGranularity is the granularity at which image access
    to video picture resources happen.
  * pname:minCodedExtent is the minimum width and height of the coded
    frames.
  * pname:maxCodedExtent is the maximum width and height of the coded
    frames.
  * pname:maxDpbSlots is the maximum number of <<dpb-slot,DPB slots>>
    supported by a single video session.
  * pname:maxActiveReferencePictures is the maximum number of
    <<active-reference-pictures,active reference pictures>> a single video
    coding operation can: use.
  * [[video-std-header-version]] pname:stdHeaderVersion is a
    slink:VkExtensionProperties structure reporting the Video Std header
    name and version supported for the video profile.

ifdef::VK_KHR_video_decode_queue[]
[NOTE]
.Note
====
It is common for video compression standards to allow using all reference
pictures associated with active DPB slots as active reference pictures,
hence for video decode profiles the values returned in pname:maxDpbSlots and
pname:maxActiveReferencePictures are often equal.
ifdef::VK_KHR_video_decode_h264[]
Similarly, in case of video decode profiles supporting field pictures the
value of pname:maxActiveReferencePictures often equals
[eq]#pname:maxDpbSlots {times} 2#.
endif::VK_KHR_video_decode_h264[]
====
endif::VK_KHR_video_decode_queue[]

include::{generated}/validity/structs/VkVideoCapabilitiesKHR.adoc[]
--

[open,refpage='VkVideoCapabilityFlagBitsKHR',desc='Video decode and encode capability bits',type='enums']
--
Bits which can: be set in slink:VkVideoCapabilitiesKHR::pname:flags are:

include::{generated}/api/enums/VkVideoCapabilityFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR indicates that video
    sessions support producing and consuming protected content.
  * [[separate-reference-images]]
    ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR indicates
    that the <<video-picture-resources,video picture resources>> associated
    with the <<dpb-slot,DPB slots>> of a video session can: be backed by
    separate sname:VkImage objects.
    If this capability flag is not present, then all DPB slots of a video
    session must: be associated with video picture resources backed by the
    same sname:VkImage object (e.g. using different layers of the same
    image).
--

[open,refpage='VkVideoCapabilityFlagsKHR',desc='Bitmask of VkVideoCapabilitiesFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoCapabilityFlagsKHR.adoc[]

tname:VkVideoCapabilityFlagsKHR is a bitmask type for setting a mask of zero
or more elink:VkVideoCapabilityFlagBitsKHR.
--


[[video-format-capabilities]]
=== Video Format Capabilities

[open,refpage='vkGetPhysicalDeviceVideoFormatPropertiesKHR',desc='Query supported video decode and encode image formats and capabilities',type='protos']
--
To enumerate the supported output, input and DPB image formats and
corresponding capabilities for a specific video profile, call:

include::{generated}/api/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.adoc[]

  * pname:physicalDevice is the physical device from which to query the
    video format properties.
  * pname:pVideoFormatInfo is a pointer to a
    slink:VkPhysicalDeviceVideoFormatInfoKHR structure specifying the usage
    and video profiles for which supported image formats and capabilities
    are returned.
  * pname:pVideoFormatPropertyCount is a pointer to an integer related to
    the number of video format properties available or queried, as described
    below.
  * pname:pVideoFormatProperties is a pointer to an array of
    slink:VkVideoFormatPropertiesKHR structures in which supported image
    formats and capabilities are returned.

If pname:pVideoFormatProperties is `NULL`, then the number of video format
properties supported for the given pname:physicalDevice is returned in
pname:pVideoFormatPropertyCount.
Otherwise, pname:pVideoFormatPropertyCount must: point to a variable set by
the user to the number of elements in the pname:pVideoFormatProperties
array, and on return the variable is overwritten with the number of values
actually written to pname:pVideoFormatProperties.
If the value of pname:pVideoFormatPropertyCount is less than the number of
video format properties supported, at most pname:pVideoFormatPropertyCount
values will be written to pname:pVideoFormatProperties, and
ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to
indicate that not all the available values were returned.

Video format properties are always queried with respect to a specific set of
video profiles.
These are specified by chaining the slink:VkVideoProfileListInfoKHR
structure to pname:pVideoFormatInfo.

For most use cases, the images are used by a single video session and a
single video profile is provided.
For a use case such as video transcoding, where a decode session output
image can: be used as encode input in one or more encode sessions, multiple
video profiles corresponding to the video sessions that will share the image
must: be provided.

If any of the <<video-profiles,video profiles>> specified via
slink:VkVideoProfileListInfoKHR::pname:pProfiles are not supported, then
this command returns one of the <<video-profile-error-codes,
video-profile-specific error codes>>.
Furthermore, if slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage
includes any image usage flags not supported by the specified video
profiles, then this command returns
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.

ifdef::VK_KHR_video_decode_queue[]
This command also returns ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR if
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage does not include
the appropriate flags as dictated by the decode capability flags returned in
slink:VkVideoDecodeCapabilitiesKHR::pname:flags for any of the profiles
specified in the slink:VkVideoProfileListInfoKHR structure provided in the
pname:pNext chain of pname:pVideoFormatInfo.

If the decode capability flags include
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR but not
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR, then in
order to query video format properties for decode DPB and output usage,
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include
both ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR and
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR.
Otherwise, the call will fail with
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.

If the decode capability flags include
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR but not
ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR, then in
order to query video format properties for decode DPB usage,
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, but not
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR.
Otherwise, the call will fail with
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.
Similarly, to query video format properties for decode output usage,
slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, but not
ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR.
Otherwise, the call will fail with
ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR.
endif::VK_KHR_video_decode_queue[]

The pname:imageUsage member of the slink:VkPhysicalDeviceVideoFormatInfoKHR
structure specifies the expected video usage flags that the returned video
formats must: support.
Correspondingly, the pname:imageUsageFlags member of each
slink:VkVideoFormatPropertiesKHR structure returned will contain at least
the same set of image usage flags.

If the implementation supports using video input, output, or DPB images of a
particular format in operations other than video decode/encode then the
pname:imageUsageFlags member of the corresponding
slink:VkVideoFormatPropertiesKHR structure returned will include additional
image usage flags indicating that.

[NOTE]
.Note
====
For most use cases, only decode or encode related usage flags are going to
be specified.
For a use case such as transcode, if the image were to be shared between
decode and encode session(s), then both decode and encode related usage
flags can: be set.
====

Multiple sname:VkVideoFormatPropertiesKHR entries may: be returned with the
same pname:format member with different pname:componentMapping,
pname:imageType, or pname:imageTiling values, as described later.

In addition, a different set of sname:VkVideoFormatPropertiesKHR entries
may: be returned depending on the pname:imageUsage member of the
sname:VkPhysicalDeviceVideoFormatInfoKHR structure, even for the same set of
video profiles, for example, based on whether encode input, encode DPB,
decode output, and/or decode DPB usage is requested.

The application can: select the parameters returned in the
sname:VkVideoFormatPropertiesKHR entries and use compatible parameters when
creating the input, output, and DPB images.
The implementation will report all image creation and usage flags that are
valid for images used with the requested video profiles but applications
should: create images only with those that are necessary for the particular
use case.

Before creating an image, the application can: obtain the complete set of
supported image format features by calling
flink:vkGetPhysicalDeviceImageFormatProperties2 using parameters derived
from the members of one of the reported sname:VkVideoFormatPropertiesKHR
entries and adding the same slink:VkVideoProfileListInfoKHR structure to the
pname:pNext chain of slink:VkPhysicalDeviceImageFormatInfo2.

The following applies to all sname:VkVideoFormatPropertiesKHR entries
returned by fname:vkGetPhysicalDeviceVideoFormatPropertiesKHR:

  * flink:vkGetPhysicalDeviceFormatProperties2 must: succeed when called
    with sname:VkVideoFormatPropertiesKHR::pname:format
  * If sname:VkVideoFormatPropertiesKHR::pname:imageTiling is
    ename:VK_IMAGE_TILING_OPTIMAL, then the pname:optimalTilingFeatures
    returned by flink:vkGetPhysicalDeviceFormatProperties2 must: include all
    format features required by the image usage flags reported in
    sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags for the format,
    as indicated in the <<format-feature-dependent-usage-flags,Format
    Feature Dependent Usage Flags>> section.
  * If sname:VkVideoFormatPropertiesKHR::pname:imageTiling is
    ename:VK_IMAGE_TILING_LINEAR, then the pname:linearTilingFeatures
    returned by flink:vkGetPhysicalDeviceFormatProperties2 must: include all
    format features required by the image usage flags reported in
    sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags for the format,
    as indicated in the <<format-feature-dependent-usage-flags,Format
    Feature Dependent Usage Flags>> section.
  * flink:vkGetPhysicalDeviceImageFormatProperties2 must: succeed when
    called with a slink:VkPhysicalDeviceImageFormatInfo2 structure
    containing the following information:
  ** The pname:pNext chain including the same
     slink:VkVideoProfileListInfoKHR structure used to call
     fname:vkGetPhysicalDeviceVideoFormatPropertiesKHR.
  ** pname:format set to the value of
     sname:VkVideoFormatPropertiesKHR::pname:format.
  ** pname:type set to the value of
     sname:VkVideoFormatPropertiesKHR::pname:imageType.
  ** pname:tiling set to the value of
     sname:VkVideoFormatPropertiesKHR::pname:imageTiling.
  ** pname:usage set to the value of
     sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags.
  ** pname:flags set to the value of
     sname:VkVideoFormatPropertiesKHR::pname:imageCreateFlags.

The pname:componentMapping member of sname:VkVideoFormatPropertiesKHR
defines the ordering of the {YCbCr} color channels from the perspective of
the video codec operations specified in slink:VkVideoProfileListInfoKHR.
For example, if the implementation produces video decode output with the
format ename:VK_FORMAT_G8_B8R8_2PLANE_420_UNORM where the blue and red
chrominance channels are swapped then the pname:componentMapping member of
the corresponding sname:VkVideoFormatPropertiesKHR structure will have the
following member values:

[source,c++]
----
components.r = VK_COMPONENT_SWIZZLE_B;        // Cb component
components.g = VK_COMPONENT_SWIZZLE_IDENTITY; // Y component
components.b = VK_COMPONENT_SWIZZLE_R;        // Cr component
components.a = VK_COMPONENT_SWIZZLE_IDENTITY; // unused, defaults to 1.0
----

.Valid Usage
****
  * [[VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-pNext-06812]]
    The pname:pNext chain of pname:pVideoFormatInfo must: include a
    slink:VkVideoProfileListInfoKHR structure with pname:profileCount
    greater than `0`
****

include::{generated}/validity/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.adoc[]
--

[open,refpage='VkPhysicalDeviceVideoFormatInfoKHR',desc='Structure specifying the codec video format',type='structs']
--
The sname:VkPhysicalDeviceVideoFormatInfoKHR structure is defined as:

include::{generated}/api/structs/VkPhysicalDeviceVideoFormatInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:imageUsage is a bitmask of elink:VkImageUsageFlagBits specifying
    the intended usage of the video images.

include::{generated}/validity/structs/VkPhysicalDeviceVideoFormatInfoKHR.adoc[]
--

[open,refpage='VkVideoFormatPropertiesKHR',desc='Structure enumerating the video image formats',type='structs']
--
The sname:VkVideoFormatPropertiesKHR structure is defined as:

include::{generated}/api/structs/VkVideoFormatPropertiesKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:format is a elink:VkFormat that specifies the format that can: be
    used with the specified video profiles and image usages.
  * pname:componentMapping defines the color channel order used for the
    format.
    pname:format along with pname:componentMapping describe how the color
    channels are ordered when producing video decoder output or are expected
    to be ordered in video encoder input, when applicable.
    If the pname:format reported does not require component swizzling then
    all members of pname:componentMapping will be set to
    ename:VK_COMPONENT_SWIZZLE_IDENTITY.
  * pname:imageCreateFlags is a bitmask of elink:VkImageCreateFlagBits
    specifying the supported image creation flags for the format.
  * pname:imageType is a elink:VkImageType that specifies the image type the
    format can: be used with.
  * pname:imageTiling is a elink:VkImageTiling that specifies the image
    tiling the format can: be used with.
  * pname:imageUsageFlags is a bitmask of elink:VkImageUsageFlagBits
    specifying the supported image usage flags for the format.

include::{generated}/validity/structs/VkVideoFormatPropertiesKHR.adoc[]
--

[[video-session]]
== Video Sessions

[open,refpage='VkVideoSessionKHR',desc='Opaque handle to a video session object',type='handles']
--
Video sessions are objects that represent and maintain the state needed to
perform video decode or encode operations using a specific video profile.

ifdef::VK_KHR_video_encode_queue[]
In case of video encode profiles this includes the current
<<encode-rate-control,rate control>> configuration and the currently set
<<encode-quality-level,video encode quality level>>.
endif::VK_KHR_video_encode_queue[]

Video sessions are represented by sname:VkVideoSessionKHR handles:

include::{generated}/api/handles/VkVideoSessionKHR.adoc[]
--


[[video-session-creation]]
=== Creating a Video Session

[open,refpage='vkCreateVideoSessionKHR',desc='Creates a video session object',type='protos']
--
To create a video session object, call:

include::{generated}/api/protos/vkCreateVideoSessionKHR.adoc[]

  * pname:device is the logical device that creates the video session.
  * pname:pCreateInfo is a pointer to a slink:VkVideoSessionCreateInfoKHR
    structure containing parameters to be used to create the video session.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.
  * pname:pVideoSession is a pointer to a slink:VkVideoSessionKHR handle in
    which the resulting video session object is returned.

The resulting video session object is said to be created with the video
codec operation specified in
pname:pCreateInfo->pVideoProfile->videoCodecOperation.

The name and version of the codec-specific Video Std header to be used with
the video session is specified by the slink:VkExtensionProperties structure
pointed to by pname:pCreateInfo->pStdHeaderVersion.
If a non-existent or unsupported Video Std header version is specified in
pname:pCreateInfo->pStdHeaderVersion->specVersion, then this command returns
ename:VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR.

[[video-session-uninitialized]]
Video session objects are created in _uninitialized_ state.
In order to transition the video session into _initial_ state, the
application must: issue a flink:vkCmdControlVideoCodingKHR command with
slink:VkVideoCodingControlInfoKHR::pname:flags including
ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR.

Video session objects also maintain the
<<dpb-state-and-backing-store,state>> of the DPB.
The number of DPB slots usable with the created video session is specified
in pname:pCreateInfo->maxDpbSlots, and each slot is initially in the
<<dpb-slot-states,inactive state>>.

Each <<dpb-slot,DPB slot>> maintained by the created video session can:
refer to a <<reference-picture,reference picture>> representing a video
frame.

ifdef::VK_KHR_video_decode_h264[]
[[decode-h264-interlaced-support]]
In addition, if the pname:videoCodecOperation member of the
slink:VkVideoProfileInfoKHR structure pointed to by
pname:pCreateInfo->pVideoProfile is
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
pname:pictureLayout member of the slink:VkVideoDecodeH264ProfileInfoKHR
structure provided in the slink:VkVideoProfileInfoKHR::pname:pNext chain is
not ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR, then the
created video session supports _interlaced_ frames and each <<dpb-slot,DPB
slot>> maintained by the created video session can: instead refer to
separate top field and bottom field <<reference-picture,reference pictures>>
that together can: represent a full video frame.
In this case, it is up to the application, driven by the video content,
whether it associates any individual DPB slot with separate top and/or
bottom field pictures or a single picture representing a full frame.
endif::VK_KHR_video_decode_h264[]

The created video session can: be used to perform video coding operations
using video frames up to the maximum size specified in
pname:pCreateInfo->maxCodedExtent.
The minimum frame size allowed is implicitly derived from
slink:VkVideoCapabilitiesKHR::pname:minCodedExtent, as returned by
flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
specified by pname:pCreateInfo->pVideoProfile.
Accordingly, the created video session is said to be created with a
pname:minCodedExtent equal to that.

ifdef::VK_KHR_video_encode_queue[]
In case of video session objects created with a video encode operation,
implementations may: return the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the
specified Video Std parameters do not adhere to the syntactic or semantic
requirements of the used video compression standard, or if values derived
from parameters according to the rules defined by the used video compression
standard do not adhere to the capabilities of the video compression standard
or the implementation.

[NOTE]
.Note
====
Applications should: not rely on the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any
command as a means to verify Video Std parameters, as implementations are
not required to report the error in any specific set of cases.
====
endif::VK_KHR_video_encode_queue[]

include::{generated}/validity/protos/vkCreateVideoSessionKHR.adoc[]
--

[open,refpage='VkVideoSessionCreateInfoKHR',desc='Structure specifying parameters of a newly created video session',type='structs']
--
The slink:VkVideoSessionCreateInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoSessionCreateInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:queueFamilyIndex is the index of the queue family the created
    video session will be used with.
  * pname:flags is a bitmask of elink:VkVideoSessionCreateFlagBitsKHR
    specifying creation flags.
  * pname:pVideoProfile is a pointer to a slink:VkVideoProfileInfoKHR
    structure specifying the video profile the created video session will be
    used with.
  * pname:pictureFormat is the image format the created video session will
    be used with.
ifdef::VK_KHR_video_decode_queue[]
    If pname:pVideoProfile->videoCodecOperation specifies a decode
    operation, then pname:pictureFormat is the image format of
    <<decode-output-picture, decode output pictures>> usable with the
    created video session.
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
    If pname:pVideoProfile->videoCodecOperation specifies an encode
    operation, then pname:pictureFormat is the image format of
    <<encode-input-picture, encode input pictures>> usable with the created
    video session.
endif::VK_KHR_video_encode_queue[]
  * pname:maxCodedExtent is the maximum width and height of the coded frames
    the created video session will be used with.
  * pname:referencePictureFormat is the image format of
    <<reference-picture,reference pictures>> stored in the <<dpb,DPB>> the
    created video session will be used with.
  * pname:maxDpbSlots is the maximum number of <<dpb-slot,DPB Slots>> that
    can: be used with the created video session.
  * pname:maxActiveReferencePictures is the maximum number of
    <<active-reference-pictures,active reference pictures>> that can: be
    used in a single video coding operation using the created video session.
  * pname:pStdHeaderVersion is a pointer to a slink:VkExtensionProperties
    structure requesting the Video Std header version to use for the
    pname:videoCodecOperation specified in pname:pVideoProfile.

.Valid Usage
****
  * [[VUID-VkVideoSessionCreateInfoKHR-protectedMemory-07189]]
    If the <<features-protectedMemory, pname:protectedMemory>> feature is
    not enabled or if slink:VkVideoCapabilitiesKHR::pname:flags does not
    include ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR, as returned
    by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
    specified by pname:pVideoProfile, then pname:flags must: not include
    ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR
ifdef::VK_KHR_video_maintenance1[]
  * [[VUID-VkVideoSessionCreateInfoKHR-flags-08371]]
    If pname:flags includes
    ename:VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, then
    <<features-videoMaintenance1,pname:videoMaintenance1>> must: be enabled
endif::VK_KHR_video_maintenance1[]
  * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-04845]]
    pname:pVideoProfile must: be a <<video-profile-support, supported video
    profile>>
  * [[VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04847]]
    pname:maxDpbSlots must: be less than or equal to
    slink:VkVideoCapabilitiesKHR::pname:maxDpbSlots, as returned by
    flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
    specified by pname:pVideoProfile
  * [[VUID-VkVideoSessionCreateInfoKHR-maxActiveReferencePictures-04849]]
    pname:maxActiveReferencePictures must: be less than or equal to
    slink:VkVideoCapabilitiesKHR::pname:maxActiveReferencePictures, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile specified by pname:pVideoProfile
  * [[VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04850]]
    If either pname:maxDpbSlots or pname:maxActiveReferencePictures is `0`,
    then both must: be `0`
  * [[VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851]]
    pname:maxCodedExtent must: be between
    slink:VkVideoCapabilitiesKHR::pname:minCodedExtent and
    slink:VkVideoCapabilitiesKHR::pname:maxCodedExtent, inclusive, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile specified by pname:pVideoProfile
ifdef::VK_KHR_video_decode_queue[]
  * [[VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-04852]]
    If pname:pVideoProfile->videoCodecOperation specifies a decode operation
    and pname:maxActiveReferencePictures is greater than `0`, then
    pname:referencePictureFormat must: be one of the supported decode DPB
    formats, as returned by
    flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
    slink:VkVideoFormatPropertiesKHR::pname:format when called with the
    pname:imageUsage member of its pname:pVideoFormatInfo parameter
    containing ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, and with a
    slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
    chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
    member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-06814]]
    If pname:pVideoProfile->videoCodecOperation specifies an encode
    operation and pname:maxActiveReferencePictures is greater than `0`, then
    pname:referencePictureFormat must: be one of the supported decode DPB
    formats, as returned by then pname:referencePictureFormat must: be one
    of the supported encode DPB formats, as returned by
    flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
    slink:VkVideoFormatPropertiesKHR::pname:format when called with the
    pname:imageUsage member of its pname:pVideoFormatInfo parameter
    containing ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR, and with a
    slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
    chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
    member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_decode_queue[]
  * [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04853]]
    If pname:pVideoProfile->videoCodecOperation specifies a decode
    operation, then pname:pictureFormat must: be one of the supported decode
    output formats, as returned by
    flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
    slink:VkVideoFormatPropertiesKHR::pname:format when called with the
    pname:imageUsage member of its pname:pVideoFormatInfo parameter
    containing ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, and with a
    slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
    chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
    member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04854]]
    If pname:pVideoProfile->videoCodecOperation specifies an encode
    operation, then pname:pictureFormat must: be one of the supported encode
    input formats, as returned by
    flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in
    slink:VkVideoFormatPropertiesKHR::pname:format when called with the
    pname:imageUsage member of its pname:pVideoFormatInfo parameter
    containing ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR, and with a
    slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext
    chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles
    member contains an element matching pname:pVideoProfile
endif::VK_KHR_video_encode_queue[]
  * [[VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190]]
    pname:pStdHeaderVersion->extensionName must: match
    slink:VkVideoCapabilitiesKHR::pname:stdHeaderVersion.extensionName, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile specified by pname:pVideoProfile
  * [[VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191]]
    pname:pStdHeaderVersion->specVersion must: be less than or equal to
    slink:VkVideoCapabilitiesKHR::pname:stdHeaderVersion.specVersion, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile specified by pname:pVideoProfile
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-08251]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the pname:pNext
    chain of this structure includes a
    slink:VkVideoEncodeH264SessionCreateInfoKHR structure, then its
    pname:maxLevelIdc member must: be less than or equal to
    slink:VkVideoEncodeH264CapabilitiesKHR::pname:maxLevelIdc, as returned
    by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
    specified in pname:pVideoProfile
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-08252]]
    If pname:pVideoProfile->videoCodecOperation is
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the pname:pNext
    chain of this structure includes a
    slink:VkVideoEncodeH265SessionCreateInfoKHR structure, then its
    pname:maxLevelIdc member must: be less than or equal to
    slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxLevelIdc, as returned
    by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
    specified in pname:pVideoProfile
endif::VK_KHR_video_encode_h265[]
****

include::{generated}/validity/structs/VkVideoSessionCreateInfoKHR.adoc[]
--

[open,refpage='VkVideoSessionCreateFlagBitsKHR',desc='Video session creation flags',type='enums']
--
Bits which can: be set in slink:VkVideoSessionCreateInfoKHR::pname:flags
are:

include::{generated}/api/enums/VkVideoSessionCreateFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR specifies that
    the video session uses protected video content.
ifdef::VK_KHR_video_encode_queue[]
  * [[encode-optimizing-overrides]]
    ename:VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR
    specifies that the implementation is allowed to
    <<encode-overrides,override>> video session parameters and other
    codec-specific encoding parameters to optimize video encode operations
    based on the use case information specified in the
    <<video-profiles,video profile>> and the used
    <<encode-quality-level,video encode quality level>>.
+
[NOTE]
.Note
====
Not specifying
ename:VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR
does not guarantee that the implementation will not do any codec-specific
parameter overrides, as certain overrides are necessary for the correct
operation of the video encoder implementation due to limitations to the
available encoding tools on that implementation.
This flag, however, enables the implementation to apply further optimizing
overrides.
====
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_maintenance1[]
  * ename:VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR specifies that
    queries within video coding scopes using the created video session are
    <<video-inline-queries,executed inline>> with video coding operations.
endif::VK_KHR_video_maintenance1[]
--

[open,refpage='VkVideoSessionCreateFlagsKHR',desc='Bitmask of VkVideoSessionCreateFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoSessionCreateFlagsKHR.adoc[]

tname:VkVideoSessionCreateFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoSessionCreateFlagBitsKHR.
--


[[video-session-destruction]]
=== Destroying a Video Session

[open,refpage='vkDestroyVideoSessionKHR',desc='Destroy video session object',type='protos']
--
To destroy a video session, call:

include::{generated}/api/protos/vkDestroyVideoSessionKHR.adoc[]

  * pname:device is the logical device that destroys the video session.
  * pname:videoSession is the video session to destroy.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.

.Valid Usage
****
  * [[VUID-vkDestroyVideoSessionKHR-videoSession-07192]]
    All submitted commands that refer to pname:videoSession must: have
    completed execution
  * [[VUID-vkDestroyVideoSessionKHR-videoSession-07193]]
    If sname:VkAllocationCallbacks were provided when pname:videoSession was
    created, a compatible set of callbacks must: be provided here
  * [[VUID-vkDestroyVideoSessionKHR-videoSession-07194]]
    If no sname:VkAllocationCallbacks were provided when pname:videoSession
    was created, pname:pAllocator must: be `NULL`
****

include::{generated}/validity/protos/vkDestroyVideoSessionKHR.adoc[]
--


[[video-session-memory-association]]
=== Video Session Memory Association

After creating a video session object, and before the object can: be used to
record video coding operations into command buffers using it, the
application must: allocate and bind device memory to the video session.
Device memory is allocated separately (see <<memory-device>>) and then
associated with the video session.

Video sessions may: have multiple memory bindings identified by unique
unsigned integer values.
Appropriate device memory must: be bound to each such memory binding before
using the video session to record command buffer commands with it.

[open,refpage='vkGetVideoSessionMemoryRequirementsKHR',desc='Get the memory requirements for a video session',type='protos']
--
To determine the memory requirements for a video session object, call:

include::{generated}/api/protos/vkGetVideoSessionMemoryRequirementsKHR.adoc[]

  * pname:device is the logical device that owns the video session.
  * pname:videoSession is the video session to query.
  * pname:pMemoryRequirementsCount is a pointer to an integer related to the
    number of memory binding requirements available or queried, as described
    below.
  * pname:pMemoryRequirements is `NULL` or a pointer to an array of
    slink:VkVideoSessionMemoryRequirementsKHR structures in which the memory
    binding requirements of the video session are returned.

If pname:pMemoryRequirements is `NULL`, then the number of memory bindings
required for the video session is returned in
pname:pMemoryRequirementsCount.
Otherwise, pname:pMemoryRequirementsCount must: point to a variable set by
the user with the number of elements in the pname:pMemoryRequirements array,
and on return the variable is overwritten with the number of memory binding
requirements actually written to pname:pMemoryRequirements.
If pname:pMemoryRequirementsCount is less than the number of memory bindings
required for the video session, then at most pname:pMemoryRequirementsCount
elements will be written to pname:pMemoryRequirements, and
ename:VK_INCOMPLETE will be returned, instead of ename:VK_SUCCESS, to
indicate that not all required memory binding requirements were returned.

include::{generated}/validity/protos/vkGetVideoSessionMemoryRequirementsKHR.adoc[]
--


[open,refpage='VkVideoSessionMemoryRequirementsKHR',desc='Structure describing video session memory requirements',type='structs']
--
The sname:VkVideoSessionMemoryRequirementsKHR structure is defined as:

include::{generated}/api/structs/VkVideoSessionMemoryRequirementsKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:memoryBindIndex is the index of the memory binding.
  * pname:memoryRequirements is a slink:VkMemoryRequirements structure in
    which the requested memory binding requirements for the binding index
    specified by pname:memoryBindIndex are returned.

include::{generated}/validity/structs/VkVideoSessionMemoryRequirementsKHR.adoc[]
--


[open,refpage='vkBindVideoSessionMemoryKHR',desc='Bind Video Memory',type='protos']
--
To attach memory to a video session object, call:

include::{generated}/api/protos/vkBindVideoSessionMemoryKHR.adoc[]

  * pname:device is the logical device that owns the video session.
  * pname:videoSession is the video session to be bound with device memory.
  * pname:bindSessionMemoryInfoCount is the number of elements in
    pname:pBindSessionMemoryInfos.
  * pname:pBindSessionMemoryInfos is a pointer to an array of
    pname:bindSessionMemoryInfoCount slink:VkBindVideoSessionMemoryInfoKHR
    structures specifying memory regions to be bound to specific memory
    bindings of the video session.

The valid usage statements below refer to the slink:VkMemoryRequirements
structure corresponding to a specific element of
pname:pBindSessionMemoryInfos, which is defined as follows:

  * If the pname:memoryBindIndex member of the element of
    pname:pBindSessionMemoryInfos in question matches the
    pname:memoryBindIndex member of one of the elements returned in
    pname:pMemoryRequirements when
    flink:vkGetVideoSessionMemoryRequirementsKHR is called with the same
    pname:videoSession and with pname:pMemoryRequirementsCount equal to
    pname:bindSessionMemoryInfoCount, then the pname:memoryRequirements
    member of that element of pname:pMemoryRequirements is the
    slink:VkMemoryRequirements structure corresponding to the element of
    pname:pBindSessionMemoryInfos in question.
  * Otherwise the element of pname:pBindSessionMemoryInfos in question is
    said to not have a corresponding slink:VkMemoryRequirements structure.

.Valid Usage
****
  * [[VUID-vkBindVideoSessionMemoryKHR-videoSession-07195]]
    The memory binding of pname:videoSession identified by the
    pname:memoryBindIndex member of any element of
    pname:pBindSessionMemoryInfos must: not already be backed by a memory
    object
  * [[VUID-vkBindVideoSessionMemoryKHR-memoryBindIndex-07196]]
    The pname:memoryBindIndex member of each element of
    pname:pBindSessionMemoryInfos must: be unique within
    pname:pBindSessionMemoryInfos
  * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07197]]
    Each element of pname:pBindSessionMemoryInfos must: have a corresponding
    slink:VkMemoryRequirements structure
  * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07198]]
    If an element of pname:pBindSessionMemoryInfos has a corresponding
    slink:VkMemoryRequirements structure, then the pname:memory member of
    that element of pname:pBindSessionMemoryInfos must: have been allocated
    using one of the memory types allowed in the pname:memoryTypeBits member
    of the corresponding slink:VkMemoryRequirements structure
  * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07199]]
    If an element of pname:pBindSessionMemoryInfos has a corresponding
    slink:VkMemoryRequirements structure, then the pname:memoryOffset member
    of that element of pname:pBindSessionMemoryInfos must: be an integer
    multiple of the pname:alignment member of the corresponding
    slink:VkMemoryRequirements structure
  * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07200]]
    If an element of pname:pBindSessionMemoryInfos has a corresponding
    slink:VkMemoryRequirements structure, then the pname:memorySize member
    of that element of pname:pBindSessionMemoryInfos must: equal the
    pname:size member of the corresponding slink:VkMemoryRequirements
    structure
****

include::{generated}/validity/protos/vkBindVideoSessionMemoryKHR.adoc[]
--

[open,refpage='VkBindVideoSessionMemoryInfoKHR',desc='Structure specifying memory bindings for a video session object',type='structs']
--
The sname:VkBindVideoSessionMemoryInfoKHR structure is defined as:

include::{generated}/api/structs/VkBindVideoSessionMemoryInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:memoryBindIndex is the memory binding index to bind memory to.
  * pname:memory is the allocated device memory to be bound to the video
    session's memory binding with index pname:memoryBindIndex.
  * pname:memoryOffset is the start offset of the region of pname:memory
    which is to be bound.
  * pname:memorySize is the size in bytes of the region of pname:memory,
    starting from pname:memoryOffset bytes, to be bound.

.Valid Usage
****
  * [[VUID-VkBindVideoSessionMemoryInfoKHR-memoryOffset-07201]]
    pname:memoryOffset must: be less than the size of pname:memory
  * [[VUID-VkBindVideoSessionMemoryInfoKHR-memorySize-07202]]
    pname:memorySize must: be less than or equal to the size of pname:memory
    minus pname:memoryOffset
****

include::{generated}/validity/structs/VkBindVideoSessionMemoryInfoKHR.adoc[]
--


[[video-profile-compatibility]]
== Video Profile Compatibility

Resources and query pools used with a particular video session must: be
compatible with the <<video-profiles,video profile>> the video session was
created with.

A slink:VkBuffer is compatible with a video profile if it was created with
the slink:VkBufferCreateInfo::pname:pNext chain including a
slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles member
containing an element matching the slink:VkVideoProfileInfoKHR structure
chain describing the video profile, and
slink:VkBufferCreateInfo::pname:usage including at least one bit specific to
video coding usage.

ifdef::VK_KHR_video_decode_queue[]
  * ename:VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR
  * ename:VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * ename:VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
  * ename:VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR
endif::VK_KHR_video_encode_queue[]

ifdef::VK_KHR_video_maintenance1[]
A slink:VkBuffer is also compatible with a video profile if it was created
with slink:VkBufferCreateInfo::pname:flags including
ename:VK_BUFFER_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR.
endif::VK_KHR_video_maintenance1[]

A slink:VkImage is compatible with a video profile if it was created with
the slink:VkImageCreateInfo::pname:pNext chain including a
slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles member
containing an element matching the slink:VkVideoProfileInfoKHR structure
chain describing the video profile, and slink:VkImageCreateInfo::pname:usage
including at least one bit specific to video coding usage.

ifdef::VK_KHR_video_decode_queue[]
  * ename:VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR
  * ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
  * ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
  * ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR
  * ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
endif::VK_KHR_video_encode_queue[]

ifdef::VK_KHR_video_maintenance1[]
A slink:VkImage is also compatible with a video profile if all of the
following conditions are true for the slink:VkImageCreateInfo structure the
image was created with:

  * slink:VkImageCreateInfo::pname:flags included
    ename:VK_IMAGE_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR.
  * The list of slink:VkVideoFormatPropertiesKHR structures, obtained by
    calling flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR with
    slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage equal to the
    slink:VkImageCreateInfo::pname:usage the image was created with and the
    slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:pNext chain including a
    slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles
    member containing a single array element specifying the
    slink:VkVideoProfileInfoKHR structure chain describing the video profile
    in question, contains an element for which all of the following
    conditions are true with respect to the slink:VkImageCreateInfo
    structure the image was created with:
  ** slink:VkImageCreateInfo::pname:format equals
     slink:VkVideoFormatPropertiesKHR::pname:format.
  ** slink:VkImageCreateInfo::pname:flags only contains bits also set in
     slink:VkVideoFormatPropertiesKHR::pname:imageCreateFlags.
  ** slink:VkImageCreateInfo::pname:imageType equals
     slink:VkVideoFormatPropertiesKHR::pname:imageType.
  ** slink:VkImageCreateInfo::pname:tiling equals
     slink:VkVideoFormatPropertiesKHR::pname:imageTiling.
  ** slink:VkImageCreateInfo::pname:usage only contains bits also set in
     slink:VkVideoFormatPropertiesKHR::pname:imageUsageFlags.

[NOTE]
.Note
====
While some of these rules allow creating buffer or image resources that may:
be compatible with any video profile, applications should: still prefer to
include the specific video profiles the buffer or image resource is expected
to be used with (through a slink:VkVideoProfileListInfoKHR structure
included in the pname:pNext chain of the corresponding create info
structure) whenever the information about the complete set of video profiles
is available at resource creation time, to enable the implementation to
optimize the created resource for the specific use case.
In the absence of that information, the implementation may: have to make
conservative decisions about the memory requirements or representation of
the resource.
====
endif::VK_KHR_video_maintenance1[]

A slink:VkImageView is compatible with a video profile if the slink:VkImage
it was created from is also compatible with that video profile.

A slink:VkQueryPool is compatible with a video profile if it was created
with the slink:VkQueryPoolCreateInfo::pname:pNext chain including a
slink:VkVideoProfileInfoKHR structure chain describing the same video
profile, and slink:VkQueryPoolCreateInfo::pname:queryType having one of the
following values:

  * ename:VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR
ifdef::VK_KHR_video_encode_queue[]
  * ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR
endif::VK_KHR_video_encode_queue[]


[[video-session-parameters]]
== Video Session Parameters

Video session parameters objects can: store preprocessed codec-specific
parameters used with a compatible video session, and enable reducing the
number of parameters needed to be provided and processed by the
implementation while recording video coding operations into command buffers.

Parameters stored in such objects are _immutable_ to facilitate the
concurrent use of the stored parameters in multiple threads.
At the same time, new parameters can: be added to existing objects using the
flink:vkUpdateVideoSessionParametersKHR command.

In order to support concurrent use of the stored immutable parameters while
also allowing the video session parameters object to be extended with new
parameters, each video session parameters object maintains an _update
sequence counter_ that is set to `0` at object creation time and must: be
incremented by each subsequent update operation.

Certain video sequences that adhere to particular video compression
standards permit updating previously supplied parameters.
If a parameter update is necessary, the application has the following
options:

  * Cache the set of parameters on the application side and create a new
    video session parameters object adding all the parameters with
    appropriate changes, as necessary; or
  * Create a new video session parameters object providing only the updated
    parameters and the previously used object as the template, which ensures
    that parameters not specified at creation time will be copied unmodified
    from the template object.

The actual types of parameters that can: be stored and the capacity for
individual parameter types, and the methods of initializing, updating, and
referring to individual parameters are specific to the video codec operation
the video session parameters object was created with.

ifdef::VK_KHR_video_decode_h264[]
  * For ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR these are defined
    in the <<decode-h264-parameter-sets,H.264 Decode Parameter Sets>>
    section.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * For ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR these are defined
    in the <<decode-h265-parameter-sets,H.265 Decode Parameter Sets>>
    section.
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * For ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR these are defined
    in the <<decode-av1-parameter-sets,AV1 Decode Parameter Sets>> section.
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_h264[]
  * For ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR these are defined
    in the <<encode-h264-parameter-sets,H.264 Encode Parameter Sets>>
    section.
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * For ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR these are defined
    in the <<encode-h265-parameter-sets,H.265 Encode Parameter Sets>>
    section.
endif::VK_KHR_video_encode_h265[]

ifdef::VK_KHR_video_encode_queue[]
Video session parameters objects created with an encode operation are
further specialized based on the <<encode-quality-level,video encode quality
level>> the video session parameters are used with, as implementations may:
apply different sets of <<encode-overrides,parameter overrides>> depending
on the used quality level.
This enables implementations to store the potentially optimized set of
parameters in these objects, further limiting the necessary processing
required while recording video encode operations into command buffers.
endif::VK_KHR_video_encode_queue[]


[open,refpage='VkVideoSessionParametersKHR',desc='Opaque handle to a video session parameters object',type='handles']
--
Video session parameters are represented by
sname:VkVideoSessionParametersKHR handles:

include::{generated}/api/handles/VkVideoSessionParametersKHR.adoc[]
--


[[creating-video-session-parameters]]
=== Creating Video Session Parameters

[open,refpage='vkCreateVideoSessionParametersKHR',desc='Creates video session parameters object',type='protos']
--
To create a video session parameters object, call:

include::{generated}/api/protos/vkCreateVideoSessionParametersKHR.adoc[]

  * pname:device is the logical device that creates the video session
    parameters object.
  * pname:pCreateInfo is a pointer to
    slink:VkVideoSessionParametersCreateInfoKHR structure containing
    parameters to be used to create the video session parameters object.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.
  * pname:pVideoSessionParameters is a pointer to a
    slink:VkVideoSessionParametersKHR handle in which the resulting video
    session parameters object is returned.

The resulting video session parameters object is said to be created with the
video codec operation pname:pCreateInfo->videoSession was created with.

ifdef::VK_KHR_video_encode_queue[]
Video session parameters objects created with an encode operation are always
created with respect to a <<encode-quality-level,video encode quality
level>>.
By default, the created video session parameters objects are created with
quality level zero, unless otherwise specified by including a
slink:VkVideoEncodeQualityLevelInfoKHR structure in the
pname:pCreateInfo->pNext chain, in which case the video session parameters
object is created with the quality level specified in
slink:VkVideoEncodeQualityLevelInfoKHR::pname:qualityLevel.
endif::VK_KHR_video_encode_queue[]

If pname:pCreateInfo->videoSessionParametersTemplate is not
dname:VK_NULL_HANDLE, then it will be used as a template for constructing
the new video session parameters object.
This happens by first adding any parameters according to the additional
creation parameters provided in the pname:pCreateInfo->pNext chain, followed
by adding any parameters from the template object that have a key that does
not match the key of any of the already added parameters.

ifdef::VK_KHR_video_encode_queue[]
For video session parameters objects created with an encode operation, the
template object specified in
pname:pCreateInfo->videoSessionParametersTemplate must: have been created
with the same <<encode-quality-level,video encode quality level>> as the
newly created object.

[NOTE]
.Note
====
This means that codec-specific parameters stored in video session parameters
objects can: only be reused across different video encode quality levels by
re-specifying them, as previously created video session parameters against
other quality levels cannot: be used as template because the original
codec-specific parameters (before the implementation may: have applied
<<encode-overrides,parameter overrides>>) may: no longer be available in
them for the purposes of constructing the derived object.
====
endif::VK_KHR_video_encode_queue[]

ifdef::VK_KHR_video_decode_h264[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the
created video session parameters object will initially contain the following
sets of parameter entries:

  * code:StdVideoH264SequenceParameterSet structures representing
    <<decode-h264-sps,H.264 SPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH264SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH264SequenceParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:seq_parameter_set_id.
  * code:StdVideoH264PictureParameterSet structures representing
    <<decode-h264-pps,H.264 PPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH264PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH264PictureParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:seq_parameter_set_id and
     pname:pic_parameter_set_id.
endif::VK_KHR_video_decode_h264[]

ifdef::VK_KHR_video_decode_h265[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
created video session parameters object will initially contain the following
sets of parameter entries:

  * code:StdVideoH265VideoParameterSet structures representing
    <<decode-h265-vps,H.265 VPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH265VideoParameterSet entries specified in
     pname:pParametersAddInfo->pStdVPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH265VideoParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:vps_video_parameter_set_id.
  * code:StdVideoH265SequenceParameterSet structures representing
    <<decode-h265-sps,H.265 SPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH265SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH265SequenceParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:sps_video_parameter_set_id and
     pname:sps_seq_parameter_set_id.
  * code:StdVideoH265PictureParameterSet structures representing
    <<decode-h265-pps,H.265 PPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH265PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH265PictureParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:sps_video_parameter_set_id,
     pname:pps_seq_parameter_set_id, and pname:pps_pic_parameter_set_id.
endif::VK_KHR_video_decode_h265[]

ifdef::VK_KHR_video_decode_av1[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR, then the
created video session parameters object will contain a single
<<decode-av1-sequence-header,AV1 sequence header>> represented by a
code:StdVideoAV1SequenceHeader structure specified through the
pname:pStdSequenceHeader member of the
slink:VkVideoDecodeAV1SessionParametersCreateInfoKHR structure provided in
the pname:pCreateInfo->pNext chain.
As such video session parameters objects can: only contain a single
<<decode-av1-sequence-header,AV1 sequence header>>, it is not possible to
use a previously created object as a template or subsequently update the
created video session parameters object.
endif::VK_KHR_video_decode_av1[]

ifdef::VK_KHR_video_encode_h264[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the
created video session parameters object will initially contain the following
sets of parameter entries:

  * code:StdVideoH264SequenceParameterSet structures representing
    <<encode-h264-sps,H.264 SPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH264SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH264SequenceParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:seq_parameter_set_id.
  * code:StdVideoH264PictureParameterSet structures representing
    <<encode-h264-pps,H.264 PPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH264PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH264PictureParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:seq_parameter_set_id and
     pname:pic_parameter_set_id.
endif::VK_KHR_video_encode_h264[]

ifdef::VK_KHR_video_encode_h265[]
If pname:pCreateInfo->videoSession was created with the video codec
operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the
created video session parameters object will initially contain the following
sets of parameter entries:

  * code:StdVideoH265VideoParameterSet structures representing
    <<encode-h265-vps,H.265 VPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH265VideoParameterSet entries specified in
     pname:pParametersAddInfo->pStdVPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH265VideoParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:vps_video_parameter_set_id.
  * code:StdVideoH265SequenceParameterSet structures representing
    <<encode-h265-sps,H.265 SPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH265SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH265SequenceParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:sps_video_parameter_set_id and
     pname:sps_seq_parameter_set_id.
  * code:StdVideoH265PictureParameterSet structures representing
    <<encode-h265-pps,H.265 PPS>> entries, as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the
     set of code:StdVideoH265PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added first;
  ** If pname:pCreateInfo->videoSessionParametersTemplate is not
     dname:VK_NULL_HANDLE, then each code:StdVideoH265PictureParameterSet
     entry stored in it is copied to the created video session parameters
     object if the created object does not already contain such an entry
     with the same pname:sps_video_parameter_set_id,
     pname:pps_seq_parameter_set_id, and pname:pps_pic_parameter_set_id.
endif::VK_KHR_video_encode_h265[]

ifdef::VK_KHR_video_encode_queue[]
In case of video session parameters objects created with a video encode
operation, implementations may: return the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the
specified Video Std parameters do not adhere to the syntactic or semantic
requirements of the used video compression standard, or if values derived
from parameters according to the rules defined by the used video compression
standard do not adhere to the capabilities of the video compression standard
or the implementation.

[NOTE]
.Note
====
Applications should: not rely on the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any
command as a means to verify Video Std parameters, as implementations are
not required to report the error in any specific set of cases.
====
endif::VK_KHR_video_encode_queue[]

include::{generated}/validity/protos/vkCreateVideoSessionParametersKHR.adoc[]
--

[open,refpage='VkVideoSessionParametersCreateInfoKHR',desc='Structure specifying parameters of a newly created video session parameters object',type='structs']
--
The sname:VkVideoSessionParametersCreateInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoSessionParametersCreateInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is reserved for future use.
  * pname:videoSessionParametersTemplate is dname:VK_NULL_HANDLE or a valid
    handle to a slink:VkVideoSessionParametersKHR object used as a template
    for constructing the new video session parameters object.
  * pname:videoSession is the video session object against which the video
    session parameters object is going to be created.

Limiting values are defined below that are referenced by the relevant valid
usage statements of this structure.

ifdef::VK_KHR_video_decode_h264[]
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then let
    `StdVideoH264SequenceParameterSet spsAddList[]` be the list of
    <<decode-h264-sps,H.264 SPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH264SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH264SequenceParameterSet entry stored in it with
     pname:seq_parameter_set_id not matching any of the entries already in
     pname:spsAddList is added to pname:spsAddList.
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then let
    `StdVideoH264PictureParameterSet ppsAddList[]` be the list of
    <<decode-h264-pps,H.264 PPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH264PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH264PictureParameterSet entry stored in it with
     pname:seq_parameter_set_id or pname:pic_parameter_set_id not matching
     any of the entries already in pname:ppsAddList is added to
     pname:ppsAddList.
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let
    `StdVideoH265VideoParameterSet vpsAddList[]` be the list of
    <<decode-h265-vps,H.265 VPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH265VideoParameterSet entries specified in
     pname:pParametersAddInfo->pStdVPSs are added to pname:vpsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH265VideoParameterSet entry stored in it with
     pname:vps_video_parameter_set_id not matching any of the entries
     already in pname:vpsAddList is added to pname:vpsAddList.
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let
    `StdVideoH265SequenceParameterSet spsAddList[]` be the list of
    <<decode-h265-sps,H.265 SPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH265SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH265SequenceParameterSet entry stored in it with
     pname:sps_video_parameter_set_id or pname:sps_seq_parameter_set_id not
     matching any of the entries already in pname:spsAddList is added to
     pname:spsAddList.
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let
    `StdVideoH265PictureParameterSet ppsAddList[]` be the list of
    <<decode-h265-pps,H.265 PPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH265PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH265PictureParameterSet entry stored in it with
     pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, or
     pname:pps_pic_parameter_set_id not matching any of the entries already
     in pname:ppsAddList is added to pname:ppsAddList.
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_encode_queue[]
  * If pname:videoSession was created with an encode operation, then let
    `uint32_t qualityLevel` be the <<encode-quality-level,video encode
    quality level>> of the created video session parameters object, defined
    as follows:
  ** If the pname:pNext chain of this structure includes a
     slink:VkVideoEncodeQualityLevelInfoKHR structure, then
     pname:qualityLevel is equal to
     slink:VkVideoEncodeQualityLevelInfoKHR::pname:qualityLevel.
  ** Otherwise pname:qualityLevel is `0`
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_encode_h264[]
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then let
    `StdVideoH264SequenceParameterSet spsAddList[]` be the list of
    <<encode-h264-sps,H.264 SPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH264SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH264SequenceParameterSet entry stored in it with
     pname:seq_parameter_set_id not matching any of the entries already in
     pname:spsAddList is added to pname:spsAddList.
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then let
    `StdVideoH264PictureParameterSet ppsAddList[]` be the list of
    <<encode-h264-pps,H.264 PPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH264PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH264PictureParameterSet entry stored in it with
     pname:seq_parameter_set_id or pname:pic_parameter_set_id not matching
     any of the entries already in pname:ppsAddList is added to
     pname:ppsAddList.
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then let
    `StdVideoH265VideoParameterSet vpsAddList[]` be the list of
    <<encode-h265-vps,H.265 VPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH265VideoParameterSet entries specified in
     pname:pParametersAddInfo->pStdVPSs are added to pname:vpsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH265VideoParameterSet entry stored in it with
     pname:vps_video_parameter_set_id not matching any of the entries
     already in pname:vpsAddList is added to pname:vpsAddList.
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then let
    `StdVideoH265SequenceParameterSet spsAddList[]` be the list of
    <<encode-h265-sps,H.265 SPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH265SequenceParameterSet entries specified in
     pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH265SequenceParameterSet entry stored in it with
     pname:sps_video_parameter_set_id or pname:sps_seq_parameter_set_id not
     matching any of the entries already in pname:spsAddList is added to
     pname:spsAddList.
  * If pname:videoSession was created with the codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then let
    `StdVideoH265PictureParameterSet ppsAddList[]` be the list of
    <<encode-h265-pps,H.265 PPS>> entries to add to the created video
    session parameters object, defined as follows:
  ** If the pname:pParametersAddInfo member of the
     slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
     provided in the pname:pNext chain is not `NULL`, then the set of
     code:StdVideoH265PictureParameterSet entries specified in
     pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList;
  ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE,
     then each code:StdVideoH265PictureParameterSet entry stored in it with
     pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, or
     pname:pps_pic_parameter_set_id not matching any of the entries already
     in pname:ppsAddList is added to pname:ppsAddList.
endif::VK_KHR_video_encode_h265[]

.Valid Usage
****
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-04855]]
    If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, it
    must: have been created against pname:videoSession
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-08310]]
    If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE and
    pname:videoSession was created with an encode operation, then
    pname:qualityLevel must: equal the <<encode-quality-level,video encode
    quality>> level pname:videoSessionParametersTemplate was created with
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_decode_h264[]
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07203]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext
    chain must: include a
    slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07204]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the number of
    elements of pname:spsAddList must: be less than or equal to the
    pname:maxStdSPSCount specified in the
    slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07205]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the number of
    elements of pname:ppsAddList must: be less than or equal to the
    pname:maxStdPPSCount specified in the
    slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07206]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext
    chain must: include a
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07207]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of
    elements of pname:vpsAddList must: be less than or equal to the
    pname:maxStdVPSCount specified in the
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07208]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of
    elements of pname:spsAddList must: be less than or equal to the
    pname:maxStdSPSCount specified in the
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07209]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of
    elements of pname:ppsAddList must: be less than or equal to the
    pname:maxStdPPSCount specified in the
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-09258]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR, then
    pname:videoSessionParametersTemplate must: be dname:VK_NULL_HANDLE
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-09259]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR, then the pname:pNext
    chain must: include a
    slink:VkVideoDecodeAV1SessionParametersCreateInfoKHR structure
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07210]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pname:pNext
    chain must: include a
    slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04839]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the number of
    elements of pname:spsAddList must: be less than or equal to the
    pname:maxStdSPSCount specified in the
    slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04840]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the number of
    elements of pname:ppsAddList must: be less than or equal to the
    pname:maxStdPPSCount specified in the
    slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07211]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pname:pNext
    chain must: include a
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04841]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the number of
    elements of pname:vpsAddList must: be less than or equal to the
    pname:maxStdVPSCount specified in the
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04842]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the number of
    elements of pname:spsAddList must: be less than or equal to the
    pname:maxStdSPSCount specified in the
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04843]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the number of
    elements of pname:ppsAddList must: be less than or equal to the
    pname:maxStdPPSCount specified in the
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure included
    in the pname:pNext chain
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-08319]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then
    code:num_tile_columns_minus1 must: be less than
    slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.width, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile pname:videoSession was created with, for each element of
    pname:ppsAddList
  * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-08320]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then
    code:num_tile_rows_minus1 must: be less than
    slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.height, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile pname:videoSession was created with, for each element of
    pname:ppsAddList
endif::VK_KHR_video_encode_h265[]
****

include::{generated}/validity/structs/VkVideoSessionParametersCreateInfoKHR.adoc[]
--

[open,refpage='VkVideoSessionParametersCreateFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkVideoSessionParametersCreateFlagsKHR.adoc[]

tname:VkVideoSessionParametersCreateFlagsKHR is a bitmask type for setting a
mask, but is currently reserved for future use.
--


[[destroying-video-session-parameters]]
=== Destroying Video Session Parameters

[open,refpage='vkDestroyVideoSessionParametersKHR',desc='Destroy video session parameters object',type='protos']
--
To destroy a video session parameters object, call:

include::{generated}/api/protos/vkDestroyVideoSessionParametersKHR.adoc[]

  * pname:device is the logical device that destroys the video session
    parameters object.
  * pname:videoSessionParameters is the video session parameters object to
    destroy.
  * pname:pAllocator controls host memory allocation as described in the
    <<memory-allocation, Memory Allocation>> chapter.

.Valid Usage
****
  * [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07212]]
    All submitted commands that refer to pname:videoSessionParameters must:
    have completed execution
  * [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07213]]
    If sname:VkAllocationCallbacks were provided when
    pname:videoSessionParameters was created, a compatible set of callbacks
    must: be provided here
  * [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07214]]
    If no sname:VkAllocationCallbacks were provided when
    pname:videoSessionParameters was created, pname:pAllocator must: be
    `NULL`
****

include::{generated}/validity/protos/vkDestroyVideoSessionParametersKHR.adoc[]
--


[[video-session-parameters-update]]
=== Updating Video Session Parameters

[open,refpage='vkUpdateVideoSessionParametersKHR',desc='Update video session parameters object',type='protos']
--
To update video session parameters object with new parameters, call:

include::{generated}/api/protos/vkUpdateVideoSessionParametersKHR.adoc[]

  * pname:device is the logical device that updates the video session
    parameters.
  * pname:videoSessionParameters is the video session parameters object to
    update.
  * pname:pUpdateInfo is a pointer to a
    slink:VkVideoSessionParametersUpdateInfoKHR structure specifying the
    parameter update information.

After a successful call to this command, the
<<video-session-parameters,update sequence counter>> of
pname:videoSessionParameters is changed to the value specified in
pname:pUpdateInfo->updateSequenceCount.

[NOTE]
.Note
====
As each update issued to a video session parameters object needs to specify
the next available update sequence count value, concurrent updates of the
same video session parameters object are inherently disallowed.
However, recording video coding operations to command buffers referring to
parameters previously added to the video session parameters object is
allowed, even if there is a concurrent update in progress adding some new
entries to the object.
====

ifdef::VK_KHR_video_decode_h264[]
If pname:videoSessionParameters was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
pname:pUpdateInfo->pNext chain includes a
slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then this
command adds the following parameter entries to
pname:videoSessionParameters:

  * The <<decode-h264-sps,H.264 SPS>> entries specified in
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdSPSs.
  * The <<decode-h264-pps,H.264 PPS>> entries specified in
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdPPSs.
endif::VK_KHR_video_decode_h264[]

ifdef::VK_KHR_video_decode_h265[]
If pname:videoSessionParameters was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
pname:pUpdateInfo->pNext chain includes a
slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then this
command adds the following parameter entries to
pname:videoSessionParameters:

  * The <<decode-h265-vps,H.265 VPS>> entries specified in
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdVPSs.
  * The <<decode-h265-sps,H.265 SPS>> entries specified in
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdSPSs.
  * The <<decode-h265-pps,H.265 PPS>> entries specified in
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdPPSs.
endif::VK_KHR_video_decode_h265[]

ifdef::VK_KHR_video_encode_h264[]
If pname:videoSessionParameters was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the
pname:pUpdateInfo->pNext chain includes a
slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure, then this
command adds the following parameter entries to
pname:videoSessionParameters:

  * The <<encode-h264-sps,H.264 SPS>> entries specified in
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdSPSs.
  * The <<encode-h264-pps,H.264 PPS>> entries specified in
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdPPSs.
endif::VK_KHR_video_encode_h264[]

ifdef::VK_KHR_video_encode_h265[]
If pname:videoSessionParameters was created with the video codec operation
ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the
pname:pUpdateInfo->pNext chain includes a
slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then this
command adds the following parameter entries to
pname:videoSessionParameters:

  * The <<encode-h265-vps,H.265 VPS>> entries specified in
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdVPSs.
  * The <<encode-h265-sps,H.265 SPS>> entries specified in
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdSPSs.
  * The <<encode-h265-pps,H.265 PPS>> entries specified in
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs.
endif::VK_KHR_video_encode_h265[]

ifdef::VK_KHR_video_encode_queue[]
In case of video session parameters objects created with a video encode
operation, implementations may: return the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the
specified Video Std parameters do not adhere to the syntactic or semantic
requirements of the used video compression standard, or if values derived
from parameters according to the rules defined by the used video compression
standard do not adhere to the capabilities of the video compression standard
or the implementation.

[NOTE]
.Note
====
Applications should: not rely on the
ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any
command as a means to verify Video Std parameters, as implementations are
not required to report the error in any specific set of cases.
====
endif::VK_KHR_video_encode_queue[]

.Valid Usage
****
  * [[VUID-vkUpdateVideoSessionParametersKHR-pUpdateInfo-07215]]
    pname:pUpdateInfo->updateSequenceCount must: equal the current
    <<video-session-parameters,update sequence counter>> of
    pname:videoSessionParameters plus one
ifdef::VK_KHR_video_decode_h264[]
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07216]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH264SequenceParameterSet entry with
    pname:seq_parameter_set_id matching any of the elements of
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdSPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07217]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the
    number of code:StdVideoH264SequenceParameterSet entries already stored
    in it plus the value of the pname:stdSPSCount member of the
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoDecodeH264SessionParametersCreateInfoKHR::pname:maxStdSPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07218]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH264PictureParameterSet entry with both
    pname:seq_parameter_set_id and pname:pic_parameter_set_id matching any
    of the elements of
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdPPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07219]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the
    number of code:StdVideoH264PictureParameterSet entries already stored in
    it plus the value of the pname:stdPPSCount member of the
    slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoDecodeH264SessionParametersCreateInfoKHR::pname:maxStdPPSCount
    pname:videoSessionParameters was created with
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07220]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH265VideoParameterSet entry with
    pname:vps_video_parameter_set_id matching any of the elements of
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdVPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07221]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
    number of code:StdVideoH265VideoParameterSet entries already stored in
    it plus the value of the pname:stdVPSCount member of the
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdVPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07222]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH265SequenceParameterSet entry with both
    pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id
    matching any of the elements of
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdSPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07223]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
    number of code:StdVideoH265SequenceParameterSet entries already stored
    in it plus the value of the pname:stdSPSCount member of the
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdSPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07224]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH265PictureParameterSet entry with
    pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, and
    pname:pps_pic_parameter_set_id all matching any of the elements of
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdPPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07225]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the
    number of code:StdVideoH265PictureParameterSet entries already stored in
    it plus the value of the pname:stdPPSCount member of the
    slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdPPSCount
    pname:videoSessionParameters was created with
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-09260]]
    pname:videoSessionParameters must: not have been created with the video
    codec operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07226]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH264SequenceParameterSet entry with
    pname:seq_parameter_set_id matching any of the elements of
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdSPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06441]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the
    number of code:StdVideoH264SequenceParameterSet entries already stored
    in it plus the value of the pname:stdSPSCount member of the
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoEncodeH264SessionParametersCreateInfoKHR::pname:maxStdSPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07227]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH264PictureParameterSet entry with both
    pname:seq_parameter_set_id and pname:pic_parameter_set_id matching any
    of the elements of
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdPPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06442]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the
    number of code:StdVideoH264PictureParameterSet entries already stored in
    it plus the value of the pname:stdPPSCount member of the
    slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoEncodeH264SessionParametersCreateInfoKHR::pname:maxStdPPSCount
    pname:videoSessionParameters was created with
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07228]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH265VideoParameterSet entry with
    pname:vps_video_parameter_set_id matching any of the elements of
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdVPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06443]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the
    number of code:StdVideoH265VideoParameterSet entries already stored in
    it plus the value of the pname:stdVPSCount member of the
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR::pname:maxStdVPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07229]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH265SequenceParameterSet entry with both
    pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id
    matching any of the elements of
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdSPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06444]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the
    number of code:StdVideoH265SequenceParameterSet entries already stored
    in it plus the value of the pname:stdSPSCount member of the
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR::pname:maxStdSPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07230]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then
    pname:videoSessionParameters must: not already contain a
    code:StdVideoH265PictureParameterSet entry with
    pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, and
    pname:pps_pic_parameter_set_id all matching any of the elements of
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06445]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the
    number of code:StdVideoH265PictureParameterSet entries already stored in
    it plus the value of the pname:stdPPSCount member of the
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure included in
    the pname:pUpdateInfo->pNext chain must: be less than or equal to the
    slink:VkVideoEncodeH265SessionParametersCreateInfoKHR::pname:maxStdPPSCount
    pname:videoSessionParameters was created with
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-08321]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then
    code:num_tile_columns_minus1 must: be less than
    slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.width, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile pname:videoSessionParameters was created with, for each element
    of slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs
  * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-08322]]
    If pname:videoSessionParameters was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the
    pname:pNext chain of pname:pUpdateInfo includes a
    slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then
    code:num_tile_rows_minus1 must: be less than
    slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.height, as
    returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video
    profile pname:videoSessionParameters was created with, for each element
    of slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs
endif::VK_KHR_video_encode_h265[]
****

include::{generated}/validity/protos/vkUpdateVideoSessionParametersKHR.adoc[]
--

[open,refpage='VkVideoSessionParametersUpdateInfoKHR',desc='Structure specifying video session parameters update information',type='structs']
--
The sname:VkVideoSessionParametersUpdateInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoSessionParametersUpdateInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:updateSequenceCount is the new <<video-session-parameters,update
    sequence count>> to set for the video session parameters object.

include::{generated}/validity/structs/VkVideoSessionParametersUpdateInfoKHR.adoc[]
--


[[video-coding-scope]]
== Video Coding Scope

Applications can: record video coding commands for a video session only
within a video coding scope.

[open,refpage='vkCmdBeginVideoCodingKHR',desc='Begin video coding scope',type='protos']
--
To begin a video coding scope, call:

include::{generated}/api/protos/vkCmdBeginVideoCodingKHR.adoc[]

  * pname:commandBuffer is the command buffer in which to record the
    command.
  * pname:pBeginInfo is a pointer to a slink:VkVideoBeginCodingInfoKHR
    structure specifying the parameters of the video coding scope, including
    the video session and video session parameters object to use.

After beginning a video coding scope, the video session object specified in
pname:pBeginInfo->videoSession is _bound_ to the command buffer, and the
command buffer is ready to record video coding operations.
Similarly, if pname:pBeginInfo->videoSessionParameters is not
dname:VK_NULL_HANDLE, it is also _bound_ to the command buffer, and video
coding operations can: refer to the codec-specific parameters stored in it.

[[bound-reference-picture-resources]]
This command also establishes the set of _bound reference picture resources_
that can: be used as <<reconstructed-picture,reconstructed pictures>> or
<<reference-picture,reference pictures>> within the video coding scope.
Each element of this set consists of a <<video-picture-resources,video
picture resource>> and the <<dpb-slot,DPB slot>> index associated with it,
if there is one.

The set of bound reference picture resources is immutable within a video
coding scope, however, the DPB slot index associated with any of the bound
reference picture resources can: change during the video coding scope in
response to video coding operations.

The slink:VkVideoReferenceSlotInfoKHR structures provided as the elements of
pname:pBeginInfo->pReferenceSlots are interpreted by this command as
follows:

  * If pname:slotIndex is non-negative and pname:pPictureResource is not
    `NULL`, then the <<video-picture-resources,video picture resource>>
    defined by the slink:VkVideoPictureResourceInfoKHR structure pointed to
    by pname:pPictureResource is added to the set of bound reference picture
    resources and is associated with the DPB slot index specified in
    pname:slotIndex.
  * If pname:slotIndex is non-negative and pname:pPictureResource is `NULL`,
    then the DPB slot with index pname:slotIndex is <<dpb-slot-states,
    deactivated>> by this command.
  * If pname:slotIndex is negative and pname:pPictureResource is not `NULL`,
    then the <<video-picture-resources,video picture resource>> defined by
    the slink:VkVideoPictureResourceInfoKHR structure pointed to by
    pname:pPictureResource is added to the set of bound reference picture
    resources without an associated DPB slot.
    Such a picture resource can: be subsequently used as a
    <<reconstructed-picture,reconstructed picture>> to associate it with a
    DPB slot.
  * If pname:slotIndex is negative and pname:pPictureResource is `NULL`,
    then the element is ignored.

ifdef::VK_KHR_video_decode_h264[]
[NOTE]
.Note
====
It is possible for multiple bound reference picture resources to be
associated with the same DPB slot index, or for a single bound reference
picture to refer to multiple separate reference pictures.
For example, in case of an <<decode-h264-profile,H.264 decode profile>> with
<<decode-h264-interlaced-support,interlaced frame support>> a single DPB
slot can refer to two separate pictures for the top and bottom fields.
Depending on the picture layout used by the <<decode-h264-profile,H.264
decode profile>>, the following special cases may: arise:

  * If the picture layout is
    ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR,
    then the top and bottom field pictures are physically co-located in the
    same video picture resource with even scanlines corresponding to the top
    field and odd scanlines corresponding to the bottom field, respectively.
  * If the picture layout is
    ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR,
    then the top and bottom field pictures are stored in separate video
    picture resources (in separate subregions of the same image layer, in
    separate layers of the same image, or in entirely separate images),
    hence two elements of
    slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots can: contain the
    same pname:slotIndex but specify different video picture resources in
    their pname:pPictureResource members.

====
endif::VK_KHR_video_decode_h264[]

All non-negative pname:slotIndex values specified in the elements of
pname:pBeginInfo->pReferenceSlots must: identify DPB slots of the video
session that are in the <<dpb-slot-states,active state>> at the time this
command is executed on the device.

[NOTE]
.Note
====
The application does not have to specify an entry in
pname:pBeginInfo->pReferenceSlots corresponding to all active DPB slots of
the video session, but only for those which are intended to be used in the
video coding scope.
This way the application can avoid any potential runtime cost associated
with binding the corresponding picture resources to the command buffer.
====

ifdef::VK_KHR_video_encode_queue[]
In case of a video encode session, the application is also responsible for
providing information about the current <<encode-rate-control-state,rate
control state>> configured for the video session by including an instance of
the slink:VkVideoEncodeRateControlInfoKHR structure in the pname:pNext chain
of pname:pBeginInfo.
If no slink:VkVideoEncodeRateControlInfoKHR is included, then the presence
of an empty slink:VkVideoEncodeRateControlInfoKHR structure is implied which
indicates that the current <<encode-rate-control-modes,rate control mode>>
is ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR.
The specified state must: <<encode-rate-control-state-matching,match>> the
effective rate control state configured for the video session at the time
the recorded command is executed on the device.

[NOTE]
.Note
====
Including an instance of the slink:VkVideoEncodeRateControlInfoKHR structure
in the pname:pNext chain of pname:pBeginInfo does not change the rate
control state configured for the video session, but only specifies the
expected rate control state configured at the time the recorded command is
executed on the device which allows the implementation to have information
about the configured rate control state at command buffer recording time.
In order to change the current rate control state of a video session, the
application has to issue an appropriate flink:vkCmdControlVideoCodingKHR
command as described in the <<video-coding-control,Video Coding Control>>
and <<encode-rate-control-state,Rate Control State>> sections.
====
endif::VK_KHR_video_encode_queue[]

.Valid Usage
****
  * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07231]]
    The sname:VkCommandPool that pname:commandBuffer was allocated from
    must: support the video codec operation pname:pBeginInfo->videoSession
    was created with, as returned by
    flink:vkGetPhysicalDeviceQueueFamilyProperties2 in
    slink:VkQueueFamilyVideoPropertiesKHR::pname:videoCodecOperations
  * [[VUID-vkCmdBeginVideoCodingKHR-None-07232]]
    There must: be no <<queries-operation-active,active>> queries
  * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07233]]
    If pname:commandBuffer is an unprotected command buffer and
    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
    then pname:pBeginInfo->videoSession must: not have been created with
    ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR
  * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07234]]
    If pname:commandBuffer is a protected command buffer and
    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
    then pname:pBeginInfo->videoSession must: have been created with
    ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR
  * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07235]]
    If pname:commandBuffer is an unprotected command buffer,
    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
    and the pname:pPictureResource member of any element of
    pname:pBeginInfo->pReferenceSlots is not `NULL`, then
    pname:pPictureResource->imageViewBinding for that element must: not
    specify an image view created from a protected image
  * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07236]]
    If pname:commandBuffer is a protected command buffer
    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
    and the pname:pPictureResource member of any element of
    pname:pBeginInfo->pReferenceSlots is not `NULL`, then
    pname:pPictureResource->imageViewBinding for that element must: specify
    an image view created from a protected image
  * [[VUID-vkCmdBeginVideoCodingKHR-slotIndex-07239]]
    If the pname:slotIndex member of any element of
    pname:pBeginInfo->pReferenceSlots is not negative, then it must: specify
    the index of a DPB slot that is in the <<dpb-slot-states,active state>>
    in pname:pBeginInfo->videoSession at the time the command is executed on
    the device
  * [[VUID-vkCmdBeginVideoCodingKHR-pPictureResource-07265]]
    Each video picture resource specified by any non-`NULL`
    pname:pPictureResource member specified in the elements of
    pname:pBeginInfo->pReferenceSlots for which pname:slotIndex is not
    negative must: <<video-picture-resource-matching,match>> one of the
    video picture resources currently associated with the DPB slot index of
    pname:pBeginInfo->videoSession specified by pname:slotIndex at the time
    the command is executed on the device
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08253]]
    If pname:pBeginInfo->videoSession was created with a video encode
    operation and the pname:pNext chain of pname:pBeginInfo does not include
    an instance of the slink:VkVideoEncodeRateControlInfoKHR structure, then
    the <<encode-rate-control-modes,rate control mode>> configured for
    pname:pBeginInfo->videoSession at the time the command is executed on
    the device must: be ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR
  * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08254]]
    If pname:pBeginInfo->videoSession was created with a video encode
    operation and the pname:pNext chain of pname:pBeginInfo includes an
    instance of the slink:VkVideoEncodeRateControlInfoKHR structure, then it
    must: <<encode-rate-control-state-matching,match>> the rate control
    state configured for pname:pBeginInfo->videoSession at the time the
    command is executed on the device
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08255]]
    If pname:pBeginInfo->videoSession was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, the
    current <<encode-rate-control-modes,rate control mode>> is not
    ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or
    ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, and
    slink:VkVideoEncodeH264CapabilitiesKHR::pname:requiresGopRemainingFrames
    is ename:VK_TRUE, as returned by
    flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the
    pname:pBeginInfo->videoSession was created with, then the pname:pNext
    chain of pname:pBeginInfo must: include an instance of the
    slink:VkVideoEncodeH264GopRemainingFrameInfoKHR with its
    pname:useGopRemainingFrames member set to ename:VK_TRUE
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08256]]
    If pname:pBeginInfo->videoSession was created with the video codec
    operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, the
    current <<encode-rate-control-modes,rate control mode>> is not
    ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or
    ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, and
    slink:VkVideoEncodeH265CapabilitiesKHR::pname:requiresGopRemainingFrames
    is ename:VK_TRUE, as returned by
    flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the
    pname:pBeginInfo->videoSession was created with, then the pname:pNext
    chain of pname:pBeginInfo must: include an instance of the
    slink:VkVideoEncodeH265GopRemainingFrameInfoKHR with its
    pname:useGopRemainingFrames member set to ename:VK_TRUE
endif::VK_KHR_video_encode_h265[]
****

include::{generated}/validity/protos/vkCmdBeginVideoCodingKHR.adoc[]
--

[open,refpage='VkVideoBeginCodingInfoKHR',desc='Structure specifying video coding scope begin information',type='structs']
--
The slink:VkVideoBeginCodingInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoBeginCodingInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is reserved for future use.
  * pname:videoSession is the video session object to be bound for the
    processing of the video commands.
  * pname:videoSessionParameters is dname:VK_NULL_HANDLE or a handle of a
    slink:VkVideoSessionParametersKHR object to be used for the processing
    of the video commands.
    If dname:VK_NULL_HANDLE, then no video session parameters object is
    bound for the duration of the video coding scope.
  * pname:referenceSlotCount is the number of elements in the
    pname:pReferenceSlots array.
  * pname:pReferenceSlots is a pointer to an array of
    slink:VkVideoReferenceSlotInfoKHR structures specifying the information
    used to determine the set of <<bound-reference-picture-resources,bound
    reference picture resources>> for the video coding scope and their
    initial association with <<dpb-slot,DPB slot>> indices.

Limiting values are defined below that are referenced by the relevant valid
usage statements of this structure.

  * Let `VkOffset2D codedOffsetGranularity` be the minimum alignment
    requirement for the coded offset of video picture resources.
    Unless otherwise defined, the value of the pname:x and pname:y members
    of pname:codedOffsetGranularity are `0`.
ifdef::VK_KHR_video_decode_h264[]
  ** If pname:videoSession was created with an <<decode-h264-profile,H.264
     decode profile>> with a
     slink:VkVideoDecodeH264ProfileInfoKHR::pname:pictureLayout of
     ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR,
     then pname:codedOffsetGranularity is equal to
     slink:VkVideoDecodeH264CapabilitiesKHR::pname:fieldOffsetGranularity,
     as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for that
     video profile.
endif::VK_KHR_video_decode_h264[]

.Valid Usage
****
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07237]]
    pname:videoSession must: have memory bound to all of its memory bindings
    returned by flink:vkGetVideoSessionMemoryRequirementsKHR for
    pname:videoSession
  * [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-04856]]
    Each non-negative slink:VkVideoReferenceSlotInfoKHR::pname:slotIndex
    specified in the elements of pname:pReferenceSlots must: be less than
    the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots specified when
    pname:videoSession was created
  * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07238]]
    Each video picture resource corresponding to any non-`NULL`
    pname:pPictureResource member specified in the elements of
    pname:pReferenceSlots must: be <<video-picture-resource-uniqueness,
    unique>> within pname:pReferenceSlots
  * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07240]]
    If the pname:pPictureResource member of any element of
    pname:pReferenceSlots is not `NULL`, then the image view specified in
    pname:pPictureResource->imageViewBinding for that element must: be
    <<video-profile-compatibility,compatible>> with the video profile
    pname:videoSession was created with
  * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07241]]
    If the pname:pPictureResource member of any element of
    pname:pReferenceSlots is not `NULL`, then the format of the image view
    specified in pname:pPictureResource->imageViewBinding for that element
    must: match the
    slink:VkVideoSessionCreateInfoKHR::pname:referencePictureFormat
    pname:videoSession was created with
  * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07242]]
    If the pname:pPictureResource member of any element of
    pname:pReferenceSlots is not `NULL`, then its pname:codedOffset member
    must: be an integer multiple of pname:codedOffsetGranularity
  * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07243]]
    If the pname:pPictureResource member of any element of
    pname:pReferenceSlots is not `NULL`, then its pname:codedExtent member
    must: be between pname:minCodedExtent and pname:maxCodedExtent,
    inclusive, pname:videoSession was created with
  * [[VUID-VkVideoBeginCodingInfoKHR-flags-07244]]
    If slink:VkVideoCapabilitiesKHR::pname:flags does not include
    ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR, as returned
    by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile
    pname:videoSession was created with, then
    pname:pPictureResource->imageViewBinding of all elements of
    pname:pReferenceSlots with a non-`NULL` pname:pPictureResource member
    must: specify image views created from the same image
ifdef::VK_KHR_video_decode_queue[]
  * [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-07245]]
    If pname:videoSession was created with a decode operation and the
    pname:slotIndex member of any element of pname:pReferenceSlots is not
    negative, then the image view specified in
    pname:pPictureResource->imageViewBinding for that element must: have
    been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-07246]]
    If pname:videoSession was created with an encode operation and the
    pname:slotIndex member of any element of pname:pReferenceSlots is not
    negative, then the image view specified in
    pname:pPictureResource->imageViewBinding for that element must: have
    been created with ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
endif::VK_KHR_video_encode_queue[]
ifdef::VK_KHR_video_decode_h264[]
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07247]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then
    pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_decode_h264[]
ifdef::VK_KHR_video_decode_h265[]
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07248]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then
    pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_decode_h265[]
ifdef::VK_KHR_video_decode_av1[]
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-09261]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR, then
    pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_decode_av1[]
ifdef::VK_KHR_video_encode_h264[]
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07249]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then
    pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_encode_h264[]
ifdef::VK_KHR_video_encode_h265[]
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07250]]
    If pname:videoSession was created with the video codec operation
    ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then
    pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE
endif::VK_KHR_video_encode_h265[]
  * [[VUID-VkVideoBeginCodingInfoKHR-videoSessionParameters-04857]]
    If pname:videoSessionParameters is not dname:VK_NULL_HANDLE, it must:
    have been created with pname:videoSession specified in
    slink:VkVideoSessionParametersCreateInfoKHR::pname:videoSession
****

include::{generated}/validity/structs/VkVideoBeginCodingInfoKHR.adoc[]
--

[open,refpage='VkVideoBeginCodingFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkVideoBeginCodingFlagsKHR.adoc[]

tname:VkVideoBeginCodingFlagsKHR is a bitmask type for setting a mask, but
is currently reserved for future use.
--

[open,refpage='VkVideoReferenceSlotInfoKHR',desc='Structure specifying information about a reference picture slot',type='structs']
--
The sname:VkVideoReferenceSlotInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoReferenceSlotInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:slotIndex is the index of the <<dpb-slot, DPB slot>> or a negative
    integer value.
  * pname:pPictureResource is `NULL` or a pointer to a
    slink:VkVideoPictureResourceInfoKHR structure describing the
    <<video-picture-resources,video picture resource>> associated with the
    DPB slot index specified by pname:slotIndex.

include::{generated}/validity/structs/VkVideoReferenceSlotInfoKHR.adoc[]
--

[open,refpage='vkCmdEndVideoCodingKHR',desc='End video coding scope',type='protos']
--
To end a video coding scope, call:

include::{generated}/api/protos/vkCmdEndVideoCodingKHR.adoc[]

  * pname:commandBuffer is the command buffer in which to record the
    command.
  * pname:pEndCodingInfo is a pointer to a slink:VkVideoEndCodingInfoKHR
    structure specifying the parameters for ending the video coding scope.

After ending a video coding scope, the video session object, the optional
video session parameters object, and all
<<bound-reference-picture-resources, reference picture resources>>
previously bound by the corresponding flink:vkCmdBeginVideoCodingKHR command
are _unbound_.

.Valid Usage
****
  * [[VUID-vkCmdEndVideoCodingKHR-None-07251]]
    There must: be no <<queries-operation-active,active>> queries
****

include::{generated}/validity/protos/vkCmdEndVideoCodingKHR.adoc[]
--

[open,refpage='VkVideoEndCodingInfoKHR',desc='Structure specifying video coding scope end information',type='structs']
--
The sname:VkVideoEndCodingInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoEndCodingInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is reserved for future use.

include::{generated}/validity/structs/VkVideoEndCodingInfoKHR.adoc[]
--

[open,refpage='VkVideoEndCodingFlagsKHR',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkVideoEndCodingFlagsKHR.adoc[]

tname:VkVideoEndCodingFlagsKHR is a bitmask type for setting a mask, but is
currently reserved for future use.
--


[[video-coding-control]]
== Video Coding Control

[open,refpage='vkCmdControlVideoCodingKHR',desc='Control video coding parameters',type='protos']
--
To apply dynamic controls to the currently bound video session object, call:

include::{generated}/api/protos/vkCmdControlVideoCodingKHR.adoc[]

  * pname:commandBuffer is the command buffer in which to record the
    command.
  * pname:pCodingControlInfo is a pointer to a
    slink:VkVideoCodingControlInfoKHR structure specifying the control
    parameters.

The control parameters provided in this call are applied to the video
session at the time the command executes on the device and are in effect
until a subsequent call to this command with the same video session bound
changes the corresponding control parameters.

A newly created video session must: be reset before performing video coding
operations using it by including ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR
in pname:pCodingControlInfo->flags.
The reset operation also returns all DPB slots of the video session to the
<<dpb-slot-states,inactive state>>.
Correspondingly, any DPB slot index associated with the
<<bound-reference-picture-resources,bound reference picture resources>> is
removed.

ifdef::VK_KHR_video_encode_queue[]
For encode sessions, the reset operation returns <<encode-rate-control,rate
control>> configuration to implementation default settings and sets the
<<encode-quality-level,video encode quality level>> to zero.
endif::VK_KHR_video_encode_queue[]

After video coding operations are performed using a video session, the reset
operation can: be used to return the video session to the same _initial_
state as after the reset of a newly created video session.
This can: be used, for example, when different video sequences are needed to
be processed with the same video session object.

ifdef::VK_KHR_video_encode_queue[]
If pname:pCodingControlInfo->flags includes
ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, then the command
replaces the <<encode-rate-control,rate control>> configuration maintained
by the video session with the configuration specified in the
slink:VkVideoEncodeRateControlInfoKHR structure included in the
pname:pCodingControlInfo->pNext chain.

If pname:pCodingControlInfo->flags includes
ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR, then the command
changes the current <<encode-quality-level,video encode quality level>> to
the value specified in the pname:qualityLevel member of the
slink:VkVideoEncodeQualityLevelInfoKHR structure included in the
pname:pCodingControlInfo->pNext chain.
endif::VK_KHR_video_encode_queue[]

.Valid Usage
****
  * [[VUID-vkCmdControlVideoCodingKHR-flags-07017]]
    If pname:pCodingControlInfo->flags does not include
    ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR, then the bound video
    session must: not be in <<video-session-uninitialized,uninitialized>>
    state at the time the command is executed on the device
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-vkCmdControlVideoCodingKHR-pCodingControlInfo-08243]]
    If the bound video session was not created with an encode operation,
    then pname:pCodingControlInfo->flags must: not include
    ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR or
    ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR
endif::VK_KHR_video_encode_queue[]
****

include::{generated}/validity/protos/vkCmdControlVideoCodingKHR.adoc[]
--

[open,refpage='VkVideoCodingControlInfoKHR',desc='Structure specifying video coding control parameters',type='structs']
--
The sname:VkVideoCodingControlInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoCodingControlInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is a bitmask of tlink:VkVideoCodingControlFlagsKHR
    specifying control flags.

.Valid Usage
****
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-VkVideoCodingControlInfoKHR-flags-07018]]
    If pname:flags includes
    ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, then the
    pname:pNext chain must: include a slink:VkVideoEncodeRateControlInfoKHR
    structure
  * [[VUID-VkVideoCodingControlInfoKHR-flags-08349]]
    If pname:flags includes
    ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR, then the
    pname:pNext chain must: include a slink:VkVideoEncodeQualityLevelInfoKHR
    structure
endif::VK_KHR_video_encode_queue[]
****

include::{generated}/validity/structs/VkVideoCodingControlInfoKHR.adoc[]
--

[open,refpage='VkVideoCodingControlFlagBitsKHR',desc='Video coding control flags',type='enums']
--
Bits which can: be set in slink:VkVideoCodingControlInfoKHR::pname:flags,
specifying the video coding control parameters to be modified, are:

include::{generated}/api/enums/VkVideoCodingControlFlagBitsKHR.adoc[]

  * ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR indicates a request for the
    bound video session to be reset before other coding control parameters
    are applied.
ifdef::VK_KHR_video_encode_queue[]
  * ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR indicates that
    the coding control parameters include video encode rate control
    parameters (see slink:VkVideoEncodeRateControlInfoKHR).
  * ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR indicates
    that the coding control parameters include video encode quality level
    parameters (see slink:VkVideoEncodeQualityLevelInfoKHR).
endif::VK_KHR_video_encode_queue[]
--

[open,refpage='VkVideoCodingControlFlagsKHR',desc='Bitmask of VkVideoCodingControlFlagBitsKHR',type='flags']
--
include::{generated}/api/flags/VkVideoCodingControlFlagsKHR.adoc[]

tname:VkVideoCodingControlFlagsKHR is a bitmask type for setting a mask of
zero or more elink:VkVideoCodingControlFlagBitsKHR.
--


ifdef::VK_KHR_video_maintenance1[]
[[video-inline-queries]]
== Inline Queries

If a video session was created with
ename:VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, beginning queries
using commands such as flink:vkCmdBeginQuery within a video coding scope is
not allowed.
Instead, queries are executed inline by including an instance of the
slink:VkVideoInlineQueryInfoKHR structure in the pname:pNext chain of the
parameters of one of the video coding commands, with its pname:queryPool
member set to a valid sname:VkQueryPool handle.

[open,refpage='VkVideoInlineQueryInfoKHR',desc='Structure specifying inline query information for video coding commands',type='structs']
--
The sname:VkVideoInlineQueryInfoKHR structure is defined as:

include::{generated}/api/structs/VkVideoInlineQueryInfoKHR.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:queryPool is dname:VK_NULL_HANDLE or a valid handle to a
    slink:VkQueryPool object that will manage the results of the queries.
  * pname:firstQuery is the query index within the query pool that will
    contain the query results for the first video coding operation.
    The query results of subsequent video coding operations will be
    contained by subsequent query indices.
  * pname:queryCount is the number of queries to execute.
+
[NOTE]
.Note
====
In practice, if pname:queryPool is not dname:VK_NULL_HANDLE, then
pname:queryCount will always have to match the number of video coding
operations issued by the video coding command this structure is specified
to, meaning that using inline queries in a video coding command will always
execute a query for each issued video coding operation.
====

This structure can: be included in the pname:pNext chain of the input
parameter structure of video coding commands.

ifdef::VK_KHR_video_decode_queue[]
  * In the pname:pNext chain of the pname:pDecodeInfo parameter of the
    flink:vkCmdDecodeVideoKHR command to execute a query for each video
    decode operation issued by the command.
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * In the pname:pNext chain of the pname:pEncodeInfo parameter of the
    flink:vkCmdEncodeVideoKHR command to execute a query for each video
    encode operation issued by the command.
endif::VK_KHR_video_encode_queue[]

.Valid Usage
****
  * [[VUID-VkVideoInlineQueryInfoKHR-queryPool-08372]]
    If pname:queryPool is not dname:VK_NULL_HANDLE, then pname:firstQuery
    must: be less than the number of queries in pname:queryPool
  * [[VUID-VkVideoInlineQueryInfoKHR-queryPool-08373]]
    If pname:queryPool is not dname:VK_NULL_HANDLE, then the sum of
    pname:firstQuery and pname:queryCount must: be less than or equal to the
    number of queries in pname:queryPool
****

include::{generated}/validity/structs/VkVideoInlineQueryInfoKHR.adoc[]
--
endif::VK_KHR_video_maintenance1[]


ifdef::VK_KHR_video_decode_queue[]
include::{chapters}/video/decode.adoc[]
endif::VK_KHR_video_decode_queue[]

ifdef::VK_KHR_video_decode_h264[]
include::{chapters}/video/h264_decode.adoc[]
endif::VK_KHR_video_decode_h264[]

ifdef::VK_KHR_video_decode_h265[]
include::{chapters}/video/h265_decode.adoc[]
endif::VK_KHR_video_decode_h265[]

ifdef::VK_KHR_video_decode_av1[]
include::{chapters}/video/av1_decode.adoc[]
endif::VK_KHR_video_decode_av1[]

ifdef::VK_KHR_video_encode_queue[]
include::{chapters}/video/encode.adoc[]
endif::VK_KHR_video_encode_queue[]

ifdef::VK_KHR_video_encode_h264[]
include::{chapters}/video/h264_encode.adoc[]
endif::VK_KHR_video_encode_h264[]

ifdef::VK_KHR_video_encode_h265[]
include::{chapters}/video/h265_encode.adoc[]
endif::VK_KHR_video_encode_h265[]