Increased SPI frequency from 5Mhz to 10MHz

Fork of RA8875 by David Smart

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GraphicsDisplayJPEG.h Source File

GraphicsDisplayJPEG.h

00001 /// Wrapping ChaN's TJpgDec into this graphics engine
00002 ///
00003 
00004 #ifndef GraphicsDisplayJPEG_H
00005 #define GraphicsDisplayJPEG_H
00006 
00007 /*----------------------------------------------------------------------------/
00008 / TJpgDec - Tiny JPEG Decompressor include file               (C)ChaN, 2012
00009 /----------------------------------------------------------------------------*/
00010 #ifndef _TJPGDEC
00011 #define _TJPGDEC
00012 
00013 /*---------------------------------------------------------------------------*/
00014 /* System Configurations */
00015 
00016 #define JD_SZBUF        512 /* Size of stream input buffer */
00017 #define JD_FORMAT       1   /* Output pixel format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */
00018 #define JD_USE_SCALE    1   /* Use descaling feature for output */
00019 #define JD_TBLCLIP      1   /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */
00020 
00021 /*---------------------------------------------------------------------------*/
00022 
00023 #include "DisplayDefs.h"
00024 
00025 /// Error code results for the jpeg engine
00026 typedef enum {
00027     JDR_OK = noerror,                   ///< 0: Succeeded 
00028     JDR_INTR = external_abort,          ///< 1: Interrupted by output function 
00029     JDR_INP = bad_parameter,            ///< 2: Device error or wrong termination of input stream 
00030     JDR_MEM1 = not_enough_ram,          ///< 3: Insufficient memory pool for the image 
00031     JDR_MEM2 = not_enough_ram,          ///< 4: Insufficient stream input buffer 
00032     JDR_PAR = bad_parameter,            ///< 5: Parameter error 
00033     JDR_FMT1 = not_supported_format,    ///< 6: Data format error (may be damaged data) 
00034     JDR_FMT2 = not_supported_format,    ///< 7: Right format but not supported 
00035     JDR_FMT3 = not_supported_format     ///< 8: Not supported JPEG standard 
00036 } JRESULT;
00037 
00038 
00039 
00040 /// Rectangular structure definition for the jpeg engine
00041 typedef struct {
00042     loc_t left;         ///< left coord
00043     loc_t right;        ///< right coord
00044     loc_t top;          ///< top coord
00045     loc_t bottom;       ///< bottom coord
00046 } JRECT;
00047 
00048 
00049 /// Decompressor object structure for the jpeg engine
00050 typedef struct JDEC JDEC;
00051 
00052 /// Internal structure for the jpeg engine
00053 struct JDEC {
00054     uint16_t dctr;              ///< Number of bytes available in the input buffer 
00055     uint8_t * dptr;             ///< Current data read ptr 
00056     uint8_t * inbuf;            ///< Bit stream input buffer 
00057     uint8_t dmsk;               ///< Current bit in the current read byte 
00058     uint8_t scale;              ///< Output scaling ratio 
00059     uint8_t msx;                ///< MCU size in unit of block (width, ...) 
00060     uint8_t msy;                ///< MCU size in unit of block (..., height) 
00061     uint8_t qtid[3];            ///< Quantization table ID of each component 
00062     int16_t dcv[3];             ///< Previous DC element of each component 
00063     uint16_t nrst;              ///< Restart inverval 
00064     uint16_t width;             ///< Size of the input image (pixel width, ...) 
00065     uint16_t height;            ///< Size of the input image (..., pixel height) 
00066     uint8_t * huffbits[2][2];   ///< Huffman bit distribution tables [id][dcac] 
00067     uint16_t * huffcode[2][2];  ///< Huffman code word tables [id][dcac] 
00068     uint8_t * huffdata[2][2];   ///< Huffman decoded data tables [id][dcac] 
00069     int32_t * qttbl[4];         ///< Dequaitizer tables [id] 
00070     void * workbuf;             ///< Working buffer for IDCT and RGB output 
00071     uint8_t * mcubuf;           ///< Working buffer for the MCU 
00072     void * pool;                ///< Pointer to available memory pool 
00073     uint16_t sz_pool;           ///< Size of momory pool (bytes available) 
00074     uint16_t (*infunc)(JDEC * jd, uint8_t * buffer, uint16_t bufsize);  ///< Pointer to jpeg stream input function 
00075     void * device;              ///< Pointer to I/O device identifiler for the session 
00076 };
00077 
00078 
00079 #endif /* _TJPGDEC */
00080 
00081 #endif // GraphicsDisplayJPEG_H