Saturday, April 21st 2018, 11:19pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

mcharre

Beginner

Date of registration: Jan 10th 2011

Posts: 8

1

Monday, March 4th 2013, 2:19pm

RAM Size optimisation for playing GIF

Hi,
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void PlayGIF(const unsigned char * pFile, unsigned long FileSize, int XPos, int YPos, int NbPlay) 
{
  int i, j;

  GUI_GIF_INFO   	GifInfo   = {0}; /* Info structure of GIF file */
  GUI_GIF_IMAGE_INFO ImageInfo = {0}; /* Info structure of one particular GIF image of the GIF file */
  /* Show movie */
  GUI_GIF_GetInfo(pFile, FileSize, &GifInfo);                 	/* Get GIF info structure */
  for (i = 0; i < NbPlay; i++)                                     	/* Show the complete GIF 2 times ... */
  {
	for (j = 0; j < GifInfo.NumImages; j++) 
	{
  	GUI_GIF_DrawSub(pFile, FileSize, XPos, YPos, j);        	/* Draw sub image */
  	GUI_GIF_GetImageInfo(pFile, FileSize, &ImageInfo, j);   	/* Get sub image information */
  	GUI_Delay(20);	/* Use the Delay member of the ImageInfo structure for waiting a while */  	
	}
  }
}


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

Mathieu

Date of registration: May 26th 2009

Posts: 1,022

2

Tuesday, March 5th 2013, 9:11am

Hello Mathieu,

Displaying images of any kind require emWin to be able to allocate memory for temporary buffers. If memory can not be allocated the according function usually returns immediately.

Best regards,
Adrian

mcharre

Beginner

Date of registration: Jan 10th 2011

Posts: 8

3

Tuesday, March 5th 2013, 2:09pm

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.

Regards
Mathieu

Date of registration: May 26th 2009

Posts: 1,022

4

Wednesday, March 6th 2013, 9:30am

Hello Mathieu,

I am afraid I do not understand which variable you mean. Please make sure to have enough memory allocated to emWin in order to have GIF images being displayed properly.

Best regards,
Adrian

mcharre

Beginner

Date of registration: Jan 10th 2011

Posts: 8

5

Thursday, March 7th 2013, 11:57am

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

Regards

Mathieu

Date of registration: May 26th 2009

Posts: 1,022

6

Friday, March 8th 2013, 9:21am

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,
Adrian

mcharre

Beginner

Date of registration: Jan 10th 2011

Posts: 8

7

Friday, March 22nd 2013, 9:22am

Hi Adrian,
Due to my RAM limitation, i forgot the GIF and use some BMP to do it manually.

Thanks a lot for your help.

Regards

Mathieu