Expand description
JPEG (a.k.a. MJPEG) still-image codec.
Decode is backed by the pure-Rust rusty_jpeg::decode; encode by the pure-Rust
rusty_jpeg::encode. Like PNG, JPEG is self-describing, so a packet is the whole
file.
Encode takes planar Y’CbCr directly (yuv420p/yuv422p/yuv444p) —
JPEG is a Y’CbCr codec, so a planar frame is already in the right colour
space at the right chroma resolution. Routing it through RGB instead cost two
colour conversions and a chroma resample round-trip: measured 2x slower and
several dB worse. RGB frames (rgb24/rgba) still work and are converted.
Decode emits planar too, for ordinary 3-component Y’CbCr: it taps the
component planes before the decoder’s chroma upsampler and colour conversion
run, which measured 1.41x faster than decoding to RGB. Grayscale, CMYK, YCCK
and lossless still take the interleaved Rgb24 path.
Encoders that need RGB declare so via accepted_pixel_formats, and the
pipeline converts for them.
JPEG is defined on full-range samples. The transcode pipeline converts
limited-range sources up front (see rff::transcode), so nothing here has to
think about range.
Functions§
- register
- Register the JPEG codec into a
CodecRegistry.