Skip to content

Sewer56/lossless-transform-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lossless-transform-utils

Crates.io Docs.rs CI

General purpose utility methods for creating lossless transforms for various file formats.

This crate provides tools to estimate data compressibility:

  • Histogram: Count byte frequencies in data
  • Entropy: Calculate ideal bits-per-byte (how compressible by entropy coders)
  • Match Estimator: Estimate LZ match count (how compressible by LZ-based compressors)

Use these to compare different data transformations and determine which yields better compression.

Quick Start

Add to your Cargo.toml:

[dependencies]
lossless-transform-utils = "0.1.3"
use lossless_transform_utils::histogram::{histogram32_from_bytes, Histogram32};
use lossless_transform_utils::entropy::code_length_of_histogram32;
use lossless_transform_utils::match_estimator::estimate_num_lz_matches_fast;

// Calculate byte histogram
let data = [1, 2, 3, 1, 2, 1];
let mut histogram = Histogram32::default();
histogram32_from_bytes(&data, &mut histogram);

// Calculate entropy (bits per byte)
let entropy = code_length_of_histogram32(&histogram, data.len() as u64);

// Estimate LZ matches
let num_matches = estimate_num_lz_matches_fast(&data);

See the lossless-transform-utils crate documentation for detailed usage, feature flags, performance numbers, and comprehensive examples.

Crates

Developer Manual

For step-by-step development guidance, see the Developer Manual.

Contributing

We welcome contributions! See the Contributing Guide for details.

License

Licensed under MIT.

About

General purpose utility methods for creating lossless transforms for various file formats.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages