To perform the actual decoding of JPEG imagery Papyrix vendors a PicoJPEG library. So today I'll at least start studying how it works!
Its aided by some helpers for bitwise manipulation, some lookuptables, global buffers, & wrappers around provided callbacks with that buffering.
There's a Huffman decoder which reads however many bits a decoded lookuptable wants, then looks up the decoded value & delta-decompresses it. And there's routine for populating these lookuptables from a codebook.
1/?
There's helpers for branching over a given index to return the appropriate codebook or value. There's a routine to parse the codebooks & other for dequantization tables & markers (aided by helpers to parse SOF, DRI, SOS, or any other markers). There's various helpers to locate certain markers.
There's multi-layered initializers, cleanup routines, a helper to seek to EOI, & validation routines called by a secondary initializer.
And then we get to the interesting bits... Tomorrow!
2/2!