rusty_jpeg 0.1.1

Pure-Rust JPEG/MJPEG decoder + encoder, no C/FFI. Baseline and progressive DCT, planar YUV in/out, real quality and chroma-subsampling control.
Documentation
//! JPEG decoding.
//!
//! Vendored from `jpeg-decoder` 0.3.2 (image-rs, MIT OR Apache-2.0).
//! See `NOTICE.md` for attribution and the list of local changes.

#![deny(unsafe_code)]
#![cfg_attr(feature = "platform_independent", forbid(unsafe_code))]

pub use decoder::{
    ColorTransform, Decoder, ImageInfo, PixelFormat, PlanarComponent, PlanarImage,
};
pub use error::{Error, UnsupportedFeature};
pub use parser::CodingProcess;

use std::io;

#[cfg(not(feature = "platform_independent"))]
mod arch;
mod decoder;
mod error;
mod huffman;
mod idct;
mod marker;
mod parser;
mod upsampler;
mod worker;

fn read_u8<R: io::Read>(reader: &mut R) -> io::Result<u8> {
    let mut buf = [0];
    reader.read_exact(&mut buf)?;
    Ok(buf[0])
}

fn read_u16_from_be<R: io::Read>(reader: &mut R) -> io::Result<u16> {
    let mut buf = [0, 0];
    reader.read_exact(&mut buf)?;
    Ok(u16::from_be_bytes(buf))
}