Skip to main content

Module jpeg

Module jpeg 

Source
Expand description

Pure-Rust JPEG coefficient codec (zero external dependencies).

Reads and writes baseline and progressive JPEG files, providing direct access to quantized DCT coefficients without any pixel-domain processing. This is the foundation for steganographic embedding, which operates entirely in the DCT domain.

Supports:

  • Baseline sequential DCT (SOF0), 8-bit precision
  • Progressive DCT (SOF2) — read-only (always writes baseline)
  • YCbCr, grayscale, and arbitrary component counts
  • Chroma subsampling: 4:2:0, 4:2:2, 4:4:4
  • Restart markers (DRI/RST)
  • Byte-for-byte round-trip for unmodified baseline images
  • Huffman table rebuild for modified coefficients

Does NOT support:

  • Arithmetic coding (SOF9+) – rejected at parse time
  • 12-bit precision – rejected at parse time

Modules§

bitio
Bit-level I/O for JPEG entropy-coded data.
dct
DCT coefficient storage and quantization tables.
error
Error types for JPEG parsing and encoding.
frame
JPEG frame header (SOF0) parsing.
huffman
Huffman coding tables for JPEG entropy decoding and encoding.
marker
JPEG marker parsing and iteration.
pixels
Pixel-domain conversion for the Y (luminance) channel.
scan
JPEG scan data encoding and decoding.
tables
Quantization and Huffman table parsing/serialization.
zigzag
Zigzag scan order mapping between JPEG coefficient order and natural order.

Structs§

JpegImage
A decoded JPEG image providing access to quantized DCT coefficients.