libwebp_sys/
ffi.rs

1/* automatically generated by rust-bindgen 0.72.0 */
2
3pub const WEBP_ENCODER_ABI_VERSION: u32 = 528;
4pub const WEBP_MAX_DIMENSION: u32 = 16383;
5pub const WEBP_DECODER_ABI_VERSION: u32 = 528;
6pub const WEBP_MUX_ABI_VERSION: u32 = 265;
7pub const WEBP_DEMUX_ABI_VERSION: u32 = 263;
8unsafe extern "C" {
9    pub fn WebPMalloc(size: usize) -> *mut ::core::ffi::c_void;
10}
11unsafe extern "C" {
12    pub fn WebPFree(ptr: *mut ::core::ffi::c_void);
13}
14unsafe extern "C" {
15    pub fn WebPGetEncoderVersion() -> ::core::ffi::c_int;
16}
17unsafe extern "C" {
18    pub fn WebPEncodeRGB(
19        rgb: *const u8,
20        width: ::core::ffi::c_int,
21        height: ::core::ffi::c_int,
22        stride: ::core::ffi::c_int,
23        quality_factor: f32,
24        output: *mut *mut u8,
25    ) -> usize;
26}
27unsafe extern "C" {
28    pub fn WebPEncodeBGR(
29        bgr: *const u8,
30        width: ::core::ffi::c_int,
31        height: ::core::ffi::c_int,
32        stride: ::core::ffi::c_int,
33        quality_factor: f32,
34        output: *mut *mut u8,
35    ) -> usize;
36}
37unsafe extern "C" {
38    pub fn WebPEncodeRGBA(
39        rgba: *const u8,
40        width: ::core::ffi::c_int,
41        height: ::core::ffi::c_int,
42        stride: ::core::ffi::c_int,
43        quality_factor: f32,
44        output: *mut *mut u8,
45    ) -> usize;
46}
47unsafe extern "C" {
48    pub fn WebPEncodeBGRA(
49        bgra: *const u8,
50        width: ::core::ffi::c_int,
51        height: ::core::ffi::c_int,
52        stride: ::core::ffi::c_int,
53        quality_factor: f32,
54        output: *mut *mut u8,
55    ) -> usize;
56}
57unsafe extern "C" {
58    pub fn WebPEncodeLosslessRGB(
59        rgb: *const u8,
60        width: ::core::ffi::c_int,
61        height: ::core::ffi::c_int,
62        stride: ::core::ffi::c_int,
63        output: *mut *mut u8,
64    ) -> usize;
65}
66unsafe extern "C" {
67    pub fn WebPEncodeLosslessBGR(
68        bgr: *const u8,
69        width: ::core::ffi::c_int,
70        height: ::core::ffi::c_int,
71        stride: ::core::ffi::c_int,
72        output: *mut *mut u8,
73    ) -> usize;
74}
75unsafe extern "C" {
76    pub fn WebPEncodeLosslessRGBA(
77        rgba: *const u8,
78        width: ::core::ffi::c_int,
79        height: ::core::ffi::c_int,
80        stride: ::core::ffi::c_int,
81        output: *mut *mut u8,
82    ) -> usize;
83}
84unsafe extern "C" {
85    pub fn WebPEncodeLosslessBGRA(
86        bgra: *const u8,
87        width: ::core::ffi::c_int,
88        height: ::core::ffi::c_int,
89        stride: ::core::ffi::c_int,
90        output: *mut *mut u8,
91    ) -> usize;
92}
93#[repr(u32)]
94#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
95pub enum WebPImageHint {
96    WEBP_HINT_DEFAULT = 0,
97    WEBP_HINT_PICTURE = 1,
98    WEBP_HINT_PHOTO = 2,
99    WEBP_HINT_GRAPH = 3,
100    WEBP_HINT_LAST = 4,
101}
102#[repr(C)]
103#[derive(Debug, Copy, Clone)]
104pub struct WebPConfig {
105    pub lossless: ::core::ffi::c_int,
106    pub quality: f32,
107    pub method: ::core::ffi::c_int,
108    pub image_hint: WebPImageHint,
109    pub target_size: ::core::ffi::c_int,
110    pub target_PSNR: f32,
111    pub segments: ::core::ffi::c_int,
112    pub sns_strength: ::core::ffi::c_int,
113    pub filter_strength: ::core::ffi::c_int,
114    pub filter_sharpness: ::core::ffi::c_int,
115    pub filter_type: ::core::ffi::c_int,
116    pub autofilter: ::core::ffi::c_int,
117    pub alpha_compression: ::core::ffi::c_int,
118    pub alpha_filtering: ::core::ffi::c_int,
119    pub alpha_quality: ::core::ffi::c_int,
120    pub pass: ::core::ffi::c_int,
121    pub show_compressed: ::core::ffi::c_int,
122    pub preprocessing: ::core::ffi::c_int,
123    pub partitions: ::core::ffi::c_int,
124    pub partition_limit: ::core::ffi::c_int,
125    pub emulate_jpeg_size: ::core::ffi::c_int,
126    pub thread_level: ::core::ffi::c_int,
127    pub low_memory: ::core::ffi::c_int,
128    pub near_lossless: ::core::ffi::c_int,
129    pub exact: ::core::ffi::c_int,
130    pub use_delta_palette: ::core::ffi::c_int,
131    pub use_sharp_yuv: ::core::ffi::c_int,
132    pub qmin: ::core::ffi::c_int,
133    pub qmax: ::core::ffi::c_int,
134}
135#[repr(u32)]
136#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
137pub enum WebPPreset {
138    WEBP_PRESET_DEFAULT = 0,
139    WEBP_PRESET_PICTURE = 1,
140    WEBP_PRESET_PHOTO = 2,
141    WEBP_PRESET_DRAWING = 3,
142    WEBP_PRESET_ICON = 4,
143    WEBP_PRESET_TEXT = 5,
144}
145unsafe extern "C" {
146    pub fn WebPConfigInitInternal(
147        arg1: *mut WebPConfig,
148        arg2: WebPPreset,
149        arg3: f32,
150        arg4: ::core::ffi::c_int,
151    ) -> ::core::ffi::c_int;
152}
153unsafe extern "C" {
154    pub fn WebPConfigLosslessPreset(
155        config: *mut WebPConfig,
156        level: ::core::ffi::c_int,
157    ) -> ::core::ffi::c_int;
158}
159unsafe extern "C" {
160    pub fn WebPValidateConfig(config: *const WebPConfig) -> ::core::ffi::c_int;
161}
162#[repr(C)]
163#[derive(Debug, Copy, Clone)]
164pub struct WebPAuxStats {
165    pub coded_size: ::core::ffi::c_int,
166    pub PSNR: [f32; 5usize],
167    pub block_count: [::core::ffi::c_int; 3usize],
168    pub header_bytes: [::core::ffi::c_int; 2usize],
169    pub residual_bytes: [[::core::ffi::c_int; 4usize]; 3usize],
170    pub segment_size: [::core::ffi::c_int; 4usize],
171    pub segment_quant: [::core::ffi::c_int; 4usize],
172    pub segment_level: [::core::ffi::c_int; 4usize],
173    pub alpha_data_size: ::core::ffi::c_int,
174    pub layer_data_size: ::core::ffi::c_int,
175    pub lossless_features: u32,
176    pub histogram_bits: ::core::ffi::c_int,
177    pub transform_bits: ::core::ffi::c_int,
178    pub cache_bits: ::core::ffi::c_int,
179    pub palette_size: ::core::ffi::c_int,
180    pub lossless_size: ::core::ffi::c_int,
181    pub lossless_hdr_size: ::core::ffi::c_int,
182    pub lossless_data_size: ::core::ffi::c_int,
183    pub cross_color_transform_bits: ::core::ffi::c_int,
184    pub pad: [u32; 1usize],
185}
186pub type WebPWriterFunction = ::core::option::Option<
187    unsafe extern "C" fn(
188        data: *const u8,
189        data_size: usize,
190        picture: *const WebPPicture,
191    ) -> ::core::ffi::c_int,
192>;
193#[repr(C)]
194#[derive(Debug, Copy, Clone)]
195pub struct WebPMemoryWriter {
196    pub mem: *mut u8,
197    pub size: usize,
198    pub max_size: usize,
199    pub pad: [u32; 1usize],
200}
201unsafe extern "C" {
202    pub fn WebPMemoryWriterInit(writer: *mut WebPMemoryWriter);
203}
204unsafe extern "C" {
205    pub fn WebPMemoryWriterClear(writer: *mut WebPMemoryWriter);
206}
207unsafe extern "C" {
208    pub fn WebPMemoryWrite(
209        data: *const u8,
210        data_size: usize,
211        picture: *const WebPPicture,
212    ) -> ::core::ffi::c_int;
213}
214pub type WebPProgressHook = ::core::option::Option<
215    unsafe extern "C" fn(
216        percent: ::core::ffi::c_int,
217        picture: *const WebPPicture,
218    ) -> ::core::ffi::c_int,
219>;
220impl WebPEncCSP {
221    pub const WEBP_CSP_ALPHA_BIT: WebPEncCSP = WebPEncCSP::WEBP_YUV420A;
222}
223#[repr(u32)]
224#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
225pub enum WebPEncCSP {
226    WEBP_YUV420 = 0,
227    WEBP_YUV420A = 4,
228    WEBP_CSP_UV_MASK = 3,
229}
230#[repr(u32)]
231#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
232pub enum WebPEncodingError {
233    VP8_ENC_OK = 0,
234    VP8_ENC_ERROR_OUT_OF_MEMORY = 1,
235    VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY = 2,
236    VP8_ENC_ERROR_NULL_PARAMETER = 3,
237    VP8_ENC_ERROR_INVALID_CONFIGURATION = 4,
238    VP8_ENC_ERROR_BAD_DIMENSION = 5,
239    VP8_ENC_ERROR_PARTITION0_OVERFLOW = 6,
240    VP8_ENC_ERROR_PARTITION_OVERFLOW = 7,
241    VP8_ENC_ERROR_BAD_WRITE = 8,
242    VP8_ENC_ERROR_FILE_TOO_BIG = 9,
243    VP8_ENC_ERROR_USER_ABORT = 10,
244    VP8_ENC_ERROR_LAST = 11,
245}
246#[repr(C)]
247#[derive(Debug, Copy, Clone)]
248pub struct WebPPicture {
249    pub use_argb: ::core::ffi::c_int,
250    pub colorspace: WebPEncCSP,
251    pub width: ::core::ffi::c_int,
252    pub height: ::core::ffi::c_int,
253    pub y: *mut u8,
254    pub u: *mut u8,
255    pub v: *mut u8,
256    pub y_stride: ::core::ffi::c_int,
257    pub uv_stride: ::core::ffi::c_int,
258    pub a: *mut u8,
259    pub a_stride: ::core::ffi::c_int,
260    pub pad1: [u32; 2usize],
261    pub argb: *mut u32,
262    pub argb_stride: ::core::ffi::c_int,
263    pub pad2: [u32; 3usize],
264    pub writer: WebPWriterFunction,
265    pub custom_ptr: *mut ::core::ffi::c_void,
266    pub extra_info_type: ::core::ffi::c_int,
267    pub extra_info: *mut u8,
268    pub stats: *mut WebPAuxStats,
269    pub error_code: WebPEncodingError,
270    pub progress_hook: WebPProgressHook,
271    pub user_data: *mut ::core::ffi::c_void,
272    pub pad3: [u32; 3usize],
273    pub pad4: *mut u8,
274    pub pad5: *mut u8,
275    pub pad6: [u32; 8usize],
276    pub memory_: *mut ::core::ffi::c_void,
277    pub memory_argb_: *mut ::core::ffi::c_void,
278    pub pad7: [*mut ::core::ffi::c_void; 2usize],
279}
280unsafe extern "C" {
281    pub fn WebPPictureInitInternal(
282        arg1: *mut WebPPicture,
283        arg2: ::core::ffi::c_int,
284    ) -> ::core::ffi::c_int;
285}
286unsafe extern "C" {
287    pub fn WebPPictureAlloc(picture: *mut WebPPicture) -> ::core::ffi::c_int;
288}
289unsafe extern "C" {
290    pub fn WebPPictureFree(picture: *mut WebPPicture);
291}
292unsafe extern "C" {
293    pub fn WebPPictureCopy(src: *const WebPPicture, dst: *mut WebPPicture) -> ::core::ffi::c_int;
294}
295unsafe extern "C" {
296    pub fn WebPPlaneDistortion(
297        src: *const u8,
298        src_stride: usize,
299        ref_: *const u8,
300        ref_stride: usize,
301        width: ::core::ffi::c_int,
302        height: ::core::ffi::c_int,
303        x_step: usize,
304        type_: ::core::ffi::c_int,
305        distortion: *mut f32,
306        result: *mut f32,
307    ) -> ::core::ffi::c_int;
308}
309unsafe extern "C" {
310    pub fn WebPPictureDistortion(
311        src: *const WebPPicture,
312        ref_: *const WebPPicture,
313        metric_type: ::core::ffi::c_int,
314        result: *mut f32,
315    ) -> ::core::ffi::c_int;
316}
317unsafe extern "C" {
318    pub fn WebPPictureCrop(
319        picture: *mut WebPPicture,
320        left: ::core::ffi::c_int,
321        top: ::core::ffi::c_int,
322        width: ::core::ffi::c_int,
323        height: ::core::ffi::c_int,
324    ) -> ::core::ffi::c_int;
325}
326unsafe extern "C" {
327    pub fn WebPPictureView(
328        src: *const WebPPicture,
329        left: ::core::ffi::c_int,
330        top: ::core::ffi::c_int,
331        width: ::core::ffi::c_int,
332        height: ::core::ffi::c_int,
333        dst: *mut WebPPicture,
334    ) -> ::core::ffi::c_int;
335}
336unsafe extern "C" {
337    pub fn WebPPictureIsView(picture: *const WebPPicture) -> ::core::ffi::c_int;
338}
339unsafe extern "C" {
340    pub fn WebPPictureRescale(
341        picture: *mut WebPPicture,
342        width: ::core::ffi::c_int,
343        height: ::core::ffi::c_int,
344    ) -> ::core::ffi::c_int;
345}
346unsafe extern "C" {
347    pub fn WebPPictureImportRGB(
348        picture: *mut WebPPicture,
349        rgb: *const u8,
350        rgb_stride: ::core::ffi::c_int,
351    ) -> ::core::ffi::c_int;
352}
353unsafe extern "C" {
354    pub fn WebPPictureImportRGBA(
355        picture: *mut WebPPicture,
356        rgba: *const u8,
357        rgba_stride: ::core::ffi::c_int,
358    ) -> ::core::ffi::c_int;
359}
360unsafe extern "C" {
361    pub fn WebPPictureImportRGBX(
362        picture: *mut WebPPicture,
363        rgbx: *const u8,
364        rgbx_stride: ::core::ffi::c_int,
365    ) -> ::core::ffi::c_int;
366}
367unsafe extern "C" {
368    pub fn WebPPictureImportBGR(
369        picture: *mut WebPPicture,
370        bgr: *const u8,
371        bgr_stride: ::core::ffi::c_int,
372    ) -> ::core::ffi::c_int;
373}
374unsafe extern "C" {
375    pub fn WebPPictureImportBGRA(
376        picture: *mut WebPPicture,
377        bgra: *const u8,
378        bgra_stride: ::core::ffi::c_int,
379    ) -> ::core::ffi::c_int;
380}
381unsafe extern "C" {
382    pub fn WebPPictureImportBGRX(
383        picture: *mut WebPPicture,
384        bgrx: *const u8,
385        bgrx_stride: ::core::ffi::c_int,
386    ) -> ::core::ffi::c_int;
387}
388unsafe extern "C" {
389    pub fn WebPPictureARGBToYUVA(picture: *mut WebPPicture, arg1: WebPEncCSP)
390    -> ::core::ffi::c_int;
391}
392unsafe extern "C" {
393    pub fn WebPPictureARGBToYUVADithered(
394        picture: *mut WebPPicture,
395        colorspace: WebPEncCSP,
396        dithering: f32,
397    ) -> ::core::ffi::c_int;
398}
399unsafe extern "C" {
400    pub fn WebPPictureSharpARGBToYUVA(picture: *mut WebPPicture) -> ::core::ffi::c_int;
401}
402unsafe extern "C" {
403    pub fn WebPPictureSmartARGBToYUVA(picture: *mut WebPPicture) -> ::core::ffi::c_int;
404}
405unsafe extern "C" {
406    pub fn WebPPictureYUVAToARGB(picture: *mut WebPPicture) -> ::core::ffi::c_int;
407}
408unsafe extern "C" {
409    pub fn WebPCleanupTransparentArea(picture: *mut WebPPicture);
410}
411unsafe extern "C" {
412    pub fn WebPPictureHasTransparency(picture: *const WebPPicture) -> ::core::ffi::c_int;
413}
414unsafe extern "C" {
415    pub fn WebPBlendAlpha(picture: *mut WebPPicture, background_rgb: u32);
416}
417unsafe extern "C" {
418    pub fn WebPEncode(config: *const WebPConfig, picture: *mut WebPPicture) -> ::core::ffi::c_int;
419}
420#[repr(C)]
421#[derive(Debug, Copy, Clone)]
422pub struct WebPIDecoder {
423    _unused: [u8; 0],
424}
425unsafe extern "C" {
426    pub fn WebPGetDecoderVersion() -> ::core::ffi::c_int;
427}
428unsafe extern "C" {
429    pub fn WebPGetInfo(
430        data: *const u8,
431        data_size: usize,
432        width: *mut ::core::ffi::c_int,
433        height: *mut ::core::ffi::c_int,
434    ) -> ::core::ffi::c_int;
435}
436unsafe extern "C" {
437    pub fn WebPDecodeRGBA(
438        data: *const u8,
439        data_size: usize,
440        width: *mut ::core::ffi::c_int,
441        height: *mut ::core::ffi::c_int,
442    ) -> *mut u8;
443}
444unsafe extern "C" {
445    pub fn WebPDecodeARGB(
446        data: *const u8,
447        data_size: usize,
448        width: *mut ::core::ffi::c_int,
449        height: *mut ::core::ffi::c_int,
450    ) -> *mut u8;
451}
452unsafe extern "C" {
453    pub fn WebPDecodeBGRA(
454        data: *const u8,
455        data_size: usize,
456        width: *mut ::core::ffi::c_int,
457        height: *mut ::core::ffi::c_int,
458    ) -> *mut u8;
459}
460unsafe extern "C" {
461    pub fn WebPDecodeRGB(
462        data: *const u8,
463        data_size: usize,
464        width: *mut ::core::ffi::c_int,
465        height: *mut ::core::ffi::c_int,
466    ) -> *mut u8;
467}
468unsafe extern "C" {
469    pub fn WebPDecodeBGR(
470        data: *const u8,
471        data_size: usize,
472        width: *mut ::core::ffi::c_int,
473        height: *mut ::core::ffi::c_int,
474    ) -> *mut u8;
475}
476unsafe extern "C" {
477    pub fn WebPDecodeYUV(
478        data: *const u8,
479        data_size: usize,
480        width: *mut ::core::ffi::c_int,
481        height: *mut ::core::ffi::c_int,
482        u: *mut *mut u8,
483        v: *mut *mut u8,
484        stride: *mut ::core::ffi::c_int,
485        uv_stride: *mut ::core::ffi::c_int,
486    ) -> *mut u8;
487}
488unsafe extern "C" {
489    pub fn WebPDecodeRGBAInto(
490        data: *const u8,
491        data_size: usize,
492        output_buffer: *mut u8,
493        output_buffer_size: usize,
494        output_stride: ::core::ffi::c_int,
495    ) -> *mut u8;
496}
497unsafe extern "C" {
498    pub fn WebPDecodeARGBInto(
499        data: *const u8,
500        data_size: usize,
501        output_buffer: *mut u8,
502        output_buffer_size: usize,
503        output_stride: ::core::ffi::c_int,
504    ) -> *mut u8;
505}
506unsafe extern "C" {
507    pub fn WebPDecodeBGRAInto(
508        data: *const u8,
509        data_size: usize,
510        output_buffer: *mut u8,
511        output_buffer_size: usize,
512        output_stride: ::core::ffi::c_int,
513    ) -> *mut u8;
514}
515unsafe extern "C" {
516    pub fn WebPDecodeRGBInto(
517        data: *const u8,
518        data_size: usize,
519        output_buffer: *mut u8,
520        output_buffer_size: usize,
521        output_stride: ::core::ffi::c_int,
522    ) -> *mut u8;
523}
524unsafe extern "C" {
525    pub fn WebPDecodeBGRInto(
526        data: *const u8,
527        data_size: usize,
528        output_buffer: *mut u8,
529        output_buffer_size: usize,
530        output_stride: ::core::ffi::c_int,
531    ) -> *mut u8;
532}
533unsafe extern "C" {
534    pub fn WebPDecodeYUVInto(
535        data: *const u8,
536        data_size: usize,
537        luma: *mut u8,
538        luma_size: usize,
539        luma_stride: ::core::ffi::c_int,
540        u: *mut u8,
541        u_size: usize,
542        u_stride: ::core::ffi::c_int,
543        v: *mut u8,
544        v_size: usize,
545        v_stride: ::core::ffi::c_int,
546    ) -> *mut u8;
547}
548#[repr(u32)]
549#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
550pub enum WEBP_CSP_MODE {
551    MODE_RGB = 0,
552    MODE_RGBA = 1,
553    MODE_BGR = 2,
554    MODE_BGRA = 3,
555    MODE_ARGB = 4,
556    MODE_RGBA_4444 = 5,
557    MODE_RGB_565 = 6,
558    MODE_rgbA = 7,
559    MODE_bgrA = 8,
560    MODE_Argb = 9,
561    MODE_rgbA_4444 = 10,
562    MODE_YUV = 11,
563    MODE_YUVA = 12,
564    MODE_LAST = 13,
565}
566#[repr(C)]
567#[derive(Debug, Copy, Clone)]
568pub struct WebPRGBABuffer {
569    pub rgba: *mut u8,
570    pub stride: ::core::ffi::c_int,
571    pub size: usize,
572}
573#[repr(C)]
574#[derive(Debug, Copy, Clone)]
575pub struct WebPYUVABuffer {
576    pub y: *mut u8,
577    pub u: *mut u8,
578    pub v: *mut u8,
579    pub a: *mut u8,
580    pub y_stride: ::core::ffi::c_int,
581    pub u_stride: ::core::ffi::c_int,
582    pub v_stride: ::core::ffi::c_int,
583    pub a_stride: ::core::ffi::c_int,
584    pub y_size: usize,
585    pub u_size: usize,
586    pub v_size: usize,
587    pub a_size: usize,
588}
589#[repr(C)]
590#[derive(Copy, Clone)]
591pub struct WebPDecBuffer {
592    pub colorspace: WEBP_CSP_MODE,
593    pub width: ::core::ffi::c_int,
594    pub height: ::core::ffi::c_int,
595    pub is_external_memory: ::core::ffi::c_int,
596    pub u: WebPDecBuffer__bindgen_ty_1,
597    pub pad: [u32; 4usize],
598    pub private_memory: *mut u8,
599}
600#[repr(C)]
601#[derive(Copy, Clone)]
602pub union WebPDecBuffer__bindgen_ty_1 {
603    pub RGBA: WebPRGBABuffer,
604    pub YUVA: WebPYUVABuffer,
605}
606impl ::core::fmt::Debug for WebPDecBuffer__bindgen_ty_1 {
607    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
608        write!(f, "WebPDecBuffer__bindgen_ty_1 {{ union }}")
609    }
610}
611impl ::core::fmt::Debug for WebPDecBuffer {
612    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
613        write!(
614            f,
615            "WebPDecBuffer {{ colorspace: {:?}, width: {:?}, height: {:?}, is_external_memory: {:?}, u: {:?}, pad: {:?}, private_memory: {:?} }}",
616            self.colorspace,
617            self.width,
618            self.height,
619            self.is_external_memory,
620            self.u,
621            self.pad,
622            self.private_memory
623        )
624    }
625}
626unsafe extern "C" {
627    pub fn WebPInitDecBufferInternal(
628        arg1: *mut WebPDecBuffer,
629        arg2: ::core::ffi::c_int,
630    ) -> ::core::ffi::c_int;
631}
632unsafe extern "C" {
633    pub fn WebPFreeDecBuffer(buffer: *mut WebPDecBuffer);
634}
635#[repr(u32)]
636#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
637pub enum VP8StatusCode {
638    VP8_STATUS_OK = 0,
639    VP8_STATUS_OUT_OF_MEMORY = 1,
640    VP8_STATUS_INVALID_PARAM = 2,
641    VP8_STATUS_BITSTREAM_ERROR = 3,
642    VP8_STATUS_UNSUPPORTED_FEATURE = 4,
643    VP8_STATUS_SUSPENDED = 5,
644    VP8_STATUS_USER_ABORT = 6,
645    VP8_STATUS_NOT_ENOUGH_DATA = 7,
646}
647unsafe extern "C" {
648    pub fn WebPINewDecoder(output_buffer: *mut WebPDecBuffer) -> *mut WebPIDecoder;
649}
650unsafe extern "C" {
651    pub fn WebPINewRGB(
652        csp: WEBP_CSP_MODE,
653        output_buffer: *mut u8,
654        output_buffer_size: usize,
655        output_stride: ::core::ffi::c_int,
656    ) -> *mut WebPIDecoder;
657}
658unsafe extern "C" {
659    pub fn WebPINewYUVA(
660        luma: *mut u8,
661        luma_size: usize,
662        luma_stride: ::core::ffi::c_int,
663        u: *mut u8,
664        u_size: usize,
665        u_stride: ::core::ffi::c_int,
666        v: *mut u8,
667        v_size: usize,
668        v_stride: ::core::ffi::c_int,
669        a: *mut u8,
670        a_size: usize,
671        a_stride: ::core::ffi::c_int,
672    ) -> *mut WebPIDecoder;
673}
674unsafe extern "C" {
675    pub fn WebPINewYUV(
676        luma: *mut u8,
677        luma_size: usize,
678        luma_stride: ::core::ffi::c_int,
679        u: *mut u8,
680        u_size: usize,
681        u_stride: ::core::ffi::c_int,
682        v: *mut u8,
683        v_size: usize,
684        v_stride: ::core::ffi::c_int,
685    ) -> *mut WebPIDecoder;
686}
687unsafe extern "C" {
688    pub fn WebPIDelete(idec: *mut WebPIDecoder);
689}
690unsafe extern "C" {
691    pub fn WebPIAppend(idec: *mut WebPIDecoder, data: *const u8, data_size: usize)
692    -> VP8StatusCode;
693}
694unsafe extern "C" {
695    pub fn WebPIUpdate(idec: *mut WebPIDecoder, data: *const u8, data_size: usize)
696    -> VP8StatusCode;
697}
698unsafe extern "C" {
699    pub fn WebPIDecGetRGB(
700        idec: *const WebPIDecoder,
701        last_y: *mut ::core::ffi::c_int,
702        width: *mut ::core::ffi::c_int,
703        height: *mut ::core::ffi::c_int,
704        stride: *mut ::core::ffi::c_int,
705    ) -> *mut u8;
706}
707unsafe extern "C" {
708    pub fn WebPIDecGetYUVA(
709        idec: *const WebPIDecoder,
710        last_y: *mut ::core::ffi::c_int,
711        u: *mut *mut u8,
712        v: *mut *mut u8,
713        a: *mut *mut u8,
714        width: *mut ::core::ffi::c_int,
715        height: *mut ::core::ffi::c_int,
716        stride: *mut ::core::ffi::c_int,
717        uv_stride: *mut ::core::ffi::c_int,
718        a_stride: *mut ::core::ffi::c_int,
719    ) -> *mut u8;
720}
721unsafe extern "C" {
722    pub fn WebPIDecodedArea(
723        idec: *const WebPIDecoder,
724        left: *mut ::core::ffi::c_int,
725        top: *mut ::core::ffi::c_int,
726        width: *mut ::core::ffi::c_int,
727        height: *mut ::core::ffi::c_int,
728    ) -> *const WebPDecBuffer;
729}
730#[repr(C)]
731#[derive(Debug, Copy, Clone)]
732pub struct WebPBitstreamFeatures {
733    pub width: ::core::ffi::c_int,
734    pub height: ::core::ffi::c_int,
735    pub has_alpha: ::core::ffi::c_int,
736    pub has_animation: ::core::ffi::c_int,
737    pub format: ::core::ffi::c_int,
738    pub pad: [u32; 5usize],
739}
740unsafe extern "C" {
741    pub fn WebPGetFeaturesInternal(
742        arg1: *const u8,
743        arg2: usize,
744        arg3: *mut WebPBitstreamFeatures,
745        arg4: ::core::ffi::c_int,
746    ) -> VP8StatusCode;
747}
748#[repr(C)]
749#[derive(Debug, Copy, Clone)]
750pub struct WebPDecoderOptions {
751    pub bypass_filtering: ::core::ffi::c_int,
752    pub no_fancy_upsampling: ::core::ffi::c_int,
753    pub use_cropping: ::core::ffi::c_int,
754    pub crop_left: ::core::ffi::c_int,
755    pub crop_top: ::core::ffi::c_int,
756    pub crop_width: ::core::ffi::c_int,
757    pub crop_height: ::core::ffi::c_int,
758    pub use_scaling: ::core::ffi::c_int,
759    pub scaled_width: ::core::ffi::c_int,
760    pub scaled_height: ::core::ffi::c_int,
761    pub use_threads: ::core::ffi::c_int,
762    pub dithering_strength: ::core::ffi::c_int,
763    pub flip: ::core::ffi::c_int,
764    pub alpha_dithering_strength: ::core::ffi::c_int,
765    pub pad: [u32; 5usize],
766}
767#[repr(C)]
768#[derive(Copy, Clone)]
769pub struct WebPDecoderConfig {
770    pub input: WebPBitstreamFeatures,
771    pub output: WebPDecBuffer,
772    pub options: WebPDecoderOptions,
773}
774impl ::core::fmt::Debug for WebPDecoderConfig {
775    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
776        write!(
777            f,
778            "WebPDecoderConfig {{ input: {:?}, output: {:?}, options: {:?} }}",
779            self.input, self.output, self.options
780        )
781    }
782}
783unsafe extern "C" {
784    pub fn WebPInitDecoderConfigInternal(
785        arg1: *mut WebPDecoderConfig,
786        arg2: ::core::ffi::c_int,
787    ) -> ::core::ffi::c_int;
788}
789unsafe extern "C" {
790    pub fn WebPValidateDecoderConfig(config: *const WebPDecoderConfig) -> ::core::ffi::c_int;
791}
792unsafe extern "C" {
793    pub fn WebPIDecode(
794        data: *const u8,
795        data_size: usize,
796        config: *mut WebPDecoderConfig,
797    ) -> *mut WebPIDecoder;
798}
799unsafe extern "C" {
800    pub fn WebPDecode(
801        data: *const u8,
802        data_size: usize,
803        config: *mut WebPDecoderConfig,
804    ) -> VP8StatusCode;
805}
806#[repr(u32)]
807#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
808pub enum WebPFeatureFlags {
809    ANIMATION_FLAG = 2,
810    XMP_FLAG = 4,
811    EXIF_FLAG = 8,
812    ALPHA_FLAG = 16,
813    ICCP_FLAG = 32,
814    ALL_VALID_FLAGS = 62,
815}
816#[repr(u32)]
817#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
818pub enum WebPMuxAnimDispose {
819    WEBP_MUX_DISPOSE_NONE = 0,
820    WEBP_MUX_DISPOSE_BACKGROUND = 1,
821}
822#[repr(u32)]
823#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
824pub enum WebPMuxAnimBlend {
825    WEBP_MUX_BLEND = 0,
826    WEBP_MUX_NO_BLEND = 1,
827}
828#[repr(C)]
829#[derive(Debug, Copy, Clone)]
830pub struct WebPData {
831    pub bytes: *const u8,
832    pub size: usize,
833}
834#[repr(C)]
835#[derive(Debug, Copy, Clone)]
836pub struct WebPMux {
837    _unused: [u8; 0],
838}
839#[repr(i32)]
840#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
841pub enum WebPMuxError {
842    WEBP_MUX_OK = 1,
843    WEBP_MUX_NOT_FOUND = 0,
844    WEBP_MUX_INVALID_ARGUMENT = -1,
845    WEBP_MUX_BAD_DATA = -2,
846    WEBP_MUX_MEMORY_ERROR = -3,
847    WEBP_MUX_NOT_ENOUGH_DATA = -4,
848}
849#[repr(u32)]
850#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
851pub enum WebPChunkId {
852    WEBP_CHUNK_VP8X = 0,
853    WEBP_CHUNK_ICCP = 1,
854    WEBP_CHUNK_ANIM = 2,
855    WEBP_CHUNK_ANMF = 3,
856    WEBP_CHUNK_DEPRECATED = 4,
857    WEBP_CHUNK_ALPHA = 5,
858    WEBP_CHUNK_IMAGE = 6,
859    WEBP_CHUNK_EXIF = 7,
860    WEBP_CHUNK_XMP = 8,
861    WEBP_CHUNK_UNKNOWN = 9,
862    WEBP_CHUNK_NIL = 10,
863}
864unsafe extern "C" {
865    pub fn WebPGetMuxVersion() -> ::core::ffi::c_int;
866}
867unsafe extern "C" {
868    pub fn WebPNewInternal(arg1: ::core::ffi::c_int) -> *mut WebPMux;
869}
870unsafe extern "C" {
871    pub fn WebPMuxDelete(mux: *mut WebPMux);
872}
873unsafe extern "C" {
874    pub fn WebPMuxCreateInternal(
875        arg1: *const WebPData,
876        arg2: ::core::ffi::c_int,
877        arg3: ::core::ffi::c_int,
878    ) -> *mut WebPMux;
879}
880unsafe extern "C" {
881    pub fn WebPMuxSetChunk(
882        mux: *mut WebPMux,
883        fourcc: *const ::core::ffi::c_char,
884        chunk_data: *const WebPData,
885        copy_data: ::core::ffi::c_int,
886    ) -> WebPMuxError;
887}
888unsafe extern "C" {
889    pub fn WebPMuxGetChunk(
890        mux: *const WebPMux,
891        fourcc: *const ::core::ffi::c_char,
892        chunk_data: *mut WebPData,
893    ) -> WebPMuxError;
894}
895unsafe extern "C" {
896    pub fn WebPMuxDeleteChunk(
897        mux: *mut WebPMux,
898        fourcc: *const ::core::ffi::c_char,
899    ) -> WebPMuxError;
900}
901#[repr(C)]
902#[derive(Debug, Copy, Clone)]
903pub struct WebPMuxFrameInfo {
904    pub bitstream: WebPData,
905    pub x_offset: ::core::ffi::c_int,
906    pub y_offset: ::core::ffi::c_int,
907    pub duration: ::core::ffi::c_int,
908    pub id: WebPChunkId,
909    pub dispose_method: WebPMuxAnimDispose,
910    pub blend_method: WebPMuxAnimBlend,
911    pub pad: [u32; 1usize],
912}
913unsafe extern "C" {
914    pub fn WebPMuxSetImage(
915        mux: *mut WebPMux,
916        bitstream: *const WebPData,
917        copy_data: ::core::ffi::c_int,
918    ) -> WebPMuxError;
919}
920unsafe extern "C" {
921    pub fn WebPMuxPushFrame(
922        mux: *mut WebPMux,
923        frame: *const WebPMuxFrameInfo,
924        copy_data: ::core::ffi::c_int,
925    ) -> WebPMuxError;
926}
927unsafe extern "C" {
928    pub fn WebPMuxGetFrame(
929        mux: *const WebPMux,
930        nth: u32,
931        frame: *mut WebPMuxFrameInfo,
932    ) -> WebPMuxError;
933}
934unsafe extern "C" {
935    pub fn WebPMuxDeleteFrame(mux: *mut WebPMux, nth: u32) -> WebPMuxError;
936}
937#[repr(C)]
938#[derive(Debug, Copy, Clone)]
939pub struct WebPMuxAnimParams {
940    pub bgcolor: u32,
941    pub loop_count: ::core::ffi::c_int,
942}
943unsafe extern "C" {
944    pub fn WebPMuxSetAnimationParams(
945        mux: *mut WebPMux,
946        params: *const WebPMuxAnimParams,
947    ) -> WebPMuxError;
948}
949unsafe extern "C" {
950    pub fn WebPMuxGetAnimationParams(
951        mux: *const WebPMux,
952        params: *mut WebPMuxAnimParams,
953    ) -> WebPMuxError;
954}
955unsafe extern "C" {
956    pub fn WebPMuxSetCanvasSize(
957        mux: *mut WebPMux,
958        width: ::core::ffi::c_int,
959        height: ::core::ffi::c_int,
960    ) -> WebPMuxError;
961}
962unsafe extern "C" {
963    pub fn WebPMuxGetCanvasSize(
964        mux: *const WebPMux,
965        width: *mut ::core::ffi::c_int,
966        height: *mut ::core::ffi::c_int,
967    ) -> WebPMuxError;
968}
969unsafe extern "C" {
970    pub fn WebPMuxGetFeatures(mux: *const WebPMux, flags: *mut u32) -> WebPMuxError;
971}
972unsafe extern "C" {
973    pub fn WebPMuxNumChunks(
974        mux: *const WebPMux,
975        id: WebPChunkId,
976        num_elements: *mut ::core::ffi::c_int,
977    ) -> WebPMuxError;
978}
979unsafe extern "C" {
980    pub fn WebPMuxAssemble(mux: *mut WebPMux, assembled_data: *mut WebPData) -> WebPMuxError;
981}
982#[repr(C)]
983#[derive(Debug, Copy, Clone)]
984pub struct WebPAnimEncoder {
985    _unused: [u8; 0],
986}
987#[repr(C)]
988#[derive(Debug, Copy, Clone)]
989pub struct WebPAnimEncoderOptions {
990    pub anim_params: WebPMuxAnimParams,
991    pub minimize_size: ::core::ffi::c_int,
992    pub kmin: ::core::ffi::c_int,
993    pub kmax: ::core::ffi::c_int,
994    pub allow_mixed: ::core::ffi::c_int,
995    pub verbose: ::core::ffi::c_int,
996    pub padding: [u32; 4usize],
997}
998unsafe extern "C" {
999    pub fn WebPAnimEncoderOptionsInitInternal(
1000        arg1: *mut WebPAnimEncoderOptions,
1001        arg2: ::core::ffi::c_int,
1002    ) -> ::core::ffi::c_int;
1003}
1004unsafe extern "C" {
1005    pub fn WebPAnimEncoderNewInternal(
1006        arg1: ::core::ffi::c_int,
1007        arg2: ::core::ffi::c_int,
1008        arg3: *const WebPAnimEncoderOptions,
1009        arg4: ::core::ffi::c_int,
1010    ) -> *mut WebPAnimEncoder;
1011}
1012unsafe extern "C" {
1013    pub fn WebPAnimEncoderAdd(
1014        enc: *mut WebPAnimEncoder,
1015        frame: *mut WebPPicture,
1016        timestamp_ms: ::core::ffi::c_int,
1017        config: *const WebPConfig,
1018    ) -> ::core::ffi::c_int;
1019}
1020unsafe extern "C" {
1021    pub fn WebPAnimEncoderAssemble(
1022        enc: *mut WebPAnimEncoder,
1023        webp_data: *mut WebPData,
1024    ) -> ::core::ffi::c_int;
1025}
1026unsafe extern "C" {
1027    pub fn WebPAnimEncoderGetError(enc: *mut WebPAnimEncoder) -> *const ::core::ffi::c_char;
1028}
1029unsafe extern "C" {
1030    pub fn WebPAnimEncoderDelete(enc: *mut WebPAnimEncoder);
1031}
1032unsafe extern "C" {
1033    pub fn WebPAnimEncoderSetChunk(
1034        enc: *mut WebPAnimEncoder,
1035        fourcc: *const ::core::ffi::c_char,
1036        chunk_data: *const WebPData,
1037        copy_data: ::core::ffi::c_int,
1038    ) -> WebPMuxError;
1039}
1040unsafe extern "C" {
1041    pub fn WebPAnimEncoderGetChunk(
1042        enc: *const WebPAnimEncoder,
1043        fourcc: *const ::core::ffi::c_char,
1044        chunk_data: *mut WebPData,
1045    ) -> WebPMuxError;
1046}
1047unsafe extern "C" {
1048    pub fn WebPAnimEncoderDeleteChunk(
1049        enc: *mut WebPAnimEncoder,
1050        fourcc: *const ::core::ffi::c_char,
1051    ) -> WebPMuxError;
1052}
1053#[repr(C)]
1054#[derive(Debug, Copy, Clone)]
1055pub struct WebPDemuxer {
1056    _unused: [u8; 0],
1057}
1058unsafe extern "C" {
1059    pub fn WebPGetDemuxVersion() -> ::core::ffi::c_int;
1060}
1061#[repr(i32)]
1062#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1063pub enum WebPDemuxState {
1064    WEBP_DEMUX_PARSE_ERROR = -1,
1065    WEBP_DEMUX_PARSING_HEADER = 0,
1066    WEBP_DEMUX_PARSED_HEADER = 1,
1067    WEBP_DEMUX_DONE = 2,
1068}
1069unsafe extern "C" {
1070    pub fn WebPDemuxInternal(
1071        arg1: *const WebPData,
1072        arg2: ::core::ffi::c_int,
1073        arg3: *mut WebPDemuxState,
1074        arg4: ::core::ffi::c_int,
1075    ) -> *mut WebPDemuxer;
1076}
1077unsafe extern "C" {
1078    pub fn WebPDemuxDelete(dmux: *mut WebPDemuxer);
1079}
1080#[repr(u32)]
1081#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1082pub enum WebPFormatFeature {
1083    WEBP_FF_FORMAT_FLAGS = 0,
1084    WEBP_FF_CANVAS_WIDTH = 1,
1085    WEBP_FF_CANVAS_HEIGHT = 2,
1086    WEBP_FF_LOOP_COUNT = 3,
1087    WEBP_FF_BACKGROUND_COLOR = 4,
1088    WEBP_FF_FRAME_COUNT = 5,
1089}
1090unsafe extern "C" {
1091    pub fn WebPDemuxGetI(dmux: *const WebPDemuxer, feature: WebPFormatFeature) -> u32;
1092}
1093#[repr(C)]
1094#[derive(Debug, Copy, Clone)]
1095pub struct WebPIterator {
1096    pub frame_num: ::core::ffi::c_int,
1097    pub num_frames: ::core::ffi::c_int,
1098    pub x_offset: ::core::ffi::c_int,
1099    pub y_offset: ::core::ffi::c_int,
1100    pub width: ::core::ffi::c_int,
1101    pub height: ::core::ffi::c_int,
1102    pub duration: ::core::ffi::c_int,
1103    pub dispose_method: WebPMuxAnimDispose,
1104    pub complete: ::core::ffi::c_int,
1105    pub fragment: WebPData,
1106    pub has_alpha: ::core::ffi::c_int,
1107    pub blend_method: WebPMuxAnimBlend,
1108    pub pad: [u32; 2usize],
1109    pub private_: *mut ::core::ffi::c_void,
1110}
1111unsafe extern "C" {
1112    pub fn WebPDemuxGetFrame(
1113        dmux: *const WebPDemuxer,
1114        frame_number: ::core::ffi::c_int,
1115        iter: *mut WebPIterator,
1116    ) -> ::core::ffi::c_int;
1117}
1118unsafe extern "C" {
1119    pub fn WebPDemuxNextFrame(iter: *mut WebPIterator) -> ::core::ffi::c_int;
1120}
1121unsafe extern "C" {
1122    pub fn WebPDemuxPrevFrame(iter: *mut WebPIterator) -> ::core::ffi::c_int;
1123}
1124unsafe extern "C" {
1125    pub fn WebPDemuxReleaseIterator(iter: *mut WebPIterator);
1126}
1127#[repr(C)]
1128#[derive(Debug, Copy, Clone)]
1129pub struct WebPChunkIterator {
1130    pub chunk_num: ::core::ffi::c_int,
1131    pub num_chunks: ::core::ffi::c_int,
1132    pub chunk: WebPData,
1133    pub pad: [u32; 6usize],
1134    pub private_: *mut ::core::ffi::c_void,
1135}
1136unsafe extern "C" {
1137    pub fn WebPDemuxGetChunk(
1138        dmux: *const WebPDemuxer,
1139        fourcc: *const ::core::ffi::c_char,
1140        chunk_number: ::core::ffi::c_int,
1141        iter: *mut WebPChunkIterator,
1142    ) -> ::core::ffi::c_int;
1143}
1144unsafe extern "C" {
1145    pub fn WebPDemuxNextChunk(iter: *mut WebPChunkIterator) -> ::core::ffi::c_int;
1146}
1147unsafe extern "C" {
1148    pub fn WebPDemuxPrevChunk(iter: *mut WebPChunkIterator) -> ::core::ffi::c_int;
1149}
1150unsafe extern "C" {
1151    pub fn WebPDemuxReleaseChunkIterator(iter: *mut WebPChunkIterator);
1152}
1153#[repr(C)]
1154#[derive(Debug, Copy, Clone)]
1155pub struct WebPAnimDecoder {
1156    _unused: [u8; 0],
1157}
1158#[repr(C)]
1159#[derive(Debug, Copy, Clone)]
1160pub struct WebPAnimDecoderOptions {
1161    pub color_mode: WEBP_CSP_MODE,
1162    pub use_threads: ::core::ffi::c_int,
1163    pub padding: [u32; 7usize],
1164}
1165unsafe extern "C" {
1166    pub fn WebPAnimDecoderOptionsInitInternal(
1167        arg1: *mut WebPAnimDecoderOptions,
1168        arg2: ::core::ffi::c_int,
1169    ) -> ::core::ffi::c_int;
1170}
1171unsafe extern "C" {
1172    pub fn WebPAnimDecoderNewInternal(
1173        arg1: *const WebPData,
1174        arg2: *const WebPAnimDecoderOptions,
1175        arg3: ::core::ffi::c_int,
1176    ) -> *mut WebPAnimDecoder;
1177}
1178#[repr(C)]
1179#[derive(Debug, Copy, Clone)]
1180pub struct WebPAnimInfo {
1181    pub canvas_width: u32,
1182    pub canvas_height: u32,
1183    pub loop_count: u32,
1184    pub bgcolor: u32,
1185    pub frame_count: u32,
1186    pub pad: [u32; 4usize],
1187}
1188unsafe extern "C" {
1189    pub fn WebPAnimDecoderGetInfo(
1190        dec: *const WebPAnimDecoder,
1191        info: *mut WebPAnimInfo,
1192    ) -> ::core::ffi::c_int;
1193}
1194unsafe extern "C" {
1195    pub fn WebPAnimDecoderGetNext(
1196        dec: *mut WebPAnimDecoder,
1197        buf: *mut *mut u8,
1198        timestamp: *mut ::core::ffi::c_int,
1199    ) -> ::core::ffi::c_int;
1200}
1201unsafe extern "C" {
1202    pub fn WebPAnimDecoderHasMoreFrames(dec: *const WebPAnimDecoder) -> ::core::ffi::c_int;
1203}
1204unsafe extern "C" {
1205    pub fn WebPAnimDecoderReset(dec: *mut WebPAnimDecoder);
1206}
1207unsafe extern "C" {
1208    pub fn WebPAnimDecoderGetDemuxer(dec: *const WebPAnimDecoder) -> *const WebPDemuxer;
1209}
1210unsafe extern "C" {
1211    pub fn WebPAnimDecoderDelete(dec: *mut WebPAnimDecoder);
1212}