Solved

zlib progressive transmission

Posted on 2009-05-20
9
360 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Good afternoon all, We are running a VM infrastructure on a clustered ESX environment with two DELL R710's.  One of our IT Application Support Engineers contacted me and asked if it was possible to extend the partition of a certain Windows 2003 S…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

706 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

19 Experts available now in Live!

Get 1:1 Help Now