cancel
Showing results for 
Search instead for 
Did you mean: 

STemWin - GUI_JPEG_DrawEx

bbee
Associate III
Posted on January 24, 2017 at 13:17

Hi.

I'm using STM32CubeF4 1.14.0 with STemWin 5.32.

I need to draw JPEGs from file using the DrawEx functions where the user has to provide a getData function which reads chunks of data from a file.

However the ...DrawEx functions do not provide any possibilty to cancel an ongoing drawing. As decoding of JPEG files need a lot of time it is necessary to have a possibility to cancel an ongoing drawing. At the moment you always have to wait until the image is fully loaded which may take a long time depending on the size of the image.

The Segger manual states that the drawing function will return immediately if the getData function doesn't return the requested number of bytes whereas the STemWin manual says that the function always has to return at least 1 Byte.

I tried to return 0 in the getData function but this will not cancel an ongoing loading of data from the image file. Instead the function will never return even when it gets no data at all.

In my opinion this is a perfect bug and should be fixed as soon as possible. Without the possibilty to cancel loading the data the library can not be used e.g. for applications like picture frames because one has to react fast on any user input instead to wait for seconds until loading and decompression has finished.

Is there any other possibilty to SAFELY cancel these drawing functions?. This is related to :

  • GUI_BMP_DrawEx, GUI_BMP_DrawScaledEx
  • GUI_JPG_DrawEx, GUI_JPEG_DrawScaledEx
  • GUI_PNG_DrawEx

#stemwin
11 REPLIES 11
Imen.D
ST Employee
Posted on January 26, 2017 at 17:43

Hello ra hummel,

Your issue is reported in our development team for more investigation and will come back to you with the feedback then.

What is the memory that you have spend ? Maybe a decoding take a lot time due to the JPEG memory requirement ? Try to increase the size of the memory, this may help.

Please, keep us informed about your update on your project.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
T J
Lead
Posted on January 27, 2017 at 05:38

can you run the jpeg decoder in a thread ?

can you terminate a thread ?

bbee
Associate III
Posted on January 27, 2017 at 07:40

Memory size is not the problem and also decoding is not the problem im fine with that. The problem is that one does not have any possiblity to cancel the image processing even if you return zero bytes in the getData function.

Sure I could use memory devices and run the decoder in a separate thread, but terminating or to cancel the thread is not an option because of memory leaks that may be produced by emwin (see:

http://forum.segger.com/index.php?page=Thread&threadID=2150

).
Sergio Roldan
Associate II
Posted on March 13, 2017 at 09:48

Hi!

I am new using emWin and I am trying to load jpeg images into memory without using conversion to c format. I am using Keil compiler and I am suposing that putting the file within the project folder will be enough in order to use the JPEG API.

I cannot try it because this API uses the windows.h library which it is not available for keil because it is not a GNU compiler.

So my question is, how can I do it?

Another thing is that you have talked about the STemWin manual, but I have only found the Getting Started manual where there aren't a reference of any function or API, Where can I find that manual?

Thanks!!

Posted on March 13, 2017 at 11:58

Hi, 

I think you have download the STemwin package from this

http://www.st.com/en/embedded-software/stemwin.html

 page and refer to the Getting Started AN4323.

So, you asked to have the

https://www.google.tn/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0ahUKEwjqhpXQp9PSAhXFWiwKHT-oBIgQFggmMAI&url=https%3A%2F%2Fwww.segger.com%2Fdownloads%2Femwin%2FUM03001_emWin5.pdf&usg=AFQjCNGriPxyOkHZwRVRQwVzMFyRQM5z8w&sig2=1LFDpirOyRRy2z49NMSUhA&bvm=bv.149397726,d.bGg

.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on March 13, 2017 at 12:52

Hi,

I already have the segger manual. What I was asking for, was the STemwin manual as ra hummel said in his first post: 

The Segger manual states that the drawing function will return immediately if the getData function doesn't return the requested number of bytes whereas the STemWin manual says that the function always has to return at least 1 Byte.

Anyway, what I want to know is how to store a jpeg image within the memory of the 32F429IDISCOVERY Board without converting it to c format, because when you convert it, the c file size is bigger than the jpeg file size, so I want to try to use the jpep file and load it into a memory device in order to check how it is better way of use for my application.

Thanks!

Sergio.

Posted on March 16, 2017 at 09:33

I am still having this problem. All the examples I have found include the 'windows' library and I am not able to find it for use with keil.

Can someone show me how to load extern files like jpeg into RAM?

Thanks.

Posted on March 16, 2017 at 09:55

You have a method but keep stating you don't want to use that method. The compiler condenses the byte array back to nominal size, in a format the linker can manage.

Your alternative is to convert to an object file and link that in, or add SDIO and FATFS support and put the image files on a microsd card.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on March 23, 2017 at 09:01

Download STM32Cube for your MCU (e.g. STM32CubeF4 for STM32F4XX MCUs) and unzip it. You will find STemWin in the sub folder Middlewares\ST\STemWin and the manual in Middlewares\ST\STemWin\Documentation\STemWin532.pdf.

Open the manual and have a look into chapter '9.2 JPEG file support'. You will find an example about how to load a JPEG file from ROM in chapter 9.2.2.

BTW you will find a starter application in Projects\STM32F429I-Discovery\Applications\STemWin