roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
tjpgd.c File Reference
#include "tjpgd.h"
Include dependency graph for tjpgd.c:

Go to the source code of this file.

Macros

#define HUFF_BIT   10 /* Bit length to apply fast huffman decode */
 
#define HUFF_LEN   (1 << HUFF_BIT)
 
#define HUFF_MASK   (HUFF_LEN - 1)
 
#define BYTECLIP(v)   Clip8[(unsigned int)(v) & 0x3FF]
 
#define LDB_WORD(ptr)   (uint16_t)(((uint16_t)*((uint8_t*)(ptr))<<8)|(uint16_t)*(uint8_t*)((ptr)+1))
 

Functions

static void * alloc_pool (JDEC *jd, size_t ndata)
 
static JRESULT create_qt_tbl (JDEC *jd, const uint8_t *data, size_t ndata)
 
static JRESULT create_huffman_tbl (JDEC *jd, const uint8_t *data, size_t ndata)
 
static int huffext (JDEC *jd, unsigned int id, unsigned int cls)
 
static int bitext (JDEC *jd, unsigned int nbit)
 
static JRESULT restart (JDEC *jd, uint16_t rstn)
 
static void block_idct (int32_t *src, jd_yuv_t *dst)
 
static JRESULT mcu_load (JDEC *jd)
 
static JRESULT mcu_output (JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), unsigned int x, unsigned int y)
 
JRESULT jd_prepare (JDEC *jd, size_t(*infunc)(JDEC *, uint8_t *, size_t), void *pool, size_t sz_pool, void *dev)
 
JRESULT jd_decomp (JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), uint8_t scale)
 

Variables

static const uint8_t Zig [64]
 
static const uint16_t Ipsf [64]
 
static const uint8_t Clip8 [1024]
 

Macro Definition Documentation

◆ BYTECLIP

#define BYTECLIP (   v)    Clip8[(unsigned int)(v) & 0x3FF]

Definition at line 74 of file tjpgd.c.

◆ HUFF_BIT

#define HUFF_BIT   10 /* Bit length to apply fast huffman decode */

Definition at line 31 of file tjpgd.c.

◆ HUFF_LEN

#define HUFF_LEN   (1 << HUFF_BIT)

Definition at line 32 of file tjpgd.c.

◆ HUFF_MASK

#define HUFF_MASK   (HUFF_LEN - 1)

Definition at line 33 of file tjpgd.c.

◆ LDB_WORD

#define LDB_WORD (   ptr)    (uint16_t)(((uint16_t)*((uint8_t*)(ptr))<<8)|(uint16_t)*(uint8_t*)((ptr)+1))

Definition at line 959 of file tjpgd.c.

Function Documentation

◆ alloc_pool()

static void * alloc_pool ( JDEC jd,
size_t  ndata 
)
static

Definition at line 132 of file tjpgd.c.

References JDEC::pool, and JDEC::sz_pool.

Referenced by create_huffman_tbl(), create_qt_tbl(), and jd_prepare().

◆ bitext()

static int bitext ( JDEC jd,
unsigned int  nbit 
)
static

Definition at line 423 of file tjpgd.c.

References JDEC::dbit, JDEC::dctr, JDEC::dptr, JDEC::inbuf, JDEC::infunc, JD_SZBUF, JDR_FMT1, JDR_INP, JDEC::marker, and JDEC::wreg.

Referenced by mcu_load().

◆ block_idct()

static void block_idct ( int32_t *  src,
jd_yuv_t dst 
)
static

Definition at line 579 of file tjpgd.c.

References BYTECLIP.

Referenced by mcu_load().

◆ create_huffman_tbl()

static JRESULT create_huffman_tbl ( JDEC jd,
const uint8_t *  data,
size_t  ndata 
)
static

◆ create_qt_tbl()

static JRESULT create_qt_tbl ( JDEC jd,
const uint8_t *  data,
size_t  ndata 
)
static

Definition at line 158 of file tjpgd.c.

References alloc_pool(), Ipsf, JDR_FMT1, JDR_MEM1, JDR_OK, JDEC::qttbl, and Zig.

Referenced by jd_prepare().

◆ huffext()

static int huffext ( JDEC jd,
unsigned int  id,
unsigned int  cls 
)
static

◆ jd_decomp()

JRESULT jd_decomp ( JDEC jd,
int(*)(JDEC *, void *, JRECT *)  outfunc,
uint8_t  scale 
)

◆ jd_prepare()

◆ mcu_load()

◆ mcu_output()

static JRESULT mcu_output ( JDEC jd,
int(*)(JDEC *, void *, JRECT *)  outfunc,
unsigned int  x,
unsigned int  y 
)
static

◆ restart()

static JRESULT restart ( JDEC jd,
uint16_t  rstn 
)
static

Definition at line 508 of file tjpgd.c.

References JDEC::dbit, JDEC::dctr, JDEC::dcv, JDEC::dptr, JDEC::inbuf, JDEC::infunc, JD_SZBUF, JDR_FMT1, JDR_INP, JDR_OK, and JDEC::marker.

Referenced by jd_decomp().

Variable Documentation

◆ Clip8

const uint8_t Clip8[1024]
static

Definition at line 76 of file tjpgd.c.

◆ Ipsf

const uint16_t Ipsf[64]
static
Initial value:
= {
(uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
(uint16_t)(1.38704*8192), (uint16_t)(1.92388*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.08979*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.38268*8192),
(uint16_t)(1.30656*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.70711*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.36048*8192),
(uint16_t)(1.17588*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.38268*8192), (uint16_t)(1.17588*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.32442*8192),
(uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
(uint16_t)(0.78570*8192), (uint16_t)(1.08979*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.61732*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.21677*8192),
(uint16_t)(0.54120*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.29290*8192), (uint16_t)(0.14932*8192),
(uint16_t)(0.27590*8192), (uint16_t)(0.38268*8192), (uint16_t)(0.36048*8192), (uint16_t)(0.32442*8192), (uint16_t)(0.27590*8192), (uint16_t)(0.21678*8192), (uint16_t)(0.14932*8192), (uint16_t)(0.07612*8192)
}

Definition at line 55 of file tjpgd.c.

Referenced by create_qt_tbl().

◆ Zig

const uint8_t Zig[64]
static
Initial value:
= {
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
}

Definition at line 41 of file tjpgd.c.

Referenced by create_qt_tbl(), and mcu_load().