[A83] Re: ZPic83 compression


[Prev][Next][Index][Thread]

[A83] Re: ZPic83 compression




> 
> Theres the prob i personally see with RLE (to some extent).  To compress a
> string of chars, it has to add two bytes.  Yes, say, a horozontal line
> would
> be compressed majorly, but a 'real' pic (a drawing) would very likley be
> not
> compressed much, if at all.
> 
> Also: Special byte.  A picture can (and most likley one out there will)
> use
> every combonation from $00 to $FF.  Chosing any old byte is impossible,
> unless you then convert any ocourances of your special byte in the pic to
> [special byte], $01, [special byte]
> 

Then you don't use a special byte. Usually you copy any byte to the buffer/
display, unless it's the special byte. My idea is to indicate whether the
next
xx bytes are normal, or a run. This would only take one bit, you could use
the msb of the length byte for this:
  0-127: not a run, just copy this number of bytes to the display/buffer.
128-255: a run, the length is found by "AND $7F" (the next byte indicates
the number of times the run should be repeated)

example: 130,3,00001111b,11110000b
(130=$82, $82 AND $7F = $02)
this would result in:
00001111b,11110000b,00001111b,11110000b,00001111b,11110000b

Rob van Wijk

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net




References: