Decoding bmp ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-11 2:21 AM
Guys,
Does anyone of you have experience on decoding bmp ? I want to display bmp file to my LCD... Any clues ? thanks #i-have-a-clue- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 6:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 7:06 PM
I don't understand, it's already working on your side ? do I miss some registers on my init ?
I used your LCD init, still the same result....it's not from the init...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 7:08 PM
I used the same init you have, still the same result,
Do I miss something in my LCD bitmap function ? thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 7:26 PM
wild guess
pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3); giving me a greenish mix with blueish....- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 7:34 PM
I fixed it,
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header I missed sizeof(hdr) supposed to be sizeof(hdr_256),f_read(&fsrc, hdr_256, sizeof(hdr), &bytesread); // Read header Thanks a lot for helping me out, for example I want to use 16K colors, I just change the 256 loop ? It works now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 7:58 PM
for 16K color will be like this ? please correct me if I'm wrong, thanks
//16K color bmp
res = f_open(&fsrc, ''test9.bmp'', FA_READ);
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header
off = *((uint32_t *)&hdr_256[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr_256[0x12]); // X pixels
yy = *((uint32_t *)&hdr_256[0x16]); // Y pixels
for(i=0; i<
16384
; i++) // Build palette conversion (+0x46 count?)
{
uint32_t pal;
f_read(&fsrc, &pal, 4, &bytesread); // Read palette B G R
// RRRRRRRRGGGGGGGGBBBBBBBB 8:8:8
// BBBBBGGGGGGRRRRR 5:6:5
//pal = ((pal & 0x00FC00) >> 5) | ((pal & 0xF80000) >> 19) | ((pal & 0x0000F8) <<
8
);
pal = ((pal & 0xF80000) >> 8) | ((pal & 0x00FC00) >> 5) | ((pal & 0x0000F8) >> 3);
//pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3);
w[i] = (uint16_t)pal;
}
f_lseek(&fsrc, off); // Seek to the data
for(y=0; y<yy; y++)
{
for(x=0; x<xx; x++)
{
uint8_t b;
f_read(&fsrc, &b, 1, &bytesread); // Read byte
LCD_SetPoint(y, x, w[b]); // Colour Map
} // x
} // y
f_close(&fsrc);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 7:59 PM
for example I want to use 16M colors, I just change the 256 loop ?
The high colour depth files don't need the palette tables, each pixel is described individually, and you'd need to transform into the 5:6:5 64K colour space of the display, or whatever it is capable of.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 8:02 PM
for 16K color will be like this ? please correct me if I'm wrong, thanks
//16K color bmp
res = f_open(&fsrc, ''test9.bmp'', FA_READ);
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header
off = *((uint32_t *)&hdr_256[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr_256[0x12]); // X pixels
yy = *((uint32_t *)&hdr_256[0x16]); // Y pixels
for(i=0; i<
16384
; i++) // Build palette conversion (+0x46 count?)
{
uint32_t pal;
f_read(&fsrc, &pal, 4, &bytesread); // Read palette B G R
// RRRRRRRRGGGGGGGGBBBBBBBB 8:8:8
// BBBBBGGGGGGRRRRR 5:6:5
//pal = ((pal & 0x00FC00) >> 5) | ((pal & 0xF80000) >> 19) | ((pal & 0x0000F8) <<
8
);
pal = ((pal & 0xF80000) >> 8) | ((pal & 0x00FC00) >> 5) | ((pal & 0x0000F8) >> 3);
//pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3);
w[i] = (uint16_t)pal;
}
f_lseek(&fsrc, off); // Seek to the data
for(y=0; y<yy; y++)
{
for(x=0; x<xx; x++)
{
uint8_t b;
f_read(&fsrc, &b, 1, &bytesread); // Read byte
LCD_SetPoint(y, x, w[b]); // Colour Map
} // x
} // y
f_close(&fsrc);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 8:11 PM
do you have example for it ? thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-04-18 8:14 PM
for 16K color will be like this ? please correct me if I'm wrong, thanks
16K? Don't you mean 24-bit 16M? There isn't a palette table, you go directly to the pixel data, and then you have to convert that to the colour space of your display.Up vote any posts that you find helpful, it shows what's working..
