Solved

zlib progressive transmission

Posted on 2009-05-20
9
362 Views
Last Modified: 2013-12-01
Hi,
I am writing a streaming server that streams large amount of image data to clients over the internet.
I want to do it progressively meaning the client would receive the image in 4 steps. 25%, 50%, 75% and 100%

Lets say my image is 1000 bytes and the compressed size is 100 bytes. Is there an easy way to figure out how many compressed bytes should I send in the 1st step so it will be equal to 250 uncompressed bytes (25%) and so on..

0
Comment
Question by:wevouch
  • 5
  • 4
9 Comments
 
LVL 86

Assisted Solution

by:jkr
jkr earned 500 total points
ID: 24433509
Since different buffers (or parts of one bigger buffer, technically that's the same) always will have different comression ratios - no. If you divide your buffre into four parts, you might get a 10% ratio on the 1st, 99% on the 2nd (e.g. just one single color), 23% on the 3rd and 50% on the 4th (just as an example). If you want the decomressed size always to be one quarter of the original, you'll have to send compressed packets of different sizes.
0
 

Author Comment

by:wevouch
ID: 24433677
Yes, I understand that the compressed size would be different for each 25% segment. THe issue is, I DO NOT want to break my source file into four parts. I want to create one compressed stream for the full image. Then when I am transmitting, I want to know how many bytes to send from this compressed stream so it would make a 25% segment uncompressed. I can do this iteratively, but thats obviously brute force.
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 24433849
Well, you'll know that after compressing each segment...
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:wevouch
ID: 24435307
but I am not compressing as segments.. i compress the whole thing once.
Or maybe i dont understand the compression right.

Say I have a file 'F' with S1, S2, S3, S4 as four 25% each segments.
say 'CF' is the compressed data after compressing 'F'. similarly CS1, CS2, CS3, CS4 after compressing S1, S2, S3, S4 respectively.

are you saying that CF = concat(CS1, CS2, CS3, CS4) ??
0
 
LVL 86

Expert Comment

by:jkr
ID: 24435708
Well, then I'd go for compressing segments in that case, seems to be easier to handle...
0
 

Author Comment

by:wevouch
ID: 24437600
i validated my above comment (are you saying that CF = concat(CS1, CS2, CS3, CS4) ??) and it seems its true.

tahnks to you jkr for making me think on those lines
0
 
LVL 86

Expert Comment

by:jkr
ID: 24437665
You're most welcome ;o)
0
 

Author Comment

by:wevouch
ID: 24439718
any comment on my other zlib related question?
0
 
LVL 86

Expert Comment

by:jkr
ID: 24441521
Sorry, it's a holiday here - will check that one later...
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

810 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