turbojpeg-sys 0.1.0

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

pub const TJ_NUMSAMP: u32 = 6;
pub const TJ_NUMPF: u32 = 12;
pub const TJ_NUMCS: u32 = 5;
pub const TJFLAG_BOTTOMUP: u32 = 2;
pub const TJFLAG_FASTUPSAMPLE: u32 = 256;
pub const TJFLAG_NOREALLOC: u32 = 1024;
pub const TJFLAG_FASTDCT: u32 = 2048;
pub const TJFLAG_ACCURATEDCT: u32 = 4096;
pub const TJFLAG_STOPONWARNING: u32 = 8192;
pub const TJFLAG_PROGRESSIVE: u32 = 16384;
pub const TJ_NUMERR: u32 = 2;
pub const TJ_NUMXOP: u32 = 8;
pub const TJXOPT_PERFECT: u32 = 1;
pub const TJXOPT_TRIM: u32 = 2;
pub const TJXOPT_CROP: u32 = 4;
pub const TJXOPT_GRAY: u32 = 8;
pub const TJXOPT_NOOUTPUT: u32 = 16;
pub const TJXOPT_PROGRESSIVE: u32 = 32;
pub const TJXOPT_COPYNONE: u32 = 64;
pub const TJFLAG_FORCEMMX: u32 = 8;
pub const TJFLAG_FORCESSE: u32 = 16;
pub const TJFLAG_FORCESSE2: u32 = 32;
pub const TJFLAG_FORCESSE3: u32 = 128;
pub const NUMSUBOPT: u32 = 6;
pub const TJ_BGR: u32 = 1;
pub const TJ_BOTTOMUP: u32 = 2;
pub const TJ_FORCEMMX: u32 = 8;
pub const TJ_FORCESSE: u32 = 16;
pub const TJ_FORCESSE2: u32 = 32;
pub const TJ_ALPHAFIRST: u32 = 64;
pub const TJ_FORCESSE3: u32 = 128;
pub const TJ_FASTUPSAMPLE: u32 = 256;
pub const TJ_YUV: u32 = 512;
pub const TJSAMP_TJSAMP_444: TJSAMP = 0;
pub const TJSAMP_TJSAMP_422: TJSAMP = 1;
pub const TJSAMP_TJSAMP_420: TJSAMP = 2;
pub const TJSAMP_TJSAMP_GRAY: TJSAMP = 3;
pub const TJSAMP_TJSAMP_440: TJSAMP = 4;
pub const TJSAMP_TJSAMP_411: TJSAMP = 5;
pub type TJSAMP = libc::c_uint;
extern "C" {
    pub static tjMCUWidth: [libc::c_int; 6usize];
}
extern "C" {
    pub static tjMCUHeight: [libc::c_int; 6usize];
}
pub const TJPF_TJPF_RGB: TJPF = 0;
pub const TJPF_TJPF_BGR: TJPF = 1;
pub const TJPF_TJPF_RGBX: TJPF = 2;
pub const TJPF_TJPF_BGRX: TJPF = 3;
pub const TJPF_TJPF_XBGR: TJPF = 4;
pub const TJPF_TJPF_XRGB: TJPF = 5;
pub const TJPF_TJPF_GRAY: TJPF = 6;
pub const TJPF_TJPF_RGBA: TJPF = 7;
pub const TJPF_TJPF_BGRA: TJPF = 8;
pub const TJPF_TJPF_ABGR: TJPF = 9;
pub const TJPF_TJPF_ARGB: TJPF = 10;
pub const TJPF_TJPF_CMYK: TJPF = 11;
pub const TJPF_TJPF_UNKNOWN: TJPF = -1;
pub type TJPF = libc::c_int;
extern "C" {
    pub static tjRedOffset: [libc::c_int; 12usize];
}
extern "C" {
    pub static tjGreenOffset: [libc::c_int; 12usize];
}
extern "C" {
    pub static tjBlueOffset: [libc::c_int; 12usize];
}
extern "C" {
    pub static tjAlphaOffset: [libc::c_int; 12usize];
}
extern "C" {
    pub static tjPixelSize: [libc::c_int; 12usize];
}
pub const TJCS_TJCS_RGB: TJCS = 0;
pub const TJCS_TJCS_YCbCr: TJCS = 1;
pub const TJCS_TJCS_GRAY: TJCS = 2;
pub const TJCS_TJCS_CMYK: TJCS = 3;
pub const TJCS_TJCS_YCCK: TJCS = 4;
pub type TJCS = libc::c_uint;
pub const TJERR_TJERR_WARNING: TJERR = 0;
pub const TJERR_TJERR_FATAL: TJERR = 1;
pub type TJERR = libc::c_uint;
pub const TJXOP_TJXOP_NONE: TJXOP = 0;
pub const TJXOP_TJXOP_HFLIP: TJXOP = 1;
pub const TJXOP_TJXOP_VFLIP: TJXOP = 2;
pub const TJXOP_TJXOP_TRANSPOSE: TJXOP = 3;
pub const TJXOP_TJXOP_TRANSVERSE: TJXOP = 4;
pub const TJXOP_TJXOP_ROT90: TJXOP = 5;
pub const TJXOP_TJXOP_ROT180: TJXOP = 6;
pub const TJXOP_TJXOP_ROT270: TJXOP = 7;
pub type TJXOP = libc::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tjscalingfactor {
    pub num: libc::c_int,
    pub denom: libc::c_int,
}
#[test]
fn bindgen_test_layout_tjscalingfactor() {
    assert_eq!(
        ::core::mem::size_of::<tjscalingfactor>(),
        8usize,
        concat!("Size of: ", stringify!(tjscalingfactor))
    );
    assert_eq!(
        ::core::mem::align_of::<tjscalingfactor>(),
        4usize,
        concat!("Alignment of ", stringify!(tjscalingfactor))
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjscalingfactor>())).num as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(tjscalingfactor),
            "::",
            stringify!(num)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjscalingfactor>())).denom as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(tjscalingfactor),
            "::",
            stringify!(denom)
        )
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tjregion {
    pub x: libc::c_int,
    pub y: libc::c_int,
    pub w: libc::c_int,
    pub h: libc::c_int,
}
#[test]
fn bindgen_test_layout_tjregion() {
    assert_eq!(
        ::core::mem::size_of::<tjregion>(),
        16usize,
        concat!("Size of: ", stringify!(tjregion))
    );
    assert_eq!(
        ::core::mem::align_of::<tjregion>(),
        4usize,
        concat!("Alignment of ", stringify!(tjregion))
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjregion>())).x as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(tjregion),
            "::",
            stringify!(x)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjregion>())).y as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(tjregion),
            "::",
            stringify!(y)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjregion>())).w as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(tjregion),
            "::",
            stringify!(w)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjregion>())).h as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(tjregion),
            "::",
            stringify!(h)
        )
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tjtransform {
    pub r: tjregion,
    pub op: libc::c_int,
    pub options: libc::c_int,
    pub data: *mut libc::c_void,
    pub customFilter: ::core::option::Option<
        unsafe extern "C" fn(
            coeffs: *mut libc::c_short,
            arrayRegion: tjregion,
            planeRegion: tjregion,
            componentIndex: libc::c_int,
            transformIndex: libc::c_int,
            transform: *mut tjtransform,
        ) -> libc::c_int,
    >,
}
#[test]
fn bindgen_test_layout_tjtransform() {
    assert_eq!(
        ::core::mem::size_of::<tjtransform>(),
        40usize,
        concat!("Size of: ", stringify!(tjtransform))
    );
    assert_eq!(
        ::core::mem::align_of::<tjtransform>(),
        8usize,
        concat!("Alignment of ", stringify!(tjtransform))
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjtransform>())).r as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(tjtransform),
            "::",
            stringify!(r)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjtransform>())).op as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(tjtransform),
            "::",
            stringify!(op)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjtransform>())).options as *const _ as usize },
        20usize,
        concat!(
            "Offset of field: ",
            stringify!(tjtransform),
            "::",
            stringify!(options)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjtransform>())).data as *const _ as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(tjtransform),
            "::",
            stringify!(data)
        )
    );
    assert_eq!(
        unsafe { &(*(::core::ptr::null::<tjtransform>())).customFilter as *const _ as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(tjtransform),
            "::",
            stringify!(customFilter)
        )
    );
}
pub type tjhandle = *mut libc::c_void;
extern "C" {
    pub fn tjInitCompress() -> tjhandle;
}
extern "C" {
    pub fn tjCompress2(
        handle: tjhandle,
        srcBuf: *const libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        jpegBuf: *mut *mut libc::c_uchar,
        jpegSize: *mut libc::c_ulong,
        jpegSubsamp: libc::c_int,
        jpegQual: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjCompressFromYUV(
        handle: tjhandle,
        srcBuf: *const libc::c_uchar,
        width: libc::c_int,
        pad: libc::c_int,
        height: libc::c_int,
        subsamp: libc::c_int,
        jpegBuf: *mut *mut libc::c_uchar,
        jpegSize: *mut libc::c_ulong,
        jpegQual: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjCompressFromYUVPlanes(
        handle: tjhandle,
        srcPlanes: *mut *const libc::c_uchar,
        width: libc::c_int,
        strides: *const libc::c_int,
        height: libc::c_int,
        subsamp: libc::c_int,
        jpegBuf: *mut *mut libc::c_uchar,
        jpegSize: *mut libc::c_ulong,
        jpegQual: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjBufSize(
        width: libc::c_int,
        height: libc::c_int,
        jpegSubsamp: libc::c_int,
    ) -> libc::c_ulong;
}
extern "C" {
    pub fn tjBufSizeYUV2(
        width: libc::c_int,
        pad: libc::c_int,
        height: libc::c_int,
        subsamp: libc::c_int,
    ) -> libc::c_ulong;
}
extern "C" {
    pub fn tjPlaneSizeYUV(
        componentID: libc::c_int,
        width: libc::c_int,
        stride: libc::c_int,
        height: libc::c_int,
        subsamp: libc::c_int,
    ) -> libc::c_ulong;
}
extern "C" {
    pub fn tjPlaneWidth(
        componentID: libc::c_int,
        width: libc::c_int,
        subsamp: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjPlaneHeight(
        componentID: libc::c_int,
        height: libc::c_int,
        subsamp: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjEncodeYUV3(
        handle: tjhandle,
        srcBuf: *const libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        dstBuf: *mut libc::c_uchar,
        pad: libc::c_int,
        subsamp: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjEncodeYUVPlanes(
        handle: tjhandle,
        srcBuf: *const libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        dstPlanes: *mut *mut libc::c_uchar,
        strides: *mut libc::c_int,
        subsamp: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjInitDecompress() -> tjhandle;
}
extern "C" {
    pub fn tjDecompressHeader3(
        handle: tjhandle,
        jpegBuf: *const libc::c_uchar,
        jpegSize: libc::c_ulong,
        width: *mut libc::c_int,
        height: *mut libc::c_int,
        jpegSubsamp: *mut libc::c_int,
        jpegColorspace: *mut libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjGetScalingFactors(numscalingfactors: *mut libc::c_int) -> *mut tjscalingfactor;
}
extern "C" {
    pub fn tjDecompress2(
        handle: tjhandle,
        jpegBuf: *const libc::c_uchar,
        jpegSize: libc::c_ulong,
        dstBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecompressToYUV2(
        handle: tjhandle,
        jpegBuf: *const libc::c_uchar,
        jpegSize: libc::c_ulong,
        dstBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pad: libc::c_int,
        height: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecompressToYUVPlanes(
        handle: tjhandle,
        jpegBuf: *const libc::c_uchar,
        jpegSize: libc::c_ulong,
        dstPlanes: *mut *mut libc::c_uchar,
        width: libc::c_int,
        strides: *mut libc::c_int,
        height: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecodeYUV(
        handle: tjhandle,
        srcBuf: *const libc::c_uchar,
        pad: libc::c_int,
        subsamp: libc::c_int,
        dstBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecodeYUVPlanes(
        handle: tjhandle,
        srcPlanes: *mut *const libc::c_uchar,
        strides: *const libc::c_int,
        subsamp: libc::c_int,
        dstBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjInitTransform() -> tjhandle;
}
extern "C" {
    pub fn tjTransform(
        handle: tjhandle,
        jpegBuf: *const libc::c_uchar,
        jpegSize: libc::c_ulong,
        n: libc::c_int,
        dstBufs: *mut *mut libc::c_uchar,
        dstSizes: *mut libc::c_ulong,
        transforms: *mut tjtransform,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDestroy(handle: tjhandle) -> libc::c_int;
}
extern "C" {
    pub fn tjAlloc(bytes: libc::c_int) -> *mut libc::c_uchar;
}
extern "C" {
    pub fn tjLoadImage(
        filename: *const libc::c_char,
        width: *mut libc::c_int,
        align: libc::c_int,
        height: *mut libc::c_int,
        pixelFormat: *mut libc::c_int,
        flags: libc::c_int,
    ) -> *mut libc::c_uchar;
}
extern "C" {
    pub fn tjSaveImage(
        filename: *const libc::c_char,
        buffer: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjFree(buffer: *mut libc::c_uchar);
}
extern "C" {
    pub fn tjGetErrorStr2(handle: tjhandle) -> *mut libc::c_char;
}
extern "C" {
    pub fn tjGetErrorCode(handle: tjhandle) -> libc::c_int;
}
extern "C" {
    pub fn TJBUFSIZE(width: libc::c_int, height: libc::c_int) -> libc::c_ulong;
}
extern "C" {
    pub fn TJBUFSIZEYUV(
        width: libc::c_int,
        height: libc::c_int,
        jpegSubsamp: libc::c_int,
    ) -> libc::c_ulong;
}
extern "C" {
    pub fn tjBufSizeYUV(
        width: libc::c_int,
        height: libc::c_int,
        subsamp: libc::c_int,
    ) -> libc::c_ulong;
}
extern "C" {
    pub fn tjCompress(
        handle: tjhandle,
        srcBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelSize: libc::c_int,
        dstBuf: *mut libc::c_uchar,
        compressedSize: *mut libc::c_ulong,
        jpegSubsamp: libc::c_int,
        jpegQual: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjEncodeYUV(
        handle: tjhandle,
        srcBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelSize: libc::c_int,
        dstBuf: *mut libc::c_uchar,
        subsamp: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjEncodeYUV2(
        handle: tjhandle,
        srcBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelFormat: libc::c_int,
        dstBuf: *mut libc::c_uchar,
        subsamp: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecompressHeader(
        handle: tjhandle,
        jpegBuf: *mut libc::c_uchar,
        jpegSize: libc::c_ulong,
        width: *mut libc::c_int,
        height: *mut libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecompressHeader2(
        handle: tjhandle,
        jpegBuf: *mut libc::c_uchar,
        jpegSize: libc::c_ulong,
        width: *mut libc::c_int,
        height: *mut libc::c_int,
        jpegSubsamp: *mut libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecompress(
        handle: tjhandle,
        jpegBuf: *mut libc::c_uchar,
        jpegSize: libc::c_ulong,
        dstBuf: *mut libc::c_uchar,
        width: libc::c_int,
        pitch: libc::c_int,
        height: libc::c_int,
        pixelSize: libc::c_int,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjDecompressToYUV(
        handle: tjhandle,
        jpegBuf: *mut libc::c_uchar,
        jpegSize: libc::c_ulong,
        dstBuf: *mut libc::c_uchar,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn tjGetErrorStr() -> *mut libc::c_char;
}