Today’s project involved transitioning from a passthrough codec to one that does some minimal amount of coding. This version determines the number of unique colors that a frame uses, codes the palette, and codes the palette indices using the minimum number of of bits necessary. For example, if there are 16 unique colors, only 4 bits are needed to code each pixel. If there are 18 colors, 5 bits are needed. Both of these are common situations for my basic test case:
![The Adventure Of Lolo](/eggs/images/lolo1.gif)
The Adventures of Lolo, NES
According to my AVI frame-tallying tool:
Assuming 60 frames/sec: 952 video frames, 0m15s running time, 30263114 total video bytes 2017540 avg video bytes/sec, 31788 avg video bytes/frame min video frame = 5 bytes, max video frame = 35905 bytes
This compression scheme is all keyframes so far. While 30 MB is better than 218 MB, which is the original size of the movie, this is far from an optimal coding. The best compression at this point comes from single-color frames. The next phase is to try some different compression techniques and see which one yields the best nominal result.