Solved

string compression routine?

Posted on 1998-10-13
7
446 Views
Last Modified: 2010-05-18
Hi everybody!

I'm looking for a set of routines (not necessarily a component - actually: preferably not a component) than can compress strings to a reasonable size (i.e. smaller than 50% for plain text)

Quite a while ago, I used to have a library called "HyperString", but
a) it only compressed BY 35% in stream-compression
b) the block compression compressed by rougly 45%, but was cumbersome to use (block length limited to 64K)

Any ideas? I am NOT looking for a component that will create ZIP-files for me!! For specific reasons, I want to compress only certain parts of a file, the rest must be accessible without decompression (header-information)

Would be nice if it was freeware or at least cheap since I won't earn money with my program...

Thanks for your help!
0
Comment
Question by:Thesan
7 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1342753
Look at paszlib. Perhaps it's what you need.
"http://www.tu-chemnitz.de/~nomssi/paszlib.html"

Regards, Madshi.
0
 
LVL 10

Expert Comment

by:Jacco
ID: 1342754
Are there any strange characters in the string? I mean is the character range used in the strings 0..255 or something like 'A'..'Z','a'..'z','0'..'9','+-=,.:;"/?!@#$%^&*()_+'?

Regards Jacco
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1342755
Hi,
What sizes of strings are we talking about here?
Using Huffman on small strings <256 chars doesn't guarantee <50% compression. Compression is not an exact science. The compression never gets better than the compressee.
Using a lookup table with entries of the most common words is an approach. However, it needs quite a large table to be efficient.
Provide more info!

/// John
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:zac
ID: 1342756
If you have Delphi 3 or above then you already have the solution in the info directory on the CD.  The ZLIB library is a c implementation of the LZ77 algorithm (used by zip, gzip etc).

It implements its compression as a stream and therefore should be perfect for you use.  It is free, even includes source code and the author even provided pascal interfaces to it....

When I have used it in the past I have got greater than 50% compression on largish text files > 20K (ish) but it very much depends on the data you are compressing

I hope this helps...

Zac
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1342757
Hello zac,

seems, that you didn't read my comment!?    :-(
0
 

Author Comment

by:Thesan
ID: 1342758
And we have a winner!!
To be fair, it's Madshi because he recommended the routines first.

They are indeed quite nice. The interface could be more sophisticated, but that's not even bad - no unnecessary overhead, just resonably fast and efficient block compression routines without limitation to the length (as far as I can tell - 500K were no problem).

Thanks to zac for pointing out that these routines are included with Delphi. However, those routines have a "stream-interface" that might be a bit easier to use but is more overhead and actually makes things more complicated in my specific case.

For blocks of 50 K with about 80% plain text, I get around 65% compression.

Thanks guys and sorry for the slow reply, but I didn't have time to figure out if the routines would work for me!

Madshi: Post an answer to get your points :-))
0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 1342759
Thank you Thesan...   :-)

sorry, zac...   :-(

Regards, Madshi.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 161
Virtuailstring tree compare node issue 14 127
how to center only a line in richedit? 4 62
Error E2158 compiling with Delphi XE10 Seattle 2 115
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question