kazan 0.3.9+1.4.359

Vulkan bindings for Rust
Documentation
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
//! <https://registry.khronos.org/vulkan/specs/latest/man/html/vulkan_video_codec_av1std_decode.html>
#![allow(unused_imports)]
use crate::{vk::Result as VkResult, vk::*, *};
use core::ffi::{CStr, c_char, c_int, c_void};
use core::mem::transmute;
use core::ptr;

pub const EXTENSION_NAME: &CStr = c"vulkan_video_codec_av1std_decode";

pub(super) mod defs {
    #![allow(non_camel_case_types, unused_imports)]
    use crate::{vk::*, *};
    use core::ffi::{CStr, c_char, c_int, c_void};
    use core::fmt;
    use core::marker::PhantomData;
    use core::ptr;

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/StdVideoDecodeAV1PictureInfoFlags.html>
    #[repr(C)]
    #[cfg_attr(feature = "debug", derive(Debug))]
    #[derive(Copy, Clone, Default)]
    #[must_use]
    pub struct StdVideoDecodeAV1PictureInfoFlags {
        pub _bitfield_0: u32,
    }

    impl StdVideoDecodeAV1PictureInfoFlags {
        #[inline]
        pub fn error_resilient_mode(mut self, error_resilient_mode: bool) -> Self {
            set_bitfield_bool::<0>(&mut self._bitfield_0, error_resilient_mode);
            self
        }

        #[inline]
        pub fn disable_cdf_update(mut self, disable_cdf_update: bool) -> Self {
            set_bitfield_bool::<1>(&mut self._bitfield_0, disable_cdf_update);
            self
        }

        #[inline]
        pub fn use_superres(mut self, use_superres: bool) -> Self {
            set_bitfield_bool::<2>(&mut self._bitfield_0, use_superres);
            self
        }

        #[inline]
        pub fn render_and_frame_size_different(
            mut self,
            render_and_frame_size_different: bool,
        ) -> Self {
            set_bitfield_bool::<3>(&mut self._bitfield_0, render_and_frame_size_different);
            self
        }

        #[inline]
        pub fn allow_screen_content_tools(mut self, allow_screen_content_tools: bool) -> Self {
            set_bitfield_bool::<4>(&mut self._bitfield_0, allow_screen_content_tools);
            self
        }

        #[inline]
        pub fn is_filter_switchable(mut self, is_filter_switchable: bool) -> Self {
            set_bitfield_bool::<5>(&mut self._bitfield_0, is_filter_switchable);
            self
        }

        #[inline]
        pub fn force_integer_mv(mut self, force_integer_mv: bool) -> Self {
            set_bitfield_bool::<6>(&mut self._bitfield_0, force_integer_mv);
            self
        }

        #[inline]
        pub fn frame_size_override_flag(mut self, frame_size_override_flag: bool) -> Self {
            set_bitfield_bool::<7>(&mut self._bitfield_0, frame_size_override_flag);
            self
        }

        #[inline]
        pub fn buffer_removal_time_present_flag(
            mut self,
            buffer_removal_time_present_flag: bool,
        ) -> Self {
            set_bitfield_bool::<8>(&mut self._bitfield_0, buffer_removal_time_present_flag);
            self
        }

        #[inline]
        pub fn allow_intrabc(mut self, allow_intrabc: bool) -> Self {
            set_bitfield_bool::<9>(&mut self._bitfield_0, allow_intrabc);
            self
        }

        #[inline]
        pub fn frame_refs_short_signaling(mut self, frame_refs_short_signaling: bool) -> Self {
            set_bitfield_bool::<10>(&mut self._bitfield_0, frame_refs_short_signaling);
            self
        }

        #[inline]
        pub fn allow_high_precision_mv(mut self, allow_high_precision_mv: bool) -> Self {
            set_bitfield_bool::<11>(&mut self._bitfield_0, allow_high_precision_mv);
            self
        }

