### Question about Run Length Encoding

Hi, if we take for example 32bits: 1111 1000 0000 1000 0001 1111 1100 0000, how does it become (24bits) 1011 1110 0011 0110 1111 0110 after RLE is applied?

Why/how does 1011 represent the 5 1's at the start of the 32bit number? I'm trying to understand the concept and was trying to figure out how to do it by hand before attempting to write a text compression program.
It's the first time I've seen RLE applied to the individual bits' level.
Could you explain how this particular implementation is supposed to work ?
 Why/how does 1011 represent the 5 1's at the start of the 32bit number?

From how it looks, the first three bits of each 4-bit group are the run length (101[2]=5) and the fourth bit is the bit to be repeated (1).

 how to do it by hand before attempting to write a text compression program.

RLE is not suitable for text compression. Rather, find sequences of characters that have already occurred previously in the text and encode their position and length.
@pq1wx1p Did you mis-type the 4th and 6th group of bits in the RLE version?

Athar's theory doesn't fit these at the moment.

5 x 1 -> 1011 cf 1011 :-)
7 x 0 -> 1110 cf 1110 :-)
1 x 1 -> 0011 cf 0011 :-)
6 x 0 -> 1100 cf 0110 :-(
7 x 1 -> 1111 cf 1111 :-)
6 x 0 -> 1100 cf 0110 :-(

It's the groups of 6 which don't match.

Andy
Topic archived. No new replies allowed.