How to diesplay a RLE-compressed image

Hi everyone

The documentation says that ‘The RLE image can be used same as other images.’
Whereas the display of an image works without compression, I am currently failing to display a RLE-compressed image (LV_USE_RLE is set to 1 in lv_conf.h)
My successful approach is:

python LVGLImage.py --ofmt C --cf I8 --compress NONE logo.png

However, no image is displayed when I execute this command

python LVGLImage.py --ofmt C --cf I8 --compress RLE logo.png

Within the program, I use this code:

static void ShowLogo(void) {
    LV_IMAGE_DECLARE(logo);
    lv_obj_t *img1 = lv_image_create(lv_screen_active());
    lv_image_set_src(img1, &logo);
    lv_obj_align(img1, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_size(img1, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
    osDelay(1000);
    lv_obj_delete(img1);
}

Is there any point I’m missing?

Is your used version 9 ?

Excuse me. I forgot to mention it. Yes, the latest version.
And no simulation; I have the problem directly on the device itself.

RLE is new in 9 and LVGL is perfect , but for me is in beta state. I stay on 8.3.7 for me stable with some my improved codes. When you have time then debug and solve your RLE issue help devel lvgl…

But irelevant of version any image codecs require RAM place to decode and too your code with 1000ms delay in code with one thread cant work…

I’m using a RTOS; so the delay (osDelay()) gives LVGL the opportunity to do his work.
And as far as the memory is concerned: I always keep an eye on it.

Yes RTOS, but only if lv_handler is in other task as show_logo. But then you …
Operating system and interrupts — LVGL documentation

I have read the article you linked. But I couldn’t connect it with my problem.
I had also asked myself whether LVGL would be triggered at all. Therefore, before I call osDelay(), I set a breakpoint on line

lv_display_flush_ready(disp_drv);

(called in my_disp_flush())
It is called continuously. But no image appears.

Show C file generated from python , header part

Thank you for showing so much interest in my problem.
logo.c (59.2 KB)


#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#elif defined(LV_BUILD_TEST)
#include "../lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif


#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif

#ifndef LV_ATTRIBUTE_IMG_DUST
#define LV_ATTRIBUTE_IMG_DUST
#endif

static const
LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_DUST
uint8_t logo_map[] = {

...
...
};

const lv_image_dsc_t logo = {
  .header.magic = LV_IMAGE_HEADER_MAGIC,
  .header.cf = LV_COLOR_FORMAT_I8,
  .header.flags = 0 | LV_IMAGE_FLAGS_COMPRESSED,
  .header.w = 300,
  .header.h = 102,
  .header.stride = 300,
  .data_size = sizeof(logo_map),
  .data = logo_map,
};

2 of the problems was, as usual, about 50cm in front of the monitor:

  • in lv_conf.h I had forgotten to activate LV_BIN_DECODER_RAM_LOAD
  • the log level was to low (LV_LOG_LEVEL_USER; now LV_LOG_LEVEL_WARN)

Now I see 2 messages, but the warning I can’t interpret.
[Warn] (0.072, +72) lv_draw_buf_create_user: No memory: 300x102, cf: 16, stride: 1200, 122400Byte, lv_draw_buf.c:256

[Error] (0.072, +0) decode_indexed: No memory for indexed image lv_bin_decoder.c:632

The description struct of my file is:

const lv_image_dsc_t logo = {
  .header.magic = LV_IMAGE_HEADER_MAGIC,
  .header.cf = LV_COLOR_FORMAT_I8,
  .header.flags = 0 | LV_IMAGE_FLAGS_COMPRESSED,
  .header.w = 300,
  .header.h = 102,
  .header.stride = 300,
  .data_size = sizeof(logo_map),
  .data = logo_map,
};

But the warning says:
color-format: not LV_COLOR_FORMAT_I8 but LV_COLOR_FORMAT_ARGB8888
With a heap of only 64kB, a memory error occurs as a result.

So my question is: where do these values in the warning come from?

Simply as i write before, for decoding any compressed image is required RAM instead FLASH. In decoders docu is writed how much memory , but simple calc is 300x102x4 because indexed can have alpha info. Result to required RAM 122400 bytes.

LVGL is new territory for me, which is why I can’t contradict your comment.
But I notice that the error messages do not match my image format.

Be that as it may, I have given up my plan to work with RLE compressed images. And without making any changes in the config file, I only exchanged the logo.c file with the uncompressed one.
And again I got the same error messages with a blank screen.
The image was only displayed after I undid the changes in the lv_conf.h file.
LV_USE_RLE = 0
LV_BIN_DECODER_RAM_LOAD = 0

Nevertheless, thank you very much for your effort to help me

why you mean this. Graphics teory is same on all systems, lvgl no except.
Format for store image is not same as format for show image and any system not allocate memory for stored image format , for what ? Image is in flash and no next copy required.

And perfect info is your platform. For example ESP32 may use PSRAM …