        #[inline]
        pub fn is_motion_mode_switchable(mut self, is_motion_mode_switchable: bool) -> Self {
            set_bitfield_bool::<12>(&mut self._bitfield_0, is_motion_mode_switchable);
            self
        }

        #[inline]
        pub fn use_ref_frame_mvs(mut self, use_ref_frame_mvs: bool) -> Self {
            set_bitfield_bool::<13>(&mut self._bitfield_0, use_ref_frame_mvs);
            self
        }

        #[inline]
        pub fn disable_frame_end_update_cdf(mut self, disable_frame_end_update_cdf: bool) -> Self {
            set_bitfield_bool::<14>(&mut self._bitfield_0, disable_frame_end_update_cdf);
            self
        }

        #[inline]
        pub fn allow_warped_motion(mut self, allow_warped_motion: bool) -> Self {
            set_bitfield_bool::<15>(&mut self._bitfield_0, allow_warped_motion);
            self
        }

        #[inline]
        pub fn reduced_tx_set(mut self, reduced_tx_set: bool) -> Self {
            set_bitfield_bool::<16>(&mut self._bitfield_0, reduced_tx_set);
            self
        }

        #[inline]
        pub fn reference_select(mut self, reference_select: bool) -> Self {
            set_bitfield_bool::<17>(&mut self._bitfield_0, reference_select);
            self
        }

        #[inline]
        pub fn skip_mode_present(mut self, skip_mode_present: bool) -> Self {
            set_bitfield_bool::<18>(&mut self._bitfield_0, skip_mode_present);
            self
        }

        #[inline]
        pub fn delta_q_present(mut self, delta_q_present: bool) -> Self {
            set_bitfield_bool::<19>(&mut self._bitfield_0, delta_q_present);
            self
        }

        #[inline]
        pub fn delta_lf_present(mut self, delta_lf_present: bool) -> Self {
            set_bitfield_bool::<20>(&mut self._bitfield_0, delta_lf_present);
            self
        }

        #[inline]
        pub fn delta_lf_multi(mut self, delta_lf_multi: bool) -> Self {
            set_bitfield_bool::<21>(&mut self._bitfield_0, delta_lf_multi);
            self
        }

        #[inline]
        pub fn segmentation_enabled(mut self, segmentation_enabled: bool) -> Self {
            set_bitfield_bool::<22>(&mut self._bitfield_0, segmentation_enabled);
            self
        }

        #[inline]
        pub fn segmentation_update_map(mut self, segmentation_update_map: bool) -> Self {
            set_bitfield_bool::<23>(&mut self._bitfield_0, segmentation_update_map);
            self
        }

        #[inline]
        pub fn segmentation_temporal_update(mut self, segmentation_temporal_update: bool) -> Self {
            set_bitfield_bool::<24>(&mut self._bitfield_0, segmentation_temporal_update);
            self
        }

        #[inline]
        pub fn segmentation_update_data(mut self, segmentation_update_data: bool) -> Self {
            set_bitfield_bool::<25>(&mut self._bitfield_0, segmentation_update_data);
            self
        }

        #[inline]
        pub fn uses_lr(mut self, uses_lr: bool) -> Self {
            set_bitfield_bool::<26>(&mut self._bitfield_0, uses_lr);
            self
        }

        #[inline]
        pub fn uses_chroma_lr(mut self, uses_chroma_lr: bool) -> Self {
            set_bitfield_bool::<27>(&mut self._bitfield_0, uses_chroma_lr);
            self
        }

