impliment RLE encode/decode