Updated standard library

Committer:
WiredHome
Date:
Mon May 16 02:05:37 2016 +0000
Revision:
115:c9862fd0c689
Child:
125:7a0b70f56550
Jpeg rendering - not yet working, just an intermediate check-point.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 115:c9862fd0c689 1 /// Wrapping ChaN's TJpgDec into this graphics engine
WiredHome 115:c9862fd0c689 2 ///
WiredHome 115:c9862fd0c689 3
WiredHome 115:c9862fd0c689 4 #ifndef GraphicsDisplayJPEG_H
WiredHome 115:c9862fd0c689 5 #define GraphicsDisplayJPEG_H
WiredHome 115:c9862fd0c689 6
WiredHome 115:c9862fd0c689 7 /*----------------------------------------------------------------------------/
WiredHome 115:c9862fd0c689 8 / TJpgDec - Tiny JPEG Decompressor include file (C)ChaN, 2012
WiredHome 115:c9862fd0c689 9 /----------------------------------------------------------------------------*/
WiredHome 115:c9862fd0c689 10 #ifndef _TJPGDEC
WiredHome 115:c9862fd0c689 11 #define _TJPGDEC
WiredHome 115:c9862fd0c689 12
WiredHome 115:c9862fd0c689 13 /*---------------------------------------------------------------------------*/
WiredHome 115:c9862fd0c689 14 /* System Configurations */
WiredHome 115:c9862fd0c689 15
WiredHome 115:c9862fd0c689 16 #define JD_SZBUF 512 /* Size of stream input buffer */
WiredHome 115:c9862fd0c689 17 #define JD_FORMAT 1 /* Output pixel format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */
WiredHome 115:c9862fd0c689 18 #define JD_USE_SCALE 1 /* Use descaling feature for output */
WiredHome 115:c9862fd0c689 19 #define JD_TBLCLIP 1 /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */
WiredHome 115:c9862fd0c689 20
WiredHome 115:c9862fd0c689 21 /*---------------------------------------------------------------------------*/
WiredHome 115:c9862fd0c689 22
WiredHome 115:c9862fd0c689 23 #include "DisplayDefs.h"
WiredHome 115:c9862fd0c689 24
WiredHome 115:c9862fd0c689 25 /* Error code */
WiredHome 115:c9862fd0c689 26 typedef enum {
WiredHome 115:c9862fd0c689 27 JDR_OK = noerror, /* 0: Succeeded */
WiredHome 115:c9862fd0c689 28 JDR_INTR = external_abort, /* 1: Interrupted by output function */
WiredHome 115:c9862fd0c689 29 JDR_INP = bad_parameter, /* 2: Device error or wrong termination of input stream */
WiredHome 115:c9862fd0c689 30 JDR_MEM1 = not_enough_ram, /* 3: Insufficient memory pool for the image */
WiredHome 115:c9862fd0c689 31 JDR_MEM2 = not_enough_ram, /* 4: Insufficient stream input buffer */
WiredHome 115:c9862fd0c689 32 JDR_PAR = bad_parameter, /* 5: Parameter error */
WiredHome 115:c9862fd0c689 33 JDR_FMT1 = not_supported_format, /* 6: Data format error (may be damaged data) */
WiredHome 115:c9862fd0c689 34 JDR_FMT2 = not_supported_format, /* 7: Right format but not supported */
WiredHome 115:c9862fd0c689 35 JDR_FMT3 = not_supported_format /* 8: Not supported JPEG standard */
WiredHome 115:c9862fd0c689 36 } JRESULT;
WiredHome 115:c9862fd0c689 37
WiredHome 115:c9862fd0c689 38
WiredHome 115:c9862fd0c689 39
WiredHome 115:c9862fd0c689 40 /* Rectangular structure */
WiredHome 115:c9862fd0c689 41 typedef struct {
WiredHome 115:c9862fd0c689 42 loc_t left, right, top, bottom;
WiredHome 115:c9862fd0c689 43 } JRECT;
WiredHome 115:c9862fd0c689 44
WiredHome 115:c9862fd0c689 45
WiredHome 115:c9862fd0c689 46
WiredHome 115:c9862fd0c689 47 /* Decompressor object structure */
WiredHome 115:c9862fd0c689 48 typedef struct JDEC JDEC;
WiredHome 115:c9862fd0c689 49 struct JDEC {
WiredHome 115:c9862fd0c689 50 uint16_t dctr; /* Number of bytes available in the input buffer */
WiredHome 115:c9862fd0c689 51 uint8_t * dptr; /* Current data read ptr */
WiredHome 115:c9862fd0c689 52 uint8_t * inbuf; /* Bit stream input buffer */
WiredHome 115:c9862fd0c689 53 uint8_t dmsk; /* Current bit in the current read byte */
WiredHome 115:c9862fd0c689 54 uint8_t scale; /* Output scaling ratio */
WiredHome 115:c9862fd0c689 55 uint8_t msx, msy; /* MCU size in unit of block (width, height) */
WiredHome 115:c9862fd0c689 56 uint8_t qtid[3]; /* Quantization table ID of each component */
WiredHome 115:c9862fd0c689 57 int16_t dcv[3]; /* Previous DC element of each component */
WiredHome 115:c9862fd0c689 58 uint16_t nrst; /* Restart inverval */
WiredHome 115:c9862fd0c689 59 uint16_t width, height; /* Size of the input image (pixel) */
WiredHome 115:c9862fd0c689 60 uint8_t * huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
WiredHome 115:c9862fd0c689 61 uint16_t * huffcode[2][2]; /* Huffman code word tables [id][dcac] */
WiredHome 115:c9862fd0c689 62 uint8_t * huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
WiredHome 115:c9862fd0c689 63 int32_t * qttbl[4]; /* Dequaitizer tables [id] */
WiredHome 115:c9862fd0c689 64 void * workbuf; /* Working buffer for IDCT and RGB output */
WiredHome 115:c9862fd0c689 65 uint8_t * mcubuf; /* Working buffer for the MCU */
WiredHome 115:c9862fd0c689 66 void * pool; /* Pointer to available memory pool */
WiredHome 115:c9862fd0c689 67 uint16_t sz_pool; /* Size of momory pool (bytes available) */
WiredHome 115:c9862fd0c689 68 uint16_t (*infunc)(JDEC * jd, uint8_t * buffer, uint16_t bufsize);/* Pointer to jpeg stream input function */
WiredHome 115:c9862fd0c689 69 void * device; /* Pointer to I/O device identifiler for the session */
WiredHome 115:c9862fd0c689 70 };
WiredHome 115:c9862fd0c689 71
WiredHome 115:c9862fd0c689 72
WiredHome 115:c9862fd0c689 73 #endif /* _TJPGDEC */
WiredHome 115:c9862fd0c689 74
WiredHome 115:c9862fd0c689 75 #endif // GraphicsDisplayJPEG_H