pub mod context;
pub mod decoder;
pub mod encoder;
pub mod golomb;
pub mod golomb_write;
pub mod marker_write;
pub mod markers;
pub mod predictor;
pub mod run_mode;
pub use decoder::{DecodedImage, JpegLsDecoder};
pub use encoder::{JpegLsEncoder, JpegLsEncoderConfig};
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum JlsError {
Truncated {
context: &'static str,
},
InvalidMarker(u16),
Unsupported(String),
NotJpegLs,
}
impl fmt::Display for JlsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Truncated { context } => write!(f, "truncated JPEG-LS stream in {context}"),
Self::InvalidMarker(m) => write!(f, "invalid JPEG-LS marker: 0x{m:04X}"),
Self::Unsupported(s) => write!(f, "unsupported JPEG-LS feature: {s}"),
Self::NotJpegLs => write!(f, "data is not a JPEG-LS stream"),
}
}
}
impl std::error::Error for JlsError {}
pub type JlsResult<T> = Result<T, JlsError>;