Thread: Compressing

  1. #1
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853

    Compressing

    Well, I would like to know if there already made functions that compress data. Like functions that you enter the data, as an array, and you get the compressed data, a smaller array. Then a function that extracts the data from the compressed form.

    I don't have any specific compression algorithm in mind. I m interested in a very general compression method that can compress any kind of values. Lets say an array of doubles. Even an ineffective (both in time and space) function will do.

    I searched didn't really find anything. But you never know, so I though to ask here. Of course what I am asking might not even be possible. The closest thing I found is programs that can compress data, providing also code in C. But they had a lot of parameteres, I would have to find the specific functions/algorithms etc etc. I would want something very easy to use

    EDIT: argh, my english is horrible
    Last edited by C_ntua; 07-17-2008 at 05:25 AM.

  2. #2
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    You could look up the immensely simple lossless compression algorithm called Run-encoding.

    http://en.wikipedia.org/wiki/Run-length_encoding
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Another relatively simple and lossless compression algorithm is "BytePair Encoding", which assumes that the data contains pairs of bytes that have the same value, and that you can replace those with another single byte. Perform this recursively until there are no longer any pairs.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compressing XML data using Lniq and GZipStream
    By Aeixious in forum C# Programming
    Replies: 2
    Last Post: 01-22-2009, 10:48 PM
  2. compressing a buffer
    By steve1_rm in forum C Programming
    Replies: 5
    Last Post: 02-29-2008, 02:19 PM
  3. help with compressing images
    By dragunov in forum C Programming
    Replies: 8
    Last Post: 08-31-2007, 05:52 AM
  4. about compressing dll and executable files
    By gumit in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 11-08-2006, 11:00 AM
  5. Compressing an entire directory
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 05-20-2002, 05:49 AM