cancel
Showing results for 
Search instead for 
Did you mean: 

Bitmap::dynamicBitmapCreate() fails to allocate (JPEG decoding)

PBU
Associate III

Hi,

I'm trying to load jpeg files in TouchGFX by using the JPEG Loader Library. I have downloaded that from the Git using the link given in TouchGFX Forum. I have added the Library in my project and tried to load a jpeg image. The image was not loaded, the image is placed in the working folder alone. I have set the break point and checked if the file is opened successfully or not. The file was opened successfully but i didn't the image in simulator output . Suggest me a solution for this issue.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

0690X000006DSg1QAG.png

Fixed it.

You're missing additional parameters to your touchgfx init call. Pointer to cache, size of cache and number of cached bitmaps. If you stepped through the code in your view you would have seen that a dynamic bitmap could not be allocated so the JPEG was never decoded.

Allocate your cache (e.g. in main.cpp) to be large enough to contain the image (240*320)

uint8_t bmpCache[240*320*4];

 EDIT: Working project is attached to a post further down this thread.

View solution in original post

13 REPLIES 13
Martin KJELDSEN
Chief III

Hi @PBU​,

I have your test project. Which compiler are you using?

PBU
Associate III

Hi Martin,

I'm using GCC Compiler. But Right now i am using Microsoft Visual Studio for Simulation. The Files are inside the msvs folder generated by TouchGFX Tool.

Martin KJELDSEN
Chief III

0690X000006DSg1QAG.png

Fixed it.

You're missing additional parameters to your touchgfx init call. Pointer to cache, size of cache and number of cached bitmaps. If you stepped through the code in your view you would have seen that a dynamic bitmap could not be allocated so the JPEG was never decoded.

Allocate your cache (e.g. in main.cpp) to be large enough to contain the image (240*320)

uint8_t bmpCache[240*320*4];

 EDIT: Working project is attached to a post further down this thread.

PBU
Associate III

Hi Martin,

I have allocated the cache as you said. After that i have another error. Can you share the project if possible. Thanks

Martin KJELDSEN
Chief III

Hi @PBU​,

Here it is. I've ommitted the touchgfx folder to conserve space. It should get copied when you open the project in the designer.

Hope this helps!

Best regards,

Martin

Hi Martin,

Thank you. It Works.

Glad it's working for you! You almost made it through creating an example with success using the github code but were just missing some configuration - I'll take this into account and emphasize it when doing the dynamic bitmap / decoding video.

PBU
Associate III

Hi Martin,

I have tried the same project using Atollic True Studio. The fopen return FAIL while trying to open .jpg file. Do we need to change any settings to solve this?

What does printing errno tell you from that failing call? #include <errno.h>

​