Expand description
JB2 bilevel image decoder — clean-room implementation (phase 2b).
Decodes JB2-encoded bitonal images from DjVu Sjbz and Djbz chunks. The JB2 format uses a ZP adaptive arithmetic coder with 262 context variables and a symbol dictionary for run-length compression of recurring glyphs.
§Key public types
Jb2Dict— shared symbol dictionary decoded from a Djbz chunkdecode— decode a Sjbz image stream to aBitmapdecode_dict— decode a Djbz dictionary stream to aJb2Dict
§Record types
| Code | Meaning |
|---|---|
| 0 | start-of-image |
| 1 | new-symbol, add to dict AND blit to page |
| 2 | new-symbol, add to dict only |
| 3 | new-symbol (direct), blit only (not added to dict) |
| 4 | matched-refine, add to dict AND blit |
| 5 | matched-refine, add to dict only |
| 6 | matched-refine, blit only |
| 7 | matched-copy (no refinement), blit only |
| 8 | non-symbol (halftone block), blit only |
| 9 | required-dict-or-reset |
| 10 | comment |
| 11 | end-of-data |
Structs§
- Jb2Dict
- A shared JB2 symbol dictionary decoded from a Djbz chunk.
Enums§
- Jb2Error
- JB2 bitonal image decoding errors.
Functions§
- decode
- Decode a JB2 image stream (Sjbz chunk data) into a
Bitmap. - decode_
dict - Decode a JB2 dictionary stream (Djbz chunk data) into a
Jb2Dict. - decode_
indexed - Decode a JB2 image stream with per-pixel blit index tracking.