-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpytj.h
44 lines (36 loc) · 1.01 KB
/
pytj.h
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
#ifndef _PYTJ_H
#define _PYTJ_H
#include <turbojpeg.h>
typedef struct {
tjhandle tj_enc;
tjhandle tj_dec;
} TJContext;
typedef struct {
int success;
unsigned char *buf;
unsigned int width;
unsigned int height;
int subsamp;
} DecodeRes;
typedef struct {
int success;
unsigned char *buf;
unsigned int len;
unsigned int width;
unsigned int height;
int subsamp;
} DecodeYUVRes;
typedef struct {
int success;
unsigned char *buf;
unsigned long len;
} EncodeRes;
TJContext *create_tjcontext(void);
void free_tjcontext(TJContext *ctx);
EncodeRes encode_image(TJContext *ctx, unsigned long _buf, unsigned int width, unsigned int height, int pixel_format, int subsamp, int quality, int flags);
void free_encoded_image(void *buf);
DecodeRes decode_image(TJContext *ctx, char *buf, unsigned long len, int pixel_format, int flags);
void free_decoded_image(void *buf);
DecodeYUVRes decode_image_to_yuv(TJContext *ctx, char *buf, unsigned long len, int flags);
void free_decoded_yuv_image(void *buf);
#endif