| 1 | //! `AutoMatte` (`#49`) and diverging Fusion `MagicMask` (`#7`) GPU matting system. |
| 2 | //! |
| 3 | //! Architecture: |
| 4 | //! - **Unified prompt extraction** ([`prompts`]): parses both Fission `AutoMatte` click points / |
| 5 | //! modes and real Fusion `MagicMask` `MagicMaskStrokes` (`BezierSpline` keyframes or inline) + |
| 6 | //! matte controls (`MatteBlur`, `MatteContractExpand`, `Invert`, `OutputMode`, `ShowMask`). |
| 7 | //! - **Stage 1 & 2** ([`cache`]): checks [`AutoMatteCache`] (in-memory + optional disk PNG sequence |
| 8 | //! from SAM 2 + MatAnyone 2 / VideoMaMa), exposes a zero-hardcoded-dependency native |
| 9 | //! [`AutoMatteRunner`] worker launcher, and falls back to a real-time WebGPU-safe multi-seed |
| 10 | //! Oklab color-affinity segmentation + joint-bilateral edge refinement pass when no cached neural |
| 11 | //! matte is available yet. |
| 12 | //! - **Stage 3** ([`gpu`]): real-time GPU port of Clover's `polish_alpha` (floor `0.045`, ceiling |
| 13 | //! `0.985`, toe gamma `1.35` below `0.15`) and `hair_safe_decontaminate` (3-scale normalized- |
| 14 | //! convolution Gaussian foreground color extrapolation at `sigma = 28, 12, 4` scaled by |
| 15 | //! `proxy_scale`). |
| 16 | |
| 17 | mod cache; |
| 18 | mod gpu; |
| 19 | mod prompts; |
| 20 | #[cfg(test)] |
| 21 | mod tests; |
| 22 | |
| 23 | pub use cache::{AutoMatteCache, CachedMatteFrame}; |
| 24 | #[cfg(not(target_arch = "wasm32"))] |
| 25 | pub use cache::{AutoMatteJobRequest, AutoMatteJobState, AutoMatteRunner, AutoMatteWorkerConfig}; |
| 26 | pub(crate) use gpu::AutoMattePipelines; |
| 27 | pub use prompts::{ |
| 28 | AutoMatteParams, OutputMode, PromptMode, PromptPoint, QualityTier, extract_auto_matte_params, |
| 29 | extract_magic_mask_params, parse_magic_mask_strokes_table, |
| 30 | }; |