        #[inline]
        pub fn apply_grain(mut self, apply_grain: bool) -> Self {
            set_bitfield_bool::<28>(&mut self._bitfield_0, apply_grain);
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/StdVideoDecodeAV1PictureInfo.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct StdVideoDecodeAV1PictureInfo<'a> {
        pub flags: StdVideoDecodeAV1PictureInfoFlags,
        pub frame_type: StdVideoAV1FrameType,
        pub current_frame_id: u32,
        pub order_hint: u8,
        pub primary_ref_frame: u8,
        pub refresh_frame_flags: u8,
        pub reserved1: u8,
        pub interpolation_filter: StdVideoAV1InterpolationFilter,
        pub tx_mode: StdVideoAV1TxMode,
        pub delta_q_res: u8,
        pub delta_lf_res: u8,
        pub skip_mode_frame: [u8; STD_VIDEO_AV1_SKIP_MODE_FRAMES as usize],
        pub coded_denom: u8,
        pub reserved2: [u8; 3],
        pub order_hints: [u8; STD_VIDEO_AV1_NUM_REF_FRAMES as usize],
        pub expected_frame_id: [u32; STD_VIDEO_AV1_NUM_REF_FRAMES as usize],
        pub p_tile_info: *const StdVideoAV1TileInfo<'a>,
        pub p_quantization: *const StdVideoAV1Quantization,
        pub p_segmentation: *const StdVideoAV1Segmentation,
        pub p_loop_filter: *const StdVideoAV1LoopFilter,
        pub p_cdef: *const StdVideoAV1CDEF,
        pub p_loop_restoration: *const StdVideoAV1LoopRestoration,
        pub p_global_motion: *const StdVideoAV1GlobalMotion,
        pub p_film_grain: *const StdVideoAV1FilmGrain,
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for StdVideoDecodeAV1PictureInfo<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("StdVideoDecodeAV1PictureInfo")
                .field("flags", &self.flags)
                .field("frame_type", &self.frame_type)
                .field("current_frame_id", &self.current_frame_id)
                .field("order_hint", &self.order_hint)
                .field("primary_ref_frame", &self.primary_ref_frame)
                .field("refresh_frame_flags", &self.refresh_frame_flags)
                .field("reserved1", &self.reserved1)
                .field("interpolation_filter", &self.interpolation_filter)
                .field("tx_mode", &self.tx_mode)
                .field("delta_q_res", &self.delta_q_res)
                .field("delta_lf_res", &self.delta_lf_res)
                .field("skip_mode_frame", &self.skip_mode_frame)
                .field("coded_denom", &self.coded_denom)
                .field("reserved2", &self.reserved2)
                .field("order_hints", &self.order_hints)
                .field("expected_frame_id", &self.expected_frame_id)
                .field("p_tile_info", &self.p_tile_info)
                .field("p_quantization", &self.p_quantization)
                .field("p_segmentation", &self.p_segmentation)
                .field("p_loop_filter", &self.p_loop_filter)
                .field("p_cdef", &self.p_cdef)
                .field("p_loop_restoration", &self.p_loop_restoration)
                .field("p_global_motion", &self.p_global_motion)
                .field("p_film_grain", &self.p_film_grain)
                .finish()
        }
    }

