roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
tjpgd.h
Go to the documentation of this file.
1
/*----------------------------------------------------------------------------/
2
/ TJpgDec - Tiny JPEG Decompressor R0.03 include file (C)ChaN, 2021
3
/----------------------------------------------------------------------------*/
4
#ifndef DEF_TJPGDEC
5
#define DEF_TJPGDEC
6
7
#ifdef __cplusplus
8
extern
"C"
{
9
#endif
10
11
#include "
tjpgdcnf.h
"
12
#include <string.h>
13
14
#if defined(_WIN32)
/* VC++ or some compiler without stdint.h */
15
typedef
unsigned
char
uint8_t;
16
typedef
unsigned
short
uint16_t;
17
typedef
short
int16_t;
18
typedef
unsigned
long
uint32_t;
19
typedef
long
int32_t;
20
#else
/* Embedded platform */
21
#include <stdint.h>
22
#endif
23
24
#if JD_FASTDECODE >= 1
25
typedef
int16_t
jd_yuv_t
;
26
#else
27
typedef
uint8_t
jd_yuv_t
;
28
#endif
29
30
31
/* Error code */
32
typedef
enum
{
33
JDR_OK
= 0,
/* 0: Succeeded */
34
JDR_INTR
,
/* 1: Interrupted by output function */
35
JDR_INP
,
/* 2: Device error or wrong termination of input stream */
36
JDR_MEM1
,
/* 3: Insufficient memory pool for the image */
37
JDR_MEM2
,
/* 4: Insufficient stream input buffer */
38
JDR_PAR
,
/* 5: Parameter error */
39
JDR_FMT1
,
/* 6: Data format error (may be broken data) */
40
JDR_FMT2
,
/* 7: Right format but not supported */
41
JDR_FMT3
/* 8: Not supported JPEG standard */
42
}
JRESULT
;
43
44
45
46
/* Rectangular region in the output image */
47
typedef
struct
{
48
uint16_t
left
;
/* Left end */
49
uint16_t
right
;
/* Right end */
50
uint16_t
top
;
/* Top end */
51
uint16_t
bottom
;
/* Bottom end */
52
}
JRECT
;
53
54
55
56
/* Decompressor object structure */
57
typedef
struct
JDEC
JDEC
;
58
struct
JDEC
{
59
size_t
dctr
;
/* Number of bytes available in the input buffer */
60
uint8_t*
dptr
;
/* Current data read ptr */
61
uint8_t*
inbuf
;
/* Bit stream input buffer */
62
uint8_t
dbit
;
/* Number of bits availavble in wreg or reading bit mask */
63
uint8_t
scale
;
/* Output scaling ratio */
64
uint8_t
msx
,
msy
;
/* MCU size in unit of block (width, height) */
65
uint8_t
qtid
[3];
/* Quantization table ID of each component, Y, Cb, Cr */
66
uint8_t
ncomp
;
/* Number of color components 1:grayscale, 3:color */
67
int16_t
dcv
[3];
/* Previous DC element of each component */
68
uint16_t
nrst
;
/* Restart inverval */
69
uint16_t
width
,
height
;
/* Size of the input image (pixel) */
70
uint8_t*
huffbits
[2][2];
/* Huffman bit distribution tables [id][dcac] */
71
uint16_t*
huffcode
[2][2];
/* Huffman code word tables [id][dcac] */
72
uint8_t*
huffdata
[2][2];
/* Huffman decoded data tables [id][dcac] */
73
int32_t*
qttbl
[4];
/* Dequantizer tables [id] */
74
#if JD_FASTDECODE >= 1
75
uint32_t
wreg
;
/* Working shift register */
76
uint8_t
marker
;
/* Detected marker (0:None) */
77
#if JD_FASTDECODE == 2
78
uint8_t
longofs
[2][2];
/* Table offset of long code [id][dcac] */
79
uint16_t*
hufflut_ac
[2];
/* Fast huffman decode tables for AC short code [id] */
80
uint8_t*
hufflut_dc
[2];
/* Fast huffman decode tables for DC short code [id] */
81
#endif
82
#endif
83
void
*
workbuf
;
/* Working buffer for IDCT and RGB output */
84
jd_yuv_t
*
mcubuf
;
/* Working buffer for the MCU */
85
void
*
pool
;
/* Pointer to available memory pool */
86
size_t
sz_pool
;
/* Size of momory pool (bytes available) */
87
size_t (*
infunc
)(
JDEC
*, uint8_t*, size_t);
/* Pointer to jpeg stream input function */
88
void
*
device
;
/* Pointer to I/O device identifiler for the session */
89
};
90
91
92
93
/* TJpgDec API functions */
94
JRESULT
jd_prepare
(
JDEC
* jd,
size_t
(*infunc)(
JDEC
*,uint8_t*,
size_t
),
void
* pool,
size_t
sz_pool,
void
* dev);
95
JRESULT
jd_decomp
(
JDEC
* jd,
int
(*outfunc)(
JDEC
*,
void
*,
JRECT
*), uint8_t scale);
96
97
98
#ifdef __cplusplus
99
}
100
#endif
101
102
#endif
/* _TJPGDEC */
JDEC
Definition
tjpgd.h:58
JDEC::msx
uint8_t msx
Definition
tjpgd.h:64
JDEC::huffdata
uint8_t * huffdata[2][2]
Definition
tjpgd.h:72
JDEC::dctr
size_t dctr
Definition
tjpgd.h:59
JDEC::infunc
size_t(* infunc)(JDEC *, uint8_t *, size_t)
Definition
tjpgd.h:87
JDEC::device
void * device
Definition
tjpgd.h:88
JDEC::width
uint16_t width
Definition
tjpgd.h:69
JDEC::huffcode
uint16_t * huffcode[2][2]
Definition
tjpgd.h:71
JDEC::hufflut_ac
uint16_t * hufflut_ac[2]
Definition
tjpgd.h:79
JDEC::msy
uint8_t msy
Definition
tjpgd.h:64
JDEC::nrst
uint16_t nrst
Definition
tjpgd.h:68
JDEC::scale
uint8_t scale
Definition
tjpgd.h:63
JDEC::hufflut_dc
uint8_t * hufflut_dc[2]
Definition
tjpgd.h:80
JDEC::height
uint16_t height
Definition
tjpgd.h:69
JDEC::dptr
uint8_t * dptr
Definition
tjpgd.h:60
JDEC::mcubuf
jd_yuv_t * mcubuf
Definition
tjpgd.h:84
JDEC::dcv
int16_t dcv[3]
Definition
tjpgd.h:67
JDEC::ncomp
uint8_t ncomp
Definition
tjpgd.h:66
JDEC::inbuf
uint8_t * inbuf
Definition
tjpgd.h:61
JDEC::qtid
uint8_t qtid[3]
Definition
tjpgd.h:65
JDEC::longofs
uint8_t longofs[2][2]
Definition
tjpgd.h:78
JDEC::workbuf
void * workbuf
Definition
tjpgd.h:83
JDEC::marker
uint8_t marker
Definition
tjpgd.h:76
JDEC::wreg
uint32_t wreg
Definition
tjpgd.h:75
JDEC::sz_pool
size_t sz_pool
Definition
tjpgd.h:86
JDEC::dbit
uint8_t dbit
Definition
tjpgd.h:62
JDEC::qttbl
int32_t * qttbl[4]
Definition
tjpgd.h:73
JDEC::pool
void * pool
Definition
tjpgd.h:85
JDEC::huffbits
uint8_t * huffbits[2][2]
Definition
tjpgd.h:70
JRECT
Definition
tjpgd.h:47
JRECT::top
uint16_t top
Definition
tjpgd.h:50
JRECT::bottom
uint16_t bottom
Definition
tjpgd.h:51
JRECT::right
uint16_t right
Definition
tjpgd.h:49
JRECT::left
uint16_t left
Definition
tjpgd.h:48
jd_yuv_t
int16_t jd_yuv_t
Definition
tjpgd.h:25
jd_prepare
JRESULT jd_prepare(JDEC *jd, size_t(*infunc)(JDEC *, uint8_t *, size_t), void *pool, size_t sz_pool, void *dev)
Definition
tjpgd.c:962
jd_decomp
JRESULT jd_decomp(JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), uint8_t scale)
Definition
tjpgd.c:1118
JRESULT
JRESULT
Definition
tjpgd.h:32
JDR_INTR
@ JDR_INTR
Definition
tjpgd.h:34
JDR_FMT3
@ JDR_FMT3
Definition
tjpgd.h:41
JDR_MEM2
@ JDR_MEM2
Definition
tjpgd.h:37
JDR_INP
@ JDR_INP
Definition
tjpgd.h:35
JDR_OK
@ JDR_OK
Definition
tjpgd.h:33
JDR_MEM1
@ JDR_MEM1
Definition
tjpgd.h:36
JDR_PAR
@ JDR_PAR
Definition
tjpgd.h:38
JDR_FMT2
@ JDR_FMT2
Definition
tjpgd.h:40
JDR_FMT1
@ JDR_FMT1
Definition
tjpgd.h:39
tjpgdcnf.h
temp_repos
roo_display
src
roo_display
image
jpeg
lib
tjpgd.h
Generated by
1.9.8