Bmp image decoder

AFAIK, a bmp-image decoder is missing from the Pokitto system sw, so I plan to implement it based on Jonne’s BMP2POK project. I want to gather some specifications first.

This is what I was planning:

Files are read from the SD card.

  1. Read from a bmp file to a bitmap
  2. Read from a rle-bmp to a rle-bitmap
  3. Read from a rle-bmp and convert it to a normal bitmap
  • Note: there is already a function to draw rle-bitmap to the screen buffer.
  • Is there a need for reading a bmp-image from memory? (from the flash rom?). Maybe
    not, as if there will be some built-in images they could be stored in the Pokitto bitmap format directly. Is there even anything like an internal drive, or is the SD card the only drive?
1 Like

One more, if you feel up to the challenge: reading from full-color bitmap on SD directly to screen.

Then people could just put pics on the SD and show them. This involves converting 24-bit to 565 on the fly and then drawing with directpixel (can be optimized quite a bit later).

Easier alternative is to read already 565-encoded pics as raw data on disk.

I see, that way we could show high color images even if we do not have memory for the buffer. I can try that also.

It’s probably easier than transferring to buffer first, you could also manage resizing I bet.

Yes, resizing by skipping pixels/rows would be quite easy. Doing filtered scaling is doable also if I keep a couple of full color rows in a temporary buffer.

This is an advanced feature thought, as you can put correctly scaled images to SD card.

I think the main benefit here would be to allow cutscenes and beautiful static screens to be used in a game, without the limitations of the ram/flash.

I did the 20fps A-ha/take on me -video with sound from SD card on the ATmega 328 (its on my jonnection YT channel) and I am pretty confident we could even do videos from SD on Pokitto with optimization.

Ok, but it is totally ok with me if Spinal wants to implement scaling also. I will probably skip it.

One thing popped in to my mind. I need to clip the image in this “image streaming” mode, in case the image is bigger than screen. It is very easy to add also clipping rect to the API. Then you could easily do simple “sprite sheet” animation just by re-reading the same file with different top left offset of the clipping rect.

This is progressing well. I have bmp-image decoder now working in the Pokitto sim. Also direct streaming of a full color bmp image to the screen works ( takes only about 100 bytes of RAM during the call, no buffers allocated).

Still todo:
-Test different color modes

  • implement clipping in bmp-streaming mode
  • test “sprite sheet”-animation in bmp-streaming mode
1 Like

Very nice :slight_smile:

-random gibberish-