Use lv_lib_split_jpg to open the jpg file, the picture shows No data

Description

Use lv_lib_split_jpg to open the jpg file, the picture shows No data.

What MCU/Processor/Board and compiler are you using?

linux gcc

What LVGL version are you using?

v7.4

What do you want to achieve?

Display jpg images correctly

What have you tried so far?

Transplant the lv_lib_split_jpg provided by lvgl and use this library according to the example

Code to reproduce

The code block(s) should be formatted like:

 lv_obj_t *img1 = lv_img_create(lv_scr_act(), NULL);
 lv_img_set_src(img1, "D:/res/img/wallpaper.jpg");

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Do you see any information in the log?

7.4 is quite old; I would suggest updating to the release/v7 branch on GitHub. It now receives essential bugfixes only.

Sorry, I remembered the wrong version. I am using the simulated development environment of v7.10.1 version to test and open the jpg file. Here is the printed log. It shows that the memory cannot be allocated. The memory size I configured in config.h is 1 * 1024 * 1024. This is very strange.

User: LV_FS_PC is initialized with.     (lv_fs_pc.c #115 lv_fs_if_pc_init())
User: The following path is considered as root directory:
/home/server/lv_sim_vscode_sdl  (lv_fs_pc.c #116 lv_fs_if_pc_init())
Warn: Couldn't allocate memory  (lv_mem.c #198 lv_mem_alloc())
Warn: Image draw cannot open the image resource         (lv_img_cache.c #135 _lv_img_cache_open())
Warn: Image draw error  (lv_draw_img.c #88 lv_draw_img())
Warn: Couldn't allocate memory  (lv_mem.c #198 lv_mem_alloc())
Warn: Image draw cannot open the image resource         (lv_img_cache.c #135 _lv_img_cache_open())
Warn: Image draw error  (lv_draw_img.c #88 lv_draw_img())
Warn: Couldn't allocate memory  (lv_mem.c #198 lv_mem_alloc())
Warn: Image draw cannot open the image resource         (lv_img_cache.c #135 _lv_img_cache_open())
Warn: Image draw error  (lv_draw_img.c #88 lv_draw_img())

What’s the size of your image (both in pixels and in bytes)?

pixels:640 * 480
size:84.8KB

The picture is an example picture provided by lv_lib_split_jpg. The link is as follows:
link

When decoding JPEG files, the SJPG decoder has to store the entire uncompressed image in RAM. At 16-bit color, that’s 614KB. If there is additional overhead for the decompression, it’s possible that the total allocation exceeds 1MB.

Try with a bigger heap (e.g. 2MB) and see if it works.

I set the LV MEM_SIZE in lv_conf.h to 2M or greater, it still shows No Data, and the log still prints:
Warn: Couldn't allocate memory (lv_mem.c #198 lv_mem_alloc())

I located the place where the memory application failed. On line 668 of lv_sjpg.c sjpeg->frame_cache applied for a memory size of640 * 480 * 3bytes. In fact, the heap size I configured in lv_conf.h is 12M. This makes me very confused. Does lvgl have any other restrictions on each memory application?

Sorry, I have found the reason. The heap size set by my simulation project does not work. As a result, it is impossible to apply for a space larger than 200kb. thank you very much for your help.