Add PNG_ABORT for libpng; Add format field in tjpgd;

This commit is contained in:
bernard 2014-03-29 08:45:26 +08:00
parent 96d9fd8715
commit 7d2b7199d8
3 changed files with 9 additions and 6 deletions

View File

@ -23,6 +23,8 @@
#include <rtthread.h>
#define PNG_MAX_MALLOC_64K
#define PNG_NO_STDIO
#define PNG_NO_ERROR_NUMBERS
#define PNG_ABORT() do { rt_kprintf("libpng abort.\n"); } while (0)
#ifndef RT_USING_NEWLIB
#define PNG_NO_WRITE_SUPPORTED

View File

@ -525,7 +525,7 @@ JRESULT mcu_load (
} while (++i < 64); /* Next AC element */
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
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 */
if (JD_FORMAT == 1) {
if (jd->format == 1) {
BYTE *s = (BYTE*)jd->workbuf;
WORD w, *d = (WORD*)s;
UINT n = rx * ry;
@ -762,6 +762,7 @@ JRESULT jd_prepare (
jd->infunc = infunc; /* Stream input function */
jd->device = dev; /* I/O device identifier */
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 (j = 0; j < 2; j++) {

View File

@ -4,10 +4,8 @@
/* System Configurations */
#define JD_SZBUF 512 /* 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 1 /* Use descaling feature for output */
#define JD_SZBUF (16 * 1024) /* Size of stream input buffer (should be multiple of 512) */
#define JD_USE_SCALE 0 /* Use descaling feature for output */
/*---------------------------------------------------------------------------*/
@ -57,6 +55,8 @@ struct JDEC {
UINT (*infunc)(JDEC*, BYTE*, UINT);/* Pointer to jpeg stream input function */
UINT (*outfunc)(JDEC*, void*, JRECT*); /* Pointer to RGB output function */
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) */
};