Skip to content

Conversation

@abhinav-s235
Copy link
Contributor

  • This commit introduces a new utility to convert BMP image files to the RGB565 color format and display them on the LCD at runtime.
  • Supports reading 16-bit files, including handling of BI_RGB and BI_BITFIELDS compression for 16-bit variants.

@abhinav-s235
Copy link
Contributor Author

Add bmp file(16bit) inside resource directory and modify the variable bmp_filename with the path of file.

@sunghan-chang
Copy link
Contributor

@abhinav-s235 Is it possible to check converting time for 320 240 and 800 480?


static int lcd_render_bmp(FAR struct lcd_dev_s *dev)
{
const char *bmp_filename = "/res/kernel/audio/img_logo_samsung.bmp";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use bmp_filename as function parameter

Copy link
Member

@pcs1265 pcs1265 Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seokhun-eom24 , How about making the BMP file path configurable in Kconfig?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seokhun-eom24 , How about making the BMP file path configurable in Kconfig?

I think it's better to parameterize for function reusability.
Additionally, since the BMP file path needs to be determined dynamically at runtime, we should consider whether Kconfig is more suitable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bmp_filename has been parameterized

}
}
priv->config->lcd_put_area((u8 *)fullscreen_buffer, 1, 1, CONFIG_LCD_XRES, CONFIG_LCD_YRES);
fclose(bmp_file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needed mm_free(fullscreen_buffer); in normal exit case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In normal exit case when SW_ROTATION is disabled
If I free the buffer the LCD will show some random colours

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right. I thought lcd_put_area copies the buffer. So it doesn't need buffer any more.

if (r_mask == 0) {
r = 0;
} else {
uint8_t r_bits = __builtin_popcount(r_mask);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check with #ifdef __GNUC__ for __builtin_popcount, __builtin_ctz exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added helper functions instead of compiler intrinsics

Comment on lines 656 to 657
int displayed_img_width = img_height;
int displayed_img_height = img_width;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these variables are unnecessary, remove them and use img_height and img_width instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes made as you suggested


int img_width = info_header.width;
int img_height = info_header.height;
// For 16-bit, each pixel is 2 bytes. Padding is to the next 4-byte boundary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you handle when img_width or img_height is larger than LCD width or height.
goto errout for these cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@abhinav-s235
Copy link
Contributor Author

abhinav-s235 commented Oct 1, 2025

@abhinav-s235 Is it possible to check converting time for 320 240 and 800 480?

You mean time require to convert bmp file?

…isplay

- This commit introduces a new utility to convert BMP image files to the
  RGB565 color format and display them on the LCD at runtime.
- Supports reading 16-bit files, including handling of `BI_RGB`
  and `BI_BITFIELDS` compression for 16-bit variants.
@abhinav-s235
Copy link
Contributor Author

@abhinav-s235 Is it possible to check converting time for 320 240 and 800 480?

You mean time require to convert bmp file?

If its time then it takes around 44ms for 800*480

Copy link
Contributor

@seokhun-eom24 seokhun-eom24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lcd_render_bmp function should be callable from lcd_init_put_image as you did.
This function must verify the provided file path, return ERROR if the file is missing or an other error occurs, otherwise just render the bmp image to LCD with lcd_put_area

When implementation is completed, change state to mergeable.

@abhinav-s235 abhinav-s235 marked this pull request as ready for review October 6, 2025 09:49
@sunghan-chang sunghan-chang merged commit 3afb6d0 into Samsung:master Oct 15, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants