Quellcode durchsuchen

Add PNG_ABORT for libpng; Add format field in tjpgd;

bernard vor 11 Jahren
Ursprung
Commit
7d2b7199d8

+ 2 - 0
components/external/libpng/pngconf.h

@@ -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

+ 3 - 2
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++) {

+ 4 - 4
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) */
 };