Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

data compression on the fly

Posted on 2001-06-11
9
Medium Priority
?
241 Views
Last Modified: 2010-04-02
I have checked the search engines but did not find
a good answer

what I have is a

char buf[1024]

and would like to have it compressed as fast
as possible , resulting size is not so important.
hopefully less...

is there any API which compresses / decompresses
this user data ?
0
Comment
Question by:boyracer
9 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6177345
Why do you want to bother with compression if, as you say, "resulting size is not so important"??
0
 

Author Comment

by:boyracer
ID: 6177410
well, if the compression rate is 40-50%, it is still good.

I do not need 80% or higher.

with less bytes, I could overcome some hardware limitations
0
 
LVL 2

Expert Comment

by:missionImpossible
ID: 6177411
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:boyracer
ID: 6177734
the codeguru stuff works for files, but I assume
I can take parts of the code ...
0
 
LVL 2

Expert Comment

by:joe_h
ID: 6177911
It would be helpful to specify what kind of data do you store in that buffer (mostly zeroes? ASCII strings? digits? sound samples?). Otherwise, I'd say it is very hard to give you a generic algoritm that would do even the 40%...
Joe_h
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 6179048
LZW compression is well suited to compress data streams (you could chain compressor and decompressor, it doesn't need to read an entire file) /very/ /fast/

It is a string->code compression, but it is mostly suitable only for data which contains repetive strings, like text or images.

And it is patented :(

For a wider choice of data-compression resources try http://www.dogma.net/DataCompression/
0
 

Author Comment

by:boyracer
ID: 6181754
hey joe...
it is going to be ascii
0
 
LVL 2

Accepted Solution

by:
joe_h earned 150 total points
ID: 6182113
All right boyracer... Assuming "standard" ASCII set, that is character codes 0 to 127, you need only 7 bits to encode one char. Therefore, you can achieve 12,5% compression just by stripping the 8th bit from each char and packing them together to fill up the "holes".

If you limit yourself to, let's say, uppercase letters, numbers 0-9, and up to 28 special symbols (for a total of 64 different codes - however, they'll no longer be ASCII), you need only 6 bits, allowing for 25% compression.

Does this sound good enough?
0
 

Author Comment

by:boyracer
ID: 6202231
thanks for your comments
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

877 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