Bitmap::dynamicBitmapCreate() fails to allocate (JPEG decoding)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-07 10:40 PM
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.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-08 7:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-08 3:25 AM
Hi @PBU​,
I have your test project. Which compiler are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-08 3:42 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-08 7:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-08 7:33 AM
Hi Martin,
I have allocated the cache as you said. After that i have another error. Can you share the project if possible. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-09 4:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-09 8:36 PM
Hi Martin,
Thank you. It Works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-11 2:51 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-11 10:09 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-02-11 10:36 PM
What does printing errno tell you from that failing call? #include <errno.h>
​
