Does MJPEG Provide a Predictable Image Size?

The answer is no. We learned this the hard way when a client called and told us the software crashed when they turned the light on! Our support team had a hard time convincing R&D that this was what the client was experiencing. A couple of developers went to the site, and sure enough, the app crashed predictably when they turned their lights on. It turned out that a reception buffer was too small, and that the image size grew considerably when the lights came on – making the image a lot more complex than when peering into a dark room. Embarrassed and humbled, we delivered a new version in a few days.

I created 4 JPEG images in Photoshop. Same resolution and same quality setting, but the sizes range from 16.2kb to 389kb. Naturally, this is a synthetic test, but it demonstrates the concept quite clearly. The white frame is the smallest, at just 16.2 kb (the images are further compressed by the blog engine, so to replicate you will need to do the experiment yourself), the dark phone is simply the regular phone with synthetically depressed light, yet the dark image is 50% smaller (compressed) than the normal one, and the noisy image is a whopping 389kb.

Going into entropy theory is beyond the scope of this blog, but let me just say that in GSM for example we don’t even attempt to compress the noise. We simply re-generate noise on the receiving end, shaping the noise with a filter.

As a result of a discussion on LinkedIn, which sparked this post, I’ve added some further observations. Two routes are taken; the image is darkened, and noise is added. One path simply compresses the image as-is, while the other multiplies the pixel values (horizontal path). The image sizes are noted. On the as-is frame, we multiply the pixel values by the same factor and compare the differences to the original.

Advertisements

Author: prescienta

Prescientas ruler

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s