BurstSPI support for improved performance
Fork of RA8875 by
GraphicsDisplayJPEG.h@150:db4c4a5438fc, 2017-09-09 (annotated)
- Committer:
- mooreaa
- Date:
- Sat Sep 09 09:09:57 2017 +0000
- Revision:
- 150:db4c4a5438fc
- Parent:
- 125:7a0b70f56550
Initial
Who changed what in which revision?
User | Revision | Line number | New 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 | 125:7a0b70f56550 | 25 | /// Error code results for the jpeg engine |
WiredHome | 115:c9862fd0c689 | 26 | typedef enum { |
WiredHome | 125:7a0b70f56550 | 27 | JDR_OK = noerror, ///< 0: Succeeded |
WiredHome | 125:7a0b70f56550 | 28 | JDR_INTR = external_abort, ///< 1: Interrupted by output function |
WiredHome | 125:7a0b70f56550 | 29 | JDR_INP = bad_parameter, ///< 2: Device error or wrong termination of input stream |
WiredHome | 125:7a0b70f56550 | 30 | JDR_MEM1 = not_enough_ram, ///< 3: Insufficient memory pool for the image |
WiredHome | 125:7a0b70f56550 | 31 | JDR_MEM2 = not_enough_ram, ///< 4: Insufficient stream input buffer |
WiredHome | 125:7a0b70f56550 | 32 | JDR_PAR = bad_parameter, ///< 5: Parameter error |
WiredHome | 125:7a0b70f56550 | 33 | JDR_FMT1 = not_supported_format, ///< 6: Data format error (may be damaged data) |
WiredHome | 125:7a0b70f56550 | 34 | JDR_FMT2 = not_supported_format, ///< 7: Right format but not supported |
WiredHome | 125:7a0b70f56550 | 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 | 125:7a0b70f56550 | 40 | /// Rectangular structure definition for the jpeg engine |
WiredHome | 115:c9862fd0c689 | 41 | typedef struct { |
WiredHome | 125:7a0b70f56550 | 42 | loc_t left; ///< left coord |
WiredHome | 125:7a0b70f56550 | 43 | loc_t right; ///< right coord |
WiredHome | 125:7a0b70f56550 | 44 | loc_t top; ///< top coord |
WiredHome | 125:7a0b70f56550 | 45 | loc_t bottom; ///< bottom coord |
WiredHome | 115:c9862fd0c689 | 46 | } JRECT; |
WiredHome | 115:c9862fd0c689 | 47 | |
WiredHome | 115:c9862fd0c689 | 48 | |
WiredHome | 125:7a0b70f56550 | 49 | /// Decompressor object structure for the jpeg engine |
WiredHome | 125:7a0b70f56550 | 50 | typedef struct JDEC JDEC; |
WiredHome | 115:c9862fd0c689 | 51 | |
WiredHome | 125:7a0b70f56550 | 52 | /// Internal structure for the jpeg engine |
WiredHome | 115:c9862fd0c689 | 53 | struct JDEC { |
WiredHome | 125:7a0b70f56550 | 54 | uint16_t dctr; ///< Number of bytes available in the input buffer |
WiredHome | 125:7a0b70f56550 | 55 | uint8_t * dptr; ///< Current data read ptr |
WiredHome | 125:7a0b70f56550 | 56 | uint8_t * inbuf; ///< Bit stream input buffer |
WiredHome | 125:7a0b70f56550 | 57 | uint8_t dmsk; ///< Current bit in the current read byte |
WiredHome | 125:7a0b70f56550 | 58 | uint8_t scale; ///< Output scaling ratio |
WiredHome | 125:7a0b70f56550 | 59 | uint8_t msx; ///< MCU size in unit of block (width, ...) |
WiredHome | 125:7a0b70f56550 | 60 | uint8_t msy; ///< MCU size in unit of block (..., height) |
WiredHome | 125:7a0b70f56550 | 61 | uint8_t qtid[3]; ///< Quantization table ID of each component |
WiredHome | 125:7a0b70f56550 | 62 | int16_t dcv[3]; ///< Previous DC element of each component |
WiredHome | 125:7a0b70f56550 | 63 | uint16_t nrst; ///< Restart inverval |
WiredHome | 125:7a0b70f56550 | 64 | uint16_t width; ///< Size of the input image (pixel width, ...) |
WiredHome | 125:7a0b70f56550 | 65 | uint16_t height; ///< Size of the input image (..., pixel height) |
WiredHome | 125:7a0b70f56550 | 66 | uint8_t * huffbits[2][2]; ///< Huffman bit distribution tables [id][dcac] |
WiredHome | 125:7a0b70f56550 | 67 | uint16_t * huffcode[2][2]; ///< Huffman code word tables [id][dcac] |
WiredHome | 125:7a0b70f56550 | 68 | uint8_t * huffdata[2][2]; ///< Huffman decoded data tables [id][dcac] |
WiredHome | 125:7a0b70f56550 | 69 | int32_t * qttbl[4]; ///< Dequaitizer tables [id] |
WiredHome | 125:7a0b70f56550 | 70 | void * workbuf; ///< Working buffer for IDCT and RGB output |
WiredHome | 125:7a0b70f56550 | 71 | uint8_t * mcubuf; ///< Working buffer for the MCU |
WiredHome | 125:7a0b70f56550 | 72 | void * pool; ///< Pointer to available memory pool |
WiredHome | 125:7a0b70f56550 | 73 | uint16_t sz_pool; ///< Size of momory pool (bytes available) |
WiredHome | 125:7a0b70f56550 | 74 | uint16_t (*infunc)(JDEC * jd, uint8_t * buffer, uint16_t bufsize); ///< Pointer to jpeg stream input function |
WiredHome | 125:7a0b70f56550 | 75 | void * device; ///< Pointer to I/O device identifiler for the session |
WiredHome | 115:c9862fd0c689 | 76 | }; |
WiredHome | 115:c9862fd0c689 | 77 | |
WiredHome | 115:c9862fd0c689 | 78 | |
WiredHome | 115:c9862fd0c689 | 79 | #endif /* _TJPGDEC */ |
WiredHome | 115:c9862fd0c689 | 80 | |
WiredHome | 115:c9862fd0c689 | 81 | #endif // GraphicsDisplayJPEG_H |