123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #ifndef DEF_TJPGDEC
- #define DEF_TJPGDEC
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "tjpgdcnf.h"
- #include <string.h>
- #if defined(_WIN32)
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef short int16_t;
- typedef unsigned long uint32_t;
- typedef long int32_t;
- #else
- #include <stdint.h>
- #endif
- #if JD_FASTDECODE >= 1
- typedef int16_t jd_yuv_t;
- #else
- typedef uint8_t jd_yuv_t;
- #endif
- typedef enum {
- JDR_OK = 0,
- JDR_INTR,
- JDR_INP,
- JDR_MEM1,
- JDR_MEM2,
- JDR_PAR,
- JDR_FMT1,
- JDR_FMT2,
- JDR_FMT3
- } JRESULT;
- typedef struct {
- uint16_t left;
- uint16_t right;
- uint16_t top;
- uint16_t bottom;
- } JRECT;
- typedef enum {
-
- JDF_RGB888 = 0,
- JDF_RGB565,
- JDF_GRAYSCALE,
- JDF_BGR888,
- JDF_BGR565,
- JDF_MAX,
- } JFORMAT;
- typedef struct JDEC JDEC;
- struct JDEC {
- size_t dctr;
- uint8_t dbit;
- uint8_t* dptr;
- #if JD_FASTDECODE >= 1
- uint32_t wreg;
- uint8_t marker;
- #endif
- uint8_t* inbuf;
- uint8_t scale;
- uint8_t msx, msy;
- uint8_t qtid[3];
- uint8_t ncomp;
- int16_t dcv[3];
- uint16_t nrst;
- uint16_t width, height;
- uint8_t* huffbits[2][2] __attribute__((aligned(32)));
- uint16_t* huffcode[2][2];
- uint8_t* huffdata[2][2];
- #if JD_FASTDECODE == 2
- uint8_t longofs[2][2] __attribute__((aligned(32)));
- uint16_t* hufflut_ac[2] __attribute__((aligned(32)));
- uint8_t* hufflut_dc[2];
- #endif
- int32_t* qttbl[4];
- void* workbuf;
- jd_yuv_t* mcubuf __attribute__((aligned(32)));
- void* pool;
- size_t sz_pool;
- size_t (*infunc)(JDEC*, uint8_t*, size_t);
- JFORMAT format;
- const void* device;
- uint8_t swap;
- } __attribute__((aligned(32)));
- JRESULT jd_prepare (JDEC* jd, size_t (*infunc)(JDEC*,uint8_t*,size_t), void* pool, size_t sz_pool, JFORMAT format, const void* dev);
- JRESULT jd_decomp (JDEC* jd, int (*outfunc)(JDEC*,void*,JRECT*), uint8_t scale);
- #ifdef __cplusplus
- }
- #endif
- #endif
|