Brighton's Blog
← All Series

Zlib

3 - RBKC: The Chunked .rabook Container

RA8D2RenesasEmbeddedBinary FormatsBare-MetalCEPUBzlibDemand Paging

Books are the reason this project exists, so this is where the e-reader stops being a graphics demo and starts being a reader.

The interesting tension here is that solving one problem creates another. Moving all the EPUB parsing to a host tool makes the device’s job trivial, but it produces a single flat object that is bigger than RAM – so now you need a way to read a piece of it without holding the whole thing. This post is also a useful comparison with the previous one: the two formats put their index at opposite ends of the file, for reasons that are entirely about the producer.

Read more →

4 - RCBZ: The Per-Page Comic Container

RA8D2RenesasEmbeddedBinary FormatsBare-MetalCCBZComicszlib

Comics turned out to be a different problem from books, and I nearly got it wrong by assuming they were the same problem.

The instinct is to reach for the container you already built. That instinct is wrong here, and the post spends a while on why: the unit you index by is a design decision, not an implementation detail, and picking the wrong one costs you several reads and several inflates for every single page turn. There is also a nice security result at the end – the device ends up never running an image decoder at all.

Read more →