RAM Size optimisation for playing GIF

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • RAM Size optimisation for playing GIF

    I have a simulation where GUI_NUMBYTES is defined with 0x200 000, but in my source code it's only defined with 0x2 000.

    The size of my GIF exceed 0x2000, so i can't see the animation on the target. The "GUI_GIF_GetInfo" function result set always the number of image to 0 as greater than max defined.
    My code is very simple:

    Source Code

    1. void PlayGIF(const unsigned char * pFile, unsigned long FileSize, int XPos, int YPos, int NbPlay)
    2. {
    3. int i, j;
    4. GUI_GIF_INFO GifInfo = {0}; /* Info structure of GIF file */
    5. GUI_GIF_IMAGE_INFO ImageInfo = {0}; /* Info structure of one particular GIF image of the GIF file */
    6. /* Show movie */
    7. GUI_GIF_GetInfo(pFile, FileSize, &GifInfo); /* Get GIF info structure */
    8. for (i = 0; i < NbPlay; i++) /* Show the complete GIF 2 times ... */
    9. {
    10. for (j = 0; j < GifInfo.NumImages; j++)
    11. {
    12. GUI_GIF_DrawSub(pFile, FileSize, XPos, YPos, j); /* Draw sub image */
    13. GUI_GIF_GetImageInfo(pFile, FileSize, &ImageInfo, j); /* Get sub image information */
    14. GUI_Delay(20); /* Use the Delay member of the ImageInfo structure for waiting a while */
    15. }
    16. }
    17. }
    Display All

    As it's only a compilation of image, is there any other way to display GIF?

  • Hi Adrian,

    How can i know the max size of the "unsigned char" variable result from emWin tool to convert the GIF?
    As the variable is in const for me (ROM is greater than RAM) is there any function which work using pointer on the variable?

    Thanks for your support.

  • Hi Adrian,

    My question is about the "GUI_NUMBYTES" defined in GUIConf.c, how can i know the size in order to treat GIF pictures?
    Because if i set it to 0x2000 the GIF cannot be read, but if i set 0x200000 it works. So how can i know the limit?

    Do i have to test all possibilities? or is there a calculation to know the value i have to set according to the max size of GIF i have?

    Thanks for your help


  • Hello Mathieu,

    The memory usage depends on your application. For detailed information about memory usage of emWin features, please refer to the sections "Memory usage" in the according chapters in the emWin documentation. GIF related information can be found in 8.3 "Displaying bitmap files" -> "GIF file support".

    Best regards,