Recently I have been trying to get my head around the PackBits compression algorithm and I'm having problems.
I understand that the packets consist of a one byte header followed by the given data and if the value of the header byte is positive, it is followed by the same number, n + 1 bytes of data.
However, I do not fully understand what happens if the header byte is negative?
If FF means repeat twice, FE means repeat 3 times and FD means repeat 4 times etc. What pattern does it follow? What would the header byte be if you needed to repeat the byte, say 20 times? Sorry if I'm missing the obvious.
Thanks in advance.