libavif_sys/
ffi.rs

1/* automatically generated by rust-bindgen 0.69.4 */
2
3pub const AVIF_VERSION_MAJOR: u32 = 1;
4pub const AVIF_VERSION_MINOR: u32 = 0;
5pub const AVIF_VERSION_PATCH: u32 = 4;
6pub const AVIF_VERSION_DEVEL: u32 = 0;
7pub const AVIF_VERSION: u32 = 1000400;
8pub const AVIF_TRUE: u32 = 1;
9pub const AVIF_FALSE: u32 = 0;
10pub const AVIF_DIAGNOSTICS_ERROR_BUFFER_SIZE: u32 = 256;
11pub const AVIF_DEFAULT_IMAGE_SIZE_LIMIT: u32 = 268435456;
12pub const AVIF_DEFAULT_IMAGE_DIMENSION_LIMIT: u32 = 32768;
13pub const AVIF_DEFAULT_IMAGE_COUNT_LIMIT: u32 = 2592000;
14pub const AVIF_QUALITY_DEFAULT: i32 = -1;
15pub const AVIF_QUALITY_LOSSLESS: u32 = 100;
16pub const AVIF_QUALITY_WORST: u32 = 0;
17pub const AVIF_QUALITY_BEST: u32 = 100;
18pub const AVIF_QUANTIZER_LOSSLESS: u32 = 0;
19pub const AVIF_QUANTIZER_BEST_QUALITY: u32 = 0;
20pub const AVIF_QUANTIZER_WORST_QUALITY: u32 = 63;
21pub const AVIF_PLANE_COUNT_YUV: u32 = 3;
22pub const AVIF_SPEED_DEFAULT: i32 = -1;
23pub const AVIF_SPEED_SLOWEST: u32 = 0;
24pub const AVIF_SPEED_FASTEST: u32 = 10;
25pub const AVIF_REPETITION_COUNT_INFINITE: i32 = -1;
26pub const AVIF_REPETITION_COUNT_UNKNOWN: i32 = -2;
27pub const AVIF_MAX_AV1_LAYER_COUNT: u32 = 4;
28pub type avifBool = ::std::os::raw::c_int;
29pub const AVIF_PLANES_YUV: avifPlanesFlag = 1;
30pub const AVIF_PLANES_A: avifPlanesFlag = 2;
31pub const AVIF_PLANES_ALL: avifPlanesFlag = 255;
32pub type avifPlanesFlag = ::std::os::raw::c_uint;
33pub type avifPlanesFlags = u32;
34pub const AVIF_CHAN_Y: avifChannelIndex = 0;
35pub const AVIF_CHAN_U: avifChannelIndex = 1;
36pub const AVIF_CHAN_V: avifChannelIndex = 2;
37pub const AVIF_CHAN_A: avifChannelIndex = 3;
38pub type avifChannelIndex = ::std::os::raw::c_uint;
39extern "C" {
40    pub fn avifVersion() -> *const ::std::os::raw::c_char;
41}
42extern "C" {
43    pub fn avifCodecVersions(outBuffer: *mut ::std::os::raw::c_char);
44}
45extern "C" {
46    pub fn avifLibYUVVersion() -> ::std::os::raw::c_uint;
47}
48extern "C" {
49    pub fn avifAlloc(size: usize) -> *mut ::std::os::raw::c_void;
50}
51extern "C" {
52    pub fn avifFree(p: *mut ::std::os::raw::c_void);
53}
54pub const AVIF_RESULT_OK: avifResult = 0;
55pub const AVIF_RESULT_UNKNOWN_ERROR: avifResult = 1;
56pub const AVIF_RESULT_INVALID_FTYP: avifResult = 2;
57pub const AVIF_RESULT_NO_CONTENT: avifResult = 3;
58pub const AVIF_RESULT_NO_YUV_FORMAT_SELECTED: avifResult = 4;
59pub const AVIF_RESULT_REFORMAT_FAILED: avifResult = 5;
60pub const AVIF_RESULT_UNSUPPORTED_DEPTH: avifResult = 6;
61pub const AVIF_RESULT_ENCODE_COLOR_FAILED: avifResult = 7;
62pub const AVIF_RESULT_ENCODE_ALPHA_FAILED: avifResult = 8;
63pub const AVIF_RESULT_BMFF_PARSE_FAILED: avifResult = 9;
64pub const AVIF_RESULT_MISSING_IMAGE_ITEM: avifResult = 10;
65pub const AVIF_RESULT_DECODE_COLOR_FAILED: avifResult = 11;
66pub const AVIF_RESULT_DECODE_ALPHA_FAILED: avifResult = 12;
67pub const AVIF_RESULT_COLOR_ALPHA_SIZE_MISMATCH: avifResult = 13;
68pub const AVIF_RESULT_ISPE_SIZE_MISMATCH: avifResult = 14;
69pub const AVIF_RESULT_NO_CODEC_AVAILABLE: avifResult = 15;
70pub const AVIF_RESULT_NO_IMAGES_REMAINING: avifResult = 16;
71pub const AVIF_RESULT_INVALID_EXIF_PAYLOAD: avifResult = 17;
72pub const AVIF_RESULT_INVALID_IMAGE_GRID: avifResult = 18;
73pub const AVIF_RESULT_INVALID_CODEC_SPECIFIC_OPTION: avifResult = 19;
74pub const AVIF_RESULT_TRUNCATED_DATA: avifResult = 20;
75pub const AVIF_RESULT_IO_NOT_SET: avifResult = 21;
76pub const AVIF_RESULT_IO_ERROR: avifResult = 22;
77pub const AVIF_RESULT_WAITING_ON_IO: avifResult = 23;
78pub const AVIF_RESULT_INVALID_ARGUMENT: avifResult = 24;
79pub const AVIF_RESULT_NOT_IMPLEMENTED: avifResult = 25;
80pub const AVIF_RESULT_OUT_OF_MEMORY: avifResult = 26;
81pub const AVIF_RESULT_CANNOT_CHANGE_SETTING: avifResult = 27;
82pub const AVIF_RESULT_INCOMPATIBLE_IMAGE: avifResult = 28;
83pub const AVIF_RESULT_NO_AV1_ITEMS_FOUND: avifResult = 10;
84pub type avifResult = ::std::os::raw::c_uint;
85extern "C" {
86    pub fn avifResultToString(result: avifResult) -> *const ::std::os::raw::c_char;
87}
88#[repr(C)]
89#[derive(Debug, Copy, Clone)]
90pub struct avifROData {
91    pub data: *const u8,
92    pub size: usize,
93}
94impl Default for avifROData {
95    fn default() -> Self {
96        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
97        unsafe {
98            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
99            s.assume_init()
100        }
101    }
102}
103#[repr(C)]
104#[derive(Debug, Copy, Clone)]
105pub struct avifRWData {
106    pub data: *mut u8,
107    pub size: usize,
108}
109impl Default for avifRWData {
110    fn default() -> Self {
111        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
112        unsafe {
113            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
114            s.assume_init()
115        }
116    }
117}
118extern "C" {
119    pub fn avifRWDataRealloc(raw: *mut avifRWData, newSize: usize) -> avifResult;
120}
121extern "C" {
122    pub fn avifRWDataSet(raw: *mut avifRWData, data: *const u8, len: usize) -> avifResult;
123}
124extern "C" {
125    pub fn avifRWDataFree(raw: *mut avifRWData);
126}
127extern "C" {
128    pub fn avifGetExifTiffHeaderOffset(
129        exif: *const u8,
130        exifSize: usize,
131        offset: *mut usize,
132    ) -> avifResult;
133}
134extern "C" {
135    pub fn avifGetExifOrientationOffset(
136        exif: *const u8,
137        exifSize: usize,
138        offset: *mut usize,
139    ) -> avifResult;
140}
141pub const AVIF_PIXEL_FORMAT_NONE: avifPixelFormat = 0;
142pub const AVIF_PIXEL_FORMAT_YUV444: avifPixelFormat = 1;
143pub const AVIF_PIXEL_FORMAT_YUV422: avifPixelFormat = 2;
144pub const AVIF_PIXEL_FORMAT_YUV420: avifPixelFormat = 3;
145pub const AVIF_PIXEL_FORMAT_YUV400: avifPixelFormat = 4;
146pub const AVIF_PIXEL_FORMAT_COUNT: avifPixelFormat = 5;
147pub type avifPixelFormat = ::std::os::raw::c_uint;
148extern "C" {
149    pub fn avifPixelFormatToString(format: avifPixelFormat) -> *const ::std::os::raw::c_char;
150}
151#[repr(C)]
152#[derive(Debug, Default, Copy, Clone)]
153pub struct avifPixelFormatInfo {
154    pub monochrome: avifBool,
155    pub chromaShiftX: ::std::os::raw::c_int,
156    pub chromaShiftY: ::std::os::raw::c_int,
157}
158extern "C" {
159    pub fn avifGetPixelFormatInfo(format: avifPixelFormat, info: *mut avifPixelFormatInfo);
160}
161pub const AVIF_CHROMA_SAMPLE_POSITION_UNKNOWN: avifChromaSamplePosition = 0;
162pub const AVIF_CHROMA_SAMPLE_POSITION_VERTICAL: avifChromaSamplePosition = 1;
163pub const AVIF_CHROMA_SAMPLE_POSITION_COLOCATED: avifChromaSamplePosition = 2;
164pub type avifChromaSamplePosition = ::std::os::raw::c_uint;
165pub const AVIF_RANGE_LIMITED: avifRange = 0;
166pub const AVIF_RANGE_FULL: avifRange = 1;
167pub type avifRange = ::std::os::raw::c_uint;
168pub const AVIF_COLOR_PRIMARIES_UNKNOWN: _bindgen_ty_1 = 0;
169pub const AVIF_COLOR_PRIMARIES_BT709: _bindgen_ty_1 = 1;
170pub const AVIF_COLOR_PRIMARIES_IEC61966_2_4: _bindgen_ty_1 = 1;
171pub const AVIF_COLOR_PRIMARIES_UNSPECIFIED: _bindgen_ty_1 = 2;
172pub const AVIF_COLOR_PRIMARIES_BT470M: _bindgen_ty_1 = 4;
173pub const AVIF_COLOR_PRIMARIES_BT470BG: _bindgen_ty_1 = 5;
174pub const AVIF_COLOR_PRIMARIES_BT601: _bindgen_ty_1 = 6;
175pub const AVIF_COLOR_PRIMARIES_SMPTE240: _bindgen_ty_1 = 7;
176pub const AVIF_COLOR_PRIMARIES_GENERIC_FILM: _bindgen_ty_1 = 8;
177pub const AVIF_COLOR_PRIMARIES_BT2020: _bindgen_ty_1 = 9;
178pub const AVIF_COLOR_PRIMARIES_XYZ: _bindgen_ty_1 = 10;
179pub const AVIF_COLOR_PRIMARIES_SMPTE431: _bindgen_ty_1 = 11;
180pub const AVIF_COLOR_PRIMARIES_SMPTE432: _bindgen_ty_1 = 12;
181pub const AVIF_COLOR_PRIMARIES_EBU3213: _bindgen_ty_1 = 22;
182pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
183pub type avifColorPrimaries = u16;
184extern "C" {
185    pub fn avifColorPrimariesGetValues(acp: avifColorPrimaries, outPrimaries: *mut f32);
186}
187extern "C" {
188    pub fn avifColorPrimariesFind(
189        inPrimaries: *const f32,
190        outName: *mut *const ::std::os::raw::c_char,
191    ) -> avifColorPrimaries;
192}
193pub const AVIF_TRANSFER_CHARACTERISTICS_UNKNOWN: _bindgen_ty_2 = 0;
194pub const AVIF_TRANSFER_CHARACTERISTICS_BT709: _bindgen_ty_2 = 1;
195pub const AVIF_TRANSFER_CHARACTERISTICS_UNSPECIFIED: _bindgen_ty_2 = 2;
196pub const AVIF_TRANSFER_CHARACTERISTICS_BT470M: _bindgen_ty_2 = 4;
197pub const AVIF_TRANSFER_CHARACTERISTICS_BT470BG: _bindgen_ty_2 = 5;
198pub const AVIF_TRANSFER_CHARACTERISTICS_BT601: _bindgen_ty_2 = 6;
199pub const AVIF_TRANSFER_CHARACTERISTICS_SMPTE240: _bindgen_ty_2 = 7;
200pub const AVIF_TRANSFER_CHARACTERISTICS_LINEAR: _bindgen_ty_2 = 8;
201pub const AVIF_TRANSFER_CHARACTERISTICS_LOG100: _bindgen_ty_2 = 9;
202pub const AVIF_TRANSFER_CHARACTERISTICS_LOG100_SQRT10: _bindgen_ty_2 = 10;
203pub const AVIF_TRANSFER_CHARACTERISTICS_IEC61966: _bindgen_ty_2 = 11;
204pub const AVIF_TRANSFER_CHARACTERISTICS_BT1361: _bindgen_ty_2 = 12;
205pub const AVIF_TRANSFER_CHARACTERISTICS_SRGB: _bindgen_ty_2 = 13;
206pub const AVIF_TRANSFER_CHARACTERISTICS_BT2020_10BIT: _bindgen_ty_2 = 14;
207pub const AVIF_TRANSFER_CHARACTERISTICS_BT2020_12BIT: _bindgen_ty_2 = 15;
208pub const AVIF_TRANSFER_CHARACTERISTICS_SMPTE2084: _bindgen_ty_2 = 16;
209pub const AVIF_TRANSFER_CHARACTERISTICS_SMPTE428: _bindgen_ty_2 = 17;
210pub const AVIF_TRANSFER_CHARACTERISTICS_HLG: _bindgen_ty_2 = 18;
211pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
212pub type avifTransferCharacteristics = u16;
213extern "C" {
214    pub fn avifTransferCharacteristicsGetGamma(
215        atc: avifTransferCharacteristics,
216        gamma: *mut f32,
217    ) -> avifResult;
218}
219extern "C" {
220    pub fn avifTransferCharacteristicsFindByGamma(gamma: f32) -> avifTransferCharacteristics;
221}
222pub const AVIF_MATRIX_COEFFICIENTS_IDENTITY: _bindgen_ty_3 = 0;
223pub const AVIF_MATRIX_COEFFICIENTS_BT709: _bindgen_ty_3 = 1;
224pub const AVIF_MATRIX_COEFFICIENTS_UNSPECIFIED: _bindgen_ty_3 = 2;
225pub const AVIF_MATRIX_COEFFICIENTS_FCC: _bindgen_ty_3 = 4;
226pub const AVIF_MATRIX_COEFFICIENTS_BT470BG: _bindgen_ty_3 = 5;
227pub const AVIF_MATRIX_COEFFICIENTS_BT601: _bindgen_ty_3 = 6;
228pub const AVIF_MATRIX_COEFFICIENTS_SMPTE240: _bindgen_ty_3 = 7;
229pub const AVIF_MATRIX_COEFFICIENTS_YCGCO: _bindgen_ty_3 = 8;
230pub const AVIF_MATRIX_COEFFICIENTS_BT2020_NCL: _bindgen_ty_3 = 9;
231pub const AVIF_MATRIX_COEFFICIENTS_BT2020_CL: _bindgen_ty_3 = 10;
232pub const AVIF_MATRIX_COEFFICIENTS_SMPTE2085: _bindgen_ty_3 = 11;
233pub const AVIF_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL: _bindgen_ty_3 = 12;
234pub const AVIF_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL: _bindgen_ty_3 = 13;
235pub const AVIF_MATRIX_COEFFICIENTS_ICTCP: _bindgen_ty_3 = 14;
236pub const AVIF_MATRIX_COEFFICIENTS_LAST: _bindgen_ty_3 = 15;
237pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
238pub type avifMatrixCoefficients = u16;
239#[repr(C)]
240#[derive(Debug, Copy, Clone)]
241pub struct avifDiagnostics {
242    pub error: [::std::os::raw::c_char; 256usize],
243}
244impl Default for avifDiagnostics {
245    fn default() -> Self {
246        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
247        unsafe {
248            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
249            s.assume_init()
250        }
251    }
252}
253extern "C" {
254    pub fn avifDiagnosticsClearError(diag: *mut avifDiagnostics);
255}
256#[repr(C)]
257#[derive(Debug, Default, Copy, Clone)]
258pub struct avifFraction {
259    pub n: i32,
260    pub d: i32,
261}
262pub const AVIF_TRANSFORM_NONE: avifTransformFlag = 0;
263pub const AVIF_TRANSFORM_PASP: avifTransformFlag = 1;
264pub const AVIF_TRANSFORM_CLAP: avifTransformFlag = 2;
265pub const AVIF_TRANSFORM_IROT: avifTransformFlag = 4;
266pub const AVIF_TRANSFORM_IMIR: avifTransformFlag = 8;
267pub type avifTransformFlag = ::std::os::raw::c_uint;
268pub type avifTransformFlags = u32;
269#[repr(C)]
270#[derive(Debug, Default, Copy, Clone)]
271pub struct avifPixelAspectRatioBox {
272    pub hSpacing: u32,
273    pub vSpacing: u32,
274}
275#[repr(C)]
276#[derive(Debug, Default, Copy, Clone)]
277pub struct avifCleanApertureBox {
278    pub widthN: u32,
279    pub widthD: u32,
280    pub heightN: u32,
281    pub heightD: u32,
282    pub horizOffN: u32,
283    pub horizOffD: u32,
284    pub vertOffN: u32,
285    pub vertOffD: u32,
286}
287#[repr(C)]
288#[derive(Debug, Default, Copy, Clone)]
289pub struct avifImageRotation {
290    pub angle: u8,
291}
292#[repr(C)]
293#[derive(Debug, Default, Copy, Clone)]
294pub struct avifImageMirror {
295    pub axis: u8,
296}
297#[repr(C)]
298#[derive(Debug, Default, Copy, Clone)]
299pub struct avifCropRect {
300    pub x: u32,
301    pub y: u32,
302    pub width: u32,
303    pub height: u32,
304}
305extern "C" {
306    pub fn avifCropRectConvertCleanApertureBox(
307        cropRect: *mut avifCropRect,
308        clap: *const avifCleanApertureBox,
309        imageW: u32,
310        imageH: u32,
311        yuvFormat: avifPixelFormat,
312        diag: *mut avifDiagnostics,
313    ) -> avifBool;
314}
315extern "C" {
316    pub fn avifCleanApertureBoxConvertCropRect(
317        clap: *mut avifCleanApertureBox,
318        cropRect: *const avifCropRect,
319        imageW: u32,
320        imageH: u32,
321        yuvFormat: avifPixelFormat,
322        diag: *mut avifDiagnostics,
323    ) -> avifBool;
324}
325#[repr(C)]
326#[derive(Debug, Default, Copy, Clone)]
327pub struct avifContentLightLevelInformationBox {
328    pub maxCLL: u16,
329    pub maxPALL: u16,
330}
331#[repr(C)]
332#[derive(Debug, Copy, Clone)]
333pub struct avifImage {
334    pub width: u32,
335    pub height: u32,
336    pub depth: u32,
337    pub yuvFormat: avifPixelFormat,
338    pub yuvRange: avifRange,
339    pub yuvChromaSamplePosition: avifChromaSamplePosition,
340    pub yuvPlanes: [*mut u8; 3usize],
341    pub yuvRowBytes: [u32; 3usize],
342    pub imageOwnsYUVPlanes: avifBool,
343    pub alphaPlane: *mut u8,
344    pub alphaRowBytes: u32,
345    pub imageOwnsAlphaPlane: avifBool,
346    pub alphaPremultiplied: avifBool,
347    pub icc: avifRWData,
348    pub colorPrimaries: avifColorPrimaries,
349    pub transferCharacteristics: avifTransferCharacteristics,
350    pub matrixCoefficients: avifMatrixCoefficients,
351    pub clli: avifContentLightLevelInformationBox,
352    pub transformFlags: avifTransformFlags,
353    pub pasp: avifPixelAspectRatioBox,
354    pub clap: avifCleanApertureBox,
355    pub irot: avifImageRotation,
356    pub imir: avifImageMirror,
357    pub exif: avifRWData,
358    pub xmp: avifRWData,
359}
360impl Default for avifImage {
361    fn default() -> Self {
362        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
363        unsafe {
364            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
365            s.assume_init()
366        }
367    }
368}
369extern "C" {
370    pub fn avifImageCreate(
371        width: u32,
372        height: u32,
373        depth: u32,
374        yuvFormat: avifPixelFormat,
375    ) -> *mut avifImage;
376}
377extern "C" {
378    pub fn avifImageCreateEmpty() -> *mut avifImage;
379}
380extern "C" {
381    pub fn avifImageCopy(
382        dstImage: *mut avifImage,
383        srcImage: *const avifImage,
384        planes: avifPlanesFlags,
385    ) -> avifResult;
386}
387extern "C" {
388    pub fn avifImageSetViewRect(
389        dstImage: *mut avifImage,
390        srcImage: *const avifImage,
391        rect: *const avifCropRect,
392    ) -> avifResult;
393}
394extern "C" {
395    pub fn avifImageDestroy(image: *mut avifImage);
396}
397extern "C" {
398    pub fn avifImageSetProfileICC(
399        image: *mut avifImage,
400        icc: *const u8,
401        iccSize: usize,
402    ) -> avifResult;
403}
404extern "C" {
405    pub fn avifImageSetMetadataExif(
406        image: *mut avifImage,
407        exif: *const u8,
408        exifSize: usize,
409    ) -> avifResult;
410}
411extern "C" {
412    pub fn avifImageSetMetadataXMP(
413        image: *mut avifImage,
414        xmp: *const u8,
415        xmpSize: usize,
416    ) -> avifResult;
417}
418extern "C" {
419    pub fn avifImageAllocatePlanes(image: *mut avifImage, planes: avifPlanesFlags) -> avifResult;
420}
421extern "C" {
422    pub fn avifImageFreePlanes(image: *mut avifImage, planes: avifPlanesFlags);
423}
424extern "C" {
425    pub fn avifImageStealPlanes(
426        dstImage: *mut avifImage,
427        srcImage: *mut avifImage,
428        planes: avifPlanesFlags,
429    );
430}
431pub const AVIF_RGB_FORMAT_RGB: avifRGBFormat = 0;
432pub const AVIF_RGB_FORMAT_RGBA: avifRGBFormat = 1;
433pub const AVIF_RGB_FORMAT_ARGB: avifRGBFormat = 2;
434pub const AVIF_RGB_FORMAT_BGR: avifRGBFormat = 3;
435pub const AVIF_RGB_FORMAT_BGRA: avifRGBFormat = 4;
436pub const AVIF_RGB_FORMAT_ABGR: avifRGBFormat = 5;
437pub const AVIF_RGB_FORMAT_RGB_565: avifRGBFormat = 6;
438pub const AVIF_RGB_FORMAT_COUNT: avifRGBFormat = 7;
439pub type avifRGBFormat = ::std::os::raw::c_uint;
440extern "C" {
441    pub fn avifRGBFormatChannelCount(format: avifRGBFormat) -> u32;
442}
443extern "C" {
444    pub fn avifRGBFormatHasAlpha(format: avifRGBFormat) -> avifBool;
445}
446pub const AVIF_CHROMA_UPSAMPLING_AUTOMATIC: avifChromaUpsampling = 0;
447pub const AVIF_CHROMA_UPSAMPLING_FASTEST: avifChromaUpsampling = 1;
448pub const AVIF_CHROMA_UPSAMPLING_BEST_QUALITY: avifChromaUpsampling = 2;
449pub const AVIF_CHROMA_UPSAMPLING_NEAREST: avifChromaUpsampling = 3;
450pub const AVIF_CHROMA_UPSAMPLING_BILINEAR: avifChromaUpsampling = 4;
451pub type avifChromaUpsampling = ::std::os::raw::c_uint;
452pub const AVIF_CHROMA_DOWNSAMPLING_AUTOMATIC: avifChromaDownsampling = 0;
453pub const AVIF_CHROMA_DOWNSAMPLING_FASTEST: avifChromaDownsampling = 1;
454pub const AVIF_CHROMA_DOWNSAMPLING_BEST_QUALITY: avifChromaDownsampling = 2;
455pub const AVIF_CHROMA_DOWNSAMPLING_AVERAGE: avifChromaDownsampling = 3;
456pub const AVIF_CHROMA_DOWNSAMPLING_SHARP_YUV: avifChromaDownsampling = 4;
457pub type avifChromaDownsampling = ::std::os::raw::c_uint;
458#[repr(C)]
459#[derive(Debug, Copy, Clone)]
460pub struct avifRGBImage {
461    pub width: u32,
462    pub height: u32,
463    pub depth: u32,
464    pub format: avifRGBFormat,
465    pub chromaUpsampling: avifChromaUpsampling,
466    pub chromaDownsampling: avifChromaDownsampling,
467    pub avoidLibYUV: avifBool,
468    pub ignoreAlpha: avifBool,
469    pub alphaPremultiplied: avifBool,
470    pub isFloat: avifBool,
471    pub maxThreads: ::std::os::raw::c_int,
472    pub pixels: *mut u8,
473    pub rowBytes: u32,
474}
475impl Default for avifRGBImage {
476    fn default() -> Self {
477        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
478        unsafe {
479            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
480            s.assume_init()
481        }
482    }
483}
484extern "C" {
485    pub fn avifRGBImageSetDefaults(rgb: *mut avifRGBImage, image: *const avifImage);
486}
487extern "C" {
488    pub fn avifRGBImagePixelSize(rgb: *const avifRGBImage) -> u32;
489}
490extern "C" {
491    pub fn avifRGBImageAllocatePixels(rgb: *mut avifRGBImage) -> avifResult;
492}
493extern "C" {
494    pub fn avifRGBImageFreePixels(rgb: *mut avifRGBImage);
495}
496extern "C" {
497    pub fn avifImageRGBToYUV(image: *mut avifImage, rgb: *const avifRGBImage) -> avifResult;
498}
499extern "C" {
500    pub fn avifImageYUVToRGB(image: *const avifImage, rgb: *mut avifRGBImage) -> avifResult;
501}
502extern "C" {
503    pub fn avifRGBImagePremultiplyAlpha(rgb: *mut avifRGBImage) -> avifResult;
504}
505extern "C" {
506    pub fn avifRGBImageUnpremultiplyAlpha(rgb: *mut avifRGBImage) -> avifResult;
507}
508extern "C" {
509    pub fn avifFullToLimitedY(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
510}
511extern "C" {
512    pub fn avifFullToLimitedUV(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
513}
514extern "C" {
515    pub fn avifLimitedToFullY(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
516}
517extern "C" {
518    pub fn avifLimitedToFullUV(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
519}
520pub const AVIF_CODEC_CHOICE_AUTO: avifCodecChoice = 0;
521pub const AVIF_CODEC_CHOICE_AOM: avifCodecChoice = 1;
522pub const AVIF_CODEC_CHOICE_DAV1D: avifCodecChoice = 2;
523pub const AVIF_CODEC_CHOICE_LIBGAV1: avifCodecChoice = 3;
524pub const AVIF_CODEC_CHOICE_RAV1E: avifCodecChoice = 4;
525pub const AVIF_CODEC_CHOICE_SVT: avifCodecChoice = 5;
526pub const AVIF_CODEC_CHOICE_AVM: avifCodecChoice = 6;
527pub type avifCodecChoice = ::std::os::raw::c_uint;
528pub const AVIF_CODEC_FLAG_CAN_DECODE: avifCodecFlag = 1;
529pub const AVIF_CODEC_FLAG_CAN_ENCODE: avifCodecFlag = 2;
530pub type avifCodecFlag = ::std::os::raw::c_uint;
531pub type avifCodecFlags = u32;
532extern "C" {
533    pub fn avifCodecName(
534        choice: avifCodecChoice,
535        requiredFlags: avifCodecFlags,
536    ) -> *const ::std::os::raw::c_char;
537}
538extern "C" {
539    pub fn avifCodecChoiceFromName(name: *const ::std::os::raw::c_char) -> avifCodecChoice;
540}
541pub type avifIODestroyFunc = ::std::option::Option<unsafe extern "C" fn(io: *mut avifIO)>;
542pub type avifIOReadFunc = ::std::option::Option<
543    unsafe extern "C" fn(
544        io: *mut avifIO,
545        readFlags: u32,
546        offset: u64,
547        size: usize,
548        out: *mut avifROData,
549    ) -> avifResult,
550>;
551pub type avifIOWriteFunc = ::std::option::Option<
552    unsafe extern "C" fn(
553        io: *mut avifIO,
554        writeFlags: u32,
555        offset: u64,
556        data: *const u8,
557        size: usize,
558    ) -> avifResult,
559>;
560#[repr(C)]
561#[derive(Debug, Copy, Clone)]
562pub struct avifIO {
563    pub destroy: avifIODestroyFunc,
564    pub read: avifIOReadFunc,
565    pub write: avifIOWriteFunc,
566    pub sizeHint: u64,
567    pub persistent: avifBool,
568    pub data: *mut ::std::os::raw::c_void,
569}
570impl Default for avifIO {
571    fn default() -> Self {
572        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
573        unsafe {
574            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
575            s.assume_init()
576        }
577    }
578}
579extern "C" {
580    pub fn avifIOCreateMemoryReader(data: *const u8, size: usize) -> *mut avifIO;
581}
582extern "C" {
583    pub fn avifIOCreateFileReader(filename: *const ::std::os::raw::c_char) -> *mut avifIO;
584}
585extern "C" {
586    pub fn avifIODestroy(io: *mut avifIO);
587}
588pub const AVIF_STRICT_DISABLED: avifStrictFlag = 0;
589pub const AVIF_STRICT_PIXI_REQUIRED: avifStrictFlag = 1;
590pub const AVIF_STRICT_CLAP_VALID: avifStrictFlag = 2;
591pub const AVIF_STRICT_ALPHA_ISPE_REQUIRED: avifStrictFlag = 4;
592pub const AVIF_STRICT_ENABLED: avifStrictFlag = 7;
593pub type avifStrictFlag = ::std::os::raw::c_uint;
594pub type avifStrictFlags = u32;
595#[repr(C)]
596#[derive(Debug, Default, Copy, Clone)]
597pub struct avifIOStats {
598    pub colorOBUSize: usize,
599    pub alphaOBUSize: usize,
600}
601#[repr(C)]
602#[derive(Debug, Copy, Clone)]
603pub struct avifDecoderData {
604    _unused: [u8; 0],
605}
606pub const AVIF_DECODER_SOURCE_AUTO: avifDecoderSource = 0;
607pub const AVIF_DECODER_SOURCE_PRIMARY_ITEM: avifDecoderSource = 1;
608pub const AVIF_DECODER_SOURCE_TRACKS: avifDecoderSource = 2;
609pub type avifDecoderSource = ::std::os::raw::c_uint;
610#[repr(C)]
611#[derive(Debug, Default, Copy, Clone)]
612pub struct avifImageTiming {
613    pub timescale: u64,
614    pub pts: f64,
615    pub ptsInTimescales: u64,
616    pub duration: f64,
617    pub durationInTimescales: u64,
618}
619pub const AVIF_PROGRESSIVE_STATE_UNAVAILABLE: avifProgressiveState = 0;
620pub const AVIF_PROGRESSIVE_STATE_AVAILABLE: avifProgressiveState = 1;
621pub const AVIF_PROGRESSIVE_STATE_ACTIVE: avifProgressiveState = 2;
622pub type avifProgressiveState = ::std::os::raw::c_uint;
623extern "C" {
624    pub fn avifProgressiveStateToString(
625        progressiveState: avifProgressiveState,
626    ) -> *const ::std::os::raw::c_char;
627}
628#[repr(C)]
629#[derive(Debug, Copy, Clone)]
630pub struct avifDecoder {
631    pub codecChoice: avifCodecChoice,
632    pub maxThreads: ::std::os::raw::c_int,
633    pub requestedSource: avifDecoderSource,
634    pub allowProgressive: avifBool,
635    pub allowIncremental: avifBool,
636    pub ignoreExif: avifBool,
637    pub ignoreXMP: avifBool,
638    pub imageSizeLimit: u32,
639    pub imageDimensionLimit: u32,
640    pub imageCountLimit: u32,
641    pub strictFlags: avifStrictFlags,
642    pub image: *mut avifImage,
643    pub imageIndex: ::std::os::raw::c_int,
644    pub imageCount: ::std::os::raw::c_int,
645    pub progressiveState: avifProgressiveState,
646    pub imageTiming: avifImageTiming,
647    pub timescale: u64,
648    pub duration: f64,
649    pub durationInTimescales: u64,
650    pub repetitionCount: ::std::os::raw::c_int,
651    pub alphaPresent: avifBool,
652    pub ioStats: avifIOStats,
653    pub diag: avifDiagnostics,
654    pub io: *mut avifIO,
655    pub data: *mut avifDecoderData,
656}
657impl Default for avifDecoder {
658    fn default() -> Self {
659        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
660        unsafe {
661            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
662            s.assume_init()
663        }
664    }
665}
666extern "C" {
667    pub fn avifDecoderCreate() -> *mut avifDecoder;
668}
669extern "C" {
670    pub fn avifDecoderDestroy(decoder: *mut avifDecoder);
671}
672extern "C" {
673    pub fn avifDecoderRead(decoder: *mut avifDecoder, image: *mut avifImage) -> avifResult;
674}
675extern "C" {
676    pub fn avifDecoderReadMemory(
677        decoder: *mut avifDecoder,
678        image: *mut avifImage,
679        data: *const u8,
680        size: usize,
681    ) -> avifResult;
682}
683extern "C" {
684    pub fn avifDecoderReadFile(
685        decoder: *mut avifDecoder,
686        image: *mut avifImage,
687        filename: *const ::std::os::raw::c_char,
688    ) -> avifResult;
689}
690extern "C" {
691    pub fn avifDecoderSetSource(decoder: *mut avifDecoder, source: avifDecoderSource)
692        -> avifResult;
693}
694extern "C" {
695    pub fn avifDecoderSetIO(decoder: *mut avifDecoder, io: *mut avifIO);
696}
697extern "C" {
698    pub fn avifDecoderSetIOMemory(
699        decoder: *mut avifDecoder,
700        data: *const u8,
701        size: usize,
702    ) -> avifResult;
703}
704extern "C" {
705    pub fn avifDecoderSetIOFile(
706        decoder: *mut avifDecoder,
707        filename: *const ::std::os::raw::c_char,
708    ) -> avifResult;
709}
710extern "C" {
711    pub fn avifDecoderParse(decoder: *mut avifDecoder) -> avifResult;
712}
713extern "C" {
714    pub fn avifDecoderNextImage(decoder: *mut avifDecoder) -> avifResult;
715}
716extern "C" {
717    pub fn avifDecoderNthImage(decoder: *mut avifDecoder, frameIndex: u32) -> avifResult;
718}
719extern "C" {
720    pub fn avifDecoderReset(decoder: *mut avifDecoder) -> avifResult;
721}
722extern "C" {
723    pub fn avifDecoderIsKeyframe(decoder: *const avifDecoder, frameIndex: u32) -> avifBool;
724}
725extern "C" {
726    pub fn avifDecoderNearestKeyframe(decoder: *const avifDecoder, frameIndex: u32) -> u32;
727}
728extern "C" {
729    pub fn avifDecoderNthImageTiming(
730        decoder: *const avifDecoder,
731        frameIndex: u32,
732        outTiming: *mut avifImageTiming,
733    ) -> avifResult;
734}
735extern "C" {
736    pub fn avifDecoderDecodedRowCount(decoder: *const avifDecoder) -> u32;
737}
738#[repr(C)]
739#[derive(Debug, Default, Copy, Clone)]
740pub struct avifExtent {
741    pub offset: u64,
742    pub size: usize,
743}
744extern "C" {
745    pub fn avifDecoderNthImageMaxExtent(
746        decoder: *const avifDecoder,
747        frameIndex: u32,
748        outExtent: *mut avifExtent,
749    ) -> avifResult;
750}
751#[repr(C)]
752#[derive(Debug, Copy, Clone)]
753pub struct avifEncoderData {
754    _unused: [u8; 0],
755}
756#[repr(C)]
757#[derive(Debug, Copy, Clone)]
758pub struct avifCodecSpecificOptions {
759    _unused: [u8; 0],
760}
761#[repr(C)]
762#[derive(Debug, Default, Copy, Clone)]
763pub struct avifScalingMode {
764    pub horizontal: avifFraction,
765    pub vertical: avifFraction,
766}
767#[repr(C)]
768#[derive(Debug, Copy, Clone)]
769pub struct avifEncoder {
770    pub codecChoice: avifCodecChoice,
771    pub maxThreads: ::std::os::raw::c_int,
772    pub speed: ::std::os::raw::c_int,
773    pub keyframeInterval: ::std::os::raw::c_int,
774    pub timescale: u64,
775    pub repetitionCount: ::std::os::raw::c_int,
776    pub extraLayerCount: u32,
777    pub quality: ::std::os::raw::c_int,
778    pub qualityAlpha: ::std::os::raw::c_int,
779    pub minQuantizer: ::std::os::raw::c_int,
780    pub maxQuantizer: ::std::os::raw::c_int,
781    pub minQuantizerAlpha: ::std::os::raw::c_int,
782    pub maxQuantizerAlpha: ::std::os::raw::c_int,
783    pub tileRowsLog2: ::std::os::raw::c_int,
784    pub tileColsLog2: ::std::os::raw::c_int,
785    pub autoTiling: avifBool,
786    pub scalingMode: avifScalingMode,
787    pub ioStats: avifIOStats,
788    pub diag: avifDiagnostics,
789    pub data: *mut avifEncoderData,
790    pub csOptions: *mut avifCodecSpecificOptions,
791}
792impl Default for avifEncoder {
793    fn default() -> Self {
794        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
795        unsafe {
796            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
797            s.assume_init()
798        }
799    }
800}
801extern "C" {
802    pub fn avifEncoderCreate() -> *mut avifEncoder;
803}
804extern "C" {
805    pub fn avifEncoderWrite(
806        encoder: *mut avifEncoder,
807        image: *const avifImage,
808        output: *mut avifRWData,
809    ) -> avifResult;
810}
811extern "C" {
812    pub fn avifEncoderDestroy(encoder: *mut avifEncoder);
813}
814pub const AVIF_ADD_IMAGE_FLAG_NONE: avifAddImageFlag = 0;
815pub const AVIF_ADD_IMAGE_FLAG_FORCE_KEYFRAME: avifAddImageFlag = 1;
816pub const AVIF_ADD_IMAGE_FLAG_SINGLE: avifAddImageFlag = 2;
817pub type avifAddImageFlag = ::std::os::raw::c_uint;
818pub type avifAddImageFlags = u32;
819extern "C" {
820    pub fn avifEncoderAddImage(
821        encoder: *mut avifEncoder,
822        image: *const avifImage,
823        durationInTimescales: u64,
824        addImageFlags: avifAddImageFlags,
825    ) -> avifResult;
826}
827extern "C" {
828    pub fn avifEncoderAddImageGrid(
829        encoder: *mut avifEncoder,
830        gridCols: u32,
831        gridRows: u32,
832        cellImages: *const *const avifImage,
833        addImageFlags: avifAddImageFlags,
834    ) -> avifResult;
835}
836extern "C" {
837    pub fn avifEncoderFinish(encoder: *mut avifEncoder, output: *mut avifRWData) -> avifResult;
838}
839extern "C" {
840    pub fn avifEncoderSetCodecSpecificOption(
841        encoder: *mut avifEncoder,
842        key: *const ::std::os::raw::c_char,
843        value: *const ::std::os::raw::c_char,
844    ) -> avifResult;
845}
846extern "C" {
847    pub fn avifImageUsesU16(image: *const avifImage) -> avifBool;
848}
849extern "C" {
850    pub fn avifImageIsOpaque(image: *const avifImage) -> avifBool;
851}
852extern "C" {
853    pub fn avifImagePlane(image: *const avifImage, channel: ::std::os::raw::c_int) -> *mut u8;
854}
855extern "C" {
856    pub fn avifImagePlaneRowBytes(image: *const avifImage, channel: ::std::os::raw::c_int) -> u32;
857}
858extern "C" {
859    pub fn avifImagePlaneWidth(image: *const avifImage, channel: ::std::os::raw::c_int) -> u32;
860}
861extern "C" {
862    pub fn avifImagePlaneHeight(image: *const avifImage, channel: ::std::os::raw::c_int) -> u32;
863}
864extern "C" {
865    pub fn avifPeekCompatibleFileType(input: *const avifROData) -> avifBool;
866}