Solved

data compression on the fly

Posted on 2001-06-11
9
225 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Grammars for C C++ and java 1 122
FMX enumerated colours 2 100
Path to  STL Map header file 1 58
need help ...get stuck at middle of coding ...need to submit by Sunday C++ 1 30
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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.

773 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