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
/* automatically generated by rust-bindgen */

pub const WEBP_ENCODER_ABI_VERSION: u32 = 526;
pub const WEBP_MAX_DIMENSION: u32 = 16383;
pub const WEBP_DECODER_ABI_VERSION: u32 = 520;
extern "C" {
    pub fn WebPGetEncoderVersion() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPEncodeRGB(
        rgb: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        quality_factor: f32,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeBGR(
        bgr: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        quality_factor: f32,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeRGBA(
        rgba: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        quality_factor: f32,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeBGRA(
        bgra: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        quality_factor: f32,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeLosslessRGB(
        rgb: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeLosslessBGR(
        bgr: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeLosslessRGBA(
        rgba: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPEncodeLosslessBGRA(
        bgra: *const u8,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        stride: ::std::os::raw::c_int,
        output: *mut *mut u8,
    ) -> usize;
}
extern "C" {
    pub fn WebPFree(ptr: *mut ::std::os::raw::c_void);
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WebPImageHint {
    WEBP_HINT_DEFAULT = 0,
    WEBP_HINT_PICTURE = 1,
    WEBP_HINT_PHOTO = 2,
    WEBP_HINT_GRAPH = 3,
    WEBP_HINT_LAST = 4,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPConfig {
    pub lossless: ::std::os::raw::c_int,
    pub quality: f32,
    pub method: ::std::os::raw::c_int,
    pub image_hint: WebPImageHint,
    pub target_size: ::std::os::raw::c_int,
    pub target_PSNR: f32,
    pub segments: ::std::os::raw::c_int,
    pub sns_strength: ::std::os::raw::c_int,
    pub filter_strength: ::std::os::raw::c_int,
    pub filter_sharpness: ::std::os::raw::c_int,
    pub filter_type: ::std::os::raw::c_int,
    pub autofilter: ::std::os::raw::c_int,
    pub alpha_compression: ::std::os::raw::c_int,
    pub alpha_filtering: ::std::os::raw::c_int,
    pub alpha_quality: ::std::os::raw::c_int,
    pub pass: ::std::os::raw::c_int,
    pub show_compressed: ::std::os::raw::c_int,
    pub preprocessing: ::std::os::raw::c_int,
    pub partitions: ::std::os::raw::c_int,
    pub partition_limit: ::std::os::raw::c_int,
    pub emulate_jpeg_size: ::std::os::raw::c_int,
    pub thread_level: ::std::os::raw::c_int,
    pub low_memory: ::std::os::raw::c_int,
    pub near_lossless: ::std::os::raw::c_int,
    pub exact: ::std::os::raw::c_int,
    pub use_delta_palette: ::std::os::raw::c_int,
    pub use_sharp_yuv: ::std::os::raw::c_int,
    pub pad: [u32; 2usize],
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WebPPreset {
    WEBP_PRESET_DEFAULT = 0,
    WEBP_PRESET_PICTURE = 1,
    WEBP_PRESET_PHOTO = 2,
    WEBP_PRESET_DRAWING = 3,
    WEBP_PRESET_ICON = 4,
    WEBP_PRESET_TEXT = 5,
}
extern "C" {
    pub fn WebPConfigInitInternal(
        arg1: *mut WebPConfig,
        arg2: WebPPreset,
        arg3: f32,
        arg4: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPConfigLosslessPreset(
        config: *mut WebPConfig,
        level: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPValidateConfig(config: *const WebPConfig) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPAuxStats {
    pub coded_size: ::std::os::raw::c_int,
    pub PSNR: [f32; 5usize],
    pub block_count: [::std::os::raw::c_int; 3usize],
    pub header_bytes: [::std::os::raw::c_int; 2usize],
    pub residual_bytes: [[::std::os::raw::c_int; 4usize]; 3usize],
    pub segment_size: [::std::os::raw::c_int; 4usize],
    pub segment_quant: [::std::os::raw::c_int; 4usize],
    pub segment_level: [::std::os::raw::c_int; 4usize],
    pub alpha_data_size: ::std::os::raw::c_int,
    pub layer_data_size: ::std::os::raw::c_int,
    pub lossless_features: u32,
    pub histogram_bits: ::std::os::raw::c_int,
    pub transform_bits: ::std::os::raw::c_int,
    pub cache_bits: ::std::os::raw::c_int,
    pub palette_size: ::std::os::raw::c_int,
    pub lossless_size: ::std::os::raw::c_int,
    pub lossless_hdr_size: ::std::os::raw::c_int,
    pub lossless_data_size: ::std::os::raw::c_int,
    pub pad: [u32; 2usize],
}
pub type WebPWriterFunction = ::std::option::Option<
    unsafe extern "C" fn(data: *const u8, data_size: usize, picture: *const WebPPicture)
        -> ::std::os::raw::c_int,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPMemoryWriter {
    pub mem: *mut u8,
    pub size: usize,
    pub max_size: usize,
    pub pad: [u32; 1usize],
}
extern "C" {
    pub fn WebPMemoryWriterInit(writer: *mut WebPMemoryWriter);
}
extern "C" {
    pub fn WebPMemoryWriterClear(writer: *mut WebPMemoryWriter);
}
extern "C" {
    pub fn WebPMemoryWrite(
        data: *const u8,
        data_size: usize,
        picture: *const WebPPicture,
    ) -> ::std::os::raw::c_int;
}
pub type WebPProgressHook = ::std::option::Option<
    unsafe extern "C" fn(percent: ::std::os::raw::c_int, picture: *const WebPPicture)
        -> ::std::os::raw::c_int,
>;
impl WebPEncCSP {
    pub const WEBP_CSP_ALPHA_BIT: WebPEncCSP = WebPEncCSP::WEBP_YUV420A;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WebPEncCSP {
    WEBP_YUV420 = 0,
    WEBP_YUV420A = 4,
    WEBP_CSP_UV_MASK = 3,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WebPEncodingError {
    VP8_ENC_OK = 0,
    VP8_ENC_ERROR_OUT_OF_MEMORY = 1,
    VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY = 2,
    VP8_ENC_ERROR_NULL_PARAMETER = 3,
    VP8_ENC_ERROR_INVALID_CONFIGURATION = 4,
    VP8_ENC_ERROR_BAD_DIMENSION = 5,
    VP8_ENC_ERROR_PARTITION0_OVERFLOW = 6,
    VP8_ENC_ERROR_PARTITION_OVERFLOW = 7,
    VP8_ENC_ERROR_BAD_WRITE = 8,
    VP8_ENC_ERROR_FILE_TOO_BIG = 9,
    VP8_ENC_ERROR_USER_ABORT = 10,
    VP8_ENC_ERROR_LAST = 11,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPPicture {
    ///
    pub use_argb: ::std::os::raw::c_int,
    pub colorspace: WebPEncCSP,
    pub width: ::std::os::raw::c_int,
    pub height: ::std::os::raw::c_int,
    pub y: *mut u8,
    pub u: *mut u8,
    pub v: *mut u8,
    pub y_stride: ::std::os::raw::c_int,
    pub uv_stride: ::std::os::raw::c_int,
    pub a: *mut u8,
    pub a_stride: ::std::os::raw::c_int,
    pub pad1: [u32; 2usize],
    pub argb: *mut u32,
    pub argb_stride: ::std::os::raw::c_int,
    pub pad2: [u32; 3usize],
    ///
    pub writer: WebPWriterFunction,
    pub custom_ptr: *mut ::std::os::raw::c_void,
    pub extra_info_type: ::std::os::raw::c_int,
    pub extra_info: *mut u8,
    ///
    pub stats: *mut WebPAuxStats,
    pub error_code: WebPEncodingError,
    pub progress_hook: WebPProgressHook,
    pub user_data: *mut ::std::os::raw::c_void,
    pub pad3: [u32; 3usize],
    pub pad4: *mut u8,
    pub pad5: *mut u8,
    pub pad6: [u32; 8usize],
    ///
    pub memory_: *mut ::std::os::raw::c_void,
    pub memory_argb_: *mut ::std::os::raw::c_void,
    pub pad7: [*mut ::std::os::raw::c_void; 2usize],
}
extern "C" {
    pub fn WebPPictureInitInternal(
        arg1: *mut WebPPicture,
        arg2: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureAlloc(picture: *mut WebPPicture) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureFree(picture: *mut WebPPicture);
}
extern "C" {
    pub fn WebPPictureCopy(src: *const WebPPicture, dst: *mut WebPPicture)
        -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPlaneDistortion(
        src: *const u8,
        src_stride: usize,
        ref_: *const u8,
        ref_stride: usize,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        x_step: usize,
        type_: ::std::os::raw::c_int,
        distortion: *mut f32,
        result: *mut f32,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureDistortion(
        src: *const WebPPicture,
        ref_: *const WebPPicture,
        metric_type: ::std::os::raw::c_int,
        result: *mut f32,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureCrop(
        picture: *mut WebPPicture,
        left: ::std::os::raw::c_int,
        top: ::std::os::raw::c_int,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureView(
        src: *const WebPPicture,
        left: ::std::os::raw::c_int,
        top: ::std::os::raw::c_int,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
        dst: *mut WebPPicture,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureIsView(picture: *const WebPPicture) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureRescale(
        pic: *mut WebPPicture,
        width: ::std::os::raw::c_int,
        height: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureImportRGB(
        picture: *mut WebPPicture,
        rgb: *const u8,
        rgb_stride: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureImportRGBA(
        picture: *mut WebPPicture,
        rgba: *const u8,
        rgba_stride: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureImportRGBX(
        picture: *mut WebPPicture,
        rgbx: *const u8,
        rgbx_stride: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureImportBGR(
        picture: *mut WebPPicture,
        bgr: *const u8,
        bgr_stride: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureImportBGRA(
        picture: *mut WebPPicture,
        bgra: *const u8,
        bgra_stride: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureImportBGRX(
        picture: *mut WebPPicture,
        bgrx: *const u8,
        bgrx_stride: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureARGBToYUVA(
        picture: *mut WebPPicture,
        arg1: WebPEncCSP,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureARGBToYUVADithered(
        picture: *mut WebPPicture,
        colorspace: WebPEncCSP,
        dithering: f32,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureSharpARGBToYUVA(picture: *mut WebPPicture) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureSmartARGBToYUVA(picture: *mut WebPPicture) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPPictureYUVAToARGB(picture: *mut WebPPicture) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPCleanupTransparentArea(picture: *mut WebPPicture);
}
extern "C" {
    pub fn WebPPictureHasTransparency(picture: *const WebPPicture) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPBlendAlpha(pic: *mut WebPPicture, background_rgb: u32);
}
extern "C" {
    pub fn WebPEncode(
        config: *const WebPConfig,
        picture: *mut WebPPicture,
    ) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPIDecoder {
    _unused: [u8; 0],
}
extern "C" {
    pub fn WebPGetDecoderVersion() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPGetInfo(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPDecodeRGBA(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeARGB(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeBGRA(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeRGB(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeBGR(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeYUV(
        data: *const u8,
        data_size: usize,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
        u: *mut *mut u8,
        v: *mut *mut u8,
        stride: *mut ::std::os::raw::c_int,
        uv_stride: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeRGBAInto(
        data: *const u8,
        data_size: usize,
        output_buffer: *mut u8,
        output_buffer_size: usize,
        output_stride: ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeARGBInto(
        data: *const u8,
        data_size: usize,
        output_buffer: *mut u8,
        output_buffer_size: usize,
        output_stride: ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeBGRAInto(
        data: *const u8,
        data_size: usize,
        output_buffer: *mut u8,
        output_buffer_size: usize,
        output_stride: ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeRGBInto(
        data: *const u8,
        data_size: usize,
        output_buffer: *mut u8,
        output_buffer_size: usize,
        output_stride: ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeBGRInto(
        data: *const u8,
        data_size: usize,
        output_buffer: *mut u8,
        output_buffer_size: usize,
        output_stride: ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPDecodeYUVInto(
        data: *const u8,
        data_size: usize,
        luma: *mut u8,
        luma_size: usize,
        luma_stride: ::std::os::raw::c_int,
        u: *mut u8,
        u_size: usize,
        u_stride: ::std::os::raw::c_int,
        v: *mut u8,
        v_size: usize,
        v_stride: ::std::os::raw::c_int,
    ) -> *mut u8;
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WEBP_CSP_MODE {
    MODE_RGB = 0,
    MODE_RGBA = 1,
    MODE_BGR = 2,
    MODE_BGRA = 3,
    MODE_ARGB = 4,
    MODE_RGBA_4444 = 5,
    MODE_RGB_565 = 6,
    MODE_rgbA = 7,
    MODE_bgrA = 8,
    MODE_Argb = 9,
    MODE_rgbA_4444 = 10,
    MODE_YUV = 11,
    MODE_YUVA = 12,
    MODE_LAST = 13,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPRGBABuffer {
    pub rgba: *mut u8,
    pub stride: ::std::os::raw::c_int,
    pub size: usize,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPYUVABuffer {
    pub y: *mut u8,
    pub u: *mut u8,
    pub v: *mut u8,
    pub a: *mut u8,
    pub y_stride: ::std::os::raw::c_int,
    pub u_stride: ::std::os::raw::c_int,
    pub v_stride: ::std::os::raw::c_int,
    pub a_stride: ::std::os::raw::c_int,
    pub y_size: usize,
    pub u_size: usize,
    pub v_size: usize,
    pub a_size: usize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct WebPDecBuffer {
    pub colorspace: WEBP_CSP_MODE,
    pub width: ::std::os::raw::c_int,
    pub height: ::std::os::raw::c_int,
    pub is_external_memory: ::std::os::raw::c_int,
    pub u: WebPDecBuffer__bindgen_ty_1,
    pub pad: [u32; 4usize],
    pub private_memory: *mut u8,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Copy, Clone)]
pub union WebPDecBuffer__bindgen_ty_1 {
    pub RGBA: WebPRGBABuffer,
    pub YUVA: WebPYUVABuffer,
    _bindgen_union_align: [u64; 10usize],
}
extern "C" {
    pub fn WebPInitDecBufferInternal(
        arg1: *mut WebPDecBuffer,
        arg2: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPFreeDecBuffer(buffer: *mut WebPDecBuffer);
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum VP8StatusCode {
    VP8_STATUS_OK = 0,
    VP8_STATUS_OUT_OF_MEMORY = 1,
    VP8_STATUS_INVALID_PARAM = 2,
    VP8_STATUS_BITSTREAM_ERROR = 3,
    VP8_STATUS_UNSUPPORTED_FEATURE = 4,
    VP8_STATUS_SUSPENDED = 5,
    VP8_STATUS_USER_ABORT = 6,
    VP8_STATUS_NOT_ENOUGH_DATA = 7,
}
extern "C" {
    pub fn WebPINewDecoder(output_buffer: *mut WebPDecBuffer) -> *mut WebPIDecoder;
}
extern "C" {
    pub fn WebPINewRGB(
        csp: WEBP_CSP_MODE,
        output_buffer: *mut u8,
        output_buffer_size: usize,
        output_stride: ::std::os::raw::c_int,
    ) -> *mut WebPIDecoder;
}
extern "C" {
    pub fn WebPINewYUVA(
        luma: *mut u8,
        luma_size: usize,
        luma_stride: ::std::os::raw::c_int,
        u: *mut u8,
        u_size: usize,
        u_stride: ::std::os::raw::c_int,
        v: *mut u8,
        v_size: usize,
        v_stride: ::std::os::raw::c_int,
        a: *mut u8,
        a_size: usize,
        a_stride: ::std::os::raw::c_int,
    ) -> *mut WebPIDecoder;
}
extern "C" {
    pub fn WebPINewYUV(
        luma: *mut u8,
        luma_size: usize,
        luma_stride: ::std::os::raw::c_int,
        u: *mut u8,
        u_size: usize,
        u_stride: ::std::os::raw::c_int,
        v: *mut u8,
        v_size: usize,
        v_stride: ::std::os::raw::c_int,
    ) -> *mut WebPIDecoder;
}
extern "C" {
    pub fn WebPIDelete(idec: *mut WebPIDecoder);
}
extern "C" {
    pub fn WebPIAppend(idec: *mut WebPIDecoder, data: *const u8, data_size: usize)
        -> VP8StatusCode;
}
extern "C" {
    pub fn WebPIUpdate(idec: *mut WebPIDecoder, data: *const u8, data_size: usize)
        -> VP8StatusCode;
}
extern "C" {
    pub fn WebPIDecGetRGB(
        idec: *const WebPIDecoder,
        last_y: *mut ::std::os::raw::c_int,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
        stride: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPIDecGetYUVA(
        idec: *const WebPIDecoder,
        last_y: *mut ::std::os::raw::c_int,
        u: *mut *mut u8,
        v: *mut *mut u8,
        a: *mut *mut u8,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
        stride: *mut ::std::os::raw::c_int,
        uv_stride: *mut ::std::os::raw::c_int,
        a_stride: *mut ::std::os::raw::c_int,
    ) -> *mut u8;
}
extern "C" {
    pub fn WebPIDecodedArea(
        idec: *const WebPIDecoder,
        left: *mut ::std::os::raw::c_int,
        top: *mut ::std::os::raw::c_int,
        width: *mut ::std::os::raw::c_int,
        height: *mut ::std::os::raw::c_int,
    ) -> *const WebPDecBuffer;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPBitstreamFeatures {
    pub width: ::std::os::raw::c_int,
    pub height: ::std::os::raw::c_int,
    pub has_alpha: ::std::os::raw::c_int,
    pub has_animation: ::std::os::raw::c_int,
    pub format: ::std::os::raw::c_int,
    pub pad: [u32; 5usize],
}
extern "C" {
    pub fn WebPGetFeaturesInternal(
        arg1: *const u8,
        arg2: usize,
        arg3: *mut WebPBitstreamFeatures,
        arg4: ::std::os::raw::c_int,
    ) -> VP8StatusCode;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WebPDecoderOptions {
    pub bypass_filtering: ::std::os::raw::c_int,
    pub no_fancy_upsampling: ::std::os::raw::c_int,
    pub use_cropping: ::std::os::raw::c_int,
    pub crop_left: ::std::os::raw::c_int,
    pub crop_top: ::std::os::raw::c_int,
    pub crop_width: ::std::os::raw::c_int,
    pub crop_height: ::std::os::raw::c_int,
    pub use_scaling: ::std::os::raw::c_int,
    pub scaled_width: ::std::os::raw::c_int,
    pub scaled_height: ::std::os::raw::c_int,
    pub use_threads: ::std::os::raw::c_int,
    pub dithering_strength: ::std::os::raw::c_int,
    pub flip: ::std::os::raw::c_int,
    pub alpha_dithering_strength: ::std::os::raw::c_int,
    pub pad: [u32; 5usize],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct WebPDecoderConfig {
    pub input: WebPBitstreamFeatures,
    pub output: WebPDecBuffer,
    pub options: WebPDecoderOptions,
}
extern "C" {
    pub fn WebPInitDecoderConfigInternal(
        arg1: *mut WebPDecoderConfig,
        arg2: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn WebPIDecode(
        data: *const u8,
        data_size: usize,
        config: *mut WebPDecoderConfig,
    ) -> *mut WebPIDecoder;
}
extern "C" {
    pub fn WebPDecode(
        data: *const u8,
        data_size: usize,
        config: *mut WebPDecoderConfig,
    ) -> VP8StatusCode;
}