Solved

zlib progressive transmission

Posted on 2009-05-20
9
361 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I wrote an article (http://www.experts-exchange.com/articles/2245/Anti-rootkit-software.html) some time ago with a reference to nLite  (http://www.nliteos.com/)slipstreaming software.  I recently changed that link to point to NTLite (https://www.ntl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now