For xupdf, before we move to using real PDF rendering in realtime, and also for real photos later, we need a way to quickly load and discard mipmap levels.
The Mipzip file format is simple: a zip file with a single entry for each mipmap level, and a metadata entry "texformat". The metadata is stored in comments so that unzip -l will show it. The format is stored as an callGL-accepted OpenGL token, e.g. COMPRESSED_RGB_S3TC_DXT1_EXT.
The following classes collaborate to provide Mipzip functionality. First of all, MipzipLoader has a nested class, Level, for representing a mipmap level, and uses GL.Texture to store the texture which it loads and unloads.
MipzipMemoryConsumer provides a published API for requesting the Texture ID and posts at the same time requests for consuming memory.
The process of loading a single mipzip level is rather intricate. Due to the requirements of memory handling and GL threads, we need to separate loading the mipmap level and teximaging it to different threads.