blazediff-shared 6.0.0

Shared BlazeDiff primitives: the RGBA8 image type, YIQ color math, and PNG/JPEG/QOI I/O
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
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
/* automatically generated by rust-bindgen 0.72.1 */

pub const SPNG_VERSION_MAJOR: u32 = 0;
pub const SPNG_VERSION_MINOR: u32 = 7;
pub const SPNG_VERSION_PATCH: u32 = 4;
pub type __int64_t = ::std::os::raw::c_longlong;
pub type __darwin_off_t = __int64_t;
pub type fpos_t = __darwin_off_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __sbuf {
    pub _base: *mut ::std::os::raw::c_uchar,
    pub _size: ::std::os::raw::c_int,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __sFILEX {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __sFILE {
    pub _p: *mut ::std::os::raw::c_uchar,
    pub _r: ::std::os::raw::c_int,
    pub _w: ::std::os::raw::c_int,
    pub _flags: ::std::os::raw::c_short,
    pub _file: ::std::os::raw::c_short,
    pub _bf: __sbuf,
    pub _lbfsize: ::std::os::raw::c_int,
    pub _cookie: *mut ::std::os::raw::c_void,
    pub _close: ::std::option::Option<
        unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int,
    >,
    pub _read: ::std::option::Option<
        unsafe extern "C" fn(
            arg1: *mut ::std::os::raw::c_void,
            arg2: *mut ::std::os::raw::c_char,
            __n: ::std::os::raw::c_int,
        ) -> ::std::os::raw::c_int,
    >,
    pub _seek: ::std::option::Option<
        unsafe extern "C" fn(
            arg1: *mut ::std::os::raw::c_void,
            arg2: fpos_t,
            arg3: ::std::os::raw::c_int,
        ) -> fpos_t,
    >,
    pub _write: ::std::option::Option<
        unsafe extern "C" fn(
            arg1: *mut ::std::os::raw::c_void,
            arg2: *const ::std::os::raw::c_char,
            __n: ::std::os::raw::c_int,
        ) -> ::std::os::raw::c_int,
    >,
    pub _ub: __sbuf,
    pub _extra: *mut __sFILEX,
    pub _ur: ::std::os::raw::c_int,
    pub _ubuf: [::std::os::raw::c_uchar; 3usize],
    pub _nbuf: [::std::os::raw::c_uchar; 1usize],
    pub _lb: __sbuf,
    pub _blksize: ::std::os::raw::c_int,
    pub _offset: fpos_t,
}
pub type FILE = __sFILE;
pub const spng_errno_SPNG_IO_ERROR: spng_errno = -2;
pub const spng_errno_SPNG_IO_EOF: spng_errno = -1;
pub const spng_errno_SPNG_OK: spng_errno = 0;
pub const spng_errno_SPNG_EINVAL: spng_errno = 1;
pub const spng_errno_SPNG_EMEM: spng_errno = 2;
pub const spng_errno_SPNG_EOVERFLOW: spng_errno = 3;
pub const spng_errno_SPNG_ESIGNATURE: spng_errno = 4;
pub const spng_errno_SPNG_EWIDTH: spng_errno = 5;
pub const spng_errno_SPNG_EHEIGHT: spng_errno = 6;
pub const spng_errno_SPNG_EUSER_WIDTH: spng_errno = 7;
pub const spng_errno_SPNG_EUSER_HEIGHT: spng_errno = 8;
pub const spng_errno_SPNG_EBIT_DEPTH: spng_errno = 9;
pub const spng_errno_SPNG_ECOLOR_TYPE: spng_errno = 10;
pub const spng_errno_SPNG_ECOMPRESSION_METHOD: spng_errno = 11;
pub const spng_errno_SPNG_EFILTER_METHOD: spng_errno = 12;
pub const spng_errno_SPNG_EINTERLACE_METHOD: spng_errno = 13;
pub const spng_errno_SPNG_EIHDR_SIZE: spng_errno = 14;
pub const spng_errno_SPNG_ENOIHDR: spng_errno = 15;
pub const spng_errno_SPNG_ECHUNK_POS: spng_errno = 16;
pub const spng_errno_SPNG_ECHUNK_SIZE: spng_errno = 17;
pub const spng_errno_SPNG_ECHUNK_CRC: spng_errno = 18;
pub const spng_errno_SPNG_ECHUNK_TYPE: spng_errno = 19;
pub const spng_errno_SPNG_ECHUNK_UNKNOWN_CRITICAL: spng_errno = 20;
pub const spng_errno_SPNG_EDUP_PLTE: spng_errno = 21;
pub const spng_errno_SPNG_EDUP_CHRM: spng_errno = 22;
pub const spng_errno_SPNG_EDUP_GAMA: spng_errno = 23;
pub const spng_errno_SPNG_EDUP_ICCP: spng_errno = 24;
pub const spng_errno_SPNG_EDUP_SBIT: spng_errno = 25;
pub const spng_errno_SPNG_EDUP_SRGB: spng_errno = 26;
pub const spng_errno_SPNG_EDUP_BKGD: spng_errno = 27;
pub const spng_errno_SPNG_EDUP_HIST: spng_errno = 28;
pub const spng_errno_SPNG_EDUP_TRNS: spng_errno = 29;
pub const spng_errno_SPNG_EDUP_PHYS: spng_errno = 30;
pub const spng_errno_SPNG_EDUP_TIME: spng_errno = 31;
pub const spng_errno_SPNG_EDUP_OFFS: spng_errno = 32;
pub const spng_errno_SPNG_EDUP_EXIF: spng_errno = 33;
pub const spng_errno_SPNG_ECHRM: spng_errno = 34;
pub const spng_errno_SPNG_EPLTE_IDX: spng_errno = 35;
pub const spng_errno_SPNG_ETRNS_COLOR_TYPE: spng_errno = 36;
pub const spng_errno_SPNG_ETRNS_NO_PLTE: spng_errno = 37;
pub const spng_errno_SPNG_EGAMA: spng_errno = 38;
pub const spng_errno_SPNG_EICCP_NAME: spng_errno = 39;
pub const spng_errno_SPNG_EICCP_COMPRESSION_METHOD: spng_errno = 40;
pub const spng_errno_SPNG_ESBIT: spng_errno = 41;
pub const spng_errno_SPNG_ESRGB: spng_errno = 42;
pub const spng_errno_SPNG_ETEXT: spng_errno = 43;
pub const spng_errno_SPNG_ETEXT_KEYWORD: spng_errno = 44;
pub const spng_errno_SPNG_EZTXT: spng_errno = 45;
pub const spng_errno_SPNG_EZTXT_COMPRESSION_METHOD: spng_errno = 46;
pub const spng_errno_SPNG_EITXT: spng_errno = 47;
pub const spng_errno_SPNG_EITXT_COMPRESSION_FLAG: spng_errno = 48;
pub const spng_errno_SPNG_EITXT_COMPRESSION_METHOD: spng_errno = 49;
pub const spng_errno_SPNG_EITXT_LANG_TAG: spng_errno = 50;
pub const spng_errno_SPNG_EITXT_TRANSLATED_KEY: spng_errno = 51;
pub const spng_errno_SPNG_EBKGD_NO_PLTE: spng_errno = 52;
pub const spng_errno_SPNG_EBKGD_PLTE_IDX: spng_errno = 53;
pub const spng_errno_SPNG_EHIST_NO_PLTE: spng_errno = 54;
pub const spng_errno_SPNG_EPHYS: spng_errno = 55;
pub const spng_errno_SPNG_ESPLT_NAME: spng_errno = 56;
pub const spng_errno_SPNG_ESPLT_DUP_NAME: spng_errno = 57;
pub const spng_errno_SPNG_ESPLT_DEPTH: spng_errno = 58;
pub const spng_errno_SPNG_ETIME: spng_errno = 59;
pub const spng_errno_SPNG_EOFFS: spng_errno = 60;
pub const spng_errno_SPNG_EEXIF: spng_errno = 61;
pub const spng_errno_SPNG_EIDAT_TOO_SHORT: spng_errno = 62;
pub const spng_errno_SPNG_EIDAT_STREAM: spng_errno = 63;
pub const spng_errno_SPNG_EZLIB: spng_errno = 64;
pub const spng_errno_SPNG_EFILTER: spng_errno = 65;
pub const spng_errno_SPNG_EBUFSIZ: spng_errno = 66;
pub const spng_errno_SPNG_EIO: spng_errno = 67;
pub const spng_errno_SPNG_EOF: spng_errno = 68;
pub const spng_errno_SPNG_EBUF_SET: spng_errno = 69;
pub const spng_errno_SPNG_EBADSTATE: spng_errno = 70;
pub const spng_errno_SPNG_EFMT: spng_errno = 71;
pub const spng_errno_SPNG_EFLAGS: spng_errno = 72;
pub const spng_errno_SPNG_ECHUNKAVAIL: spng_errno = 73;
pub const spng_errno_SPNG_ENCODE_ONLY: spng_errno = 74;
pub const spng_errno_SPNG_EOI: spng_errno = 75;
pub const spng_errno_SPNG_ENOPLTE: spng_errno = 76;
pub const spng_errno_SPNG_ECHUNK_LIMITS: spng_errno = 77;
pub const spng_errno_SPNG_EZLIB_INIT: spng_errno = 78;
pub const spng_errno_SPNG_ECHUNK_STDLEN: spng_errno = 79;
pub const spng_errno_SPNG_EINTERNAL: spng_errno = 80;
pub const spng_errno_SPNG_ECTXTYPE: spng_errno = 81;
pub const spng_errno_SPNG_ENOSRC: spng_errno = 82;
pub const spng_errno_SPNG_ENODST: spng_errno = 83;
pub const spng_errno_SPNG_EOPSTATE: spng_errno = 84;
pub const spng_errno_SPNG_ENOTFINAL: spng_errno = 85;
pub type spng_errno = ::std::os::raw::c_int;
pub const spng_text_type_SPNG_TEXT: spng_text_type = 1;
pub const spng_text_type_SPNG_ZTXT: spng_text_type = 2;
pub const spng_text_type_SPNG_ITXT: spng_text_type = 3;
pub type spng_text_type = ::std::os::raw::c_uint;
pub const spng_color_type_SPNG_COLOR_TYPE_GRAYSCALE: spng_color_type = 0;
pub const spng_color_type_SPNG_COLOR_TYPE_TRUECOLOR: spng_color_type = 2;
pub const spng_color_type_SPNG_COLOR_TYPE_INDEXED: spng_color_type = 3;
pub const spng_color_type_SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: spng_color_type = 4;
pub const spng_color_type_SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: spng_color_type = 6;
pub type spng_color_type = ::std::os::raw::c_uint;
pub const spng_filter_SPNG_FILTER_NONE: spng_filter = 0;
pub const spng_filter_SPNG_FILTER_SUB: spng_filter = 1;
pub const spng_filter_SPNG_FILTER_UP: spng_filter = 2;
pub const spng_filter_SPNG_FILTER_AVERAGE: spng_filter = 3;
pub const spng_filter_SPNG_FILTER_PAETH: spng_filter = 4;
pub type spng_filter = ::std::os::raw::c_uint;
pub const spng_filter_choice_SPNG_DISABLE_FILTERING: spng_filter_choice = 0;
pub const spng_filter_choice_SPNG_FILTER_CHOICE_NONE: spng_filter_choice = 8;
pub const spng_filter_choice_SPNG_FILTER_CHOICE_SUB: spng_filter_choice = 16;
pub const spng_filter_choice_SPNG_FILTER_CHOICE_UP: spng_filter_choice = 32;
pub const spng_filter_choice_SPNG_FILTER_CHOICE_AVG: spng_filter_choice = 64;
pub const spng_filter_choice_SPNG_FILTER_CHOICE_PAETH: spng_filter_choice = 128;
pub const spng_filter_choice_SPNG_FILTER_CHOICE_ALL: spng_filter_choice = 248;
pub type spng_filter_choice = ::std::os::raw::c_uint;
pub const spng_interlace_method_SPNG_INTERLACE_NONE: spng_interlace_method = 0;
pub const spng_interlace_method_SPNG_INTERLACE_ADAM7: spng_interlace_method = 1;
pub type spng_interlace_method = ::std::os::raw::c_uint;
pub const spng_format_SPNG_FMT_RGBA8: spng_format = 1;
pub const spng_format_SPNG_FMT_RGBA16: spng_format = 2;
pub const spng_format_SPNG_FMT_RGB8: spng_format = 4;
pub const spng_format_SPNG_FMT_GA8: spng_format = 16;
pub const spng_format_SPNG_FMT_GA16: spng_format = 32;
pub const spng_format_SPNG_FMT_G8: spng_format = 64;
pub const spng_format_SPNG_FMT_PNG: spng_format = 256;
pub const spng_format_SPNG_FMT_RAW: spng_format = 512;
pub type spng_format = ::std::os::raw::c_uint;
pub const spng_ctx_flags_SPNG_CTX_IGNORE_ADLER32: spng_ctx_flags = 1;
pub const spng_ctx_flags_SPNG_CTX_ENCODER: spng_ctx_flags = 2;
pub type spng_ctx_flags = ::std::os::raw::c_uint;
pub const spng_decode_flags_SPNG_DECODE_USE_TRNS: spng_decode_flags = 1;
pub const spng_decode_flags_SPNG_DECODE_USE_GAMA: spng_decode_flags = 2;
pub const spng_decode_flags_SPNG_DECODE_USE_SBIT: spng_decode_flags = 8;
pub const spng_decode_flags_SPNG_DECODE_TRNS: spng_decode_flags = 1;
pub const spng_decode_flags_SPNG_DECODE_GAMMA: spng_decode_flags = 2;
pub const spng_decode_flags_SPNG_DECODE_PROGRESSIVE: spng_decode_flags = 256;
pub type spng_decode_flags = ::std::os::raw::c_uint;
pub const spng_crc_action_SPNG_CRC_ERROR: spng_crc_action = 0;
pub const spng_crc_action_SPNG_CRC_DISCARD: spng_crc_action = 1;
pub const spng_crc_action_SPNG_CRC_USE: spng_crc_action = 2;
pub type spng_crc_action = ::std::os::raw::c_uint;
pub const spng_encode_flags_SPNG_ENCODE_PROGRESSIVE: spng_encode_flags = 1;
pub const spng_encode_flags_SPNG_ENCODE_FINALIZE: spng_encode_flags = 2;
pub type spng_encode_flags = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_ihdr {
    pub width: u32,
    pub height: u32,
    pub bit_depth: u8,
    pub color_type: u8,
    pub compression_method: u8,
    pub filter_method: u8,
    pub interlace_method: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_plte_entry {
    pub red: u8,
    pub green: u8,
    pub blue: u8,
    pub alpha: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_plte {
    pub n_entries: u32,
    pub entries: [spng_plte_entry; 256usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_trns {
    pub gray: u16,
    pub red: u16,
    pub green: u16,
    pub blue: u16,
    pub n_type3_entries: u32,
    pub type3_alpha: [u8; 256usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_chrm_int {
    pub white_point_x: u32,
    pub white_point_y: u32,
    pub red_x: u32,
    pub red_y: u32,
    pub green_x: u32,
    pub green_y: u32,
    pub blue_x: u32,
    pub blue_y: u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_chrm {
    pub white_point_x: f64,
    pub white_point_y: f64,
    pub red_x: f64,
    pub red_y: f64,
    pub green_x: f64,
    pub green_y: f64,
    pub blue_x: f64,
    pub blue_y: f64,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_iccp {
    pub profile_name: [::std::os::raw::c_char; 80usize],
    pub profile_len: usize,
    pub profile: *mut ::std::os::raw::c_char,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_sbit {
    pub grayscale_bits: u8,
    pub red_bits: u8,
    pub green_bits: u8,
    pub blue_bits: u8,
    pub alpha_bits: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_text {
    pub keyword: [::std::os::raw::c_char; 80usize],
    pub type_: ::std::os::raw::c_int,
    pub length: usize,
    pub text: *mut ::std::os::raw::c_char,
    pub compression_flag: u8,
    pub compression_method: u8,
    pub language_tag: *mut ::std::os::raw::c_char,
    pub translated_keyword: *mut ::std::os::raw::c_char,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_bkgd {
    pub gray: u16,
    pub red: u16,
    pub green: u16,
    pub blue: u16,
    pub plte_index: u16,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_hist {
    pub frequency: [u16; 256usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_phys {
    pub ppu_x: u32,
    pub ppu_y: u32,
    pub unit_specifier: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_splt_entry {
    pub red: u16,
    pub green: u16,
    pub blue: u16,
    pub alpha: u16,
    pub frequency: u16,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_splt {
    pub name: [::std::os::raw::c_char; 80usize],
    pub sample_depth: u8,
    pub n_entries: u32,
    pub entries: *mut spng_splt_entry,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_time {
    pub year: u16,
    pub month: u8,
    pub day: u8,
    pub hour: u8,
    pub minute: u8,
    pub second: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_offs {
    pub x: i32,
    pub y: i32,
    pub unit_specifier: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_exif {
    pub length: usize,
    pub data: *mut ::std::os::raw::c_char,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_chunk {
    pub offset: usize,
    pub length: u32,
    pub type_: [u8; 4usize],
    pub crc: u32,
}
pub const spng_location_SPNG_AFTER_IHDR: spng_location = 1;
pub const spng_location_SPNG_AFTER_PLTE: spng_location = 2;
pub const spng_location_SPNG_AFTER_IDAT: spng_location = 8;
pub type spng_location = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_unknown_chunk {
    pub type_: [u8; 4usize],
    pub length: usize,
    pub data: *mut ::std::os::raw::c_void,
    pub location: spng_location,
}
pub const spng_option_SPNG_KEEP_UNKNOWN_CHUNKS: spng_option = 1;
pub const spng_option_SPNG_IMG_COMPRESSION_LEVEL: spng_option = 2;
pub const spng_option_SPNG_IMG_WINDOW_BITS: spng_option = 3;
pub const spng_option_SPNG_IMG_MEM_LEVEL: spng_option = 4;
pub const spng_option_SPNG_IMG_COMPRESSION_STRATEGY: spng_option = 5;
pub const spng_option_SPNG_TEXT_COMPRESSION_LEVEL: spng_option = 6;
pub const spng_option_SPNG_TEXT_WINDOW_BITS: spng_option = 7;
pub const spng_option_SPNG_TEXT_MEM_LEVEL: spng_option = 8;
pub const spng_option_SPNG_TEXT_COMPRESSION_STRATEGY: spng_option = 9;
pub const spng_option_SPNG_FILTER_CHOICE: spng_option = 10;
pub const spng_option_SPNG_CHUNK_COUNT_LIMIT: spng_option = 11;
pub const spng_option_SPNG_ENCODE_TO_BUFFER: spng_option = 12;
pub type spng_option = ::std::os::raw::c_uint;
pub type spng_malloc_fn =
    ::std::option::Option<unsafe extern "C" fn(size: usize) -> *mut ::std::os::raw::c_void>;
pub type spng_realloc_fn = ::std::option::Option<
    unsafe extern "C" fn(
        ptr: *mut ::std::os::raw::c_void,
        size: usize,
    ) -> *mut ::std::os::raw::c_void,
>;
pub type spng_calloc_fn = ::std::option::Option<
    unsafe extern "C" fn(count: usize, size: usize) -> *mut ::std::os::raw::c_void,
>;
pub type spng_free_fn =
    ::std::option::Option<unsafe extern "C" fn(ptr: *mut ::std::os::raw::c_void)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_alloc {
    pub malloc_fn: spng_malloc_fn,
    pub realloc_fn: spng_realloc_fn,
    pub calloc_fn: spng_calloc_fn,
    pub free_fn: spng_free_fn,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_row_info {
    pub scanline_idx: u32,
    pub row_num: u32,
    pub pass: ::std::os::raw::c_int,
    pub filter: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct spng_ctx {
    _unused: [u8; 0],
}
pub type spng_read_fn = ::std::option::Option<
    unsafe extern "C" fn(
        ctx: *mut spng_ctx,
        user: *mut ::std::os::raw::c_void,
        dest: *mut ::std::os::raw::c_void,
        length: usize,
    ) -> ::std::os::raw::c_int,
>;
pub type spng_write_fn = ::std::option::Option<
    unsafe extern "C" fn(
        ctx: *mut spng_ctx,
        user: *mut ::std::os::raw::c_void,
        src: *mut ::std::os::raw::c_void,
        length: usize,
    ) -> ::std::os::raw::c_int,
>;
pub type spng_rw_fn = ::std::option::Option<
    unsafe extern "C" fn(
        ctx: *mut spng_ctx,
        user: *mut ::std::os::raw::c_void,
        dst_src: *mut ::std::os::raw::c_void,
        length: usize,
    ) -> ::std::os::raw::c_int,
>;
unsafe extern "C" {
    pub fn spng_ctx_new(flags: ::std::os::raw::c_int) -> *mut spng_ctx;
}
unsafe extern "C" {
    pub fn spng_ctx_new2(alloc: *mut spng_alloc, flags: ::std::os::raw::c_int) -> *mut spng_ctx;
}
unsafe extern "C" {
    pub fn spng_ctx_free(ctx: *mut spng_ctx);
}
unsafe extern "C" {
    pub fn spng_set_png_buffer(
        ctx: *mut spng_ctx,
        buf: *const ::std::os::raw::c_void,
        size: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_png_stream(
        ctx: *mut spng_ctx,
        rw_func: spng_rw_fn,
        user: *mut ::std::os::raw::c_void,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_png_file(ctx: *mut spng_ctx, file: *mut FILE) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_png_buffer(
        ctx: *mut spng_ctx,
        len: *mut usize,
        error: *mut ::std::os::raw::c_int,
    ) -> *mut ::std::os::raw::c_void;
}
unsafe extern "C" {
    pub fn spng_set_image_limits(
        ctx: *mut spng_ctx,
        width: u32,
        height: u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_image_limits(
        ctx: *mut spng_ctx,
        width: *mut u32,
        height: *mut u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_chunk_limits(
        ctx: *mut spng_ctx,
        chunk_size: usize,
        cache_size: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_chunk_limits(
        ctx: *mut spng_ctx,
        chunk_size: *mut usize,
        cache_size: *mut usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_crc_action(
        ctx: *mut spng_ctx,
        critical: ::std::os::raw::c_int,
        ancillary: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_option(
        ctx: *mut spng_ctx,
        option: spng_option,
        value: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_option(
        ctx: *mut spng_ctx,
        option: spng_option,
        value: *mut ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_decoded_image_size(
        ctx: *mut spng_ctx,
        fmt: ::std::os::raw::c_int,
        len: *mut usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_decode_image(
        ctx: *mut spng_ctx,
        out: *mut ::std::os::raw::c_void,
        len: usize,
        fmt: ::std::os::raw::c_int,
        flags: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_decode_scanline(
        ctx: *mut spng_ctx,
        out: *mut ::std::os::raw::c_void,
        len: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_decode_row(
        ctx: *mut spng_ctx,
        out: *mut ::std::os::raw::c_void,
        len: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_decode_chunks(ctx: *mut spng_ctx) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_row_info(
        ctx: *mut spng_ctx,
        row_info: *mut spng_row_info,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_encode_image(
        ctx: *mut spng_ctx,
        img: *const ::std::os::raw::c_void,
        len: usize,
        fmt: ::std::os::raw::c_int,
        flags: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_encode_scanline(
        ctx: *mut spng_ctx,
        scanline: *const ::std::os::raw::c_void,
        len: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_encode_row(
        ctx: *mut spng_ctx,
        row: *const ::std::os::raw::c_void,
        len: usize,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_encode_chunks(ctx: *mut spng_ctx) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_ihdr(ctx: *mut spng_ctx, ihdr: *mut spng_ihdr) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_plte(ctx: *mut spng_ctx, plte: *mut spng_plte) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_trns(ctx: *mut spng_ctx, trns: *mut spng_trns) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_chrm(ctx: *mut spng_ctx, chrm: *mut spng_chrm) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_chrm_int(
        ctx: *mut spng_ctx,
        chrm_int: *mut spng_chrm_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_gama(ctx: *mut spng_ctx, gamma: *mut f64) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_gama_int(ctx: *mut spng_ctx, gama_int: *mut u32) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_iccp(ctx: *mut spng_ctx, iccp: *mut spng_iccp) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_sbit(ctx: *mut spng_ctx, sbit: *mut spng_sbit) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_srgb(ctx: *mut spng_ctx, rendering_intent: *mut u8) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_text(
        ctx: *mut spng_ctx,
        text: *mut spng_text,
        n_text: *mut u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_bkgd(ctx: *mut spng_ctx, bkgd: *mut spng_bkgd) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_hist(ctx: *mut spng_ctx, hist: *mut spng_hist) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_phys(ctx: *mut spng_ctx, phys: *mut spng_phys) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_splt(
        ctx: *mut spng_ctx,
        splt: *mut spng_splt,
        n_splt: *mut u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_time(ctx: *mut spng_ctx, time: *mut spng_time) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_unknown_chunks(
        ctx: *mut spng_ctx,
        chunks: *mut spng_unknown_chunk,
        n_chunks: *mut u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_offs(ctx: *mut spng_ctx, offs: *mut spng_offs) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_get_exif(ctx: *mut spng_ctx, exif: *mut spng_exif) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_ihdr(ctx: *mut spng_ctx, ihdr: *mut spng_ihdr) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_plte(ctx: *mut spng_ctx, plte: *mut spng_plte) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_trns(ctx: *mut spng_ctx, trns: *mut spng_trns) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_chrm(ctx: *mut spng_ctx, chrm: *mut spng_chrm) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_chrm_int(
        ctx: *mut spng_ctx,
        chrm_int: *mut spng_chrm_int,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_gama(ctx: *mut spng_ctx, gamma: f64) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_gama_int(ctx: *mut spng_ctx, gamma: u32) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_iccp(ctx: *mut spng_ctx, iccp: *mut spng_iccp) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_sbit(ctx: *mut spng_ctx, sbit: *mut spng_sbit) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_srgb(ctx: *mut spng_ctx, rendering_intent: u8) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_text(
        ctx: *mut spng_ctx,
        text: *mut spng_text,
        n_text: u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_bkgd(ctx: *mut spng_ctx, bkgd: *mut spng_bkgd) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_hist(ctx: *mut spng_ctx, hist: *mut spng_hist) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_phys(ctx: *mut spng_ctx, phys: *mut spng_phys) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_splt(
        ctx: *mut spng_ctx,
        splt: *mut spng_splt,
        n_splt: u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_time(ctx: *mut spng_ctx, time: *mut spng_time) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_unknown_chunks(
        ctx: *mut spng_ctx,
        chunks: *mut spng_unknown_chunk,
        n_chunks: u32,
    ) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_offs(ctx: *mut spng_ctx, offs: *mut spng_offs) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_set_exif(ctx: *mut spng_ctx, exif: *mut spng_exif) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
    pub fn spng_strerror(err: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    pub fn spng_version_string() -> *const ::std::os::raw::c_char;
}