    impl Default for StdVideoDecodeAV1PictureInfo<'_> {
        fn default() -> Self {
            Self {
                flags: Default::default(),
                frame_type: Default::default(),
                current_frame_id: Default::default(),
                order_hint: Default::default(),
                primary_ref_frame: Default::default(),
                refresh_frame_flags: Default::default(),
                reserved1: Default::default(),
                interpolation_filter: Default::default(),
                tx_mode: Default::default(),
                delta_q_res: Default::default(),
                delta_lf_res: Default::default(),
                skip_mode_frame: [Default::default(); _],
                coded_denom: Default::default(),
                reserved2: [Default::default(); _],
                order_hints: [Default::default(); _],
                expected_frame_id: [Default::default(); _],
                p_tile_info: ptr::null(),
                p_quantization: ptr::null(),
                p_segmentation: ptr::null(),
                p_loop_filter: ptr::null(),
                p_cdef: ptr::null(),
                p_loop_restoration: ptr::null(),
                p_global_motion: ptr::null(),
                p_film_grain: ptr::null(),
                _marker: PhantomData,
            }
        }
    }

    impl<'a> StdVideoDecodeAV1PictureInfo<'a> {
        #[inline]
        pub fn flags(mut self, flags: StdVideoDecodeAV1PictureInfoFlags) -> Self {
            self.flags = flags;
            self
        }

        #[inline]
        pub fn frame_type(mut self, frame_type: StdVideoAV1FrameType) -> Self {
            self.frame_type = frame_type;
            self
        }

        #[inline]
        pub fn current_frame_id(mut self, current_frame_id: u32) -> Self {
            self.current_frame_id = current_frame_id;
            self
        }

        #[inline]
        pub fn order_hint(mut self, order_hint: u8) -> Self {
            self.order_hint = order_hint;
            self
        }

        #[inline]
        pub fn primary_ref_frame(mut self, primary_ref_frame: u8) -> Self {
            self.primary_ref_frame = primary_ref_frame;
            self
        }

        #[inline]
        pub fn refresh_frame_flags(mut self, refresh_frame_flags: u8) -> Self {
            self.refresh_frame_flags = refresh_frame_flags;
            self
        }

        #[inline]
        pub fn reserved1(mut self, reserved1: u8) -> Self {
            self.reserved1 = reserved1;
            self
        }

        #[inline]
        pub fn interpolation_filter(
            mut self,
            interpolation_filter: StdVideoAV1InterpolationFilter,
        ) -> Self {
            self.interpolation_filter = interpolation_filter;
            self
        }

        #[inline]
        pub fn tx_mode(mut self, tx_mode: StdVideoAV1TxMode) -> Self {
            self.tx_mode = tx_mode;
            self
        }

        #[inline]
        pub fn delta_q_res(mut self, delta_q_res: u8) -> Self {
            self.delta_q_res = delta_q_res;
            self
        }

        #[inline]
        pub fn delta_lf_res(mut self, delta_lf_res: u8) -> Self {
            self.delta_lf_res = delta_lf_res;
            self
        }

        #[inline]
        pub fn skip_mode_frame(
            mut self,
            skip_mode_frame: [u8; STD_VIDEO_AV1_SKIP_MODE_FRAMES as usize],
        ) -> Self {
            self.skip_mode_frame = skip_mode_frame;
            self
        }

        #[inline]
        pub fn coded_denom(mut self, coded_denom: u8) -> Self {
            self.coded_denom = coded_denom;
            self
        }

        #[inline]
        pub fn reserved2(mut self, reserved2: [u8; 3]) -> Self {
            self.reserved2 = reserved2;
            self
        }

        #[inline]
        pub fn order_hints(
            mut self,
            order_hints: [u8; STD_VIDEO_AV1_NUM_REF_FRAMES as usize],
        ) -> Self {
            self.order_hints = order_hints;
            self
        }

        #[inline]
        pub fn expected_frame_id(
            mut self,
            expected_frame_id: [u32; STD_VIDEO_AV1_NUM_REF_FRAMES as usize],
        ) -> Self {
            self.expected_frame_id = expected_frame_id;
            self
        }

        #[inline]
        pub fn tile_info(mut self, tile_info: &'a StdVideoAV1TileInfo<'a>) -> Self {
            self.p_tile_info = tile_info;
            self
        }

        #[inline]
        pub fn quantization(mut self, quantization: &'a StdVideoAV1Quantization) -> Self {
            self.p_quantization = quantization;
            self
        }

        #[inline]
        pub fn segmentation(mut self, segmentation: &'a StdVideoAV1Segmentation) -> Self {
            self.p_segmentation = segmentation;
            self
        }

        #[inline]
        pub fn loop_filter(mut self, loop_filter: &'a StdVideoAV1LoopFilter) -> Self {
            self.p_loop_filter = loop_filter;
            self
        }

        #[inline]
        pub fn cdef(mut self, cdef: &'a StdVideoAV1CDEF) -> Self {
            self.p_cdef = cdef;
            self
        }

        #[inline]
        pub fn loop_restoration(
            mut self,
            loop_restoration: &'a StdVideoAV1LoopRestoration,
        ) -> Self {
            self.p_loop_restoration = loop_restoration;
            self
        }

        #[inline]
        pub fn global_motion(mut self, global_motion: &'a StdVideoAV1GlobalMotion) -> Self {
            self.p_global_motion = global_motion;
            self
        }

        #[inline]
        pub fn film_grain(mut self, film_grain: &'a StdVideoAV1FilmGrain) -> Self {
            self.p_film_grain = film_grain;
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/StdVideoDecodeAV1ReferenceInfoFlags.html>
    #[repr(C)]
    #[cfg_attr(feature = "debug", derive(Debug))]
    #[derive(Copy, Clone, Default)]
    #[must_use]
    pub struct StdVideoDecodeAV1ReferenceInfoFlags {
        pub _bitfield_0: u32,
    }

    impl StdVideoDecodeAV1ReferenceInfoFlags {
        #[inline]
        pub fn disable_frame_end_update_cdf(mut self, disable_frame_end_update_cdf: bool) -> Self {
            set_bitfield_bool::<0>(&mut self._bitfield_0, disable_frame_end_update_cdf);
            self
        }

        #[inline]
        pub fn segmentation_enabled(mut self, segmentation_enabled: bool) -> Self {
            set_bitfield_bool::<1>(&mut self._bitfield_0, segmentation_enabled);
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/StdVideoDecodeAV1ReferenceInfo.html>
    #[repr(C)]
    #[cfg_attr(feature = "debug", derive(Debug))]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct StdVideoDecodeAV1ReferenceInfo {
        pub flags: StdVideoDecodeAV1ReferenceInfoFlags,
        pub frame_type: u8,
        pub ref_frame_sign_bias: u8,
        pub order_hint: u8,
        pub saved_order_hints: [u8; STD_VIDEO_AV1_NUM_REF_FRAMES as usize],
    }

    impl Default for StdVideoDecodeAV1ReferenceInfo {
        fn default() -> Self {
            Self {
                flags: Default::default(),
                frame_type: Default::default(),
                ref_frame_sign_bias: Default::default(),
                order_hint: Default::default(),
                saved_order_hints: [Default::default(); _],
            }
        }
    }

    impl StdVideoDecodeAV1ReferenceInfo {
        #[inline]
        pub fn flags(mut self, flags: StdVideoDecodeAV1ReferenceInfoFlags) -> Self {
            self.flags = flags;
            self
        }

        #[inline]
        pub fn frame_type(mut self, frame_type: u8) -> Self {
            self.frame_type = frame_type;
            self
        }

        #[inline]
        pub fn ref_frame_sign_bias(mut self, ref_frame_sign_bias: u8) -> Self {
            self.ref_frame_sign_bias = ref_frame_sign_bias;
            self
        }

        #[inline]
        pub fn order_hint(mut self, order_hint: u8) -> Self {
            self.order_hint = order_hint;
            self
        }

        #[inline]
        pub fn saved_order_hints(
            mut self,
            saved_order_hints: [u8; STD_VIDEO_AV1_NUM_REF_FRAMES as usize],
        ) -> Self {
            self.saved_order_hints = saved_order_hints;
            self
        }
    }
}

#[cfg(feature = "ffi")]
pub(super) mod ffi {
    #![allow(non_camel_case_types)]
    use super::defs::*;

    pub type StdVideoDecodeAV1PictureInfoFlags = super::defs::StdVideoDecodeAV1PictureInfoFlags;
    pub type StdVideoDecodeAV1PictureInfo = super::defs::StdVideoDecodeAV1PictureInfo<'static>;
    pub type StdVideoDecodeAV1ReferenceInfoFlags = super::defs::StdVideoDecodeAV1ReferenceInfoFlags;
    pub type StdVideoDecodeAV1ReferenceInfo = super::defs::StdVideoDecodeAV1ReferenceInfo;
    impl super::defs::StdVideoDecodeAV1PictureInfo<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(&self) -> &StdVideoDecodeAV1PictureInfo {
            unsafe { core::mem::transmute(self) }
        }
    }
}