Expand description
High-throughput bit readers (“bit pumps”).
RAW codecs consume bit streams in several orders:
| Pump | Bit order inside a word | Used by (examples) |
|---|---|---|
BitPumpMsb | MSB-first, bytes in order | Nikon, Pentax, Canon CRW/CRX, packed BE |
BitPumpJpeg | MSB-first with FF 00 unstuffing | lossless JPEG (CR2, DNG, Sony, Kodak…) |
BitPumpLsb | LSB-first, bytes in order | Panasonic, Olympus? (no), packed LE |
BitPumpMsb16 | MSB-first inside 16-bit LE words | Sony/Olympus packed variants, Fuji |
BitPumpMsb32 | MSB-first inside 32-bit LE words | Samsung, Phase One, Hasselblad packed |
All pumps keep a 64-bit cache. The hot refill reads 8 bytes at once and tops the
cache up to at least 56 valid bits without per-byte branches; the last few bytes
of a stream go through a bounds-checked slow path that pads with zeros. Reading
past the end never panics: it yields zero bits and increments an overrun counter
that decoders check (see BitRead::overrun) to reject truncated/corrupt data
instead of looping forever.
Structs§
- BitPump
Jpeg - MSB-first pump for JPEG entropy-coded segments: removes
FF 00byte stuffing and stops (feeding zeros) at a marker (FF xx,xx != 0). - BitPump
Lsb - LSB-first bit pump (little-endian bit order).
- BitPump
Msb - MSB-first bit pump (big-endian bit order).
- BitPump
MsbWords - MSB-first bit order inside little-endian words of
Wbytes (2 or 4).
Traits§
- BitRead
- Common interface of all bit pumps.
Functions§
- extend_
diff - Sign-extend a JPEG-style difference value:
lenbitsv→ signed diff.
Type Aliases§
- BitPump
Msb16 - MSB-first inside 16-bit little-endian words.
- BitPump
Msb32 - MSB-first inside 32-bit little-endian words.