1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! JPEG Decoder - Public API.
//!
//! This module provides everything needed for JPEG decoding.
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use zenjpeg::decoder::{Decoder, DecodeResult, Result};
//!
//! fn decode_jpeg(data: &[u8]) -> Result<DecodeResult> {
//! Decoder::new().decode(data, enough::Unstoppable)
//! }
//! ```
//!
//! # Decode to specific format
//!
//! ```rust,ignore
//! use zenjpeg::decoder::{Decoder, OutputTarget, PixelFormat, Result};
//!
//! fn decode_f32(data: &[u8]) -> Result<Vec<f32>> {
//! let result = Decoder::new()
//! .output_target(OutputTarget::SrgbF32)
//! .decode(data, enough::Unstoppable)?;
//! Ok(result.into_pixels_f32().unwrap())
//! }
//! ```
//!
//! # Resource Limits and Cancellation
//!
//! Protect against malicious images and support cooperative cancellation:
//!
//! ```rust,ignore
//! use zenjpeg::decoder::Decoder;
//! use zenjpeg::types::Limits;
//! use enough::Unstoppable;
//!
//! // Set resource limits (DoS protection)
//! let decoder = Decoder::new()
//! .max_pixels(100_000_000) // 100 megapixels max
//! .max_memory(512_000_000); // 512 MB max allocation
//!
//! // Or use Limits struct
//! let limits = Limits {
//! max_pixels: Some(100_000_000),
//! max_memory: Some(512_000_000),
//! max_output: None,
//! };
//! let decoder = Decoder::new().limits(limits);
//!
//! // Custom stop token for cancellation
//! let result = decoder.decode(data, &my_cancel_token)?;
//! ```
// Note: Currently re-exporting internal error types since the decoder
// types we re-export from crate::decode use them internally.
// === Error types ===
/// Errors that can occur during JPEG decoding.
pub type DecodeError = crateError;
// Keep legacy aliases for backward compatibility
pub use crate;
// === Main decoder types ===
pub use crate;
// === Metadata preservation types ===
pub use crate;
// === Depth map extraction types ===
pub use crate;
// === Types used in public structs ===
pub use crate;
// Also re-export PixelLayout from encoder for easy conversion
pub use cratePixelLayout;
// === ICC profile support ===
pub use crateTargetColorSpace;
pub use crateextract_icc_profile;