Solved

zlib progressive transmission

Posted on 2009-05-20
9
364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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