Add PNG_ABORT for libpng; Add format field in tjpgd;
This commit is contained in:
parent
96d9fd8715
commit
7d2b7199d8
|
@ -23,6 +23,8 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#define PNG_MAX_MALLOC_64K
|
#define PNG_MAX_MALLOC_64K
|
||||||
#define PNG_NO_STDIO
|
#define PNG_NO_STDIO
|
||||||
|
#define PNG_NO_ERROR_NUMBERS
|
||||||
|
#define PNG_ABORT() do { rt_kprintf("libpng abort.\n"); } while (0)
|
||||||
|
|
||||||
#ifndef RT_USING_NEWLIB
|
#ifndef RT_USING_NEWLIB
|
||||||
#define PNG_NO_WRITE_SUPPORTED
|
#define PNG_NO_WRITE_SUPPORTED
|
||||||
|
|
|
@ -525,7 +525,7 @@ JRESULT mcu_load (
|
||||||
} while (++i < 64); /* Next AC element */
|
} while (++i < 64); /* Next AC element */
|
||||||
|
|
||||||
if (JD_USE_SCALE && jd->scale == 3)
|
if (JD_USE_SCALE && jd->scale == 3)
|
||||||
*bp = (*tmp / 256) + 128; /* If scale ratio is 1/8, IDCT can be ommited and only DC element is used */
|
*bp = (BYTE)((*tmp / 256) + 128); /* If scale ratio is 1/8, IDCT can be ommited and only DC element is used */
|
||||||
else
|
else
|
||||||
block_idct(tmp, bp); /* Apply IDCT and store the block to the MCU buffer */
|
block_idct(tmp, bp); /* Apply IDCT and store the block to the MCU buffer */
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ JRESULT mcu_output (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert RGB888 to RGB565 if needed */
|
/* Convert RGB888 to RGB565 if needed */
|
||||||
if (JD_FORMAT == 1) {
|
if (jd->format == 1) {
|
||||||
BYTE *s = (BYTE*)jd->workbuf;
|
BYTE *s = (BYTE*)jd->workbuf;
|
||||||
WORD w, *d = (WORD*)s;
|
WORD w, *d = (WORD*)s;
|
||||||
UINT n = rx * ry;
|
UINT n = rx * ry;
|
||||||
|
@ -762,6 +762,7 @@ JRESULT jd_prepare (
|
||||||
jd->infunc = infunc; /* Stream input function */
|
jd->infunc = infunc; /* Stream input function */
|
||||||
jd->device = dev; /* I/O device identifier */
|
jd->device = dev; /* I/O device identifier */
|
||||||
jd->nrst = 0; /* No restart interval (default) */
|
jd->nrst = 0; /* No restart interval (default) */
|
||||||
|
jd->format = 0; /* use RGB888 (3 BYTE/pix) default */
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) { /* Nulls pointers */
|
for (i = 0; i < 2; i++) { /* Nulls pointers */
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
|
|
|
@ -4,10 +4,8 @@
|
||||||
|
|
||||||
/* System Configurations */
|
/* System Configurations */
|
||||||
|
|
||||||
#define JD_SZBUF 512 /* Size of stream input buffer (should be multiple of 512) */
|
#define JD_SZBUF (16 * 1024) /* Size of stream input buffer (should be multiple of 512) */
|
||||||
#define JD_FORMAT 1 /* Output RGB format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */
|
#define JD_USE_SCALE 0 /* Use descaling feature for output */
|
||||||
#define JD_USE_SCALE 1 /* Use descaling feature for output */
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -57,6 +55,8 @@ struct JDEC {
|
||||||
UINT (*infunc)(JDEC*, BYTE*, UINT);/* Pointer to jpeg stream input function */
|
UINT (*infunc)(JDEC*, BYTE*, UINT);/* Pointer to jpeg stream input function */
|
||||||
UINT (*outfunc)(JDEC*, void*, JRECT*); /* Pointer to RGB output function */
|
UINT (*outfunc)(JDEC*, void*, JRECT*); /* Pointer to RGB output function */
|
||||||
void* device; /* Pointer to I/O device identifiler for the session */
|
void* device; /* Pointer to I/O device identifiler for the session */
|
||||||
|
|
||||||
|
BYTE format; /* the output format, 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue