Issues regarding video transmission display in LVGL

Board: Huangshan Series, Function: Obtain JPEG image data online and display it via LVGL.

Currently, I’m able to successfully receive JPEG file data sent from a mobile phone. The data starts with the header FF D8 and ends with FF D9.
Initially, I intended to enable CONFIG_LV_USE_TJPGD and simply call lv_image_set_src(img_obj, data) to display the image.

However, when attempting to directly display the image using LVGL’s TJPGD decoding library, it didn’t work. After troubleshooting, I found that lv_image_set_src determines the input data type among three options: LV_IMAGE_SRC_FILE, LV_IMAGE_SRC_VARIABLE, and LV_IMAGE_SRC_SYMBOL.

  • LV_IMAGE_SRC_FILE: Reads from the file system. Since my JPEG data resides in memory rather than in a physical file, this option is invalid.
  • LV_IMAGE_SRC_VARIABLE: Requires data structured as lv_img_dsc_t, which holds decoded raw pixel data (e.g., RGB565). This is typically used for images embedded directly in code. Since my input is compressed JPEG data in memory, it cannot be used directly.
  • LV_IMAGE_SRC_SYMBOL: Refers to built-in LVGL symbol icons, which clearly doesn’t apply here.

Therefore, I’ve considered the following possible solutions:

  1. Use an external JPEG decoder library to decode the JPEG data into RGB565 format, construct a proper lv_img_dsc_t, and then pass it to lv_image_set_src. However, I couldn’t find any relevant decoding examples or supported libraries in the SDK (LB52).

  2. Save the JPEG data into the file system using lv_fs, then load it via lv_image_set_src as a file. I tried this approach, but it quickly leads to memory exhaustion. Example memory status:

    total memory: 337188
    used memory : 146272
    maximum allocated memory: 152216
    

    Besides, I’d prefer to avoid this method due to inefficiency—writing to and reading from storage just for temporary image display impacts performance.

Could you please advise if there is a better way to achieve this functionality? Any guidance or suggestions would be greatly appreciated. Thank you!

我也是进行手机传输图片然后本地显示,我现在是通过TJpgDec解码后存入PSRAM中,然后通过LVGL Canvas功能直接去LCD上绘制像素,这样可以正常显示图片
我想问一下你是通过什么方式把手机上的图片传输到本地板子上的,我这边传输速度很慢

Transmitting a JPEG image of about 10KB via Bluetooth BLE; I haven’t measured the speed yet, but visually it takes roughly 0.2 to 0.5 seconds per image. I’ve been focused on solving LVGL display issues, and I’ll also try out the LVGL canvas feature. Thanks for the tip!

First scenario: We will later release a decoding routine using the LV_IMAGE_SRC_VARIABLE method.

Second scenario: Your device seems to have crashed; however, memory usage does not appear to be exceeding limits.