SSD1306 I2C OLED - Muybridge Animation

It does not decode a GIF but a format developed by him.

bitbank: I created a Mac/Linux program to take animated GIFs and turn them into a compact form that's easy to play back (my own byte oriented compression). The player code doesn't need any RAM and runs well on an ATtiny85.

Yes, I am aware of that. But I suspect that he has a pretty good knowledge of how to decode a regular GIF.

It would be interesting to know if it can be done with Uno-size SRAM.

Yes, I am sure that you can invent a special format. But you would need to process every standard GIF into this special format before you use it. Not as convenient as using standard PC tools like IrfanView.

David.

david_prentice: Yes, I am aware of that. But I suspect that he has a pretty good knowledge of how to decode a regular GIF.

It would be interesting to know if it can be done with Uno-size SRAM.

Yes, I am sure that you can invent a special format. But you would need to process every standard GIF into this special format before you use it. Not as convenient as using standard PC tools like IrfanView.

David.

As I state in my blog post. No AVR MCU has enough RAM to decode a GIF. LZW compression needs a dynamic dictionary with 4096 entries and multiple pointers/flags for each entry. Animated GIF requires additional RAM to hold the previous frame. Neither of which is possible with less than 32-64k of RAM. My solution is a practical way to leverage the numerous animated GIF tools to easily create complex animations to run on AVRs. The other side of my project is that my code allows the "slow+cheap" I2C version of the SSD1306 to become practical for doing fast animations.

It is the same also for small GIF? Because Bodmer was able to decode JPEG on a Mega (SRAM 8Kb) https://github.com/Bodmer/JPEGDecoder and I used his library on a STM32F103 with 20Kb SRAM.

Anyway maybe an ESP8266 or an ESP32 can do that?

zoomx:
It is the same also for small GIF?
Because Bodmer was able to decode JPEG on a Mega (SRAM 8Kb)
GitHub - Bodmer/JPEGDecoder: A JPEG decoder library
and I used his library on a STM32F103 with 20Kb SRAM.

Anyway maybe an ESP8266 or an ESP32 can do that?

JPEG and GIF compression have nothing to do with each other. Yes, it’s possible to decode a JPEG with less RAM than a GIF. The problem with GIF decoding is that the dictionary grows as you decode the image. You may be able to decode a tiny image, but then a slightly larger one will need more room to decode. It would be a “half-baked” solution that would fail frequently. An ESP32 could certainly handle GIF decoding. This topic is about animating images on much more constrained MCUs like the AVR series.

stievenart:

I have attached an image of a Star Wars AT-AT that someone might animate:

Done.

at80.c (99.3 KB)

Thanks. It seems that frame 14 (img14) was lost.

@dm3942,

There are three types of monochrome bitmap:

  1. MSB first. 8-bits across a row per byte. Used by Adafruit drawBitmap()
  2. LSB first. 8-bits across a row. Used by Adafruit drawXBitmap() and U8g2lib
  3. KS0108 style. 8 vertical bits per byte. Draw an 8-bit deep stripe across the screen. Called a page.

Method (3) is native to the SSD1306, KS0108, … controller. And is the format used by Adafruit and U8g2lib for RAM buffers.

I found Image2GLCD on the Internet. It appears to be capable of generating all three styles.
I could not get it to work properly. The program is Chinese. I don’t know how to register in Chinese. I can’t read Chinese Help files.

Image2GLCD can resize to fit your GLCD / OLED
Image2GLCD can alter colour depth / contrast.

Your bitmaps were made for (2) with default depth. You could get better images if you adjust the depth.

I suspect that some programs can extract multiple frames from an animated GIF. Which would be nice.

Anyway, I have adapted your arrays to suit a Uno.
And converted them to (3) format.

A Uno can achieve about 15 FPS with I2C and drawBitmap() or 30FPS with the native KS0108 format.

If you use SPI, you can get 30FPS and 285 FPS on a Uno.

Can anyone recommend an Image program that work properly?
It would be nice to generate multiple C arrays directly from animated GIF.

David.

OLED_at80s.zip (29.2 KB)

I found Image2GLCD here http://www.ablab.in/image2glcd-software/ it is in english not chinese! I found also this one https://sourceforge.net/projects/lcd-image-converter/ and this one http://bitmap2lcd.com/blog/ No one works with animated gif. I believe that it can be done using multiple programs, one for splitting gif and one for converting, with a third program that automate the process.

I will wait to hear from someone that has a positive experience with a PC app.

I do not want to "register" with an Indian website. I do not mind paying a modest contribution to the real author.

David.