rust_gpujpeg/
bindings.rs

1/* automatically generated by rust-bindgen 0.71.1 */
2
3pub const __bool_true_false_are_defined: u32 = 1;
4pub const true_: u32 = 1;
5pub const false_: u32 = 0;
6pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
7pub const _SAL_VERSION: u32 = 20;
8pub const __SAL_H_VERSION: u32 = 180000000;
9pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
10pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
11pub const _CRT_PACKING: u32 = 8;
12pub const _HAS_EXCEPTIONS: u32 = 1;
13pub const _STL_LANG: u32 = 0;
14pub const _HAS_CXX17: u32 = 0;
15pub const _HAS_CXX20: u32 = 0;
16pub const _HAS_CXX23: u32 = 0;
17pub const _HAS_CXX26: u32 = 0;
18pub const _HAS_NODISCARD: u32 = 0;
19pub const WCHAR_MIN: u32 = 0;
20pub const WCHAR_MAX: u32 = 65535;
21pub const WINT_MIN: u32 = 0;
22pub const WINT_MAX: u32 = 65535;
23pub const GPUJPEG_MAX_COMPONENT_COUNT: u32 = 4;
24pub const GPUJPEG_INIT_DEV_VERBOSE: u32 = 1;
25pub const GPUJPEG_OPENGL_INTEROPERABILITY: u32 = 2;
26pub const GPUJPEG_VERBOSE: u32 = 1;
27pub const GPUJPEG_MAX_SEGMENT_INFO_HEADER_COUNT: u32 = 100;
28pub const GPUJPEG_NOERR: u32 = 0;
29pub const GPUJPEG_ERROR: i32 = -1;
30pub const GPUJPEG_ERR_RESTART_CHANGE: i32 = -2;
31pub const GPUJPEG_VAL_TRUE: &[u8; 2] = b"1\0";
32pub const GPUJPEG_VAL_FALSE: &[u8; 2] = b"0\0";
33pub const GPUJPEG_MAX_DEVICE_COUNT: u32 = 10;
34pub const GPUJPEG_SUBSAMPLING_UNKNOWN: u32 = 0;
35pub const GPUJPEG_ENCODER_OPT_OUT_PINNED: &[u8; 15] = b"enc_out_pinned\0";
36pub const GPUJPEG_ENC_OPT_OUT: &[u8; 12] = b"enc_opt_out\0";
37pub const GPUJPEG_ENC_OUT_VAL_PAGEABLE: &[u8; 21] = b"enc_out_val_pageable\0";
38pub const GPUJPEG_ENC_OUT_VAL_PINNED: &[u8; 19] = b"enc_out_val_pinned\0";
39pub const GPUJPEG_DEC_OPT_TGA_RLE_BOOL: &[u8; 16] = b"dec_opt_tga_rle\0";
40pub type wchar_t = ::std::os::raw::c_ushort;
41pub type max_align_t = f64;
42pub type va_list = *mut ::std::os::raw::c_char;
43unsafe extern "C" {
44    pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
45}
46pub type __vcrt_bool = bool;
47unsafe extern "C" {
48    pub fn __security_init_cookie();
49}
50unsafe extern "C" {
51    pub fn __security_check_cookie(_StackCookie: usize);
52}
53unsafe extern "C" {
54    pub fn __report_gsfailure(_StackCookie: usize) -> !;
55}
56unsafe extern "C" {
57    pub static mut __security_cookie: usize;
58}
59pub type int_least8_t = ::std::os::raw::c_schar;
60pub type int_least16_t = ::std::os::raw::c_short;
61pub type int_least32_t = ::std::os::raw::c_int;
62pub type int_least64_t = ::std::os::raw::c_longlong;
63pub type uint_least8_t = ::std::os::raw::c_uchar;
64pub type uint_least16_t = ::std::os::raw::c_ushort;
65pub type uint_least32_t = ::std::os::raw::c_uint;
66pub type uint_least64_t = ::std::os::raw::c_ulonglong;
67pub type int_fast8_t = ::std::os::raw::c_schar;
68pub type int_fast16_t = ::std::os::raw::c_int;
69pub type int_fast32_t = ::std::os::raw::c_int;
70pub type int_fast64_t = ::std::os::raw::c_longlong;
71pub type uint_fast8_t = ::std::os::raw::c_uchar;
72pub type uint_fast16_t = ::std::os::raw::c_uint;
73pub type uint_fast32_t = ::std::os::raw::c_uint;
74pub type uint_fast64_t = ::std::os::raw::c_ulonglong;
75pub type intmax_t = ::std::os::raw::c_longlong;
76pub type uintmax_t = ::std::os::raw::c_ulonglong;
77pub const gpujpeg_color_space_GPUJPEG_NONE: gpujpeg_color_space = 0;
78pub const gpujpeg_color_space_GPUJPEG_RGB: gpujpeg_color_space = 1;
79
80///limited-range YCbCr BT.601
81pub const gpujpeg_color_space_GPUJPEG_YCBCR_BT601: gpujpeg_color_space = 2;
82
83/// GPUJPEG_YCBCR_BT601
84pub const gpujpeg_color_space_GPUJPEG_YCBCR_BT601_256LVLS: gpujpeg_color_space = 3;
85/// limited-range YCbCr JPEG
86pub const gpujpeg_color_space_GPUJPEG_YCBCR_JPEG: gpujpeg_color_space = 3;
87/// limited-range YCbCr BT.709
88/// GPUJPEG_YCBCR_BT709
89pub const gpujpeg_color_space_GPUJPEG_YCBCR_BT709: gpujpeg_color_space = 4;
90/// @ref GPUJPEG_YCBCR_BT709
91/// GPUJPEG_YCBCR_BT709_256LVLS
92pub const gpujpeg_color_space_GPUJPEG_YCBCR: gpujpeg_color_space = 4;
93/// @deprecated will be removed soon (is this ever needed?), define ENABLE_YUV to enable pre/post processors
94
95pub const gpujpeg_color_space_GPUJPEG_YUV: gpujpeg_color_space = 5;
96/// Color spaces for JPEG codec
97pub type gpujpeg_color_space = ::std::os::raw::c_int;
98pub const gpujpeg_pixel_format_GPUJPEG_PIXFMT_NONE: gpujpeg_pixel_format = -1;
99/// 8bit unsigned samples, 1 component
100pub const gpujpeg_pixel_format_GPUJPEG_U8: gpujpeg_pixel_format = 0;
101/// 8bit unsigned samples, 3 components, 4:4:4 sampling,
102/// sample order: comp#0 comp#1 comp#2, interleaved
103pub const gpujpeg_pixel_format_GPUJPEG_444_U8_P012: gpujpeg_pixel_format = 1;
104/// 8bit unsigned samples, 3 components, 4:4:4, planar
105pub const gpujpeg_pixel_format_GPUJPEG_444_U8_P0P1P2: gpujpeg_pixel_format = 2;
106/// 8bit unsigned samples, 3 components, 4:2:2,
107/// order of samples: comp#1 comp#0 comp#2 comp#0, interleaved
108pub const gpujpeg_pixel_format_GPUJPEG_422_U8_P1020: gpujpeg_pixel_format = 3;
109/// 8bit unsigned samples, planar, 3 components, 4:2:2, planar
110pub const gpujpeg_pixel_format_GPUJPEG_422_U8_P0P1P2: gpujpeg_pixel_format = 4;
111/// 8bit unsigned samples, planar, 3 components, 4:2:0, planar
112pub const gpujpeg_pixel_format_GPUJPEG_420_U8_P0P1P2: gpujpeg_pixel_format = 5;
113/// 8bit unsigned samples, 3 or 4 components, each pixel padded to 32bits
114/// with optional alpha or unused, 4:4:4(:4) sampling, interleaved
115pub const gpujpeg_pixel_format_GPUJPEG_4444_U8_P0123: gpujpeg_pixel_format = 6;
116/// Pixel format for input/output image data.
117pub type gpujpeg_pixel_format = ::std::os::raw::c_int;
118/// Sampling factor for color component in JPEG format
119#[repr(C)]
120#[derive(Debug, Copy, Clone)]
121pub struct gpujpeg_component_sampling_factor {
122    pub horizontal: u8,
123    pub vertical: u8,
124}
125#[allow(clippy::unnecessary_operation, clippy::identity_op)]
126const _: () = {
127    ["Size of gpujpeg_component_sampling_factor"]
128        [::std::mem::size_of::<gpujpeg_component_sampling_factor>() - 2usize];
129    ["Alignment of gpujpeg_component_sampling_factor"]
130        [::std::mem::align_of::<gpujpeg_component_sampling_factor>() - 1usize];
131    ["Offset of field: gpujpeg_component_sampling_factor::horizontal"]
132        [::std::mem::offset_of!(gpujpeg_component_sampling_factor, horizontal) - 0usize];
133    ["Offset of field: gpujpeg_component_sampling_factor::vertical"]
134        [::std::mem::offset_of!(gpujpeg_component_sampling_factor, vertical) - 1usize];
135};
136#[repr(C)]
137#[derive(Debug, Copy, Clone)]
138pub struct CUstream_st {
139    _unused: [u8; 0],
140}
141pub type cudaStream_t = *mut CUstream_st;
142unsafe extern "C" {
143    /// # return
144    /// runtime version of the GPUJPEG library
145    pub fn gpujpeg_version() -> ::std::os::raw::c_int;
146}
147
148unsafe extern "C" {
149    /// # return
150    /// text representation of GPUJPEG version number
151    pub fn gpujpeg_version_to_string(
152        version: ::std::os::raw::c_int,
153    ) -> *const ::std::os::raw::c_char;
154}
155unsafe extern "C" {
156    /// # return
157    /// current time in seconds
158    pub fn gpujpeg_get_time() -> f64;
159}
160/// Device info for one device
161#[repr(C)]
162#[derive(Debug, Copy, Clone)]
163pub struct gpujpeg_device_info {
164    /// Device id
165    pub id: ::std::os::raw::c_int,
166    /// Device name
167    pub name: [::std::os::raw::c_char; 256usize],
168    /// Compute capability major version
169    pub cc_major: ::std::os::raw::c_int,
170    /// Compute capability minor version
171    pub cc_minor: ::std::os::raw::c_int,
172    /// Amount of global memory
173    pub global_memory: usize,
174    /// Amount of constant memory
175    pub constant_memory: usize,
176    /// Amount of shared memory
177    pub shared_memory: usize,
178    /// Number of registers per block
179    pub register_count: ::std::os::raw::c_int,
180    /// Number of multiprocessors
181    pub multiprocessor_count: ::std::os::raw::c_int,
182}
183#[allow(clippy::unnecessary_operation, clippy::identity_op)]
184const _: () = {
185    ["Size of gpujpeg_device_info"][::std::mem::size_of::<gpujpeg_device_info>() - 304usize];
186    ["Alignment of gpujpeg_device_info"][::std::mem::align_of::<gpujpeg_device_info>() - 8usize];
187    ["Offset of field: gpujpeg_device_info::id"]
188        [::std::mem::offset_of!(gpujpeg_device_info, id) - 0usize];
189    ["Offset of field: gpujpeg_device_info::name"]
190        [::std::mem::offset_of!(gpujpeg_device_info, name) - 4usize];
191    ["Offset of field: gpujpeg_device_info::cc_major"]
192        [::std::mem::offset_of!(gpujpeg_device_info, cc_major) - 260usize];
193    ["Offset of field: gpujpeg_device_info::cc_minor"]
194        [::std::mem::offset_of!(gpujpeg_device_info, cc_minor) - 264usize];
195    ["Offset of field: gpujpeg_device_info::global_memory"]
196        [::std::mem::offset_of!(gpujpeg_device_info, global_memory) - 272usize];
197    ["Offset of field: gpujpeg_device_info::constant_memory"]
198        [::std::mem::offset_of!(gpujpeg_device_info, constant_memory) - 280usize];
199    ["Offset of field: gpujpeg_device_info::shared_memory"]
200        [::std::mem::offset_of!(gpujpeg_device_info, shared_memory) - 288usize];
201    ["Offset of field: gpujpeg_device_info::register_count"]
202        [::std::mem::offset_of!(gpujpeg_device_info, register_count) - 296usize];
203    ["Offset of field: gpujpeg_device_info::multiprocessor_count"]
204        [::std::mem::offset_of!(gpujpeg_device_info, multiprocessor_count) - 300usize];
205};
206/// Device info for one device
207#[repr(C)]
208#[derive(Debug, Copy, Clone)]
209pub struct gpujpeg_devices_info {
210    /// Number of devices
211    pub device_count: ::std::os::raw::c_int,
212    /// Device info for each
213    pub device: [gpujpeg_device_info; 10usize],
214}
215#[allow(clippy::unnecessary_operation, clippy::identity_op)]
216const _: () = {
217    ["Size of gpujpeg_devices_info"][::std::mem::size_of::<gpujpeg_devices_info>() - 3048usize];
218    ["Alignment of gpujpeg_devices_info"][::std::mem::align_of::<gpujpeg_devices_info>() - 8usize];
219    ["Offset of field: gpujpeg_devices_info::device_count"]
220        [::std::mem::offset_of!(gpujpeg_devices_info, device_count) - 0usize];
221    ["Offset of field: gpujpeg_devices_info::device"]
222        [::std::mem::offset_of!(gpujpeg_devices_info, device) - 8usize];
223};
224unsafe extern "C" {
225    /// Get information about available devices
226    ///
227    /// # return
228    /// devices info
229    pub fn gpujpeg_get_devices_info() -> gpujpeg_devices_info;
230}
231unsafe extern "C" {
232    /// Print information about available devices
233    ///
234    /// # return
235    /// 0 if success
236    /// # return
237    /// -1 for error (eg. no devices were found)
238    pub fn gpujpeg_print_devices_info() -> ::std::os::raw::c_int;
239}
240unsafe extern "C" {
241    /// Init CUDA device
242    ///
243    /// @param device_id CUDA device id (starting at 0)
244    /// @param flags @ref Flags, e.g. if device info should be printed out (@ref GPUJPEG_INIT_DEV_VERBOSE) or
245    ///              enable OpenGL interoperability (@ref GPUJPEG_OPENGL_INTEROPERABILITY)
246    /// # return
247    /// 0 if succeeds, otherwise nonzero
248    pub fn gpujpeg_init_device(
249        device_id: ::std::os::raw::c_int,
250        flags: ::std::os::raw::c_int,
251    ) -> ::std::os::raw::c_int;
252}
253/// auto-select the best restart interval
254pub const restart_int_RESTART_AUTO: restart_int = -1;
255/// disabled; CPU Huffman encoder will be used
256pub const restart_int_RESTART_NONE: restart_int = 0;
257pub type restart_int = ::std::os::raw::c_int;
258/// suppress informative messages (but not warnings and errors)
259pub const verbosity_GPUJPEG_LL_QUIET: verbosity = -1;
260/// normal verbosity
261pub const verbosity_GPUJPEG_LL_INFO: verbosity = 0;
262/// print summary (image size, duration)
263pub const verbosity_GPUJPEG_LL_STATUS: verbosity = 1;
264/// print additional information
265pub const verbosity_GPUJPEG_LL_VERBOSE: verbosity = 2;
266/// print more information, including internal ones
267pub const verbosity_GPUJPEG_LL_DEBUG: verbosity = 3;
268/// print maximum of information, including JPEG file internal structure
269pub const verbosity_GPUJPEG_LL_DEBUG2: verbosity = 4;
270pub type verbosity = ::std::os::raw::c_int;
271/// JPEG parameters. This structure should not be initialized only be hand,
272/// but at first gpujpeg_set_default_parameters should be call and then
273/// some parameters could be changed.
274#[repr(C)]
275#[derive(Debug, Copy, Clone)]
276pub struct gpujpeg_parameters {
277    /// Verbosity level - show more information, collects duration of each phase, etc.
278    /// @sa @ref verbosity for values
279    pub verbose: ::std::os::raw::c_int,
280    pub perf_stats: ::std::os::raw::c_int,
281    /// Encoder quality level (0-100)
282    pub quality: ::std::os::raw::c_int,
283    /// Restart interval (0 means that restart interval is disabled and CPU huffman coder is used)
284    /// @sa @rf restart_int for special values
285    pub restart_interval: ::std::os::raw::c_int,
286    /// Flag which determines if interleaved format of JPEG stream should be used, \"1\" = only
287    /// one scan which includes all color components (e.g. Y Cb Cr Y Cb Cr ...),
288    /// or \"0\" = one scan for each color component (e.g. Y Y Y ..., Cb Cb Cb ..., Cr Cr Cr ...)
289    pub interleaved: ::std::os::raw::c_int,
290    /// Use segment info in stream for fast decoding. The segment info is placed into special
291    /// application headers and contains indexes to beginnings of segments in the stream, so
292    /// the decoder don't have to parse the stream byte-by-byte but he can only read the
293    /// segment info and start decoding. The segment info is presented for each scan, and thus
294    /// the best result is achieved when it is used in combination with \"interleaved = 1\" settings.
295    pub segment_info: ::std::os::raw::c_int,
296    /// JPEG image component count; count of valid sampling_factor elements
297    /// use gpujpeg_parameters_chroma_subsampling() to set comp_count and sampling_factor
298    pub comp_count: ::std::os::raw::c_int,
299    /// Sampling factors for each color component inside JPEG stream.
300    pub sampling_factor: [gpujpeg_component_sampling_factor; 4usize],
301    /// Color space that is used inside JPEG stream = that is carried in JPEG format = to
302    /// which are input data converted. Default value is @ref GPUJPEG_YCBCR_JPEG, changing it
303    /// will change the JPEG format from @ref GPUJPEG_HEADER_JFIF \"JFIF\" (see also @ref
304    /// gpujpeg_encoder_set_jpeg_header).
305    /// - encoding: Set by user
306    /// - decoding: Set by gpujpeg
307    pub color_space_internal: gpujpeg_color_space,
308}
309#[allow(clippy::unnecessary_operation, clippy::identity_op)]
310const _: () = {
311    ["Size of gpujpeg_parameters"][::std::mem::size_of::<gpujpeg_parameters>() - 40usize];
312    ["Alignment of gpujpeg_parameters"][::std::mem::align_of::<gpujpeg_parameters>() - 4usize];
313    ["Offset of field: gpujpeg_parameters::verbose"]
314        [::std::mem::offset_of!(gpujpeg_parameters, verbose) - 0usize];
315    ["Offset of field: gpujpeg_parameters::perf_stats"]
316        [::std::mem::offset_of!(gpujpeg_parameters, perf_stats) - 4usize];
317    ["Offset of field: gpujpeg_parameters::quality"]
318        [::std::mem::offset_of!(gpujpeg_parameters, quality) - 8usize];
319    ["Offset of field: gpujpeg_parameters::restart_interval"]
320        [::std::mem::offset_of!(gpujpeg_parameters, restart_interval) - 12usize];
321    ["Offset of field: gpujpeg_parameters::interleaved"]
322        [::std::mem::offset_of!(gpujpeg_parameters, interleaved) - 16usize];
323    ["Offset of field: gpujpeg_parameters::segment_info"]
324        [::std::mem::offset_of!(gpujpeg_parameters, segment_info) - 20usize];
325    ["Offset of field: gpujpeg_parameters::comp_count"]
326        [::std::mem::offset_of!(gpujpeg_parameters, comp_count) - 24usize];
327    ["Offset of field: gpujpeg_parameters::sampling_factor"]
328        [::std::mem::offset_of!(gpujpeg_parameters, sampling_factor) - 28usize];
329    ["Offset of field: gpujpeg_parameters::color_space_internal"]
330        [::std::mem::offset_of!(gpujpeg_parameters, color_space_internal) - 36usize];
331};
332unsafe extern "C" {
333    /// Set default parameters for JPEG coder
334    ///
335    /// @param param Parameters for JPEG coder
336    /// # return
337    /// void
338    /// @sa gpujpeg_default_parameters
339    pub fn gpujpeg_set_default_parameters(param: *mut gpujpeg_parameters);
340}
341unsafe extern "C" {
342    /// alternative to @ref gpujpeg_set_default_parameters allowing simultaneous
343    /// declaration and intialization for convenience.
344    pub fn gpujpeg_default_parameters() -> gpujpeg_parameters;
345}
346/// Sampling factor for all components
347pub type gpujpeg_sampling_factor_t = u32;
348unsafe extern "C" {
349    /// Set parameters for using specified chroma subsampling
350    /// @param param       parameters for coder
351    /// @param subsampling one of GPUJPEG_SUBSAMPLING_{444,422,420}
352    pub fn gpujpeg_parameters_chroma_subsampling(
353        param: *mut gpujpeg_parameters,
354        subsampling: gpujpeg_sampling_factor_t,
355    );
356}
357unsafe extern "C" {
358    /// Returns convenient name for subsampling (4:2:0 etc.). If it cannot be constructed
359    /// returns the format W1xH1:W2xH2:W3xH3.
360    pub fn gpujpeg_subsampling_get_name(
361        comp_count: ::std::os::raw::c_int,
362        sampling_factor: *const gpujpeg_component_sampling_factor,
363    ) -> *const ::std::os::raw::c_char;
364}
365unsafe extern "C" {
366    /// returns gpujpeg_sampling_factor_t from textual representation of subsampling
367    ///
368    /// @retval subsampling, GPUJPEG_SUBSAMPLING_UNKNOWN if not recognized
369    pub fn gpujpeg_subsampling_from_name(
370        subsampling: *const ::std::os::raw::c_char,
371    ) -> gpujpeg_sampling_factor_t;
372}
373/// Image parameters. This structure should not be initialized only be hand,
374/// but at first gpujpeg_image_set_default_parameters should be call and then
375/// some parameters could be changed.
376#[repr(C)]
377#[derive(Debug, Copy, Clone)]
378pub struct gpujpeg_image_parameters {
379    /// Image data width
380    pub width: ::std::os::raw::c_int,
381    /// Image data height
382    pub height: ::std::os::raw::c_int,
383    /// Image data color space
384    pub color_space: gpujpeg_color_space,
385    /// Image data sampling factor
386    pub pixel_format: gpujpeg_pixel_format,
387    /// Number of bytes padded to each row
388    pub width_padding: ::std::os::raw::c_int,
389}
390#[allow(clippy::unnecessary_operation, clippy::identity_op)]
391const _: () = {
392    ["Size of gpujpeg_image_parameters"]
393        [::std::mem::size_of::<gpujpeg_image_parameters>() - 20usize];
394    ["Alignment of gpujpeg_image_parameters"]
395        [::std::mem::align_of::<gpujpeg_image_parameters>() - 4usize];
396    ["Offset of field: gpujpeg_image_parameters::width"]
397        [::std::mem::offset_of!(gpujpeg_image_parameters, width) - 0usize];
398    ["Offset of field: gpujpeg_image_parameters::height"]
399        [::std::mem::offset_of!(gpujpeg_image_parameters, height) - 4usize];
400    ["Offset of field: gpujpeg_image_parameters::color_space"]
401        [::std::mem::offset_of!(gpujpeg_image_parameters, color_space) - 8usize];
402    ["Offset of field: gpujpeg_image_parameters::pixel_format"]
403        [::std::mem::offset_of!(gpujpeg_image_parameters, pixel_format) - 12usize];
404    ["Offset of field: gpujpeg_image_parameters::width_padding"]
405        [::std::mem::offset_of!(gpujpeg_image_parameters, width_padding) - 16usize];
406};
407unsafe extern "C" {
408    /// Set default parameters for JPEG image
409    ///
410    /// @param param  Parameters for image
411    /// # return
412    /// void
413    pub fn gpujpeg_image_set_default_parameters(param: *mut gpujpeg_image_parameters);
414}
415unsafe extern "C" {
416    /// alternative to @ref gpujpeg_set_default_image_parameters allowing
417    ///simultaneous * declaration and intialization for convenience.
418    pub fn gpujpeg_default_image_parameters() -> gpujpeg_image_parameters;
419}
420/// Unknown image file format
421pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_UNKNOWN: gpujpeg_image_file_format = 0;
422/// JPEG file format
423pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_JPEG: gpujpeg_image_file_format = 1;
424/// Raw file format
425/// # note all following formats must be raw
426pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_RAW: gpujpeg_image_file_format = 2;
427/// Gray file format
428pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_GRAY: gpujpeg_image_file_format = 3;
429/// RGB file format, simple data format without header [R G B] [R G B] ...
430pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_RGB: gpujpeg_image_file_format = 4;
431/// RGBA file format, simple data format without header [R G B A] [R G B A] ...
432pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_RGBA: gpujpeg_image_file_format = 5;
433/// RGBA file format, simple data format without header [R G B A] [R G B A] ...
434pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_BMP: gpujpeg_image_file_format = 6;
435/// RGBA file format, simple data format without header [R G B A] [R G B A] ...
436pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_GIF: gpujpeg_image_file_format = 7;
437/// RGBA file format, simple data format without header [R G B A] [R G B A] ...
438pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_PNG: gpujpeg_image_file_format = 8;
439/// RGBA file format, simple data format without header [R G B A] [R G B A] ...
440pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_TGA: gpujpeg_image_file_format = 9;
441/// PNM file format
442pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_PGM: gpujpeg_image_file_format = 10;
443/// PNM file format
444pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_PPM: gpujpeg_image_file_format = 11;
445/// PNM file format
446pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_PNM: gpujpeg_image_file_format = 12;
447/// PAM file format
448pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_PAM: gpujpeg_image_file_format = 13;
449/// PAM file format
450pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_Y4M: gpujpeg_image_file_format = 14;
451/// YUV file format, simple data format without header [Y U V] [Y U V] ...
452/// # note all following formats must be YUV
453pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_YUV: gpujpeg_image_file_format = 15;
454/// YUV file format with alpha channel [Y U V A] [Y U V A] ...
455pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_YUVA: gpujpeg_image_file_format = 16;
456/// UYVY - packed YUV 4:2:2 with pattern U Y0 V Y1
457pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_UYVY: gpujpeg_image_file_format = 17;
458/// i420 file format
459pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_I420: gpujpeg_image_file_format = 18;
460/// testing (empty) image, that is SW generated
461pub const gpujpeg_image_file_format_GPUJPEG_IMAGE_FILE_TST: gpujpeg_image_file_format = 19;
462/// Image file formats
463///
464/// # note if modifying the enum, check the macros below
465pub type gpujpeg_image_file_format = ::std::os::raw::c_int;
466/// Encoder/decoder fine-grained statistics with duration of individual steps
467/// of JPEG compression/decompression. All values are in milliseconds.
468///
469/// # note
470/// The values are only informative and for debugging only and thus this is
471/// not considered as a part of a public API.
472#[repr(C)]
473#[derive(Debug, Copy, Clone)]
474pub struct gpujpeg_duration_stats {
475    pub duration_memory_to: f64,
476    pub duration_memory_from: f64,
477    pub duration_memory_map: f64,
478    pub duration_memory_unmap: f64,
479    pub duration_preprocessor: f64,
480    pub duration_dct_quantization: f64,
481    pub duration_huffman_coder: f64,
482    pub duration_stream: f64,
483    pub duration_in_gpu: f64,
484}
485#[allow(clippy::unnecessary_operation, clippy::identity_op)]
486const _: () = {
487    ["Size of gpujpeg_duration_stats"][::std::mem::size_of::<gpujpeg_duration_stats>() - 72usize];
488    ["Alignment of gpujpeg_duration_stats"]
489        [::std::mem::align_of::<gpujpeg_duration_stats>() - 8usize];
490    ["Offset of field: gpujpeg_duration_stats::duration_memory_to"]
491        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_memory_to) - 0usize];
492    ["Offset of field: gpujpeg_duration_stats::duration_memory_from"]
493        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_memory_from) - 8usize];
494    ["Offset of field: gpujpeg_duration_stats::duration_memory_map"]
495        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_memory_map) - 16usize];
496    ["Offset of field: gpujpeg_duration_stats::duration_memory_unmap"]
497        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_memory_unmap) - 24usize];
498    ["Offset of field: gpujpeg_duration_stats::duration_preprocessor"]
499        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_preprocessor) - 32usize];
500    ["Offset of field: gpujpeg_duration_stats::duration_dct_quantization"]
501        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_dct_quantization) - 40usize];
502    ["Offset of field: gpujpeg_duration_stats::duration_huffman_coder"]
503        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_huffman_coder) - 48usize];
504    ["Offset of field: gpujpeg_duration_stats::duration_stream"]
505        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_stream) - 56usize];
506    ["Offset of field: gpujpeg_duration_stats::duration_in_gpu"]
507        [::std::mem::offset_of!(gpujpeg_duration_stats, duration_in_gpu) - 64usize];
508};
509unsafe extern "C" {
510    /// Get image file format from filename
511    ///
512    /// @param filename  Filename of image file
513    /// # return
514    /// image_file_format or GPUJPEG_IMAGE_FILE_UNKNOWN if type cannot be determined
515    pub fn gpujpeg_image_get_file_format(
516        filename: *const ::std::os::raw::c_char,
517    ) -> gpujpeg_image_file_format;
518}
519unsafe extern "C" {
520    /// Sets cuda device.
521    ///
522    /// @param index  Index of the CUDA device to be activated.
523    pub fn gpujpeg_set_device(index: ::std::os::raw::c_int);
524}
525unsafe extern "C" {
526    /// Calculate size for image by parameters
527    ///
528    /// @param param  Image parameters
529    /// # return
530    /// calculate size
531    pub fn gpujpeg_image_calculate_size(param: *mut gpujpeg_image_parameters) -> usize;
532}
533unsafe extern "C" {
534    /// Load image from file
535    ///
536    /// Allocated image must be freed by gpujpeg_image_load_from_file().
537    ///
538    /// @param         filaname    Image filename
539    /// @param[out]    image       Image data buffer allocated as CUDA host buffer
540    /// @param[in,out] image_size  Image data buffer size (can be specified for verification or 0 for retrieval)
541    /// # return
542    /// 0 if succeeds, otherwise nonzero
543    pub fn gpujpeg_image_load_from_file(
544        filename: *const ::std::os::raw::c_char,
545        image: *mut *mut u8,
546        image_size: *mut usize,
547    ) -> ::std::os::raw::c_int;
548}
549unsafe extern "C" {
550    /// Save image to a file
551    ///
552    /// File format is deduced from the filename extension (if any).
553    ///
554    /// Use the extension \"XXX\" (eg. \"image.XXX\") to automatically select the
555    /// extension according to param_image. PNM is used for grayscale or RGB, PAM for
556    /// RGBA, Y4M ottherwise. \"XXX\" placeholder in filename is replaced with used
557    /// extension. It is user responsibility to ensure that @ref filename is writable
558    /// in this case.
559    ///
560    /// @param filaname  Image filename
561    /// @param image  Image data buffer
562    /// @param image_size  Image data buffer size
563    /// @param param_image Image properties (may be NULL)
564    /// # return
565    /// 0 if succeeds, otherwise nonzero
566    pub fn gpujpeg_image_save_to_file(
567        filename: *const ::std::os::raw::c_char,
568        image: *const u8,
569        image_size: usize,
570        param_image: *const gpujpeg_image_parameters,
571    ) -> ::std::os::raw::c_int;
572}
573unsafe extern "C" {
574    /// Reads/obtains properties from uncompressed file (PNM etc.)
575    ///
576    /// For files without header (.rgb, .yuv...) it obtains only color space pixel format deduced from file extension.
577    ///
578    /// @retval 0 on success; != 0 on error
579    /// @retval -1 on error
580    /// @retval 1 only color space and  pixel format was deduced from file extension (see above)
581    pub fn gpujpeg_image_get_properties(
582        filename: *const ::std::os::raw::c_char,
583        param_image: *mut gpujpeg_image_parameters,
584        file_exists: ::std::os::raw::c_int,
585    ) -> ::std::os::raw::c_int;
586}
587unsafe extern "C" {
588    /// Destroys image allocated by GPUJPEG (eg. gpujpeg_image_load_from_file())
589    ///
590    /// @param image  Image data buffer
591    /// # return
592    /// 0 if succeeds, otherwise nonzero
593    pub fn gpujpeg_image_destroy(image: *mut u8) -> ::std::os::raw::c_int;
594}
595unsafe extern "C" {
596    /// Print range info for image samples
597    ///
598    /// @param filename
599    /// @param width
600    /// @param height
601    /// @param sampling_factor
602    pub fn gpujpeg_image_range_info(
603        filename: *const ::std::os::raw::c_char,
604        width: ::std::os::raw::c_int,
605        height: ::std::os::raw::c_int,
606        sampling_factor: gpujpeg_pixel_format,
607    );
608}
609unsafe extern "C" {
610    /// Convert image
611    ///
612    /// # note
613    /// currently defunct
614    ///
615    /// @param input
616    /// @param filename
617    /// @param param_image_from
618    /// @param param_image_to
619    /// # return
620    /// 0 if succeeds, otherwise nonzero
621    pub fn gpujpeg_image_convert(
622        input: *const ::std::os::raw::c_char,
623        output: *const ::std::os::raw::c_char,
624        param_image_from: gpujpeg_image_parameters,
625        param_image_to: gpujpeg_image_parameters,
626    ) -> ::std::os::raw::c_int;
627}
628#[repr(C)]
629#[derive(Debug, Copy, Clone)]
630pub struct gpujpeg_opengl_context {
631    _unused: [u8; 0],
632}
633unsafe extern "C" {
634    /// Init OpenGL context
635    ///
636    /// This call is optional - initializes OpenGL context, thus doesn't need to be
637    /// called when context already exists. If not called, however, it may be required
638    /// to run glewInit() from client code prior to running GPUJPEG with GL interoperability.
639    ///
640    /// Returned pointer should be freed with gpujpeg_opengl_destroy() when done.
641    ///
642    /// @param[out] ctx pointer to OpenGL context data (to be passed to gpujpeg_opengl_destroy())
643    /// # return
644    ///      0  if succeeds, otherwise nonzero
645    /// # return
646    ///     -1  if initialization fails
647    /// # return
648    ///     -2  if OpenGL support was not compiled in
649    pub fn gpujpeg_opengl_init(ctx: *mut *mut gpujpeg_opengl_context) -> ::std::os::raw::c_int;
650}
651unsafe extern "C" {
652    /// Destroys OpenGL context created with gpujpeg_opengl_init()
653    ///
654    /// # return
655    /// NULL if failed, otherwise state pointer
656    pub fn gpujpeg_opengl_destroy(arg1: *mut gpujpeg_opengl_context);
657}
658unsafe extern "C" {
659    /// Create OpenGL texture
660    ///
661    /// @param width
662    /// @param height
663    /// @param data
664    /// # return
665    /// nonzero texture id if succeeds, otherwise 0
666    pub fn gpujpeg_opengl_texture_create(
667        width: ::std::os::raw::c_int,
668        height: ::std::os::raw::c_int,
669        data: *mut u8,
670    ) -> ::std::os::raw::c_int;
671}
672unsafe extern "C" {
673    /// Set data to OpenGL texture
674    ///
675    /// @param texture_id
676    /// @param data
677    /// # return
678    /// 0 if succeeds, otherwise nonzero
679    pub fn gpujpeg_opengl_texture_set_data(
680        texture_id: ::std::os::raw::c_int,
681        data: *mut u8,
682    ) -> ::std::os::raw::c_int;
683}
684unsafe extern "C" {
685    /// Get data from OpenGL texture
686    ///
687    /// @param texture_id
688    /// @param data
689    /// @param data_size
690    /// # return
691    /// 0 data if succeeds, otherwise nonzero
692    pub fn gpujpeg_opengl_texture_get_data(
693        texture_id: ::std::os::raw::c_int,
694        data: *mut u8,
695        data_size: *mut usize,
696    ) -> ::std::os::raw::c_int;
697}
698unsafe extern "C" {
699    /// Destroy OpenGL texture
700    ///
701    /// @param texture_id
702    pub fn gpujpeg_opengl_texture_destroy(texture_id: ::std::os::raw::c_int);
703}
704pub const gpujpeg_opengl_texture_type_GPUJPEG_OPENGL_TEXTURE_READ: gpujpeg_opengl_texture_type = 1;
705pub const gpujpeg_opengl_texture_type_GPUJPEG_OPENGL_TEXTURE_WRITE: gpujpeg_opengl_texture_type = 2;
706/// Registered OpenGL texture type
707pub type gpujpeg_opengl_texture_type = ::std::os::raw::c_int;
708/// Represents OpenGL texture that is registered to CUDA,
709/// thus the device pointer can be acquired.
710#[repr(C)]
711#[derive(Debug, Copy, Clone)]
712pub struct gpujpeg_opengl_texture {
713    /// Texture id
714    pub texture_id: ::std::os::raw::c_int,
715    /// Texture type
716    pub texture_type: gpujpeg_opengl_texture_type,
717    /// Texture width
718    pub texture_width: ::std::os::raw::c_int,
719    /// Texture height
720    pub texture_height: ::std::os::raw::c_int,
721    /// Texture pixel buffer object type
722    pub texture_pbo_type: ::std::os::raw::c_int,
723    /// Texture pixel buffer object id
724    pub texture_pbo_id: ::std::os::raw::c_int,
725    /// Texture PBO resource for CUDA
726    pub texture_pbo_resource: *mut cudaGraphicsResource,
727    /// Texture callbacks parameter
728    pub texture_callback_param: *mut ::std::os::raw::c_void,
729    /// Texture callback for attaching OpenGL context (by default not used)
730    pub texture_callback_attach_opengl:
731        ::std::option::Option<unsafe extern "C" fn(param: *mut ::std::os::raw::c_void)>,
732    /// Texture callback for detaching OpenGL context (by default not used)
733    pub texture_callback_detach_opengl:
734        ::std::option::Option<unsafe extern "C" fn(param: *mut ::std::os::raw::c_void)>,
735}
736#[allow(clippy::unnecessary_operation, clippy::identity_op)]
737const _: () = {
738    ["Size of gpujpeg_opengl_texture"][::std::mem::size_of::<gpujpeg_opengl_texture>() - 56usize];
739    ["Alignment of gpujpeg_opengl_texture"]
740        [::std::mem::align_of::<gpujpeg_opengl_texture>() - 8usize];
741    ["Offset of field: gpujpeg_opengl_texture::texture_id"]
742        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_id) - 0usize];
743    ["Offset of field: gpujpeg_opengl_texture::texture_type"]
744        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_type) - 4usize];
745    ["Offset of field: gpujpeg_opengl_texture::texture_width"]
746        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_width) - 8usize];
747    ["Offset of field: gpujpeg_opengl_texture::texture_height"]
748        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_height) - 12usize];
749    ["Offset of field: gpujpeg_opengl_texture::texture_pbo_type"]
750        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_pbo_type) - 16usize];
751    ["Offset of field: gpujpeg_opengl_texture::texture_pbo_id"]
752        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_pbo_id) - 20usize];
753    ["Offset of field: gpujpeg_opengl_texture::texture_pbo_resource"]
754        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_pbo_resource) - 24usize];
755    ["Offset of field: gpujpeg_opengl_texture::texture_callback_param"]
756        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_callback_param) - 32usize];
757    ["Offset of field: gpujpeg_opengl_texture::texture_callback_attach_opengl"]
758        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_callback_attach_opengl) - 40usize];
759    ["Offset of field: gpujpeg_opengl_texture::texture_callback_detach_opengl"]
760        [::std::mem::offset_of!(gpujpeg_opengl_texture, texture_callback_detach_opengl) - 48usize];
761};
762unsafe extern "C" {
763    /// Register OpenGL texture to CUDA
764    ///
765    /// @param texture_id
766    /// # return
767    /// allocated registred texture structure
768    pub fn gpujpeg_opengl_texture_register(
769        texture_id: ::std::os::raw::c_int,
770        texture_type: gpujpeg_opengl_texture_type,
771    ) -> *mut gpujpeg_opengl_texture;
772}
773unsafe extern "C" {
774    /// Unregister OpenGL texture from CUDA. Deallocated given
775    /// structure.
776    ///
777    /// @param texture
778    pub fn gpujpeg_opengl_texture_unregister(texture: *mut gpujpeg_opengl_texture);
779}
780unsafe extern "C" {
781    /// Map registered OpenGL texture to CUDA and return
782    /// device pointer to the texture data
783    ///
784    /// @param texture
785    /// @param data_size  Data size in returned buffer
786    /// @param copy_from_texture  Specifies whether memory copy from texture
787    ///                           should be performed
788    pub fn gpujpeg_opengl_texture_map(
789        texture: *mut gpujpeg_opengl_texture,
790        data_size: *mut usize,
791    ) -> *mut u8;
792}
793unsafe extern "C" {
794    /// Unmap registered OpenGL texture from CUDA and the device
795    /// pointer is no longer useable.
796    ///
797    /// @param texture
798    /// @param copy_to_texture  Specifies whether memoryc copy to texture
799    ///                         should be performed
800    pub fn gpujpeg_opengl_texture_unmap(texture: *mut gpujpeg_opengl_texture);
801}
802unsafe extern "C" {
803    /// Get color space name
804    ///
805    /// @param color_space
806    pub fn gpujpeg_color_space_get_name(
807        color_space: gpujpeg_color_space,
808    ) -> *const ::std::os::raw::c_char;
809}
810unsafe extern "C" {
811    /// Returns pixel format by string name
812    pub fn gpujpeg_pixel_format_by_name(
813        name: *const ::std::os::raw::c_char,
814    ) -> gpujpeg_pixel_format;
815}
816unsafe extern "C" {
817    pub fn gpujpeg_print_pixel_formats();
818}
819unsafe extern "C" {
820    /// Returns color space by string name
821    pub fn gpujpeg_color_space_by_name(name: *const ::std::os::raw::c_char) -> gpujpeg_color_space;
822}
823unsafe extern "C" {
824    /// Returns number of color components in pixel format
825    pub fn gpujpeg_pixel_format_get_comp_count(
826        pixel_format: gpujpeg_pixel_format,
827    ) -> ::std::os::raw::c_int;
828}
829unsafe extern "C" {
830    /// Returns name of the pixel format
831    pub fn gpujpeg_pixel_format_get_name(
832        pixel_format: gpujpeg_pixel_format,
833    ) -> *const ::std::os::raw::c_char;
834}
835unsafe extern "C" {
836    /// Returns true if a pixel format is planar
837    pub fn gpujpeg_pixel_format_is_planar(
838        pixel_format: gpujpeg_pixel_format,
839    ) -> ::std::os::raw::c_int;
840}
841unsafe extern "C" {
842    pub fn gpujpeg_device_reset();
843}
844#[repr(C)]
845#[derive(Debug, Copy, Clone)]
846pub struct gpujpeg_encoder {
847    _unused: [u8; 0],
848}
849/// Encoder will use custom input buffer
850pub const gpujpeg_encoder_input_type_GPUJPEG_ENCODER_INPUT_IMAGE: gpujpeg_encoder_input_type = 0;
851/// Encoder will use OpenGL Texture PBO Resource as input buffer
852pub const gpujpeg_encoder_input_type_GPUJPEG_ENCODER_INPUT_OPENGL_TEXTURE:
853    gpujpeg_encoder_input_type = 1;
854/// Encoder will use custom GPU input buffer
855pub const gpujpeg_encoder_input_type_GPUJPEG_ENCODER_INPUT_GPU_IMAGE: gpujpeg_encoder_input_type =
856    2;
857/// Encoder input type
858pub type gpujpeg_encoder_input_type = ::std::os::raw::c_int;
859/// Encoder input structure
860#[repr(C)]
861#[derive(Debug, Copy, Clone)]
862pub struct gpujpeg_encoder_input {
863    /// Output type
864    pub type_: gpujpeg_encoder_input_type,
865    /// Image data
866    pub image: *mut u8,
867    /// Registered OpenGL Texture
868    pub texture: *mut gpujpeg_opengl_texture,
869}
870#[allow(clippy::unnecessary_operation, clippy::identity_op)]
871const _: () = {
872    ["Size of gpujpeg_encoder_input"][::std::mem::size_of::<gpujpeg_encoder_input>() - 24usize];
873    ["Alignment of gpujpeg_encoder_input"]
874        [::std::mem::align_of::<gpujpeg_encoder_input>() - 8usize];
875    ["Offset of field: gpujpeg_encoder_input::type_"]
876        [::std::mem::offset_of!(gpujpeg_encoder_input, type_) - 0usize];
877    ["Offset of field: gpujpeg_encoder_input::image"]
878        [::std::mem::offset_of!(gpujpeg_encoder_input, image) - 8usize];
879    ["Offset of field: gpujpeg_encoder_input::texture"]
880        [::std::mem::offset_of!(gpujpeg_encoder_input, texture) - 16usize];
881};
882unsafe extern "C" {
883    /// Set encoder input to image data
884    ///
885    /// @param encoder_input  Encoder input structure
886    /// @param image  Input image data
887    /// # return
888    /// void
889    /// @sa gpujpeg_encoder_input_image
890    pub fn gpujpeg_encoder_input_set_image(input: *mut gpujpeg_encoder_input, image: *mut u8);
891}
892unsafe extern "C" {
893    /// Set encoder input to GPU image data
894    ///
895    /// @param encoder_input  Encoder input structure
896    /// @param image GPU image data
897    /// # return
898    /// void
899    /// @sa gpujpeg_encoder_input_gpu_image
900    pub fn gpujpeg_encoder_input_set_gpu_image(input: *mut gpujpeg_encoder_input, image: *mut u8);
901}
902unsafe extern "C" {
903    /// Set encoder input to OpenGL texture
904    ///
905    /// @param encoder_input  Encoder input structure
906    /// @param texture_id  OpenGL texture id
907    /// # return
908    /// void
909    /// @sa gpujpeg_encoder_input_set_texture
910    pub fn gpujpeg_encoder_input_set_texture(
911        input: *mut gpujpeg_encoder_input,
912        texture: *mut gpujpeg_opengl_texture,
913    );
914}
915unsafe extern "C" {
916    /// alternative to @ref gpujpeg_encoder_input_set_image returning the struct as a return value
917    pub fn gpujpeg_encoder_input_image(image: *mut u8) -> gpujpeg_encoder_input;
918}
919unsafe extern "C" {
920    /// alternative to @ref gpujpeg_encoder_input_set_gpu_image returning the struct as a return value
921    pub fn gpujpeg_encoder_input_gpu_image(image: *mut u8) -> gpujpeg_encoder_input;
922}
923unsafe extern "C" {
924    /// alternative to @ref gpujpeg_encoder_input_set_texture returning the struct as a return value
925    pub fn gpujpeg_encoder_input_texture(
926        texture: *mut gpujpeg_opengl_texture,
927    ) -> gpujpeg_encoder_input;
928}
929unsafe extern "C" {
930    /// Create JPEG encoder
931    ///
932    /// @param stream CUDA stream to be used, may be cudaStreamDefault (0x00)
933    /// # return
934    /// encoder structure if succeeds, otherwise NULL
935    pub fn gpujpeg_encoder_create(stream: cudaStream_t) -> *mut gpujpeg_encoder;
936}
937unsafe extern "C" {
938    /// Compute maximum number of image pixels (width x height) which can be encoded by given memory size.
939    ///
940    /// @param encoder
941    /// @param param
942    /// @param param_image
943    /// @param image_input_type
944    /// @param memory_size
945    /// @param max_pixels
946    /// # return
947    /// size of used device memory in bytes if succeeds, otherwise 0
948    pub fn gpujpeg_encoder_max_pixels(
949        param: *mut gpujpeg_parameters,
950        param_image: *mut gpujpeg_image_parameters,
951        image_input_type: gpujpeg_encoder_input_type,
952        memory_size: usize,
953        max_pixels: *mut ::std::os::raw::c_int,
954    ) -> usize;
955}
956unsafe extern "C" {
957    /// Compute maximum size of device memory which will be used for encoding image with given number of pixels.
958    ///
959    /// @param encoder
960    /// @param param
961    /// @param param_image
962    /// @param image_input_type
963    /// @param max_pixels
964    /// # return
965    /// size of required device memory in bytes if succeeds, otherwise 0
966    pub fn gpujpeg_encoder_max_memory(
967        param: *mut gpujpeg_parameters,
968        param_image: *mut gpujpeg_image_parameters,
969        image_input_type: gpujpeg_encoder_input_type,
970        max_pixels: ::std::os::raw::c_int,
971    ) -> usize;
972}
973unsafe extern "C" {
974    /// Pre-allocate all encoding buffers for given image pixels.
975    ///
976    /// @param encoder
977    /// @param param
978    /// @param param_image
979    /// @param image_input_type
980    /// # return
981    /// 0 if succeeds, otherwise nonzero
982    pub fn gpujpeg_encoder_allocate(
983        encoder: *mut gpujpeg_encoder,
984        param: *const gpujpeg_parameters,
985        param_image: *const gpujpeg_image_parameters,
986        image_input_type: gpujpeg_encoder_input_type,
987    ) -> ::std::os::raw::c_int;
988}
989unsafe extern "C" {
990    /// Compress image by encoder
991    ///
992    /// @param encoder  Encoder structure
993    /// @param param  Parameters for coder
994    /// @param param_image  Parameters for image data
995    /// @param image  Source image data
996    /// @param[out] image_compressed  Pointer to variable where compressed image data buffer will be placed.
997    ///                               Returned host buffer is owned by encoder and must not be freed by the caller.
998    ///                               Buffer is valid until next gpujpeg_encoder_encode() call.
999    /// @param[out] image_compressed_size  Pointer to variable where compressed image size will be placed.
1000    /// # return
1001    /// 0 if succeeds, otherwise nonzero
1002    pub fn gpujpeg_encoder_encode(
1003        encoder: *mut gpujpeg_encoder,
1004        param: *const gpujpeg_parameters,
1005        param_image: *const gpujpeg_image_parameters,
1006        input: *const gpujpeg_encoder_input,
1007        image_compressed: *mut *mut u8,
1008        image_compressed_size: *mut usize,
1009    ) -> ::std::os::raw::c_int;
1010}
1011unsafe extern "C" {
1012    /// Returns duration statistics for last encoded image
1013    /// # return
1014    /// 0 if succeeds, otherwise nonzero
1015    /// # note
1016    /// The values are only informative and for debugging only and thus this is
1017    /// not considered as a part of a public API.
1018    /// @deprecated
1019    /// The encoder now prints the statistics to stdout if gpujpeg_parameters.perf_stats is set.
1020    /// May be removed in future versions - please report if using this function.
1021    pub fn gpujpeg_encoder_get_stats(
1022        encoder: *mut gpujpeg_encoder,
1023        stats: *mut gpujpeg_duration_stats,
1024    ) -> ::std::os::raw::c_int;
1025}
1026/// for 1 or 3 channel @ref GPUJPEG_YCBCR_JPEG @ref GPUJPEG_HEADER_JFIF, for @ref
1027/// GPUJPEG_RGB @ref GPUJPEG_HEADER_ADOBE, @ref GPUJPEG_HEADER_SPIFF otherwise
1028pub const gpujpeg_header_type_GPUJPEG_HEADER_DEFAULT: gpujpeg_header_type = 0;
1029pub const gpujpeg_header_type_GPUJPEG_HEADER_JFIF: gpujpeg_header_type = 1;
1030pub const gpujpeg_header_type_GPUJPEG_HEADER_SPIFF: gpujpeg_header_type = 2;
1031/// Adobe APP8 header
1032pub const gpujpeg_header_type_GPUJPEG_HEADER_ADOBE: gpujpeg_header_type = 4;
1033pub type gpujpeg_header_type = ::std::os::raw::c_int;
1034unsafe extern "C" {
1035    /// Forces JPEG header to be emitted.
1036    ///
1037    /// Header type should be capable of describing the resulting JPEG, eg. JFIF only for BT.601
1038    /// full-scale YCbCr images. If not, resulting JPEG image may be incompatible with decoders.
1039    pub fn gpujpeg_encoder_set_jpeg_header(
1040        encoder: *mut gpujpeg_encoder,
1041        header_type: gpujpeg_header_type,
1042    );
1043}
1044unsafe extern "C" {
1045    /// Suggests optimal restart interval to be used for given param_image balancing both image
1046    /// size and performance.
1047    /// @param subsampling 444 422 or 420
1048    pub fn gpujpeg_encoder_suggest_restart_interval(
1049        param_image: *const gpujpeg_image_parameters,
1050        subsampling: gpujpeg_sampling_factor_t,
1051        interleaved: bool,
1052        verbose: ::std::os::raw::c_int,
1053    ) -> ::std::os::raw::c_int;
1054}
1055unsafe extern "C" {
1056    /// sets encoder option
1057    /// @retval GPUJPEG_NOERR  option was sucessfully set
1058    /// @retval GPUJPEG_ERROR  invalid argument passed
1059    pub fn gpujpeg_encoder_set_option(
1060        encoder: *mut gpujpeg_encoder,
1061        opt: *const ::std::os::raw::c_char,
1062        val: *const ::std::os::raw::c_char,
1063    ) -> ::std::os::raw::c_int;
1064}
1065unsafe extern "C" {
1066    /// Destory JPEG encoder
1067    ///
1068    /// @param encoder  Encoder structure
1069    /// # return
1070    /// 0 if succeeds, otherwise nonzero
1071    pub fn gpujpeg_encoder_destroy(encoder: *mut gpujpeg_encoder) -> ::std::os::raw::c_int;
1072}
1073#[repr(C)]
1074#[derive(Debug, Copy, Clone)]
1075pub struct gpujpeg_decoder {
1076    _unused: [u8; 0],
1077}
1078/// Decoder will use it's internal output buffer
1079pub const gpujpeg_decoder_output_type_GPUJPEG_DECODER_OUTPUT_INTERNAL_BUFFER:
1080    gpujpeg_decoder_output_type = 0;
1081/// Decoder will use custom output buffer
1082pub const gpujpeg_decoder_output_type_GPUJPEG_DECODER_OUTPUT_CUSTOM_BUFFER:
1083    gpujpeg_decoder_output_type = 1;
1084/// Decoder will use OpenGL Texture PBO Resource as output buffer
1085pub const gpujpeg_decoder_output_type_GPUJPEG_DECODER_OUTPUT_OPENGL_TEXTURE:
1086    gpujpeg_decoder_output_type = 2;
1087/// Decoder will use internal CUDA buffer as output buffer
1088pub const gpujpeg_decoder_output_type_GPUJPEG_DECODER_OUTPUT_CUDA_BUFFER:
1089    gpujpeg_decoder_output_type = 3;
1090/// Decoder will use custom CUDA buffer as output buffer
1091pub const gpujpeg_decoder_output_type_GPUJPEG_DECODER_OUTPUT_CUSTOM_CUDA_BUFFER:
1092    gpujpeg_decoder_output_type = 4;
1093/// Decoder output type
1094pub type gpujpeg_decoder_output_type = ::std::os::raw::c_int;
1095/// Decoder output structure
1096#[repr(C)]
1097#[derive(Debug, Copy, Clone)]
1098pub struct gpujpeg_decoder_output {
1099    /// Output type
1100    pub type_: gpujpeg_decoder_output_type,
1101    /// Decompressed data
1102    pub data: *mut u8,
1103    /// Decompressed data size
1104    pub data_size: usize,
1105    /// Decoded image parameters
1106    pub param_image: gpujpeg_image_parameters,
1107    /// OpenGL texture
1108    pub texture: *mut gpujpeg_opengl_texture,
1109}
1110#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1111const _: () = {
1112    ["Size of gpujpeg_decoder_output"][::std::mem::size_of::<gpujpeg_decoder_output>() - 56usize];
1113    ["Alignment of gpujpeg_decoder_output"]
1114        [::std::mem::align_of::<gpujpeg_decoder_output>() - 8usize];
1115    ["Offset of field: gpujpeg_decoder_output::type_"]
1116        [::std::mem::offset_of!(gpujpeg_decoder_output, type_) - 0usize];
1117    ["Offset of field: gpujpeg_decoder_output::data"]
1118        [::std::mem::offset_of!(gpujpeg_decoder_output, data) - 8usize];
1119    ["Offset of field: gpujpeg_decoder_output::data_size"]
1120        [::std::mem::offset_of!(gpujpeg_decoder_output, data_size) - 16usize];
1121    ["Offset of field: gpujpeg_decoder_output::param_image"]
1122        [::std::mem::offset_of!(gpujpeg_decoder_output, param_image) - 24usize];
1123    ["Offset of field: gpujpeg_decoder_output::texture"]
1124        [::std::mem::offset_of!(gpujpeg_decoder_output, texture) - 48usize];
1125};
1126/// @sa gpujpeg_parametes
1127/// call gpujpeg_decoder_default_init_parameters() to initialize"]
1128#[repr(C)]
1129#[derive(Debug, Copy, Clone)]
1130pub struct gpujpeg_decoder_init_parameters {
1131    /// stream CUDA stream to be used, cudaStreamDefault (0x00) is default
1132    pub stream: cudaStream_t,
1133    /// verbosity level (-1 - quiet, 0 - normal, 1 - verbose)
1134    pub verbose: ::std::os::raw::c_int,
1135    /// print performance statistics on output
1136    pub perf_stats: bool,
1137    /// if FFmpeg specific COM marker \"CS=ITU601\" present, interpret the data as
1138    /// limited-range BT.709 not BT.601
1139    pub ff_cs_itu601_is_709: bool,
1140}
1141#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1142const _: () = {
1143    ["Size of gpujpeg_decoder_init_parameters"]
1144        [::std::mem::size_of::<gpujpeg_decoder_init_parameters>() - 16usize];
1145    ["Alignment of gpujpeg_decoder_init_parameters"]
1146        [::std::mem::align_of::<gpujpeg_decoder_init_parameters>() - 8usize];
1147    ["Offset of field: gpujpeg_decoder_init_parameters::stream"]
1148        [::std::mem::offset_of!(gpujpeg_decoder_init_parameters, stream) - 0usize];
1149    ["Offset of field: gpujpeg_decoder_init_parameters::verbose"]
1150        [::std::mem::offset_of!(gpujpeg_decoder_init_parameters, verbose) - 8usize];
1151    ["Offset of field: gpujpeg_decoder_init_parameters::perf_stats"]
1152        [::std::mem::offset_of!(gpujpeg_decoder_init_parameters, perf_stats) - 12usize];
1153    ["Offset of field: gpujpeg_decoder_init_parameters::ff_cs_itu601_is_709"]
1154        [::std::mem::offset_of!(gpujpeg_decoder_init_parameters, ff_cs_itu601_is_709) - 13usize];
1155};
1156unsafe extern "C" {
1157    /// Set default parameters to decoder output structure
1158    ///
1159    /// @param output  Decoder output structure
1160    /// # return
1161    /// void
1162    pub fn gpujpeg_decoder_output_set_default(output: *mut gpujpeg_decoder_output);
1163}
1164unsafe extern "C" {
1165    /// Setup decoder output to custom buffer
1166    ///
1167    /// @param output        Decoder output structure
1168    /// @param custom_buffer Custom buffer
1169    /// # return
1170    /// void
1171    pub fn gpujpeg_decoder_output_set_custom(
1172        output: *mut gpujpeg_decoder_output,
1173        custom_buffer: *mut u8,
1174    );
1175}
1176unsafe extern "C" {
1177    /// Set decoder output to OpenGL texture
1178    ///
1179    /// @param output  Decoder output structure
1180    /// # return
1181    /// void
1182    pub fn gpujpeg_decoder_output_set_texture(
1183        output: *mut gpujpeg_decoder_output,
1184        texture: *mut gpujpeg_opengl_texture,
1185    );
1186}
1187unsafe extern "C" {
1188    /// Sets output to CUDA buffer
1189    ///
1190    /// @param output  Decoder output structure
1191    pub fn gpujpeg_decoder_output_set_cuda_buffer(output: *mut gpujpeg_decoder_output);
1192}
1193unsafe extern "C" {
1194    /// Setup decoder output to custom CUDA buffer
1195    ///
1196    /// @param output          Decoder output structure
1197    /// @param d_custom_buffer Custom buffer in CUDA device memory
1198    /// # return
1199    /// void
1200    pub fn gpujpeg_decoder_output_set_custom_cuda(
1201        output: *mut gpujpeg_decoder_output,
1202        d_custom_buffer: *mut u8,
1203    );
1204}
1205unsafe extern "C" {
1206    /// Create JPEG decoder
1207    ///
1208    /// @sa gpujpeg_decoder_create_with_params
1209    /// @param stream CUDA stream to be used, may be cudaStreamDefault (0x00)
1210    /// # return
1211    /// decoder structure if succeeds, otherwise NULL
1212    pub fn gpujpeg_decoder_create(stream: cudaStream_t) -> *mut gpujpeg_decoder;
1213}
1214unsafe extern "C" {
1215    pub fn gpujpeg_decoder_default_init_parameters() -> gpujpeg_decoder_init_parameters;
1216}
1217
1218unsafe extern "C" {
1219    /// @brief Create JPEG decoder - extended versison
1220
1221    /// This version is an alternative to gpujpeg_decoder_create() allowing setting more parameters during initialization
1222    /// (verbose, perf_stats). Previously, if those needed to be set, it the decoder must have been configured with
1223    /// gpujpeg_decoder_init().
1224    ///
1225    /// @sa gpujpeg_decoder_create
1226    /// # return
1227    /// decoder structure if succeeds, otherwise NULL
1228    pub fn gpujpeg_decoder_create_with_params(
1229        params: *const gpujpeg_decoder_init_parameters,
1230    ) -> *mut gpujpeg_decoder;
1231}
1232unsafe extern "C" {
1233    /// Init JPEG decoder for specific image properties
1234    ///
1235    /// Following properties are relevant:
1236    /// - image dimensions, commonent count
1237    /// - output pixel format that will be requested
1238    /// - interleaving, restart interval, color_space_internal (usually GPUJPEG_YCBCR_BT601_256LVLS)
1239    /// - correct subsampling setting
1240    ///
1241    /// # note
1242    /// Doesn't need to be called from user code, buffers will be initialized automatically according to
1243    /// image properties during decompression.
1244    ///
1245    /// @param decoder  Decoder structure
1246    /// @param[in] param        Parameters for coder, pointed structure is copied
1247    /// @param[in] param_image  Parameters for image data, pointed structure is copied
1248    /// # return
1249    /// 0 if succeeds, otherwise nonzero
1250    pub fn gpujpeg_decoder_init(
1251        decoder: *mut gpujpeg_decoder,
1252        param: *const gpujpeg_parameters,
1253        param_image: *const gpujpeg_image_parameters,
1254    ) -> ::std::os::raw::c_int;
1255}
1256unsafe extern "C" {
1257    /// Decompress image by decoder
1258    ///
1259    /// @param decoder  Decoder structure
1260    /// @param image  Source image data
1261    /// @param image_size  Source image data size
1262    /// @param image_decompressed  Pointer to variable where decompressed image data buffer will be placed
1263    /// @param image_decompressed_size  Pointer to variable where decompressed image size will be placed
1264    /// # return
1265    /// @ref Errors
1266    pub fn gpujpeg_decoder_decode(
1267        decoder: *mut gpujpeg_decoder,
1268        image: *mut u8,
1269        image_size: usize,
1270        output: *mut gpujpeg_decoder_output,
1271    ) -> ::std::os::raw::c_int;
1272}
1273unsafe extern "C" {
1274    /// Returns duration statistics for last decoded image
1275    /// # return
1276    /// 0 if succeeds, otherwise nonzero
1277    /// # note
1278    /// The values are only informative and for debugging only and thus this is
1279    /// not considered as a part of a public API.
1280    /// @deprecated
1281    /// The decoder now prints the statistics to stdout if gpujpeg_parameters.perf_stats is set.
1282    /// May be removed in future versions - please report if using this function.
1283    pub fn gpujpeg_decoder_get_stats(
1284        decoder: *mut gpujpeg_decoder,
1285        stats: *mut gpujpeg_duration_stats,
1286    ) -> ::std::os::raw::c_int;
1287}
1288unsafe extern "C" {
1289    /// Destory JPEG decoder
1290    ///
1291    /// @param decoder  Decoder structure
1292    /// # return
1293    /// 0 if succeeds, otherwise nonzero
1294    pub fn gpujpeg_decoder_destroy(decoder: *mut gpujpeg_decoder) -> ::std::os::raw::c_int;
1295}
1296unsafe extern "C" {
1297    /// Sets output format
1298    ///
1299    /// If not called, @ref GPUJPEG_CS_DEFAULT and @ref GPUJPEG_PIXFMT_AUTODETECT
1300    /// are used.
1301    ///
1302    /// @param decoder         Decoder structure
1303    /// @param color_space     Requested output color space,
1304    ///                        use @ref GPUJPEG_NONE to keep JPEG internal color space;
1305    ///                        special value @ref GPUJPEG_CS_DEFAULT to decode RGB
1306    ///                        (or luma for grayscale)
1307    /// @param sampling_factor Requestd color sampling factor; special values
1308    ///                        @ref decoder_pixfmt_placeholders can be used
1309    pub fn gpujpeg_decoder_set_output_format(
1310        decoder: *mut gpujpeg_decoder,
1311        color_space: gpujpeg_color_space,
1312        pixel_format: gpujpeg_pixel_format,
1313    );
1314}
1315unsafe extern "C" {
1316    /// @copydoc gpujpeg_reader_get_image_info
1317    pub fn gpujpeg_decoder_get_image_info(
1318        image: *mut u8,
1319        image_size: usize,
1320        param_image: *mut gpujpeg_image_parameters,
1321        param: *mut gpujpeg_parameters,
1322        segment_count: *mut ::std::os::raw::c_int,
1323    ) -> ::std::os::raw::c_int;
1324}
1325unsafe extern "C" {
1326    /// sets decoder option
1327    /// @retval GPUJPEG_NOERR  option was sucessfully set
1328    /// @retval GPUJPEG_ERROR  invalid argument passed
1329    pub fn gpujpeg_decoder_set_option(
1330        decoder: *mut gpujpeg_decoder,
1331        opt: *const ::std::os::raw::c_char,
1332        val: *const ::std::os::raw::c_char,
1333    ) -> ::std::os::raw::c_int;
1334}
1335/// Texture PBO resource for CUDA
1336#[repr(C)]
1337#[derive(Debug, Copy, Clone)]
1338pub struct cudaGraphicsResource {
1339    pub _address: u8,
1340}