libdav1d_sys/
ffi.rs

1/* automatically generated by rust-bindgen 0.69.4 */
2
3pub const DAV1D_MAX_CDEF_STRENGTHS: u32 = 8;
4pub const DAV1D_MAX_OPERATING_POINTS: u32 = 32;
5pub const DAV1D_MAX_TILE_COLS: u32 = 64;
6pub const DAV1D_MAX_TILE_ROWS: u32 = 64;
7pub const DAV1D_MAX_SEGMENTS: u32 = 8;
8pub const DAV1D_NUM_REF_FRAMES: u32 = 8;
9pub const DAV1D_PRIMARY_REF_NONE: u32 = 7;
10pub const DAV1D_REFS_PER_FRAME: u32 = 7;
11pub const DAV1D_TOTAL_REFS_PER_FRAME: u32 = 8;
12pub const DAV1D_PICTURE_ALIGNMENT: u32 = 64;
13pub const DAV1D_API_VERSION_MAJOR: u32 = 7;
14pub const DAV1D_API_VERSION_MINOR: u32 = 0;
15pub const DAV1D_API_VERSION_PATCH: u32 = 0;
16pub const DAV1D_MAX_THREADS: u32 = 256;
17pub const DAV1D_MAX_FRAME_DELAY: u32 = 256;
18pub type va_list = __builtin_va_list;
19#[doc = " A reference-counted object wrapper for a user-configurable pointer."]
20#[repr(C)]
21#[derive(Debug, Copy, Clone)]
22pub struct Dav1dUserData {
23    #[doc = "< data pointer"]
24    pub data: *const u8,
25    #[doc = "< allocation origin"]
26    pub ref_: *mut Dav1dRef,
27}
28#[doc = " Input packet metadata which are copied from the input data used to\n decode each image into the matching structure of the output image\n returned back to the user. Since these are metadata fields, they\n can be used for other purposes than the documented ones, they will\n still be passed from input data to output picture without being\n used internally."]
29#[repr(C)]
30#[derive(Debug, Copy, Clone)]
31pub struct Dav1dDataProps {
32    #[doc = "< container timestamp of input data, INT64_MIN if unknown (default)"]
33    pub timestamp: i64,
34    #[doc = "< container duration of input data, 0 if unknown (default)"]
35    pub duration: i64,
36    #[doc = "< stream offset of input data, -1 if unknown (default)"]
37    pub offset: i64,
38    #[doc = "< packet size, default Dav1dData.sz"]
39    pub size: usize,
40    #[doc = "< user-configurable data, default NULL members"]
41    pub user_data: Dav1dUserData,
42}
43extern "C" {
44    #[doc = " Release reference to a Dav1dDataProps."]
45    pub fn dav1d_data_props_unref(props: *mut Dav1dDataProps);
46}
47#[repr(u32)]
48#[non_exhaustive]
49#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
50pub enum Dav1dObuType {
51    DAV1D_OBU_SEQ_HDR = 1,
52    DAV1D_OBU_TD = 2,
53    DAV1D_OBU_FRAME_HDR = 3,
54    DAV1D_OBU_TILE_GRP = 4,
55    DAV1D_OBU_METADATA = 5,
56    DAV1D_OBU_FRAME = 6,
57    DAV1D_OBU_REDUNDANT_FRAME_HDR = 7,
58    DAV1D_OBU_PADDING = 15,
59}
60#[repr(u32)]
61#[non_exhaustive]
62#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
63pub enum Dav1dTxfmMode {
64    DAV1D_TX_4X4_ONLY = 0,
65    DAV1D_TX_LARGEST = 1,
66    DAV1D_TX_SWITCHABLE = 2,
67    DAV1D_N_TX_MODES = 3,
68}
69impl Dav1dFilterMode {
70    pub const DAV1D_FILTER_BILINEAR: Dav1dFilterMode = Dav1dFilterMode::DAV1D_N_SWITCHABLE_FILTERS;
71}
72impl Dav1dFilterMode {
73    pub const DAV1D_FILTER_SWITCHABLE: Dav1dFilterMode = Dav1dFilterMode::DAV1D_N_FILTERS;
74}
75#[repr(u32)]
76#[non_exhaustive]
77#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
78pub enum Dav1dFilterMode {
79    DAV1D_FILTER_8TAP_REGULAR = 0,
80    DAV1D_FILTER_8TAP_SMOOTH = 1,
81    DAV1D_FILTER_8TAP_SHARP = 2,
82    DAV1D_N_SWITCHABLE_FILTERS = 3,
83    DAV1D_N_FILTERS = 4,
84}
85#[repr(u32)]
86#[non_exhaustive]
87#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
88pub enum Dav1dAdaptiveBoolean {
89    DAV1D_OFF = 0,
90    DAV1D_ON = 1,
91    DAV1D_ADAPTIVE = 2,
92}
93#[repr(u32)]
94#[non_exhaustive]
95#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
96pub enum Dav1dRestorationType {
97    DAV1D_RESTORATION_NONE = 0,
98    DAV1D_RESTORATION_SWITCHABLE = 1,
99    DAV1D_RESTORATION_WIENER = 2,
100    DAV1D_RESTORATION_SGRPROJ = 3,
101}
102#[repr(u32)]
103#[non_exhaustive]
104#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
105pub enum Dav1dWarpedMotionType {
106    DAV1D_WM_TYPE_IDENTITY = 0,
107    DAV1D_WM_TYPE_TRANSLATION = 1,
108    DAV1D_WM_TYPE_ROT_ZOOM = 2,
109    DAV1D_WM_TYPE_AFFINE = 3,
110}
111#[repr(C)]
112#[derive(Copy, Clone)]
113pub struct Dav1dWarpedMotionParams {
114    pub type_: Dav1dWarpedMotionType,
115    pub matrix: [i32; 6usize],
116    pub u: Dav1dWarpedMotionParams__bindgen_ty_1,
117}
118#[repr(C)]
119#[derive(Copy, Clone)]
120pub union Dav1dWarpedMotionParams__bindgen_ty_1 {
121    pub p: Dav1dWarpedMotionParams__bindgen_ty_1__bindgen_ty_1,
122    pub abcd: [i16; 4usize],
123}
124#[repr(C)]
125#[derive(Debug, Copy, Clone)]
126pub struct Dav1dWarpedMotionParams__bindgen_ty_1__bindgen_ty_1 {
127    pub alpha: i16,
128    pub beta: i16,
129    pub gamma: i16,
130    pub delta: i16,
131}
132#[repr(u32)]
133#[non_exhaustive]
134#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
135pub enum Dav1dPixelLayout {
136    #[doc = "< monochrome"]
137    DAV1D_PIXEL_LAYOUT_I400 = 0,
138    #[doc = "< 4:2:0 planar"]
139    DAV1D_PIXEL_LAYOUT_I420 = 1,
140    #[doc = "< 4:2:2 planar"]
141    DAV1D_PIXEL_LAYOUT_I422 = 2,
142    #[doc = "< 4:4:4 planar"]
143    DAV1D_PIXEL_LAYOUT_I444 = 3,
144}
145#[repr(u32)]
146#[non_exhaustive]
147#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
148pub enum Dav1dFrameType {
149    #[doc = "< Key Intra frame"]
150    DAV1D_FRAME_TYPE_KEY = 0,
151    #[doc = "< Inter frame"]
152    DAV1D_FRAME_TYPE_INTER = 1,
153    #[doc = "< Non key Intra frame"]
154    DAV1D_FRAME_TYPE_INTRA = 2,
155    #[doc = "< Switch Inter frame"]
156    DAV1D_FRAME_TYPE_SWITCH = 3,
157}
158#[repr(u32)]
159#[non_exhaustive]
160#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
161pub enum Dav1dColorPrimaries {
162    DAV1D_COLOR_PRI_BT709 = 1,
163    DAV1D_COLOR_PRI_UNKNOWN = 2,
164    DAV1D_COLOR_PRI_BT470M = 4,
165    DAV1D_COLOR_PRI_BT470BG = 5,
166    DAV1D_COLOR_PRI_BT601 = 6,
167    DAV1D_COLOR_PRI_SMPTE240 = 7,
168    DAV1D_COLOR_PRI_FILM = 8,
169    DAV1D_COLOR_PRI_BT2020 = 9,
170    DAV1D_COLOR_PRI_XYZ = 10,
171    DAV1D_COLOR_PRI_SMPTE431 = 11,
172    DAV1D_COLOR_PRI_SMPTE432 = 12,
173    DAV1D_COLOR_PRI_EBU3213 = 22,
174    DAV1D_COLOR_PRI_RESERVED = 255,
175}
176#[repr(u32)]
177#[non_exhaustive]
178#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
179pub enum Dav1dTransferCharacteristics {
180    DAV1D_TRC_BT709 = 1,
181    DAV1D_TRC_UNKNOWN = 2,
182    DAV1D_TRC_BT470M = 4,
183    DAV1D_TRC_BT470BG = 5,
184    DAV1D_TRC_BT601 = 6,
185    DAV1D_TRC_SMPTE240 = 7,
186    DAV1D_TRC_LINEAR = 8,
187    #[doc = "< logarithmic (100:1 range)"]
188    DAV1D_TRC_LOG100 = 9,
189    #[doc = "< lograithmic (100*sqrt(10):1 range)"]
190    DAV1D_TRC_LOG100_SQRT10 = 10,
191    DAV1D_TRC_IEC61966 = 11,
192    DAV1D_TRC_BT1361 = 12,
193    DAV1D_TRC_SRGB = 13,
194    DAV1D_TRC_BT2020_10BIT = 14,
195    DAV1D_TRC_BT2020_12BIT = 15,
196    #[doc = "< PQ"]
197    DAV1D_TRC_SMPTE2084 = 16,
198    DAV1D_TRC_SMPTE428 = 17,
199    #[doc = "< hybrid log/gamma (BT.2100 / ARIB STD-B67)"]
200    DAV1D_TRC_HLG = 18,
201    DAV1D_TRC_RESERVED = 255,
202}
203#[repr(u32)]
204#[non_exhaustive]
205#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
206pub enum Dav1dMatrixCoefficients {
207    DAV1D_MC_IDENTITY = 0,
208    DAV1D_MC_BT709 = 1,
209    DAV1D_MC_UNKNOWN = 2,
210    DAV1D_MC_FCC = 4,
211    DAV1D_MC_BT470BG = 5,
212    DAV1D_MC_BT601 = 6,
213    DAV1D_MC_SMPTE240 = 7,
214    DAV1D_MC_SMPTE_YCGCO = 8,
215    DAV1D_MC_BT2020_NCL = 9,
216    DAV1D_MC_BT2020_CL = 10,
217    DAV1D_MC_SMPTE2085 = 11,
218    #[doc = "< Chromaticity-derived"]
219    DAV1D_MC_CHROMAT_NCL = 12,
220    DAV1D_MC_CHROMAT_CL = 13,
221    DAV1D_MC_ICTCP = 14,
222    DAV1D_MC_RESERVED = 255,
223}
224#[repr(u32)]
225#[non_exhaustive]
226#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
227pub enum Dav1dChromaSamplePosition {
228    DAV1D_CHR_UNKNOWN = 0,
229    #[doc = "< Horizontally co-located with luma(0, 0)\n< sample, between two vertical samples"]
230    DAV1D_CHR_VERTICAL = 1,
231    #[doc = "< Co-located with luma(0, 0) sample"]
232    DAV1D_CHR_COLOCATED = 2,
233}
234#[repr(C)]
235#[derive(Debug, Copy, Clone)]
236pub struct Dav1dContentLightLevel {
237    pub max_content_light_level: u16,
238    pub max_frame_average_light_level: u16,
239}
240#[repr(C)]
241#[derive(Debug, Copy, Clone)]
242pub struct Dav1dMasteringDisplay {
243    pub primaries: [[u16; 2usize]; 3usize],
244    pub white_point: [u16; 2usize],
245    pub max_luminance: u32,
246    pub min_luminance: u32,
247}
248#[repr(C)]
249#[derive(Debug, Copy, Clone)]
250pub struct Dav1dITUTT35 {
251    pub country_code: u8,
252    pub country_code_extension_byte: u8,
253    pub payload_size: usize,
254    pub payload: *mut u8,
255}
256#[repr(C)]
257#[derive(Debug, Copy, Clone)]
258pub struct Dav1dSequenceHeader {
259    #[doc = " Stream profile, 0 for 8-10 bits/component 4:2:0 or monochrome;\n 1 for 8-10 bits/component 4:4:4; 2 for 4:2:2 at any bits/component,\n or 12 bits/component at any chroma subsampling."]
260    pub profile: u8,
261    #[doc = " Maximum dimensions for this stream. In non-scalable streams, these\n are often the actual dimensions of the stream, although that is not\n a normative requirement."]
262    pub max_width: ::std::os::raw::c_int,
263    #[doc = " Maximum dimensions for this stream. In non-scalable streams, these\n are often the actual dimensions of the stream, although that is not\n a normative requirement."]
264    pub max_height: ::std::os::raw::c_int,
265    #[doc = "< format of the picture"]
266    pub layout: Dav1dPixelLayout,
267    #[doc = "< color primaries (av1)"]
268    pub pri: Dav1dColorPrimaries,
269    #[doc = "< transfer characteristics (av1)"]
270    pub trc: Dav1dTransferCharacteristics,
271    #[doc = "< matrix coefficients (av1)"]
272    pub mtrx: Dav1dMatrixCoefficients,
273    #[doc = "< chroma sample position (av1)"]
274    pub chr: Dav1dChromaSamplePosition,
275    #[doc = " 0, 1 and 2 mean 8, 10 or 12 bits/component, respectively. This is not\n exactly the same as 'hbd' from the spec; the spec's hbd distinguishes\n between 8 (0) and 10-12 (1) bits/component, and another element\n (twelve_bit) to distinguish between 10 and 12 bits/component. To get\n the spec's hbd, use !!our_hbd, and to get twelve_bit, use hbd == 2."]
276    pub hbd: u8,
277    #[doc = " Pixel data uses JPEG pixel range ([0,255] for 8bits) instead of\n MPEG pixel range ([16,235] for 8bits luma, [16,240] for 8bits chroma)."]
278    pub color_range: u8,
279    pub num_operating_points: u8,
280    pub operating_points: [Dav1dSequenceHeader_Dav1dSequenceHeaderOperatingPoint; 32usize],
281    pub still_picture: u8,
282    pub reduced_still_picture_header: u8,
283    pub timing_info_present: u8,
284    pub num_units_in_tick: u32,
285    pub time_scale: u32,
286    pub equal_picture_interval: u8,
287    pub num_ticks_per_picture: u32,
288    pub decoder_model_info_present: u8,
289    pub encoder_decoder_buffer_delay_length: u8,
290    pub num_units_in_decoding_tick: u32,
291    pub buffer_removal_delay_length: u8,
292    pub frame_presentation_delay_length: u8,
293    pub display_model_info_present: u8,
294    pub width_n_bits: u8,
295    pub height_n_bits: u8,
296    pub frame_id_numbers_present: u8,
297    pub delta_frame_id_n_bits: u8,
298    pub frame_id_n_bits: u8,
299    pub sb128: u8,
300    pub filter_intra: u8,
301    pub intra_edge_filter: u8,
302    pub inter_intra: u8,
303    pub masked_compound: u8,
304    pub warped_motion: u8,
305    pub dual_filter: u8,
306    pub order_hint: u8,
307    pub jnt_comp: u8,
308    pub ref_frame_mvs: u8,
309    pub screen_content_tools: Dav1dAdaptiveBoolean,
310    pub force_integer_mv: Dav1dAdaptiveBoolean,
311    pub order_hint_n_bits: u8,
312    pub super_res: u8,
313    pub cdef: u8,
314    pub restoration: u8,
315    pub ss_hor: u8,
316    pub ss_ver: u8,
317    pub monochrome: u8,
318    pub color_description_present: u8,
319    pub separate_uv_delta_q: u8,
320    pub film_grain_present: u8,
321    pub operating_parameter_info:
322        [Dav1dSequenceHeader_Dav1dSequenceHeaderOperatingParameterInfo; 32usize],
323}
324#[repr(C)]
325#[derive(Debug, Copy, Clone)]
326pub struct Dav1dSequenceHeader_Dav1dSequenceHeaderOperatingPoint {
327    pub major_level: u8,
328    pub minor_level: u8,
329    pub initial_display_delay: u8,
330    pub idc: u16,
331    pub tier: u8,
332    pub decoder_model_param_present: u8,
333    pub display_model_param_present: u8,
334}
335#[repr(C)]
336#[derive(Debug, Copy, Clone)]
337pub struct Dav1dSequenceHeader_Dav1dSequenceHeaderOperatingParameterInfo {
338    pub decoder_buffer_delay: u32,
339    pub encoder_buffer_delay: u32,
340    pub low_delay_mode: u8,
341}
342#[repr(C)]
343#[derive(Debug, Copy, Clone)]
344pub struct Dav1dSegmentationData {
345    pub delta_q: i16,
346    pub delta_lf_y_v: i8,
347    pub delta_lf_y_h: i8,
348    pub delta_lf_u: i8,
349    pub delta_lf_v: i8,
350    pub ref_: i8,
351    pub skip: u8,
352    pub globalmv: u8,
353}
354#[repr(C)]
355#[derive(Debug, Copy, Clone)]
356pub struct Dav1dSegmentationDataSet {
357    pub d: [Dav1dSegmentationData; 8usize],
358    pub preskip: u8,
359    pub last_active_segid: i8,
360}
361#[repr(C)]
362#[derive(Debug, Copy, Clone)]
363pub struct Dav1dLoopfilterModeRefDeltas {
364    pub mode_delta: [i8; 2usize],
365    pub ref_delta: [i8; 8usize],
366}
367#[repr(C)]
368#[derive(Debug, Copy, Clone)]
369pub struct Dav1dFilmGrainData {
370    pub seed: ::std::os::raw::c_uint,
371    pub num_y_points: ::std::os::raw::c_int,
372    pub y_points: [[u8; 2usize]; 14usize],
373    pub chroma_scaling_from_luma: ::std::os::raw::c_int,
374    pub num_uv_points: [::std::os::raw::c_int; 2usize],
375    pub uv_points: [[[u8; 2usize]; 10usize]; 2usize],
376    pub scaling_shift: ::std::os::raw::c_int,
377    pub ar_coeff_lag: ::std::os::raw::c_int,
378    pub ar_coeffs_y: [i8; 24usize],
379    pub ar_coeffs_uv: [[i8; 28usize]; 2usize],
380    pub ar_coeff_shift: u64,
381    pub grain_scale_shift: ::std::os::raw::c_int,
382    pub uv_mult: [::std::os::raw::c_int; 2usize],
383    pub uv_luma_mult: [::std::os::raw::c_int; 2usize],
384    pub uv_offset: [::std::os::raw::c_int; 2usize],
385    pub overlap_flag: ::std::os::raw::c_int,
386    pub clip_to_restricted_range: ::std::os::raw::c_int,
387}
388#[repr(C)]
389#[derive(Copy, Clone)]
390pub struct Dav1dFrameHeader {
391    #[doc = "< film grain parameters"]
392    pub film_grain: Dav1dFrameHeader__bindgen_ty_1,
393    #[doc = "< type of the picture"]
394    pub frame_type: Dav1dFrameType,
395    pub width: [::std::os::raw::c_int; 2usize],
396    pub height: ::std::os::raw::c_int,
397    #[doc = "< frame number"]
398    pub frame_offset: u8,
399    #[doc = "< temporal id of the frame for SVC"]
400    pub temporal_id: u8,
401    #[doc = "< spatial id of the frame for SVC"]
402    pub spatial_id: u8,
403    pub show_existing_frame: u8,
404    pub existing_frame_idx: u8,
405    pub frame_id: u32,
406    pub frame_presentation_delay: u32,
407    pub show_frame: u8,
408    pub showable_frame: u8,
409    pub error_resilient_mode: u8,
410    pub disable_cdf_update: u8,
411    pub allow_screen_content_tools: u8,
412    pub force_integer_mv: u8,
413    pub frame_size_override: u8,
414    pub primary_ref_frame: u8,
415    pub buffer_removal_time_present: u8,
416    pub operating_points: [Dav1dFrameHeader_Dav1dFrameHeaderOperatingPoint; 32usize],
417    pub refresh_frame_flags: u8,
418    pub render_width: ::std::os::raw::c_int,
419    pub render_height: ::std::os::raw::c_int,
420    pub super_res: Dav1dFrameHeader__bindgen_ty_2,
421    pub have_render_size: u8,
422    pub allow_intrabc: u8,
423    pub frame_ref_short_signaling: u8,
424    pub refidx: [i8; 7usize],
425    pub hp: u8,
426    pub subpel_filter_mode: Dav1dFilterMode,
427    pub switchable_motion_mode: u8,
428    pub use_ref_frame_mvs: u8,
429    pub refresh_context: u8,
430    pub tiling: Dav1dFrameHeader__bindgen_ty_3,
431    pub quant: Dav1dFrameHeader__bindgen_ty_4,
432    pub segmentation: Dav1dFrameHeader__bindgen_ty_5,
433    pub delta: Dav1dFrameHeader__bindgen_ty_6,
434    pub all_lossless: u8,
435    pub loopfilter: Dav1dFrameHeader__bindgen_ty_7,
436    pub cdef: Dav1dFrameHeader__bindgen_ty_8,
437    pub restoration: Dav1dFrameHeader__bindgen_ty_9,
438    pub txfm_mode: Dav1dTxfmMode,
439    pub switchable_comp_refs: u8,
440    pub skip_mode_allowed: u8,
441    pub skip_mode_enabled: u8,
442    pub skip_mode_refs: [i8; 2usize],
443    pub warp_motion: u8,
444    pub reduced_txtp_set: u8,
445    pub gmv: [Dav1dWarpedMotionParams; 7usize],
446}
447#[repr(C)]
448#[derive(Debug, Copy, Clone)]
449pub struct Dav1dFrameHeader__bindgen_ty_1 {
450    pub data: Dav1dFilmGrainData,
451    pub present: u8,
452    pub update: u8,
453}
454#[repr(C)]
455#[derive(Debug, Copy, Clone)]
456pub struct Dav1dFrameHeader_Dav1dFrameHeaderOperatingPoint {
457    pub buffer_removal_time: u32,
458}
459#[repr(C)]
460#[derive(Debug, Copy, Clone)]
461pub struct Dav1dFrameHeader__bindgen_ty_2 {
462    pub width_scale_denominator: u8,
463    pub enabled: u8,
464}
465#[repr(C)]
466#[derive(Debug, Copy, Clone)]
467pub struct Dav1dFrameHeader__bindgen_ty_3 {
468    pub uniform: u8,
469    pub n_bytes: u8,
470    pub min_log2_cols: u8,
471    pub max_log2_cols: u8,
472    pub log2_cols: u8,
473    pub cols: u8,
474    pub min_log2_rows: u8,
475    pub max_log2_rows: u8,
476    pub log2_rows: u8,
477    pub rows: u8,
478    pub col_start_sb: [u16; 65usize],
479    pub row_start_sb: [u16; 65usize],
480    pub update: u16,
481}
482#[repr(C)]
483#[derive(Debug, Copy, Clone)]
484pub struct Dav1dFrameHeader__bindgen_ty_4 {
485    pub yac: u8,
486    pub ydc_delta: i8,
487    pub udc_delta: i8,
488    pub uac_delta: i8,
489    pub vdc_delta: i8,
490    pub vac_delta: i8,
491    pub qm: u8,
492    pub qm_y: u8,
493    pub qm_u: u8,
494    pub qm_v: u8,
495}
496#[repr(C)]
497#[derive(Debug, Copy, Clone)]
498pub struct Dav1dFrameHeader__bindgen_ty_5 {
499    pub enabled: u8,
500    pub update_map: u8,
501    pub temporal: u8,
502    pub update_data: u8,
503    pub seg_data: Dav1dSegmentationDataSet,
504    pub lossless: [u8; 8usize],
505    pub qidx: [u8; 8usize],
506}
507#[repr(C)]
508#[derive(Debug, Copy, Clone)]
509pub struct Dav1dFrameHeader__bindgen_ty_6 {
510    pub q: Dav1dFrameHeader__bindgen_ty_6__bindgen_ty_1,
511    pub lf: Dav1dFrameHeader__bindgen_ty_6__bindgen_ty_2,
512}
513#[repr(C)]
514#[derive(Debug, Copy, Clone)]
515pub struct Dav1dFrameHeader__bindgen_ty_6__bindgen_ty_1 {
516    pub present: u8,
517    pub res_log2: u8,
518}
519#[repr(C)]
520#[derive(Debug, Copy, Clone)]
521pub struct Dav1dFrameHeader__bindgen_ty_6__bindgen_ty_2 {
522    pub present: u8,
523    pub res_log2: u8,
524    pub multi: u8,
525}
526#[repr(C)]
527#[derive(Debug, Copy, Clone)]
528pub struct Dav1dFrameHeader__bindgen_ty_7 {
529    pub level_y: [u8; 2usize],
530    pub level_u: u8,
531    pub level_v: u8,
532    pub mode_ref_delta_enabled: u8,
533    pub mode_ref_delta_update: u8,
534    pub mode_ref_deltas: Dav1dLoopfilterModeRefDeltas,
535    pub sharpness: u8,
536}
537#[repr(C)]
538#[derive(Debug, Copy, Clone)]
539pub struct Dav1dFrameHeader__bindgen_ty_8 {
540    pub damping: u8,
541    pub n_bits: u8,
542    pub y_strength: [u8; 8usize],
543    pub uv_strength: [u8; 8usize],
544}
545#[repr(C)]
546#[derive(Debug, Copy, Clone)]
547pub struct Dav1dFrameHeader__bindgen_ty_9 {
548    pub type_: [Dav1dRestorationType; 3usize],
549    pub unit_size: [u8; 2usize],
550}
551#[repr(C)]
552#[derive(Debug, Copy, Clone)]
553pub struct Dav1dPictureParameters {
554    #[doc = "< width (in pixels)"]
555    pub w: ::std::os::raw::c_int,
556    #[doc = "< height (in pixels)"]
557    pub h: ::std::os::raw::c_int,
558    #[doc = "< format of the picture"]
559    pub layout: Dav1dPixelLayout,
560    #[doc = "< bits per pixel component (8 or 10)"]
561    pub bpc: ::std::os::raw::c_int,
562}
563#[repr(C)]
564#[derive(Debug, Copy, Clone)]
565pub struct Dav1dPicture {
566    pub seq_hdr: *mut Dav1dSequenceHeader,
567    pub frame_hdr: *mut Dav1dFrameHeader,
568    #[doc = " Pointers to planar image data (Y is [0], U is [1], V is [2]). The data\n should be bytes (for 8 bpc) or words (for 10 bpc). In case of words\n containing 10 bpc image data, the pixels should be located in the LSB\n bits, so that values range between [0, 1023]; the upper bits should be\n zero'ed out."]
569    pub data: [*mut ::std::os::raw::c_void; 3usize],
570    #[doc = " Number of bytes between 2 lines in data[] for luma [0] or chroma [1]."]
571    pub stride: [isize; 2usize],
572    pub p: Dav1dPictureParameters,
573    pub m: Dav1dDataProps,
574    #[doc = " High Dynamic Range Content Light Level metadata applying to this picture,\n as defined in section 5.8.3 and 6.7.3"]
575    pub content_light: *mut Dav1dContentLightLevel,
576    #[doc = " High Dynamic Range Mastering Display Color Volume metadata applying to\n this picture, as defined in section 5.8.4 and 6.7.4"]
577    pub mastering_display: *mut Dav1dMasteringDisplay,
578    #[doc = " Array of ITU-T T.35 metadata as defined in section 5.8.2 and 6.7.2"]
579    pub itut_t35: *mut Dav1dITUTT35,
580    #[doc = " Number of ITU-T T35 metadata entries in the array"]
581    pub n_itut_t35: usize,
582    #[doc = "< reserved for future use"]
583    pub reserved: [usize; 4usize],
584    #[doc = "< Dav1dFrameHeader allocation origin"]
585    pub frame_hdr_ref: *mut Dav1dRef,
586    #[doc = "< Dav1dSequenceHeader allocation origin"]
587    pub seq_hdr_ref: *mut Dav1dRef,
588    #[doc = "< Dav1dContentLightLevel allocation origin"]
589    pub content_light_ref: *mut Dav1dRef,
590    #[doc = "< Dav1dMasteringDisplay allocation origin"]
591    pub mastering_display_ref: *mut Dav1dRef,
592    #[doc = "< Dav1dITUTT35 allocation origin"]
593    pub itut_t35_ref: *mut Dav1dRef,
594    #[doc = "< reserved for future use"]
595    pub reserved_ref: [usize; 4usize],
596    #[doc = "< Frame data allocation origin"]
597    pub ref_: *mut Dav1dRef,
598    #[doc = "< pointer managed by the allocator"]
599    pub allocator_data: *mut ::std::os::raw::c_void,
600}
601#[repr(C)]
602#[derive(Debug, Copy, Clone)]
603pub struct Dav1dPicAllocator {
604    #[doc = "< custom data to pass to the allocator callbacks."]
605    pub cookie: *mut ::std::os::raw::c_void,
606    #[doc = " Allocate the picture buffer based on the Dav1dPictureParameters.\n\n The data[0], data[1] and data[2] must be DAV1D_PICTURE_ALIGNMENT byte\n aligned and with a pixel width/height multiple of 128 pixels. Any\n allocated memory area should also be padded by DAV1D_PICTURE_ALIGNMENT\n bytes.\n data[1] and data[2] must share the same stride[1].\n\n This function will be called on the main thread (the thread which calls\n dav1d_get_picture()).\n\n @param  pic The picture to allocate the buffer for. The callback needs to\n             fill the picture data[0], data[1], data[2], stride[0] and\n             stride[1].\n             The allocator can fill the pic allocator_data pointer with\n             a custom pointer that will be passed to\n             release_picture_callback().\n @param cookie Custom pointer passed to all calls.\n\n @note No fields other than data, stride and allocator_data must be filled\n       by this callback.\n @return 0 on success. A negative DAV1D_ERR value on error."]
607    pub alloc_picture_callback: ::std::option::Option<
608        unsafe extern "C" fn(
609            pic: *mut Dav1dPicture,
610            cookie: *mut ::std::os::raw::c_void,
611        ) -> ::std::os::raw::c_int,
612    >,
613    #[doc = " Release the picture buffer.\n\n If frame threading is used, this function may be called by the main\n thread (the thread which calls dav1d_get_picture()) or any of the frame\n threads and thus must be thread-safe. If frame threading is not used,\n this function will only be called on the main thread.\n\n @param pic    The picture that was filled by alloc_picture_callback().\n @param cookie Custom pointer passed to all calls."]
614    pub release_picture_callback: ::std::option::Option<
615        unsafe extern "C" fn(pic: *mut Dav1dPicture, cookie: *mut ::std::os::raw::c_void),
616    >,
617}
618extern "C" {
619    #[doc = " Release reference to a picture."]
620    pub fn dav1d_picture_unref(p: *mut Dav1dPicture);
621}
622#[repr(C)]
623#[derive(Debug, Copy, Clone)]
624pub struct Dav1dData {
625    #[doc = "< data pointer"]
626    pub data: *const u8,
627    #[doc = "< data size"]
628    pub sz: usize,
629    #[doc = "< allocation origin"]
630    pub ref_: *mut Dav1dRef,
631    #[doc = "< user provided metadata passed to the output picture"]
632    pub m: Dav1dDataProps,
633}
634extern "C" {
635    #[doc = " Allocate data.\n\n @param data Input context.\n @param   sz Size of the data that should be allocated.\n\n @return Pointer to the allocated buffer on success. NULL on error."]
636    pub fn dav1d_data_create(data: *mut Dav1dData, sz: usize) -> *mut u8;
637}
638extern "C" {
639    #[doc = " Wrap an existing data array.\n\n @param          data Input context.\n @param           buf The data to be wrapped.\n @param            sz Size of the data.\n @param free_callback Function to be called when we release our last\n                      reference to this data. In this callback, $buf will be\n                      the $buf argument to this function, and $cookie will\n                      be the $cookie input argument to this function.\n @param        cookie Opaque parameter passed to free_callback().\n\n @return 0 on success. A negative DAV1D_ERR value on error."]
640    pub fn dav1d_data_wrap(
641        data: *mut Dav1dData,
642        buf: *const u8,
643        sz: usize,
644        free_callback: ::std::option::Option<
645            unsafe extern "C" fn(buf: *const u8, cookie: *mut ::std::os::raw::c_void),
646        >,
647        cookie: *mut ::std::os::raw::c_void,
648    ) -> ::std::os::raw::c_int;
649}
650extern "C" {
651    #[doc = " Wrap a user-provided data pointer into a reference counted object.\n\n data->m.user_data field will initialized to wrap the provided $user_data\n pointer.\n\n $free_callback will be called on the same thread that released the last\n reference. If frame threading is used, make sure $free_callback is\n thread-safe.\n\n @param          data Input context.\n @param     user_data The user data to be wrapped.\n @param free_callback Function to be called when we release our last\n                      reference to this data. In this callback, $user_data\n                      will be the $user_data argument to this function, and\n                      $cookie will be the $cookie input argument to this\n                      function.\n @param        cookie Opaque parameter passed to $free_callback.\n\n @return 0 on success. A negative DAV1D_ERR value on error."]
652    pub fn dav1d_data_wrap_user_data(
653        data: *mut Dav1dData,
654        user_data: *const u8,
655        free_callback: ::std::option::Option<
656            unsafe extern "C" fn(user_data: *const u8, cookie: *mut ::std::os::raw::c_void),
657        >,
658        cookie: *mut ::std::os::raw::c_void,
659    ) -> ::std::os::raw::c_int;
660}
661extern "C" {
662    #[doc = " Free the data reference.\n\n The reference count for data->m.user_data will be decremented (if it has been\n initialized with dav1d_data_wrap_user_data). The $data object will be memset\n to 0.\n\n @param data Input context."]
663    pub fn dav1d_data_unref(data: *mut Dav1dData);
664}
665#[repr(C)]
666#[derive(Debug, Copy, Clone)]
667pub struct Dav1dContext {
668    _unused: [u8; 0],
669}
670#[repr(C)]
671#[derive(Debug, Copy, Clone)]
672pub struct Dav1dLogger {
673    #[doc = "< Custom data to pass to the callback."]
674    pub cookie: *mut ::std::os::raw::c_void,
675    #[doc = " Logger callback. May be NULL to disable logging.\n\n @param cookie Custom pointer passed to all calls.\n @param format The vprintf compatible format string.\n @param     ap List of arguments referenced by the format string."]
676    pub callback: ::std::option::Option<
677        unsafe extern "C" fn(
678            cookie: *mut ::std::os::raw::c_void,
679            format: *const ::std::os::raw::c_char,
680            ap: *mut __va_list_tag,
681        ),
682    >,
683}
684pub mod Dav1dInloopFilterType {
685    pub type Type = ::std::os::raw::c_uint;
686    pub const DAV1D_INLOOPFILTER_NONE: Type = 0;
687    pub const DAV1D_INLOOPFILTER_DEBLOCK: Type = 1;
688    pub const DAV1D_INLOOPFILTER_CDEF: Type = 2;
689    pub const DAV1D_INLOOPFILTER_RESTORATION: Type = 4;
690    pub const DAV1D_INLOOPFILTER_ALL: Type = 7;
691}
692#[repr(u32)]
693#[non_exhaustive]
694#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
695pub enum Dav1dDecodeFrameType {
696    #[doc = "< decode and return all frames"]
697    DAV1D_DECODEFRAMETYPE_ALL = 0,
698    #[doc = "< decode and return frames referenced by other frames only"]
699    DAV1D_DECODEFRAMETYPE_REFERENCE = 1,
700    #[doc = "< decode and return intra frames only (includes keyframes)"]
701    DAV1D_DECODEFRAMETYPE_INTRA = 2,
702    #[doc = "< decode and return keyframes only"]
703    DAV1D_DECODEFRAMETYPE_KEY = 3,
704}
705#[repr(C)]
706#[derive(Debug, Copy, Clone)]
707pub struct Dav1dSettings {
708    #[doc = "< number of threads (0 = number of logical cores in host system, default 0)"]
709    pub n_threads: ::std::os::raw::c_int,
710    #[doc = "< Set to 1 for low-latency decoding (0 = ceil(sqrt(n_threads)), default 0)"]
711    pub max_frame_delay: ::std::os::raw::c_int,
712    #[doc = "< whether to apply film grain on output frames (default 1)"]
713    pub apply_grain: ::std::os::raw::c_int,
714    #[doc = "< select an operating point for scalable AV1 bitstreams (0 - 31, default 0)"]
715    pub operating_point: ::std::os::raw::c_int,
716    #[doc = "< output all spatial layers of a scalable AV1 biststream (default 1)"]
717    pub all_layers: ::std::os::raw::c_int,
718    #[doc = "< maximum frame size, in pixels (0 = unlimited, default 0)"]
719    pub frame_size_limit: ::std::os::raw::c_uint,
720    #[doc = "< Picture allocator callback."]
721    pub allocator: Dav1dPicAllocator,
722    #[doc = "< Logger callback."]
723    pub logger: Dav1dLogger,
724    #[doc = "< whether to abort decoding on standard compliance violations\n< that don't affect actual bitstream decoding (e.g. inconsistent\n< or invalid metadata, default 0)"]
725    pub strict_std_compliance: ::std::os::raw::c_int,
726    #[doc = "< output invisibly coded frames (in coding order) in addition\n< to all visible frames. Because of show-existing-frame, this\n< means some frames may appear twice (once when coded,\n< once when shown, default 0)"]
727    pub output_invisible_frames: ::std::os::raw::c_int,
728    #[doc = "< postfilters to enable during decoding (default\n< DAV1D_INLOOPFILTER_ALL)"]
729    pub inloop_filters: Dav1dInloopFilterType::Type,
730    #[doc = "< frame types to decode (default\n< DAV1D_DECODEFRAMETYPE_ALL)"]
731    pub decode_frame_type: Dav1dDecodeFrameType,
732    #[doc = "< reserved for future use"]
733    pub reserved: [u8; 16usize],
734}
735extern "C" {
736    #[doc = " Get library version."]
737    pub fn dav1d_version() -> *const ::std::os::raw::c_char;
738}
739extern "C" {
740    #[doc = " Get library API version.\n\n @return A value in the format 0x00XXYYZZ, where XX is the major version,\n         YY the minor version, and ZZ the patch version.\n @see DAV1D_API_MAJOR, DAV1D_API_MINOR, DAV1D_API_PATCH"]
741    pub fn dav1d_version_api() -> ::std::os::raw::c_uint;
742}
743extern "C" {
744    #[doc = " Initialize settings to default values.\n\n @param s Input settings context."]
745    pub fn dav1d_default_settings(s: *mut Dav1dSettings);
746}
747extern "C" {
748    #[doc = " Allocate and open a decoder instance.\n\n @param c_out The decoder instance to open. *c_out will be set to the\n              allocated context.\n @param     s Input settings context.\n\n @note The context must be freed using dav1d_close() when decoding is\n       finished.\n\n @return 0 on success, or < 0 (a negative DAV1D_ERR code) on error."]
749    pub fn dav1d_open(
750        c_out: *mut *mut Dav1dContext,
751        s: *const Dav1dSettings,
752    ) -> ::std::os::raw::c_int;
753}
754extern "C" {
755    #[doc = " Parse a Sequence Header OBU from bitstream data.\n\n @param out Output Sequence Header.\n @param buf The data to be parser.\n @param sz  Size of the data.\n\n @return\n                  0: Success, and out is filled with the parsed Sequence Header\n                     OBU parameters.\n  DAV1D_ERR(ENOENT): No Sequence Header OBUs were found in the buffer.\n  Other negative DAV1D_ERR codes: Invalid data in the buffer, invalid passed-in\n                                  arguments, and other errors during parsing.\n\n @note It is safe to feed this function data containing other OBUs than a\n       Sequence Header, as they will simply be ignored. If there is more than\n       one Sequence Header OBU present, only the last will be returned."]
756    pub fn dav1d_parse_sequence_header(
757        out: *mut Dav1dSequenceHeader,
758        buf: *const u8,
759        sz: usize,
760    ) -> ::std::os::raw::c_int;
761}
762extern "C" {
763    #[doc = " Feed bitstream data to the decoder, in the form of one or multiple AV1\n Open Bitstream Units (OBUs).\n\n @param   c Input decoder instance.\n @param  in Input bitstream data. On success, ownership of the reference is\n            passed to the library.\n\n @return\n         0: Success, and the data was consumed.\n  DAV1D_ERR(EAGAIN): The data can't be consumed. dav1d_get_picture() should\n                     be called to get one or more frames before the function\n                     can consume new data.\n  Other negative DAV1D_ERR codes: Error during decoding or because of invalid\n                                  passed-in arguments. The reference remains\n                                  owned by the caller."]
764    pub fn dav1d_send_data(c: *mut Dav1dContext, in_: *mut Dav1dData) -> ::std::os::raw::c_int;
765}
766extern "C" {
767    #[doc = " Return a decoded picture.\n\n @param   c Input decoder instance.\n @param out Output frame. The caller assumes ownership of the returned\n            reference.\n\n @return\n         0: Success, and a frame is returned.\n  DAV1D_ERR(EAGAIN): Not enough data to output a frame. dav1d_send_data()\n                     should be called with new input.\n  Other negative DAV1D_ERR codes: Error during decoding or because of invalid\n                                  passed-in arguments.\n\n @note To drain buffered frames from the decoder (i.e. on end of stream),\n       call this function until it returns DAV1D_ERR(EAGAIN).\n\n @code{.c}\n  Dav1dData data = { 0 };\n  Dav1dPicture p = { 0 };\n  int res;\n\n  read_data(&data);\n  do {\n      res = dav1d_send_data(c, &data);\n      // Keep going even if the function can't consume the current data\n         packet. It eventually will after one or more frames have been\n         returned in this loop.\n      if (res < 0 && res != DAV1D_ERR(EAGAIN))\n          free_and_abort();\n      res = dav1d_get_picture(c, &p);\n      if (res < 0) {\n          if (res != DAV1D_ERR(EAGAIN))\n              free_and_abort();\n      } else\n          output_and_unref_picture(&p);\n  // Stay in the loop as long as there's data to consume.\n  } while (data.sz || read_data(&data) == SUCCESS);\n\n  // Handle EOS by draining all buffered frames.\n  do {\n      res = dav1d_get_picture(c, &p);\n      if (res < 0) {\n          if (res != DAV1D_ERR(EAGAIN))\n              free_and_abort();\n      } else\n          output_and_unref_picture(&p);\n  } while (res == 0);\n @endcode"]
768    pub fn dav1d_get_picture(c: *mut Dav1dContext, out: *mut Dav1dPicture)
769        -> ::std::os::raw::c_int;
770}
771extern "C" {
772    #[doc = " Apply film grain to a previously decoded picture. If the picture contains no\n film grain metadata, then this function merely returns a new reference.\n\n @param   c Input decoder instance.\n @param out Output frame. The caller assumes ownership of the returned\n            reference.\n @param  in Input frame. No ownership is transferred.\n\n @return\n         0: Success, and a frame is returned.\n  Other negative DAV1D_ERR codes: Error due to lack of memory or because of\n                                  invalid passed-in arguments.\n\n @note If `Dav1dSettings.apply_grain` is true, film grain was already applied\n       by `dav1d_get_picture`, and so calling this function leads to double\n       application of film grain. Users should only call this when needed."]
773    pub fn dav1d_apply_grain(
774        c: *mut Dav1dContext,
775        out: *mut Dav1dPicture,
776        in_: *const Dav1dPicture,
777    ) -> ::std::os::raw::c_int;
778}
779extern "C" {
780    #[doc = " Close a decoder instance and free all associated memory.\n\n @param c_out The decoder instance to close. *c_out will be set to NULL."]
781    pub fn dav1d_close(c_out: *mut *mut Dav1dContext);
782}
783extern "C" {
784    #[doc = " Flush all delayed frames in decoder and clear internal decoder state,\n to be used when seeking.\n\n @param c Input decoder instance.\n\n @note Decoding will start only after a valid sequence header OBU is\n       delivered to dav1d_send_data().\n"]
785    pub fn dav1d_flush(c: *mut Dav1dContext);
786}
787#[repr(u32)]
788#[non_exhaustive]
789#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
790pub enum Dav1dEventFlags {
791    #[doc = " The last returned picture contains a reference to a new Sequence Header,\n either because it's the start of a new coded sequence, or the decoder was\n flushed before it was generated."]
792    DAV1D_EVENT_FLAG_NEW_SEQUENCE = 1,
793    #[doc = " The last returned picture contains a reference to a Sequence Header with\n new operating parameters information for the current coded sequence."]
794    DAV1D_EVENT_FLAG_NEW_OP_PARAMS_INFO = 2,
795}
796extern "C" {
797    #[doc = " Fetch a combination of DAV1D_EVENT_FLAG_* event flags generated by the decoding\n process.\n\n @param c Input decoder instance.\n @param flags Where to write the flags.\n\n @return 0 on success, or < 0 (a negative DAV1D_ERR code) on error.\n\n @note Calling this function will clear all the event flags currently stored in\n       the decoder.\n"]
798    pub fn dav1d_get_event_flags(
799        c: *mut Dav1dContext,
800        flags: *mut Dav1dEventFlags,
801    ) -> ::std::os::raw::c_int;
802}
803extern "C" {
804    #[doc = " Retrieve the user-provided metadata associated with the input data packet\n for the last decoding error reported to the user, i.e. a negative return\n value (not EAGAIN) from dav1d_send_data() or dav1d_get_picture().\n\n @param   c Input decoder instance.\n @param out Output Dav1dDataProps. On success, the caller assumes ownership of\n            the returned reference.\n\n @return 0 on success, or < 0 (a negative DAV1D_ERR code) on error."]
805    pub fn dav1d_get_decode_error_data_props(
806        c: *mut Dav1dContext,
807        out: *mut Dav1dDataProps,
808    ) -> ::std::os::raw::c_int;
809}
810extern "C" {
811    #[doc = " Get the decoder delay, which is the number of internally buffered frames, not\n including reference frames.\n This value is guaranteed to be >= 1 and <= max_frame_delay.\n\n @param s Input settings context.\n\n @return Decoder frame delay on success, or < 0 (a negative DAV1D_ERR code) on\n         error.\n\n @note The returned delay is valid only for a Dav1dContext initialized with the\n       provided Dav1dSettings."]
812    pub fn dav1d_get_frame_delay(s: *const Dav1dSettings) -> ::std::os::raw::c_int;
813}
814#[doc = "< allocation origin"]
815#[repr(C)]
816#[derive(Debug, Copy, Clone)]
817pub struct Dav1dRef {
818    pub _address: u8,
819}