shannon-fano-0.1.0.1: Shannon-fano compression algorithm implementation in Haskell

Codec.Compression.ShannonFano

Synopsis

# Documentation

Arguments

 :: String Input string -> Table Int Resulting table

Gives the frequency table of all characters in a string.

Arguments

 :: String Input string -> Table Float Resulting table

Gives the probability table of all characters in a string.

Arguments

 :: (Num a, Ord a) => (String -> Table a) frequency or probability can be applied -> String String to compress -> Maybe String Compressed, 0's and 1's, resulting string

Compresses a string by applying a table generator function and uses it to create a string of 0's and 1's.

Arguments

 :: (Num a, Ord a) => (String -> Table a) frequency or probability can be applied -> String String to compress -> IO ()

Compresses a string to a file.

Calls the compress function on the input string and writes the binary code in a file.

The resulting files are: - 'out.bin' <- binary compressed file - 'decode.dat' <- contains the decoding table of out.bin

Arguments

 :: (Num a, Ord a) => Table a Input table -> Encoding a Resulting encoding

Given a Table encodes it by applying the Shannon-fano algorithm.

Arguments

 :: (Num a, Ord a) => Encoding a Input encoding -> CodeTable Resulting code table

Generates a CodeTable

Arguments

 :: (Num a, Ord a) => Encoding a Input encoding -> DecodeTable Resulting decode table

Generates a DecodeTable

Arguments

 :: FilePath File path for the decode table -> IO (Maybe DecodeTable) Decode table

Reads a DecodeTable from a file

Arguments

 :: DecodeTable Decoding table -> String Example "0110110111" -> Maybe String Resulting string

Decodes a String (made out of 0's and 1's) given a DecodeTable

Arguments

 :: FilePath File holding the decoding table info -> FilePath File holding the compressed binary -> String Resulting file to output. -> IO ()

Decompresses a file given a decoding table file and a compressed binary file.

If the resulting output file is empty ("") the default name is "result.dat"