G.3.2 The RLE decoder

Pseudo code for the RLE decoder is shown below:

Loop until the number of output bytes equals the uncompressed segment size

Read the next source byte into n

If n> =0 and n <= 127 then

output the next n+1 bytes literally

Elseif n <= - 1 and n >= -127 then

output the next byte -n+1 times

Elseif n = - 128 then

output nothing