-
GIF or Not?
11/09/2018 at 20:04 • 0 commentsWith the decision to adapt Nyan Cat to the Hackaday Belgrade 2018 badge (as preparation for the Hackaday Superconference 2018 badge) it’s time to get down to some implementation details. Obviously we start with the cat – the original animated GIF is widely available. Can we use the file as-is?
Looking at the GIF, it was drawn at 400×400 resolution. The badge LCD has a native resolution of 320×240, so the aspect ratio is wrong and the resolution is lower. In Photoshop I tried cropping the animation to see how that looked. I didn’t miss the cropped starry sky but I do miss the cropped rainbow trail. So let’s scale instead of crop.
The next question is: what file format? Do we stick with original GIF or something else? Raw bitmaps are out of the question. They would consume far too much valuable real estate on the badge. Rendering GIF would require porting a GIF decode library. When I was looking around for projects that decode GIF on a PIC32, I found the XORYA project which used libnsgif.
Looking over libnsgif dependencies, at first glance everything looks doable on the badge. This library was built to be part of the larger NetSurf project but it has abstraction layers that helps make badge adaptation easier. It looks like work, but a manageable amount of work.
But while it would be instructive to port an existing library for use, I lean towards doing something simpler to keep the demo approachable. So before I tackle the task of porting a GIF library, I wanted to evaluate run-length encoding. It is is the easiest compression algorithm available, making for code that is easy to read and understand. And this particular animation – with large horizontal streaks of the same color – seems ideally suited to the approach.
(Cross-posted to NewScrewdriver.com)
-
Hackaday Badge Project: Nyan Cat
11/09/2018 at 20:02 • 0 commentsAfter I've done an initial round of probing and learning and experimenting with the Hackaday Belgrade 2018 badge, it's about time I start writing something that I can put on its successor Hackaday Supercon 2018 badge. What to do?
For the purposes of a badge demo, it should explore areas of badge programming that aren't already present in existing badge firmware. Because that's what "demo" means - a demonstration.
I had been fascinated by the LCD module from the start, and the more I learn about it the more I feel it's been under-utilized by existing badge code. In keeping with the retro computing theme, almost everything on the badge are text-based, leaving the graphics capabilities of the badge largely unused. The ideal project would flex those visual muscles.
Another point of novelty on the badge is the audio subsystem, consuming three of five timers, even more of the precious I/O pins on the chip, it'd be a shame to waste all those resources. I want to make it sing.
So, what sights and sounds shall I present as a demonstration? A brainstorming session with [amybaldwindev] produced a list of candidates. The top candidate was Nyan Cat the famed YouTube star. Now, the badge won't be able to play a YouTube video nor play its corresponding sound track. But the video's source was a relatively simple animated GIF, and others have already done work to simplify the soundtrack.
Adapting an internet meme should make the result appealing to the Superconference audience. Making it an interesting technical demonstration project would almost end up being just a side bonus!
The only downside is that it doesn't fit with the retro computing theme, but I can live with that.
(Cross-posted to NewScrewdriver.com)