LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compressing a data stream with gzip / zlib?

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 
0 Kudos
Message 1 of 6
(6,424 Views)
I suggest you to use another way to keep you data small. look for the binary files.
 
B.
Benoit Séguin
Software Designer
0 Kudos
Message 2 of 6
(6,396 Views)
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?
Message 3 of 6
(6,394 Views)
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
0 Kudos
Message 4 of 6
(6,378 Views)
The LabVIEW zip functions are quite limited. OpenG 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.
Message 5 of 6
(6,370 Views)
The OpenG Zip VIs should allow you to do string compression and decompression without writing to file.  Also, the development version (unreleased) allows reading and writing zip file contents to and from strings, rather than files.
Message 6 of 6
(6,355 Views)