Skip to main content

Crate djvu_jb2

Crate djvu_jb2 

Source
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 chunk
  • decode — decode a Sjbz image stream to a Bitmap
  • decode_dict — decode a Djbz dictionary stream to a Jb2Dict

§Record types

CodeMeaning
0start-of-image
1new-symbol, add to dict AND blit to page
2new-symbol, add to dict only
3new-symbol (direct), blit only (not added to dict)
4matched-refine, add to dict AND blit
5matched-refine, add to dict only
6matched-refine, blit only
7matched-copy (no refinement), blit only
8non-symbol (halftone block), blit only
9required-dict-or-reset
10comment
11end-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.