LVGL 9 memory requirements for LV_COLOR_FORMAT_I4 and LV_COLOR_FORMAT_I8 seem incorrect

Description

LVGL 9 memory requirements for LV_COLOR_FORMAT_I4 and LV_COLOR_FORMAT_I8 seem incorrect

What LVGL version are you using?

9.2.0

In LVGL 8.x.x, for LV_COLOR_DEPTH 16, I was using the following:

lv_canvas_set_buffer(stormlapse_canGraph, lightGraphBufStart, 474, 110, LV_IMG_CF_INDEXED_4BIT)

The buffer referenced by lightGraphBufStart was sized at 52,140 bytes (474 * 110 * 4 bits) and everything worked smoothly.

In migrating to LVGL 9.2.0, I changed LV_IMG_CF_INDEXED_4BIT to LV_COLOR_FORMAT_I4, which I believe is equivalent. From the latest docs:

The canvas supports all the color formats like LV_COLOR_FORMAT_ARGB8888 or LV_COLOR_FORMAT_I2. See the full list in the Color formats section.

-and-

LV_COLOR_FORMAT_I1, LV_COLOR_FORMAT_I2, LV_COLOR_FORMAT_I4, LV_COLOR_FORMAT_I8: Uses a palette with 2, 4, 16 or 256 colors and stores each pixel in 1, 2, 4 or 8 bits

However, when I run my app, nothing appears on the canvas. Turning on LVGL log reveals the following:

[Warn]  (62.019, +16)    lv_draw_buf_create_ex: No memory: 474x110, cf: 16, stride: 1896, 208560Byte,  lv_draw_buf.c:286
[Error] (62.019, +0)     decode_indexed: No memory for indexed image lv_bin_decoder.c:636

It is attempting to 2 bytes of memory per pixel vs 4 bits as per docs and LVGL 8.3.x, and obviously failing.

=====
Similarly, in LVGL 8.x.x, for LV_COLOR_DEPTH 16, I had an image with color format LV_IMG_CF_INDEXED_8BIT and size 400x400, generated from the Image Converter tool and stored as a .c file, and I was able to display that with no issues.

Switching to v9.2.0, regenerating the image as LV_COLOR_FORMAT_I8 using the supplied python script, when the app tries to display this, I get the following error:

[Warn]  (6.350, +0)      lv_draw_buf_create_ex: No memory: 400x400, cf: 16, stride: 1600, 640000Byte,  lv_draw_buf.c:286
[Error] (6.350, +0)      decode_indexed: No memory for indexed image lv_bin_decoder.c:636
[Error] (6.350, +0)      lv_draw_image_normal_helper: Failed to open image lv_draw_image.c:174

Am I doing something wrong, or has the memory requirements changed drastically for LVGL 9.x.x?

Turns out I was doing something wrong. This setting in lv_conf.h was set to 1:

/Decode bin images to RAM/
#define LV_BIN_DECODER_RAM_LOAD 0

Slightly confusing comment and name, for it to also apply to the canvas object, even though under the hood it uses imageā€¦