1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
/* automatically generated by rust-bindgen 0.69.4 */

pub const AVIF_VERSION_MAJOR: u32 = 1;
pub const AVIF_VERSION_MINOR: u32 = 0;
pub const AVIF_VERSION_PATCH: u32 = 4;
pub const AVIF_VERSION_DEVEL: u32 = 0;
pub const AVIF_VERSION: u32 = 1000400;
pub const AVIF_TRUE: u32 = 1;
pub const AVIF_FALSE: u32 = 0;
pub const AVIF_DIAGNOSTICS_ERROR_BUFFER_SIZE: u32 = 256;
pub const AVIF_DEFAULT_IMAGE_SIZE_LIMIT: u32 = 268435456;
pub const AVIF_DEFAULT_IMAGE_DIMENSION_LIMIT: u32 = 32768;
pub const AVIF_DEFAULT_IMAGE_COUNT_LIMIT: u32 = 2592000;
pub const AVIF_QUALITY_DEFAULT: i32 = -1;
pub const AVIF_QUALITY_LOSSLESS: u32 = 100;
pub const AVIF_QUALITY_WORST: u32 = 0;
pub const AVIF_QUALITY_BEST: u32 = 100;
pub const AVIF_QUANTIZER_LOSSLESS: u32 = 0;
pub const AVIF_QUANTIZER_BEST_QUALITY: u32 = 0;
pub const AVIF_QUANTIZER_WORST_QUALITY: u32 = 63;
pub const AVIF_PLANE_COUNT_YUV: u32 = 3;
pub const AVIF_SPEED_DEFAULT: i32 = -1;
pub const AVIF_SPEED_SLOWEST: u32 = 0;
pub const AVIF_SPEED_FASTEST: u32 = 10;
pub const AVIF_REPETITION_COUNT_INFINITE: i32 = -1;
pub const AVIF_REPETITION_COUNT_UNKNOWN: i32 = -2;
pub const AVIF_MAX_AV1_LAYER_COUNT: u32 = 4;
pub type avifBool = ::std::os::raw::c_int;
pub const AVIF_PLANES_YUV: avifPlanesFlag = 1;
pub const AVIF_PLANES_A: avifPlanesFlag = 2;
pub const AVIF_PLANES_ALL: avifPlanesFlag = 255;
pub type avifPlanesFlag = ::std::os::raw::c_uint;
pub type avifPlanesFlags = u32;
pub const AVIF_CHAN_Y: avifChannelIndex = 0;
pub const AVIF_CHAN_U: avifChannelIndex = 1;
pub const AVIF_CHAN_V: avifChannelIndex = 2;
pub const AVIF_CHAN_A: avifChannelIndex = 3;
pub type avifChannelIndex = ::std::os::raw::c_uint;
extern "C" {
    pub fn avifVersion() -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn avifCodecVersions(outBuffer: *mut ::std::os::raw::c_char);
}
extern "C" {
    pub fn avifLibYUVVersion() -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn avifAlloc(size: usize) -> *mut ::std::os::raw::c_void;
}
extern "C" {
    pub fn avifFree(p: *mut ::std::os::raw::c_void);
}
pub const AVIF_RESULT_OK: avifResult = 0;
pub const AVIF_RESULT_UNKNOWN_ERROR: avifResult = 1;
pub const AVIF_RESULT_INVALID_FTYP: avifResult = 2;
pub const AVIF_RESULT_NO_CONTENT: avifResult = 3;
pub const AVIF_RESULT_NO_YUV_FORMAT_SELECTED: avifResult = 4;
pub const AVIF_RESULT_REFORMAT_FAILED: avifResult = 5;
pub const AVIF_RESULT_UNSUPPORTED_DEPTH: avifResult = 6;
pub const AVIF_RESULT_ENCODE_COLOR_FAILED: avifResult = 7;
pub const AVIF_RESULT_ENCODE_ALPHA_FAILED: avifResult = 8;
pub const AVIF_RESULT_BMFF_PARSE_FAILED: avifResult = 9;
pub const AVIF_RESULT_MISSING_IMAGE_ITEM: avifResult = 10;
pub const AVIF_RESULT_DECODE_COLOR_FAILED: avifResult = 11;
pub const AVIF_RESULT_DECODE_ALPHA_FAILED: avifResult = 12;
pub const AVIF_RESULT_COLOR_ALPHA_SIZE_MISMATCH: avifResult = 13;
pub const AVIF_RESULT_ISPE_SIZE_MISMATCH: avifResult = 14;
pub const AVIF_RESULT_NO_CODEC_AVAILABLE: avifResult = 15;
pub const AVIF_RESULT_NO_IMAGES_REMAINING: avifResult = 16;
pub const AVIF_RESULT_INVALID_EXIF_PAYLOAD: avifResult = 17;
pub const AVIF_RESULT_INVALID_IMAGE_GRID: avifResult = 18;
pub const AVIF_RESULT_INVALID_CODEC_SPECIFIC_OPTION: avifResult = 19;
pub const AVIF_RESULT_TRUNCATED_DATA: avifResult = 20;
pub const AVIF_RESULT_IO_NOT_SET: avifResult = 21;
pub const AVIF_RESULT_IO_ERROR: avifResult = 22;
pub const AVIF_RESULT_WAITING_ON_IO: avifResult = 23;
pub const AVIF_RESULT_INVALID_ARGUMENT: avifResult = 24;
pub const AVIF_RESULT_NOT_IMPLEMENTED: avifResult = 25;
pub const AVIF_RESULT_OUT_OF_MEMORY: avifResult = 26;
pub const AVIF_RESULT_CANNOT_CHANGE_SETTING: avifResult = 27;
pub const AVIF_RESULT_INCOMPATIBLE_IMAGE: avifResult = 28;
pub const AVIF_RESULT_NO_AV1_ITEMS_FOUND: avifResult = 10;
pub type avifResult = ::std::os::raw::c_uint;
extern "C" {
    pub fn avifResultToString(result: avifResult) -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifROData {
    pub data: *const u8,
    pub size: usize,
}
impl Default for avifROData {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifRWData {
    pub data: *mut u8,
    pub size: usize,
}
impl Default for avifRWData {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifRWDataRealloc(raw: *mut avifRWData, newSize: usize) -> avifResult;
}
extern "C" {
    pub fn avifRWDataSet(raw: *mut avifRWData, data: *const u8, len: usize) -> avifResult;
}
extern "C" {
    pub fn avifRWDataFree(raw: *mut avifRWData);
}
extern "C" {
    pub fn avifGetExifTiffHeaderOffset(
        exif: *const u8,
        exifSize: usize,
        offset: *mut usize,
    ) -> avifResult;
}
extern "C" {
    pub fn avifGetExifOrientationOffset(
        exif: *const u8,
        exifSize: usize,
        offset: *mut usize,
    ) -> avifResult;
}
pub const AVIF_PIXEL_FORMAT_NONE: avifPixelFormat = 0;
pub const AVIF_PIXEL_FORMAT_YUV444: avifPixelFormat = 1;
pub const AVIF_PIXEL_FORMAT_YUV422: avifPixelFormat = 2;
pub const AVIF_PIXEL_FORMAT_YUV420: avifPixelFormat = 3;
pub const AVIF_PIXEL_FORMAT_YUV400: avifPixelFormat = 4;
pub const AVIF_PIXEL_FORMAT_COUNT: avifPixelFormat = 5;
pub type avifPixelFormat = ::std::os::raw::c_uint;
extern "C" {
    pub fn avifPixelFormatToString(format: avifPixelFormat) -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifPixelFormatInfo {
    pub monochrome: avifBool,
    pub chromaShiftX: ::std::os::raw::c_int,
    pub chromaShiftY: ::std::os::raw::c_int,
}
extern "C" {
    pub fn avifGetPixelFormatInfo(format: avifPixelFormat, info: *mut avifPixelFormatInfo);
}
pub const AVIF_CHROMA_SAMPLE_POSITION_UNKNOWN: avifChromaSamplePosition = 0;
pub const AVIF_CHROMA_SAMPLE_POSITION_VERTICAL: avifChromaSamplePosition = 1;
pub const AVIF_CHROMA_SAMPLE_POSITION_COLOCATED: avifChromaSamplePosition = 2;
pub type avifChromaSamplePosition = ::std::os::raw::c_uint;
pub const AVIF_RANGE_LIMITED: avifRange = 0;
pub const AVIF_RANGE_FULL: avifRange = 1;
pub type avifRange = ::std::os::raw::c_uint;
pub const AVIF_COLOR_PRIMARIES_UNKNOWN: _bindgen_ty_1 = 0;
pub const AVIF_COLOR_PRIMARIES_BT709: _bindgen_ty_1 = 1;
pub const AVIF_COLOR_PRIMARIES_IEC61966_2_4: _bindgen_ty_1 = 1;
pub const AVIF_COLOR_PRIMARIES_UNSPECIFIED: _bindgen_ty_1 = 2;
pub const AVIF_COLOR_PRIMARIES_BT470M: _bindgen_ty_1 = 4;
pub const AVIF_COLOR_PRIMARIES_BT470BG: _bindgen_ty_1 = 5;
pub const AVIF_COLOR_PRIMARIES_BT601: _bindgen_ty_1 = 6;
pub const AVIF_COLOR_PRIMARIES_SMPTE240: _bindgen_ty_1 = 7;
pub const AVIF_COLOR_PRIMARIES_GENERIC_FILM: _bindgen_ty_1 = 8;
pub const AVIF_COLOR_PRIMARIES_BT2020: _bindgen_ty_1 = 9;
pub const AVIF_COLOR_PRIMARIES_XYZ: _bindgen_ty_1 = 10;
pub const AVIF_COLOR_PRIMARIES_SMPTE431: _bindgen_ty_1 = 11;
pub const AVIF_COLOR_PRIMARIES_SMPTE432: _bindgen_ty_1 = 12;
pub const AVIF_COLOR_PRIMARIES_EBU3213: _bindgen_ty_1 = 22;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
pub type avifColorPrimaries = u16;
extern "C" {
    pub fn avifColorPrimariesGetValues(acp: avifColorPrimaries, outPrimaries: *mut f32);
}
extern "C" {
    pub fn avifColorPrimariesFind(
        inPrimaries: *const f32,
        outName: *mut *const ::std::os::raw::c_char,
    ) -> avifColorPrimaries;
}
pub const AVIF_TRANSFER_CHARACTERISTICS_UNKNOWN: _bindgen_ty_2 = 0;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT709: _bindgen_ty_2 = 1;
pub const AVIF_TRANSFER_CHARACTERISTICS_UNSPECIFIED: _bindgen_ty_2 = 2;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT470M: _bindgen_ty_2 = 4;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT470BG: _bindgen_ty_2 = 5;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT601: _bindgen_ty_2 = 6;
pub const AVIF_TRANSFER_CHARACTERISTICS_SMPTE240: _bindgen_ty_2 = 7;
pub const AVIF_TRANSFER_CHARACTERISTICS_LINEAR: _bindgen_ty_2 = 8;
pub const AVIF_TRANSFER_CHARACTERISTICS_LOG100: _bindgen_ty_2 = 9;
pub const AVIF_TRANSFER_CHARACTERISTICS_LOG100_SQRT10: _bindgen_ty_2 = 10;
pub const AVIF_TRANSFER_CHARACTERISTICS_IEC61966: _bindgen_ty_2 = 11;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT1361: _bindgen_ty_2 = 12;
pub const AVIF_TRANSFER_CHARACTERISTICS_SRGB: _bindgen_ty_2 = 13;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT2020_10BIT: _bindgen_ty_2 = 14;
pub const AVIF_TRANSFER_CHARACTERISTICS_BT2020_12BIT: _bindgen_ty_2 = 15;
pub const AVIF_TRANSFER_CHARACTERISTICS_SMPTE2084: _bindgen_ty_2 = 16;
pub const AVIF_TRANSFER_CHARACTERISTICS_SMPTE428: _bindgen_ty_2 = 17;
pub const AVIF_TRANSFER_CHARACTERISTICS_HLG: _bindgen_ty_2 = 18;
pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
pub type avifTransferCharacteristics = u16;
extern "C" {
    pub fn avifTransferCharacteristicsGetGamma(
        atc: avifTransferCharacteristics,
        gamma: *mut f32,
    ) -> avifResult;
}
extern "C" {
    pub fn avifTransferCharacteristicsFindByGamma(gamma: f32) -> avifTransferCharacteristics;
}
pub const AVIF_MATRIX_COEFFICIENTS_IDENTITY: _bindgen_ty_3 = 0;
pub const AVIF_MATRIX_COEFFICIENTS_BT709: _bindgen_ty_3 = 1;
pub const AVIF_MATRIX_COEFFICIENTS_UNSPECIFIED: _bindgen_ty_3 = 2;
pub const AVIF_MATRIX_COEFFICIENTS_FCC: _bindgen_ty_3 = 4;
pub const AVIF_MATRIX_COEFFICIENTS_BT470BG: _bindgen_ty_3 = 5;
pub const AVIF_MATRIX_COEFFICIENTS_BT601: _bindgen_ty_3 = 6;
pub const AVIF_MATRIX_COEFFICIENTS_SMPTE240: _bindgen_ty_3 = 7;
pub const AVIF_MATRIX_COEFFICIENTS_YCGCO: _bindgen_ty_3 = 8;
pub const AVIF_MATRIX_COEFFICIENTS_BT2020_NCL: _bindgen_ty_3 = 9;
pub const AVIF_MATRIX_COEFFICIENTS_BT2020_CL: _bindgen_ty_3 = 10;
pub const AVIF_MATRIX_COEFFICIENTS_SMPTE2085: _bindgen_ty_3 = 11;
pub const AVIF_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL: _bindgen_ty_3 = 12;
pub const AVIF_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL: _bindgen_ty_3 = 13;
pub const AVIF_MATRIX_COEFFICIENTS_ICTCP: _bindgen_ty_3 = 14;
pub const AVIF_MATRIX_COEFFICIENTS_LAST: _bindgen_ty_3 = 15;
pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
pub type avifMatrixCoefficients = u16;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifDiagnostics {
    pub error: [::std::os::raw::c_char; 256usize],
}
impl Default for avifDiagnostics {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifDiagnosticsClearError(diag: *mut avifDiagnostics);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifFraction {
    pub n: i32,
    pub d: i32,
}
pub const AVIF_TRANSFORM_NONE: avifTransformFlag = 0;
pub const AVIF_TRANSFORM_PASP: avifTransformFlag = 1;
pub const AVIF_TRANSFORM_CLAP: avifTransformFlag = 2;
pub const AVIF_TRANSFORM_IROT: avifTransformFlag = 4;
pub const AVIF_TRANSFORM_IMIR: avifTransformFlag = 8;
pub type avifTransformFlag = ::std::os::raw::c_uint;
pub type avifTransformFlags = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifPixelAspectRatioBox {
    pub hSpacing: u32,
    pub vSpacing: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifCleanApertureBox {
    pub widthN: u32,
    pub widthD: u32,
    pub heightN: u32,
    pub heightD: u32,
    pub horizOffN: u32,
    pub horizOffD: u32,
    pub vertOffN: u32,
    pub vertOffD: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifImageRotation {
    pub angle: u8,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifImageMirror {
    pub axis: u8,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifCropRect {
    pub x: u32,
    pub y: u32,
    pub width: u32,
    pub height: u32,
}
extern "C" {
    pub fn avifCropRectConvertCleanApertureBox(
        cropRect: *mut avifCropRect,
        clap: *const avifCleanApertureBox,
        imageW: u32,
        imageH: u32,
        yuvFormat: avifPixelFormat,
        diag: *mut avifDiagnostics,
    ) -> avifBool;
}
extern "C" {
    pub fn avifCleanApertureBoxConvertCropRect(
        clap: *mut avifCleanApertureBox,
        cropRect: *const avifCropRect,
        imageW: u32,
        imageH: u32,
        yuvFormat: avifPixelFormat,
        diag: *mut avifDiagnostics,
    ) -> avifBool;
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifContentLightLevelInformationBox {
    pub maxCLL: u16,
    pub maxPALL: u16,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifImage {
    pub width: u32,
    pub height: u32,
    pub depth: u32,
    pub yuvFormat: avifPixelFormat,
    pub yuvRange: avifRange,
    pub yuvChromaSamplePosition: avifChromaSamplePosition,
    pub yuvPlanes: [*mut u8; 3usize],
    pub yuvRowBytes: [u32; 3usize],
    pub imageOwnsYUVPlanes: avifBool,
    pub alphaPlane: *mut u8,
    pub alphaRowBytes: u32,
    pub imageOwnsAlphaPlane: avifBool,
    pub alphaPremultiplied: avifBool,
    pub icc: avifRWData,
    pub colorPrimaries: avifColorPrimaries,
    pub transferCharacteristics: avifTransferCharacteristics,
    pub matrixCoefficients: avifMatrixCoefficients,
    pub clli: avifContentLightLevelInformationBox,
    pub transformFlags: avifTransformFlags,
    pub pasp: avifPixelAspectRatioBox,
    pub clap: avifCleanApertureBox,
    pub irot: avifImageRotation,
    pub imir: avifImageMirror,
    pub exif: avifRWData,
    pub xmp: avifRWData,
}
impl Default for avifImage {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifImageCreate(
        width: u32,
        height: u32,
        depth: u32,
        yuvFormat: avifPixelFormat,
    ) -> *mut avifImage;
}
extern "C" {
    pub fn avifImageCreateEmpty() -> *mut avifImage;
}
extern "C" {
    pub fn avifImageCopy(
        dstImage: *mut avifImage,
        srcImage: *const avifImage,
        planes: avifPlanesFlags,
    ) -> avifResult;
}
extern "C" {
    pub fn avifImageSetViewRect(
        dstImage: *mut avifImage,
        srcImage: *const avifImage,
        rect: *const avifCropRect,
    ) -> avifResult;
}
extern "C" {
    pub fn avifImageDestroy(image: *mut avifImage);
}
extern "C" {
    pub fn avifImageSetProfileICC(
        image: *mut avifImage,
        icc: *const u8,
        iccSize: usize,
    ) -> avifResult;
}
extern "C" {
    pub fn avifImageSetMetadataExif(
        image: *mut avifImage,
        exif: *const u8,
        exifSize: usize,
    ) -> avifResult;
}
extern "C" {
    pub fn avifImageSetMetadataXMP(
        image: *mut avifImage,
        xmp: *const u8,
        xmpSize: usize,
    ) -> avifResult;
}
extern "C" {
    pub fn avifImageAllocatePlanes(image: *mut avifImage, planes: avifPlanesFlags) -> avifResult;
}
extern "C" {
    pub fn avifImageFreePlanes(image: *mut avifImage, planes: avifPlanesFlags);
}
extern "C" {
    pub fn avifImageStealPlanes(
        dstImage: *mut avifImage,
        srcImage: *mut avifImage,
        planes: avifPlanesFlags,
    );
}
pub const AVIF_RGB_FORMAT_RGB: avifRGBFormat = 0;
pub const AVIF_RGB_FORMAT_RGBA: avifRGBFormat = 1;
pub const AVIF_RGB_FORMAT_ARGB: avifRGBFormat = 2;
pub const AVIF_RGB_FORMAT_BGR: avifRGBFormat = 3;
pub const AVIF_RGB_FORMAT_BGRA: avifRGBFormat = 4;
pub const AVIF_RGB_FORMAT_ABGR: avifRGBFormat = 5;
pub const AVIF_RGB_FORMAT_RGB_565: avifRGBFormat = 6;
pub const AVIF_RGB_FORMAT_COUNT: avifRGBFormat = 7;
pub type avifRGBFormat = ::std::os::raw::c_uint;
extern "C" {
    pub fn avifRGBFormatChannelCount(format: avifRGBFormat) -> u32;
}
extern "C" {
    pub fn avifRGBFormatHasAlpha(format: avifRGBFormat) -> avifBool;
}
pub const AVIF_CHROMA_UPSAMPLING_AUTOMATIC: avifChromaUpsampling = 0;
pub const AVIF_CHROMA_UPSAMPLING_FASTEST: avifChromaUpsampling = 1;
pub const AVIF_CHROMA_UPSAMPLING_BEST_QUALITY: avifChromaUpsampling = 2;
pub const AVIF_CHROMA_UPSAMPLING_NEAREST: avifChromaUpsampling = 3;
pub const AVIF_CHROMA_UPSAMPLING_BILINEAR: avifChromaUpsampling = 4;
pub type avifChromaUpsampling = ::std::os::raw::c_uint;
pub const AVIF_CHROMA_DOWNSAMPLING_AUTOMATIC: avifChromaDownsampling = 0;
pub const AVIF_CHROMA_DOWNSAMPLING_FASTEST: avifChromaDownsampling = 1;
pub const AVIF_CHROMA_DOWNSAMPLING_BEST_QUALITY: avifChromaDownsampling = 2;
pub const AVIF_CHROMA_DOWNSAMPLING_AVERAGE: avifChromaDownsampling = 3;
pub const AVIF_CHROMA_DOWNSAMPLING_SHARP_YUV: avifChromaDownsampling = 4;
pub type avifChromaDownsampling = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifRGBImage {
    pub width: u32,
    pub height: u32,
    pub depth: u32,
    pub format: avifRGBFormat,
    pub chromaUpsampling: avifChromaUpsampling,
    pub chromaDownsampling: avifChromaDownsampling,
    pub avoidLibYUV: avifBool,
    pub ignoreAlpha: avifBool,
    pub alphaPremultiplied: avifBool,
    pub isFloat: avifBool,
    pub maxThreads: ::std::os::raw::c_int,
    pub pixels: *mut u8,
    pub rowBytes: u32,
}
impl Default for avifRGBImage {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifRGBImageSetDefaults(rgb: *mut avifRGBImage, image: *const avifImage);
}
extern "C" {
    pub fn avifRGBImagePixelSize(rgb: *const avifRGBImage) -> u32;
}
extern "C" {
    pub fn avifRGBImageAllocatePixels(rgb: *mut avifRGBImage) -> avifResult;
}
extern "C" {
    pub fn avifRGBImageFreePixels(rgb: *mut avifRGBImage);
}
extern "C" {
    pub fn avifImageRGBToYUV(image: *mut avifImage, rgb: *const avifRGBImage) -> avifResult;
}
extern "C" {
    pub fn avifImageYUVToRGB(image: *const avifImage, rgb: *mut avifRGBImage) -> avifResult;
}
extern "C" {
    pub fn avifRGBImagePremultiplyAlpha(rgb: *mut avifRGBImage) -> avifResult;
}
extern "C" {
    pub fn avifRGBImageUnpremultiplyAlpha(rgb: *mut avifRGBImage) -> avifResult;
}
extern "C" {
    pub fn avifFullToLimitedY(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn avifFullToLimitedUV(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn avifLimitedToFullY(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn avifLimitedToFullUV(depth: u32, v: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
pub const AVIF_CODEC_CHOICE_AUTO: avifCodecChoice = 0;
pub const AVIF_CODEC_CHOICE_AOM: avifCodecChoice = 1;
pub const AVIF_CODEC_CHOICE_DAV1D: avifCodecChoice = 2;
pub const AVIF_CODEC_CHOICE_LIBGAV1: avifCodecChoice = 3;
pub const AVIF_CODEC_CHOICE_RAV1E: avifCodecChoice = 4;
pub const AVIF_CODEC_CHOICE_SVT: avifCodecChoice = 5;
pub const AVIF_CODEC_CHOICE_AVM: avifCodecChoice = 6;
pub type avifCodecChoice = ::std::os::raw::c_uint;
pub const AVIF_CODEC_FLAG_CAN_DECODE: avifCodecFlag = 1;
pub const AVIF_CODEC_FLAG_CAN_ENCODE: avifCodecFlag = 2;
pub type avifCodecFlag = ::std::os::raw::c_uint;
pub type avifCodecFlags = u32;
extern "C" {
    pub fn avifCodecName(
        choice: avifCodecChoice,
        requiredFlags: avifCodecFlags,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn avifCodecChoiceFromName(name: *const ::std::os::raw::c_char) -> avifCodecChoice;
}
pub type avifIODestroyFunc = ::std::option::Option<unsafe extern "C" fn(io: *mut avifIO)>;
pub type avifIOReadFunc = ::std::option::Option<
    unsafe extern "C" fn(
        io: *mut avifIO,
        readFlags: u32,
        offset: u64,
        size: usize,
        out: *mut avifROData,
    ) -> avifResult,
>;
pub type avifIOWriteFunc = ::std::option::Option<
    unsafe extern "C" fn(
        io: *mut avifIO,
        writeFlags: u32,
        offset: u64,
        data: *const u8,
        size: usize,
    ) -> avifResult,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifIO {
    pub destroy: avifIODestroyFunc,
    pub read: avifIOReadFunc,
    pub write: avifIOWriteFunc,
    pub sizeHint: u64,
    pub persistent: avifBool,
    pub data: *mut ::std::os::raw::c_void,
}
impl Default for avifIO {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifIOCreateMemoryReader(data: *const u8, size: usize) -> *mut avifIO;
}
extern "C" {
    pub fn avifIOCreateFileReader(filename: *const ::std::os::raw::c_char) -> *mut avifIO;
}
extern "C" {
    pub fn avifIODestroy(io: *mut avifIO);
}
pub const AVIF_STRICT_DISABLED: avifStrictFlag = 0;
pub const AVIF_STRICT_PIXI_REQUIRED: avifStrictFlag = 1;
pub const AVIF_STRICT_CLAP_VALID: avifStrictFlag = 2;
pub const AVIF_STRICT_ALPHA_ISPE_REQUIRED: avifStrictFlag = 4;
pub const AVIF_STRICT_ENABLED: avifStrictFlag = 7;
pub type avifStrictFlag = ::std::os::raw::c_uint;
pub type avifStrictFlags = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifIOStats {
    pub colorOBUSize: usize,
    pub alphaOBUSize: usize,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifDecoderData {
    _unused: [u8; 0],
}
pub const AVIF_DECODER_SOURCE_AUTO: avifDecoderSource = 0;
pub const AVIF_DECODER_SOURCE_PRIMARY_ITEM: avifDecoderSource = 1;
pub const AVIF_DECODER_SOURCE_TRACKS: avifDecoderSource = 2;
pub type avifDecoderSource = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifImageTiming {
    pub timescale: u64,
    pub pts: f64,
    pub ptsInTimescales: u64,
    pub duration: f64,
    pub durationInTimescales: u64,
}
pub const AVIF_PROGRESSIVE_STATE_UNAVAILABLE: avifProgressiveState = 0;
pub const AVIF_PROGRESSIVE_STATE_AVAILABLE: avifProgressiveState = 1;
pub const AVIF_PROGRESSIVE_STATE_ACTIVE: avifProgressiveState = 2;
pub type avifProgressiveState = ::std::os::raw::c_uint;
extern "C" {
    pub fn avifProgressiveStateToString(
        progressiveState: avifProgressiveState,
    ) -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifDecoder {
    pub codecChoice: avifCodecChoice,
    pub maxThreads: ::std::os::raw::c_int,
    pub requestedSource: avifDecoderSource,
    pub allowProgressive: avifBool,
    pub allowIncremental: avifBool,
    pub ignoreExif: avifBool,
    pub ignoreXMP: avifBool,
    pub imageSizeLimit: u32,
    pub imageDimensionLimit: u32,
    pub imageCountLimit: u32,
    pub strictFlags: avifStrictFlags,
    pub image: *mut avifImage,
    pub imageIndex: ::std::os::raw::c_int,
    pub imageCount: ::std::os::raw::c_int,
    pub progressiveState: avifProgressiveState,
    pub imageTiming: avifImageTiming,
    pub timescale: u64,
    pub duration: f64,
    pub durationInTimescales: u64,
    pub repetitionCount: ::std::os::raw::c_int,
    pub alphaPresent: avifBool,
    pub ioStats: avifIOStats,
    pub diag: avifDiagnostics,
    pub io: *mut avifIO,
    pub data: *mut avifDecoderData,
}
impl Default for avifDecoder {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifDecoderCreate() -> *mut avifDecoder;
}
extern "C" {
    pub fn avifDecoderDestroy(decoder: *mut avifDecoder);
}
extern "C" {
    pub fn avifDecoderRead(decoder: *mut avifDecoder, image: *mut avifImage) -> avifResult;
}
extern "C" {
    pub fn avifDecoderReadMemory(
        decoder: *mut avifDecoder,
        image: *mut avifImage,
        data: *const u8,
        size: usize,
    ) -> avifResult;
}
extern "C" {
    pub fn avifDecoderReadFile(
        decoder: *mut avifDecoder,
        image: *mut avifImage,
        filename: *const ::std::os::raw::c_char,
    ) -> avifResult;
}
extern "C" {
    pub fn avifDecoderSetSource(decoder: *mut avifDecoder, source: avifDecoderSource)
        -> avifResult;
}
extern "C" {
    pub fn avifDecoderSetIO(decoder: *mut avifDecoder, io: *mut avifIO);
}
extern "C" {
    pub fn avifDecoderSetIOMemory(
        decoder: *mut avifDecoder,
        data: *const u8,
        size: usize,
    ) -> avifResult;
}
extern "C" {
    pub fn avifDecoderSetIOFile(
        decoder: *mut avifDecoder,
        filename: *const ::std::os::raw::c_char,
    ) -> avifResult;
}
extern "C" {
    pub fn avifDecoderParse(decoder: *mut avifDecoder) -> avifResult;
}
extern "C" {
    pub fn avifDecoderNextImage(decoder: *mut avifDecoder) -> avifResult;
}
extern "C" {
    pub fn avifDecoderNthImage(decoder: *mut avifDecoder, frameIndex: u32) -> avifResult;
}
extern "C" {
    pub fn avifDecoderReset(decoder: *mut avifDecoder) -> avifResult;
}
extern "C" {
    pub fn avifDecoderIsKeyframe(decoder: *const avifDecoder, frameIndex: u32) -> avifBool;
}
extern "C" {
    pub fn avifDecoderNearestKeyframe(decoder: *const avifDecoder, frameIndex: u32) -> u32;
}
extern "C" {
    pub fn avifDecoderNthImageTiming(
        decoder: *const avifDecoder,
        frameIndex: u32,
        outTiming: *mut avifImageTiming,
    ) -> avifResult;
}
extern "C" {
    pub fn avifDecoderDecodedRowCount(decoder: *const avifDecoder) -> u32;
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifExtent {
    pub offset: u64,
    pub size: usize,
}
extern "C" {
    pub fn avifDecoderNthImageMaxExtent(
        decoder: *const avifDecoder,
        frameIndex: u32,
        outExtent: *mut avifExtent,
    ) -> avifResult;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifEncoderData {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifCodecSpecificOptions {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct avifScalingMode {
    pub horizontal: avifFraction,
    pub vertical: avifFraction,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct avifEncoder {
    pub codecChoice: avifCodecChoice,
    pub maxThreads: ::std::os::raw::c_int,
    pub speed: ::std::os::raw::c_int,
    pub keyframeInterval: ::std::os::raw::c_int,
    pub timescale: u64,
    pub repetitionCount: ::std::os::raw::c_int,
    pub extraLayerCount: u32,
    pub quality: ::std::os::raw::c_int,
    pub qualityAlpha: ::std::os::raw::c_int,
    pub minQuantizer: ::std::os::raw::c_int,
    pub maxQuantizer: ::std::os::raw::c_int,
    pub minQuantizerAlpha: ::std::os::raw::c_int,
    pub maxQuantizerAlpha: ::std::os::raw::c_int,
    pub tileRowsLog2: ::std::os::raw::c_int,
    pub tileColsLog2: ::std::os::raw::c_int,
    pub autoTiling: avifBool,
    pub scalingMode: avifScalingMode,
    pub ioStats: avifIOStats,
    pub diag: avifDiagnostics,
    pub data: *mut avifEncoderData,
    pub csOptions: *mut avifCodecSpecificOptions,
}
impl Default for avifEncoder {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
extern "C" {
    pub fn avifEncoderCreate() -> *mut avifEncoder;
}
extern "C" {
    pub fn avifEncoderWrite(
        encoder: *mut avifEncoder,
        image: *const avifImage,
        output: *mut avifRWData,
    ) -> avifResult;
}
extern "C" {
    pub fn avifEncoderDestroy(encoder: *mut avifEncoder);
}
pub const AVIF_ADD_IMAGE_FLAG_NONE: avifAddImageFlag = 0;
pub const AVIF_ADD_IMAGE_FLAG_FORCE_KEYFRAME: avifAddImageFlag = 1;
pub const AVIF_ADD_IMAGE_FLAG_SINGLE: avifAddImageFlag = 2;
pub type avifAddImageFlag = ::std::os::raw::c_uint;
pub type avifAddImageFlags = u32;
extern "C" {
    pub fn avifEncoderAddImage(
        encoder: *mut avifEncoder,
        image: *const avifImage,
        durationInTimescales: u64,
        addImageFlags: avifAddImageFlags,
    ) -> avifResult;
}
extern "C" {
    pub fn avifEncoderAddImageGrid(
        encoder: *mut avifEncoder,
        gridCols: u32,
        gridRows: u32,
        cellImages: *const *const avifImage,
        addImageFlags: avifAddImageFlags,
    ) -> avifResult;
}
extern "C" {
    pub fn avifEncoderFinish(encoder: *mut avifEncoder, output: *mut avifRWData) -> avifResult;
}
extern "C" {
    pub fn avifEncoderSetCodecSpecificOption(
        encoder: *mut avifEncoder,
        key: *const ::std::os::raw::c_char,
        value: *const ::std::os::raw::c_char,
    ) -> avifResult;
}
extern "C" {
    pub fn avifImageUsesU16(image: *const avifImage) -> avifBool;
}
extern "C" {
    pub fn avifImageIsOpaque(image: *const avifImage) -> avifBool;
}
extern "C" {
    pub fn avifImagePlane(image: *const avifImage, channel: ::std::os::raw::c_int) -> *mut u8;
}
extern "C" {
    pub fn avifImagePlaneRowBytes(image: *const avifImage, channel: ::std::os::raw::c_int) -> u32;
}
extern "C" {
    pub fn avifImagePlaneWidth(image: *const avifImage, channel: ::std::os::raw::c_int) -> u32;
}
extern "C" {
    pub fn avifImagePlaneHeight(image: *const avifImage, channel: ::std::os::raw::c_int) -> u32;
}
extern "C" {
    pub fn avifPeekCompatibleFileType(input: *const avifROData) -> avifBool;
}