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
//! Core gain map math and metadata for Ultra HDR.
//!
//! This crate provides the pure computational components for Ultra HDR:
//! - Gain map metadata parsing/generation (XMP, ISO 21496-1)
//! - Pixel math for applying/computing gain maps
//! - Tone mapping (HDR → SDR)
//! - Color space conversions and transfer functions
//!
//! This crate has **no JPEG codec dependency**. For full Ultra HDR encode/decode,
//! use the `ultrahdr` crate which provides codec integration.
//!
//! # Cooperative Cancellation
//!
//! Long-running operations accept an `impl Stop` parameter from the `enough` crate
//! for cooperative cancellation. Use `Unstoppable` when cancellation is not needed.
//!
//! # Example
//!
//! ```ignore
//! use ultrahdr_core::{
//! gainmap::{apply_gainmap, compute_gainmap, GainMapConfig, HdrOutputFormat},
//! metadata::xmp::{parse_xmp, generate_xmp},
//! GainMap, GainMapMetadata, RawImage,
//! };
//! use enough::Unstoppable;
//!
//! // Compute gain map from HDR and SDR images
//! let config = GainMapConfig::default();
//! let (gainmap, metadata) = compute_gainmap(&hdr, &sdr, &config, Unstoppable)?;
//!
//! // Generate XMP metadata
//! let xmp = generate_xmp(&metadata, gainmap_jpeg_size);
//!
//! // Apply gain map to reconstruct HDR
//! let hdr_output = apply_gainmap(&sdr, &gainmap, &metadata, 4.0, HdrOutputFormat::LinearFloat, Unstoppable)?;
//! ```
// Re-export core types
pub use ;
// Re-export enough for convenience
pub use ;
// Re-export gain map types
pub use ;
/// Safety limits for parsing and allocation.