Просмотр исходного кода

update: tjpgd, 更新jpg库接口名字为luat_*

zengeshuai 1 месяц назад
Родитель
Сommit
b63c7f2a71
3 измененных файлов с 14 добавлено и 14 удалено
  1. 10 10
      components/lcd/luat_lib_lcd_jpg.c
  2. 2 2
      components/tjpgd/tjpgd.c
  3. 2 2
      components/tjpgd/tjpgd.h

+ 10 - 10
components/lcd/luat_lib_lcd_jpg.c

@@ -45,7 +45,7 @@ typedef struct {
 } IODEV;
 } IODEV;
 
 
 static unsigned int file_in_func (JDEC* jd, uint8_t* buff, unsigned int nbyte){
 static unsigned int file_in_func (JDEC* jd, uint8_t* buff, unsigned int nbyte){
-    IODEV *dev = (IODEV*)jd->device;   /* Device identifier for the session (5th argument of jd_prepare function) */
+    IODEV *dev = (IODEV*)jd->device;   /* Device identifier for the session (5th argument of luat_jd_prepare function) */
     if (buff) {
     if (buff) {
         /* Read bytes from input stream */
         /* Read bytes from input stream */
         return luat_fs_fread(buff, 1, nbyte, dev->fp);
         return luat_fs_fread(buff, 1, nbyte, dev->fp);
@@ -99,22 +99,22 @@ int lcd_draw_jpeg_default(luat_lcd_conf_t* conf, const char* path, int16_t x, in
         LLOGE("out of memory when malloc jpeg decode workbuff");
         LLOGE("out of memory when malloc jpeg decode workbuff");
         return -3;
         return -3;
     }
     }
-    res = jd_prepare(&jdec, file_in_func, work, sz_work, &devid);
+    res = luat_jd_prepare(&jdec, file_in_func, work, sz_work, &devid);
     if (res != JDR_OK) {
     if (res != JDR_OK) {
         luat_heap_free(work);
         luat_heap_free(work);
         luat_fs_fclose(fd);
         luat_fs_fclose(fd);
-        LLOGW("jd_prepare file %s error %d", path, res);
+        LLOGW("luat_jd_prepare file %s error %d", path, res);
         return -2;
         return -2;
     }
     }
     devid.x = x;
     devid.x = x;
     devid.y = y;
     devid.y = y;
     // devid.width = jdec.width;
     // devid.width = jdec.width;
     // devid.height = jdec.height;
     // devid.height = jdec.height;
-    res = jd_decomp(&jdec, lcd_out_func, 0);
+    res = luat_jd_decomp(&jdec, lcd_out_func, 0);
     luat_heap_free(work);
     luat_heap_free(work);
     luat_fs_fclose(fd);
     luat_fs_fclose(fd);
     if (res != JDR_OK) {
     if (res != JDR_OK) {
-        LLOGW("jd_decomp file %s error %d", path, res);
+        LLOGW("luat_jd_decomp file %s error %d", path, res);
         return -2;
         return -2;
     }else {
     }else {
         lcd_auto_flush(lcd_dft_conf);
         lcd_auto_flush(lcd_dft_conf);
@@ -123,7 +123,7 @@ int lcd_draw_jpeg_default(luat_lcd_conf_t* conf, const char* path, int16_t x, in
 }
 }
 
 
 static unsigned int decode_file_in_func (JDEC* jd, uint8_t* buff, unsigned int nbyte){
 static unsigned int decode_file_in_func (JDEC* jd, uint8_t* buff, unsigned int nbyte){
-    luat_lcd_buff_info_t *buff_info = (luat_lcd_buff_info_t*)jd->device;   /* Device identifier for the session (5th argument of jd_prepare function) */
+    luat_lcd_buff_info_t *buff_info = (luat_lcd_buff_info_t*)jd->device;   /* Device identifier for the session (5th argument of luat_jd_prepare function) */
     if (buff) {
     if (buff) {
         /* Read bytes from input stream */
         /* Read bytes from input stream */
         return luat_fs_fread(buff, 1, nbyte, (FILE*)(buff_info->userdata));
         return luat_fs_fread(buff, 1, nbyte, (FILE*)(buff_info->userdata));
@@ -175,18 +175,18 @@ int lcd_jpeg_decode_default(luat_lcd_conf_t* conf, const char* path, luat_lcd_bu
 		LLOGE("out of memory when malloc jpeg decode workbuff");
 		LLOGE("out of memory when malloc jpeg decode workbuff");
 		goto error;
 		goto error;
 	}
 	}
-    res = jd_prepare(&jdec, decode_file_in_func, work, sz_work, buff_info);
+    res = luat_jd_prepare(&jdec, decode_file_in_func, work, sz_work, buff_info);
     if (res != JDR_OK) {
     if (res != JDR_OK) {
-        LLOGW("jd_prepare file %s error %d", path, res);
+        LLOGW("luat_jd_prepare file %s error %d", path, res);
         goto error;
         goto error;
     }
     }
     buff_info->width = jdec.width;
     buff_info->width = jdec.width;
     buff_info->height = jdec.height;
     buff_info->height = jdec.height;
 	buff_info->len = jdec.width*jdec.height*sizeof(luat_color_t);
 	buff_info->len = jdec.width*jdec.height*sizeof(luat_color_t);
 	buff_info->buff = luat_heap_malloc(buff_info->len);
 	buff_info->buff = luat_heap_malloc(buff_info->len);
-    res = jd_decomp(&jdec, decode_out_func, 0);
+    res = luat_jd_decomp(&jdec, decode_out_func, 0);
     if (res != JDR_OK) {
     if (res != JDR_OK) {
-        LLOGW("jd_decomp file %s error %d", path, res);
+        LLOGW("luat_jd_decomp file %s error %d", path, res);
         goto error;
         goto error;
     }
     }
     luat_heap_free(work);
     luat_heap_free(work);

+ 2 - 2
components/tjpgd/tjpgd.c

@@ -961,7 +961,7 @@ static JRESULT mcu_output (
 #define	LDB_WORD(ptr)		(uint16_t)(((uint16_t)*((uint8_t*)(ptr))<<8)|(uint16_t)*(uint8_t*)((ptr)+1))
 #define	LDB_WORD(ptr)		(uint16_t)(((uint16_t)*((uint8_t*)(ptr))<<8)|(uint16_t)*(uint8_t*)((ptr)+1))
 
 
 
 
-JRESULT jd_prepare (
+JRESULT luat_jd_prepare (
 	JDEC* jd,				/* Blank decompressor object */
 	JDEC* jd,				/* Blank decompressor object */
 	size_t (*infunc)(JDEC*, uint8_t*, size_t),	/* JPEG strem input function */
 	size_t (*infunc)(JDEC*, uint8_t*, size_t),	/* JPEG strem input function */
 	void* pool,				/* Working buffer for the decompression session */
 	void* pool,				/* Working buffer for the decompression session */
@@ -1118,7 +1118,7 @@ JRESULT jd_prepare (
 /* Start to decompress the JPEG picture                                  */
 /* Start to decompress the JPEG picture                                  */
 /*-----------------------------------------------------------------------*/
 /*-----------------------------------------------------------------------*/
 
 
-JRESULT jd_decomp (
+JRESULT luat_jd_decomp (
 	JDEC* jd,								/* Initialized decompression object */
 	JDEC* jd,								/* Initialized decompression object */
 	int (*outfunc)(JDEC*, void*, JRECT*),	/* RGB output function */
 	int (*outfunc)(JDEC*, void*, JRECT*),	/* RGB output function */
 	uint8_t scale							/* Output de-scaling factor (0 to 3) */
 	uint8_t scale							/* Output de-scaling factor (0 to 3) */

+ 2 - 2
components/tjpgd/tjpgd.h

@@ -91,8 +91,8 @@ struct JDEC {
 
 
 
 
 /* TJpgDec API functions */
 /* TJpgDec API functions */
-JRESULT jd_prepare (JDEC* jd, size_t (*infunc)(JDEC*,uint8_t*,size_t), void* pool, size_t sz_pool, void* dev);
-JRESULT jd_decomp (JDEC* jd, int (*outfunc)(JDEC*,void*,JRECT*), uint8_t scale);
+JRESULT luat_jd_prepare (JDEC* jd, size_t (*infunc)(JDEC*,uint8_t*,size_t), void* pool, size_t sz_pool, void* dev);
+JRESULT luat_jd_decomp (JDEC* jd, int (*outfunc)(JDEC*,void*,JRECT*), uint8_t scale);
 
 
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus