tx2-iff

Crates.iotx2-iff
lib.rstx2-iff
version0.1.0
created_at2025-12-03 01:09:38.362724+00
updated_at2025-12-03 01:09:38.362724+00
descriptionPPF-IFF (Involuted Fractal Format) - Image codec using Physics-Prime Factorization, 360-prime quantization, and symplectic warping
homepagehttps://github.com/IreGaddr/tx2-iff
repositoryhttps://github.com/IreGaddr/tx2-iff
max_upload_size
id1963113
size328,691
Ire Gaddr (IreGaddr)

documentation

https://docs.rs/tx2-iff

README

TX2-IFF (Involuted Fractal Format)

TX2-IFF is a next-generation image compression codec built on the principles of Physics-Prime Factorization (PPF) and Symplectic Geometry. It is designed to achieve high compression ratios for complex, high-entropy images by storing the generators of the image content rather than the content itself.

Key Features

  • Symplectic Compression: Uses symplectic warp fields to model geometric deformations.
  • Physics-Prime Factorization: Utilizes "360-Prime" quantization tables derived from the factors of 360 ($2^3 \times 3^2 \times 5$).
  • Three-Layer Architecture:
    1. Wavelet Skeleton: CDF 5/3 biorthogonal wavelets in YCoCg-R color space (4:2:0 subsampled).
    2. Texture Flesh: Procedural synthesis for high-entropy regions using PPF noise.
    3. Warp Field: Sparse symplectic vectors for geometric coherence.
  • Zstd Residuals: Efficient compression of residual data using Zstd.
  • GPU Acceleration: WGPU-based decoder for fast reconstruction.

Installation

Add this to your Cargo.toml:

[dependencies]
tx2-iff = "0.1.0"

Usage

Encoding

use tx2_iff::encoder::{Encoder, EncoderConfig};
use image::io::Reader as ImageReader;

fn main() {
    let img = ImageReader::open("input.png").unwrap().decode().unwrap();
    let rgb = img.to_rgb8();
    
    let config = EncoderConfig::default();
    let encoder = Encoder::new(config);
    
    let iff_data = encoder.encode(&rgb, img.width(), img.height()).unwrap();
    
    std::fs::write("output.iff", iff_data).unwrap();
}

Decoding

use tx2_iff::format::IffImage;
use tx2_iff::decoder::{Decoder, DecoderConfig};

fn main() {
    let data = std::fs::read("output.iff").unwrap();
    let iff_image = IffImage::from_bytes(&data).unwrap();
    
    let decoder = Decoder::new(DecoderConfig::default());
    let rgb_pixels = decoder.decode(&iff_image).unwrap();
    
    // Use rgb_pixels...
}

Viewer

This crate includes a viewer binary that uses tx2-core to display .iff files.

cargo run --bin viewer --features gpu -- <path_to_image.iff>

License

MIT

Commit count: 0

cargo fmt