Discussion:
compressing a data stream with gzip / zlib?
(too old to reply)
Chad M. Carr
2008-08-06 19:10:05 UTC
Permalink
The zlib dll and deflate vi works great as long as you have all the data at once to pass it; but I would like to be able to generate a compressed stream from a continuous input stream.  Looking at the original zlib source code, it looks like that should be fairly straightforward (although I freely admit my C skills are rather rusty), but I've not been able to determine if the LV zlib dll has that ability.  Any thoughts or hints will be greatly appreciated!
 
Thanks,
 
Chad 
Benoit
2008-08-11 15:10:05 UTC
Permalink
I suggest you to use another way to keep you data small. look for the binary files.
 
B.
smercurio_fc
2008-08-11 15:10:06 UTC
Permalink
Are you trying to compress this stream for file I/O, or for something else? Are you transmitting it over a network? What kind of data are we talking about? What kind of size are we talking about? What are you trying to compress it down to?
Chad M. Carr
2008-08-11 17:40:08 UTC
Permalink
I'm already dealing with binary data (I16's).   Data size is fairly large; several dozen channels at 25KHz for at leat 30 minutes.  The end users of the data prefer compressed Matlab file format, which uses the same zlib compression, but you have to have the entire variable as a single block.
 
What I have been doing is saving each channel as a separate binary file (we recieve the data on one second interrupts).  Once the test is complete, I can use gzip to compress each file, then I modify the file header to change it from a gzipped file to a matfile. (It's a bit more complicated than that, but that's the gist of it).
 
What I would perfer to do is skip having to save the (very large) binary files, but in order to do that, as I originally mentioned, I need to have a compression routine that will accept a stream of data rather than the entire block as the zlib vi's currently expect.
 
I've looked at the source code for the orginal zlib, and it can handle streams very well, but the labivew implemention does not, so I'm hoping someone knows of either a workaround or a different implentation of the zlib routines.
 
Thanks,
 
Chad
smercurio_fc
2008-08-11 18:40:14 UTC
Permalink
The LabVIEW zip functions are quite limited. <a href="http://www.openg.org" target="_blank">OpenG</a> has a more extensive set of zip functions. I did not find a function to allow you to do streaming compression, but the code is all there and you may be able to adapt it more easily.
Jim Kring
2008-08-12 05:10:05 UTC
Permalink
The <a href="http://wiki.openg.org/Oglib_lvzip" target="_blank">OpenG Zip VIs</a> should allow you to do string compression and decompression without writing to file.&nbsp; Also, the development version (unreleased) allows reading and writing zip file contents to and from strings, rather than files.
Continue reading on narkive:
Search results for 'compressing a data stream with gzip / zlib?' (Questions and Answers)
7
replies
Which program is best for unzipping rar files?
started 2007-04-27 04:06:31 UTC
software
Loading...