From 7d2b7199d8d82848f621d0493540b13c9d9841e9 Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 29 Mar 2014 08:45:26 +0800 Subject: [PATCH] Add PNG_ABORT for libpng; Add format field in tjpgd; --- components/external/libpng/pngconf.h | 2 ++ components/external/tjpgd1a/tjpgd.c | 5 +++-- components/external/tjpgd1a/tjpgd.h | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/external/libpng/pngconf.h b/components/external/libpng/pngconf.h index 047376302..bb0a189f9 100644 --- a/components/external/libpng/pngconf.h +++ b/components/external/libpng/pngconf.h @@ -23,6 +23,8 @@ #include #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 diff --git a/components/external/tjpgd1a/tjpgd.c b/components/external/tjpgd1a/tjpgd.c index 9c69989ce..4817f92b5 100644 --- a/components/external/tjpgd1a/tjpgd.c +++ b/components/external/tjpgd1a/tjpgd.c @@ -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++) { diff --git a/components/external/tjpgd1a/tjpgd.h b/components/external/tjpgd1a/tjpgd.h index 07a917419..ee84cd2d2 100644 --- a/components/external/tjpgd1a/tjpgd.h +++ b/components/external/tjpgd1a/tjpgd.h @@ -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) */ };