# zlib progressive transmission

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%

Lets 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..

###### Who is Participating?

Commented:
Well, you'll know that after compressing each segment...
0

Commented:
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 Commented:
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

Author Commented:
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

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

Author Commented:
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

Commented:
You're most welcome ;o)
0

Author Commented:
any comment on my other zlib related question?
0

Commented:
Sorry, it's a holiday here - will check that one later...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.