atx_reader 0.1.0

Parser and decoder for Apple .atx texture archives (AAPL container with ASTC payload), as produced by tools like Cellebrite UFED iOS exports.
Documentation
//! Parser and decoder for Apple `.atx` texture archives.
//!
//! The `.atx` format is an AAPL-container (RIFF-style chunked file) that
//! wraps ASTC-compressed image data. It is produced by Apple tooling and
//! surfaces in third-party forensic exports such as Cellebrite UFED.
//!
//! # Quick start
//!
//! ```no_run
//! use std::fs;
//!
//! let bytes = fs::read("snapshot.atx").unwrap();
//!
//! // High-level API — returns RGBA8 pixels at the original (width, height).
//! let img = atx_reader::decode(&bytes).unwrap();
//! assert_eq!(img.pixels.len(), (img.width * img.height * 4) as usize);
//!
//! # #[cfg(feature = "image")]
//! # {
//! // With the `image` feature, you can save directly:
//! let rgba = atx_reader::decode_to_image(&bytes).unwrap();
//! rgba.save("snapshot.png").unwrap();
//! # }
//! ```
//!
//! # What this crate decodes
//!
//! The format was reverse-engineered from real `.atx` samples. The current
//! implementation handles the layout used by iOS lock-screen / thumbnail
//! exports:
//!
//! - `AAPL\r\n\x1a\n` container signature
//! - `HEAD` chunk carrying width / height / depth / mipmap count / a 16-byte
//!   texture UUID and two pixel-format discriminator words
//! - `FILL` padding chunks (skipped)
//! - An `astc` payload chunk holding raw ASTC blocks laid out in Apple's
//!   macro-tiled Morton ordering
//!
//! Single-mip, single-layer, 2D, ASTC 4×4 is the default decoding path. The
//! lower-level [`AtxContainer`] / [`AtxDecoder`] API exposes everything else
//! (chunk iteration, format codes, custom footprint, custom payload layout)
//! for callers that need to support new samples.

#![forbid(unsafe_code)]

mod error;
mod format;
mod parser;

#[cfg(feature = "decode")]
mod decode;

pub use error::{AtxError, Result};
pub use format::AstcFootprint;
pub use parser::{
    AAPL_MAGIC, ASTC_TAG, AtxChunk, AtxContainer, AtxHeader, ChunkIter, FILL_TAG, HEAD_TAG,
    LZFS_TAG, TexturePayload,
};

#[cfg(feature = "decode")]
pub use decode::{AtxDecoder, DecodeOptions, DecodedImage, PayloadLayout, decode, decode_with};

#[cfg(feature = "image")]
pub use decode::decode_to_image;