Solved

data compression on the fly

Posted on 2001-06-11
9
237 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 

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 50 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

Technology Partners: 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

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 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