各位好!
想与各位请教,目前我正在使用JPEG解码器将图片从SD卡解码后显示到LCD,同时有显示问题,程序参考STM32H7官方JPEG,检查过后扩大Chunk值后有一点改善,可是仍然部分少图。
- /* Private define ------------------------------------------------------------*/
- #define CHUNK_SIZE_IN ((uint32_t)(64 * 1024))//(4096)) //
- #define CHUNK_SIZE_OUT ((uint32_t)(64 * 1024))//(64 * 1024))
- #define JPEG_BUFFER_EMPTY 0
- #define JPEG_BUFFER_FULL 1
- #define NB_OUTPUT_DATA_BUFFERS 2
- #define NB_INPUT_DATA_BUFFERS 2
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- FIL *pFile; /* pointer to File object */
- uint8_t JPEG_Data_InBuffer0[CHUNK_SIZE_IN];
- uint8_t JPEG_Data_InBuffer1[CHUNK_SIZE_IN];
- JPEG_Data_BufferTypeDef Jpeg_IN_BufferTab[NB_INPUT_DATA_BUFFERS] =
- {
- {JPEG_BUFFER_EMPTY , JPEG_Data_InBuffer0, 0},
- {JPEG_BUFFER_EMPTY , JPEG_Data_InBuffer1, 0}
- };
复制代码
- uint32_t JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, FIL *file, uint32_t DestAddress)
- {
- uint32_t i;
-
- pFile = file;
- FrameBufferAddress = DestAddress;
-
- /* Read from JPG file and fill input buffers */
- for(i = 0; i < NB_INPUT_DATA_BUFFERS; i++)
- {
- if(f_read (pFile, Jpeg_IN_BufferTab[i].DataBuffer , CHUNK_SIZE_IN, (UINT*)(&Jpeg_IN_BufferTab[i].DataBufferSize)) == FR_OK)
- {
- Jpeg_IN_BufferTab[i].State = JPEG_BUFFER_FULL;
- }
- else
- {
- Error_Handler();
- }
- }
- /* Start JPEG decoding with DMA method */
- HAL_JPEG_Decode_DMA(hjpeg ,Jpeg_IN_BufferTab[0].DataBuffer ,Jpeg_IN_BufferTab[0].DataBufferSize ,(uint8_t *)FrameBufferAddress ,CHUNK_SIZE_OUT);
-
-
- return 0;
- }
复制代码
还请各位协助!
谢谢!
|