Link to home
Start Free TrialLog in
Avatar of wevouch
wevouch

asked on

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%

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..

SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wevouch
wevouch

ASKER

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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wevouch

ASKER

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) ??
Well, then I'd go for compressing segments in that case, seems to be easier to handle...
Avatar of wevouch

ASKER

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
You're most welcome ;o)
Avatar of wevouch

ASKER

any comment on my other zlib related question?
Sorry, it's a holiday here - will check that one later...