[net.graphics] Request for info on RUN-LENGTH CODE technique

msp@ukc.UUCP (M.S.Parsons) (11/26/84)

.... .  .    .        .                .                          .

I would be very interested in hearing from people who use the run-length code
technique for compressing images. In particular, what external (disk) format 
do you use? 
At the moment, we are using images of 256 by 256 with 256 colours, so each run
nicely fits into 2 bytes:
      -----------------------
      | colour | length - 1 |
      -----------------------
But what do you do with bigger images? I guess you could just use two of the
above runs, or you could use two bytes for length, one for colour e.t.c.
How do you do it? (Is there an agreed standard on this?)
Any info appreciated,
   Mike.
------------------------------------------------------------------------------
Mike Parsons  UUCP:  ..{cfg,edcaad,mcvax,kcl-cs}!ukc!msp     msp@ukc.UUCP
              Mail:  Computing Laboratory, University of Kent, Canterbury,
                     Kent, England CT2 7NF

ken@turtlevax.UUCP (Ken Turkowski) (12/02/84)

Depending on the complexity of image, runlength coding produces worse
compression than a straight byte storage.  A mixture of the two is
helpful:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0| run length  |     color     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... +-+-+-+-+-+-+-+-+
|1|vector length|     color0    |   color1      | ... |  color n-1    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... +-+-+-+-+-+-+-+-+

I have called this a "sparse vector" type of representation.  The runs
are of length 128 (instead of 256) max, because the most significant
byte is used to switch between runs and vectors.

Depending on the measure used, the break-even point is a run of 3, 4,
or 5.
-- 
Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,flairvax,nsc}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.ARPA