How to find the maximum saving in bits that could be made by using Run-Length encoding to an image of a particular resolution?

153 Views Asked by At

So I'm currently looking at run-length encoding and I understand how the concept works and I can apply it directly to images and such. For instance, I was looking at this question:

Data representing this image must be compressed using run-length encoding (RLE).

Black, grey and white image

The first 3 bits are used for the colour and the next 4 bits for the run length of pixels.

Encoding starts from the top left pixel and is continuous between rows.

I am asked and can successfully complete converting the first two rows of pixels into binary data using RLE. I am then asked to construct an expression to show the maximum saving in bit that could be made by using an RLE algorithm to compress an image with this resolution. They give the answer as: (10 x 9 x 7) - (10 x 9 / 15 x 7) which I don't understand.

Now I've tried looking online on how to answer this question but every example is given as just calculating the number of bits in the compressed image and subtracting this from the number of bits in the uncompressed image. Now in this case the uncompressed image has a resolution of (10 x 9 x 3). 10 is the length, 9 the height and 3 the bit-depth. So how come the first part of the equation is (10 x 9 x 7)? This is the resolution of a compressed image where each consecutive pixel is a different colour (i.e. the worst case for RLE) isn't it?

Presumably we want the difference from the original uncompressed image and even if not, wouldn't the best case (in terms of bit saving) for an image of this resolution be a 10x9 rectangle of all the same coloured pixels for RLE?

Furthermore, more generally, I don't see where the 15 comes from. 10 comes from the length of the rectangle, 9 is the height of the rectangle and 7 is the run length + the colour. I don't see where 15 could even come in to this which might make the question a bit clearer.

0

There are 0 best solutions below