Crate tx2_iff

Crate tx2_iff 

Source
Expand description

§TX2-IFF: Involuted Fractal Format

A next-generation image codec based on Physics-Prime Factorization (PPF), 360-prime quantization, and symplectic warping fields.

§Three-Layer Architecture

§Layer 1: Skeleton (Structural Geometry)

  • Method: Integer Wavelet Transform (CDF 5/3)
  • Storage: Low-frequency bands + high-magnitude high-frequency coefficients
  • Quantization: 360-prime pattern table
  • Purpose: Sharp edges, shapes, text

§Layer 2: Flesh (Deterministic Texture Synthesis)

  • Method: PPF-based deterministic noise generation
  • Storage: Region descriptors {x, y, w, h, seed, chaos, scale}
  • Correction: Sparse residual (real - synthesized)
  • Purpose: High-entropy texture (skin, fabric, nature)

§Layer 3: Warping Field (Symplectic Spatial Advection)

  • Method: 4-fold radial basis + vortex primitives
  • Storage: Basis coefficients + sparse vortex list
  • Purpose: Self-similar regions with geometric deformation

§Mathematical Foundations

The codec is built on several mathematical frameworks:

  • Physics-Prime Factorization (PPF): -1 as the unique “Sign Prime”
  • 360 Prime Pattern: 96 residue classes modulo 360 for optimal coverage
  • IOT/RIOT Geometry: Involuted Oblate Toroid with fractal warping function
  • Symplectic Mechanics: 4-fold radial symmetry for universal stability
  • Fixed-Point Integer Math: 16.16 representation for deterministic computation

§Example Usage

use tx2_iff::{Encoder, Decoder, EncoderConfig, DecoderConfig};

// Encode an image
let image = image::open("input.png")?;
let config = EncoderConfig::default();
let encoder = Encoder::new(config);
let iff_data = encoder.encode(&image)?;

// Decode the image
let decoder_config = DecoderConfig::default();
let decoder = Decoder::new(decoder_config);
let decoded = decoder.decode(&iff_data)?;

Re-exports§

pub use error::IffError;
pub use error::Result;
pub use fixed::Fixed;
pub use format::IffImage;
pub use format::Layer;
pub use texture::Region;
pub use warp::Vortex;
pub use encoder::Encoder;
pub use encoder::EncoderConfig;
pub use decoder::Decoder;
pub use decoder::DecoderConfig;

Modules§

color
Color space conversions and subsampling
compression
Simple compression utilities for integer data
decoder
Image decoder (Layer reconstruction)
encoder
Image encoder (Layer composition and optimization)
error
Error types for TX2-IFF codec
fixed
Fixed-point arithmetic for deterministic computation
format
IFF file format structures and serialization
noise
Deterministic noise generation using PPF-based hash
prime
360 Prime Pattern and PPF-based quantization
texture
Texture synthesis module (Layer 2: The Flesh)
warp
Symplectic warping field (Layer 3: The Warping Field)
wavelet
Integer Wavelet Transform (CDF 5/3) for Layer 1 skeleton

Constants§

FIXED_FRAC_BITS
Fixed-point fractional bits (16.16 format)
MAGIC
PPF-IFF magic number: “PPFI” in ASCII
MAX_DIMENSION
Maximum supported image dimension
PRIME_RESIDUE_CLASSES
Number of 360-prime residue classes
RADIAL_SYMMETRY_ORDER
4-fold radial symmetry constant
VERSION
Library version
WAVELET_LEVELS
CDF 5/3 wavelet decomposition levels