I have noticed that whenever I am playing animated GIF files it slows with each frame.
I am using the STM32F429 with the STemWin and FatFS library, and play the file from a micro SD card.
Below is the applicable code. Am I missing something? I appreciate your assistance with this problem.
I am using the STM32F429 with the STemWin and FatFS library, and play the file from a micro SD card.
Below is the applicable code. Am I missing something? I appreciate your assistance with this problem.
Source Code
- int APP_GetData(void * p, const U8 * * ppData, unsigned NumBytesReq, U32 Off){ FIL * phFile; UINT NumBytesRead; phFile = (FIL *) p; // Check buffer size if (NumBytesReq > sizeof(_acBuffer)) { NumBytesReq = sizeof(_acBuffer); } // Set file pointer to the offset location f_lseek(phFile, Off); // Read data into buffer f_read(phFile, _acBuffer, NumBytesReq, (UINT *)&NumBytesRead); // Set data pointer to the beginning of the buffer *ppData = _acBuffer; // Return number of available bytes return NumBytesRead;}
- void _ShowGIFEx(const TCHAR* pFile){ GUI_GIF_IMAGE_INFO ImageInfo = {0}; //Info structure of one particular GIF image of the GIF file GUI_GIF_INFO GifInfo = {0}; //Info structure of GIF file int i; int XPos; int YPos;
- XPos = 0; YPos = 0;
- if (f_open(&fil, pFile, FA_READ) == FR_OK) { GUI_GIF_GetInfoEx(APP_GetData, &fil, &GifInfo); //Get GIF info structure for (i = 0; i < GifInfo.NumImages; i++) { // plot with emWin the file handled by F1 GUI_GIF_DrawSubEx(APP_GetData, &fil, XPos, YPos, i); GUI_GIF_GetImageInfoEx(APP_GetData, &fil, &ImageInfo, i); //Get sub image information Delay_ms(ImageInfo.Delay ? ImageInfo.Delay: 500); //Use the Delay member of the ImageInfo structure for waiting a while } // close the file handled by F1 if (f_close(&fil) == FR_OK) { f_close(&fil); } }}