KEMBAR78
Run length encoding | PPTX
RUN LENGTH
 ENCODING

       Praseetha S Nair
         M.Tech(CS)
COMPRESSION


 Data compressed by eliminating redundant elements.

 Purpose of compression:-

  -save storage space

  -reduce communications capacity requirements

 Some code must be substituted for eliminated element.

 Based on this code receiver can reconstruct original
  data.
 Categories:-
  1.lossless compression
    -no information lost
    -decompressed data are identical to original
  uncompressed
     data
  2.lossy compression
    -decompressed data may be an
  approximation to the
     original uncompressed data
Null Suppression

 Oldest and simplest

 Long string of blanks , nulls etc cause
  redundancy.

 At transmitter:

  -scans data for string of blanks.

  -substitute two character code for any string

   that is encountered.
 Example :

  the string

      XYZbbbbbQRX

  is replaced by

      XYZSC5QRX

  where Sc is a special compression indication
  character

       b is symbol for a blank space
 At receiver:

  -scan incoming character for special indication

   character

  -reconstruct original data
Run-Length Encoding


 Compress any type of repeating data sequence

 At transmitter:

  -identify repeating characters to replace

  -if found, eliminate and replace by three- character code
Sc        X             Cc
            Sc-Special character indicating compression follows
            X-Any repeated data character
            Cc-Character count

                         (a) Compression format

Original data string           Encoded data string
$******55.72                   $c*655.72
---------                      Sc-9
                               GunsScb9Butter


                         (b)Examples

                    Fig: Run-Length Encoding
 Efficiency depends on

  -number of repeated character occurrences in data to be
  compressed

  -average repeated character length.

 Compression ratio=length of uncompressed data

                      length of compressed data

 Any compression scheme will have variable performance
  as the content of the input varies.
 It is used as an element in more complex
  image compression technique.

 For run-length encoding on an image,
  transmission of digital line scan is replaced
  by transmission of a quantity count of each of
  successive run of black or white scanned
  picture element.
0000000000
                                       0000000000
                                       0001111000
                                       0001001000
                                       0001111000
                                       0000001000
                                       0000001000
                                       0001111000
                                       0000000000
                                       0000000000
                                       Length:100 bit

                                       23W 4B 6W 1B 2W 1B
                                       6W 4B 9W 1B 9W 1B
                                       6W 4B 23W
(a)Image
                                       or:
Fig: Run-Length Code for a 100-pixel   23 4 6 1 6 4 9 1 916 4
image                                  23
                                       Length:15characters=1
                                       20bit
 Application of run length encoding to a 10X10
  image.

 10X10 representation is converted to a 100-
  bit code.

 Each pixel is represented by a single bit
  indicate black or white.

 Run-length code consist of length of alternate
  black or white sequence.

 Encoded data stream is a string of number
  that indicate length of alternate black or
  white runs.
THANK YOU

Run length encoding

  • 1.
    RUN LENGTH ENCODING Praseetha S Nair M.Tech(CS)
  • 2.
    COMPRESSION  Data compressedby eliminating redundant elements.  Purpose of compression:- -save storage space -reduce communications capacity requirements  Some code must be substituted for eliminated element.  Based on this code receiver can reconstruct original data.
  • 3.
     Categories:- 1.lossless compression -no information lost -decompressed data are identical to original uncompressed data 2.lossy compression -decompressed data may be an approximation to the original uncompressed data
  • 4.
    Null Suppression  Oldestand simplest  Long string of blanks , nulls etc cause redundancy.  At transmitter: -scans data for string of blanks. -substitute two character code for any string that is encountered.
  • 5.
     Example : the string XYZbbbbbQRX is replaced by XYZSC5QRX where Sc is a special compression indication character b is symbol for a blank space
  • 6.
     At receiver: -scan incoming character for special indication character -reconstruct original data
  • 7.
    Run-Length Encoding  Compressany type of repeating data sequence  At transmitter: -identify repeating characters to replace -if found, eliminate and replace by three- character code
  • 8.
    Sc X Cc Sc-Special character indicating compression follows X-Any repeated data character Cc-Character count (a) Compression format Original data string Encoded data string $******55.72 $c*655.72 --------- Sc-9 GunsScb9Butter (b)Examples Fig: Run-Length Encoding
  • 9.
     Efficiency dependson -number of repeated character occurrences in data to be compressed -average repeated character length.  Compression ratio=length of uncompressed data length of compressed data  Any compression scheme will have variable performance as the content of the input varies.
  • 10.
     It isused as an element in more complex image compression technique.  For run-length encoding on an image, transmission of digital line scan is replaced by transmission of a quantity count of each of successive run of black or white scanned picture element.
  • 11.
    0000000000 0000000000 0001111000 0001001000 0001111000 0000001000 0000001000 0001111000 0000000000 0000000000 Length:100 bit 23W 4B 6W 1B 2W 1B 6W 4B 9W 1B 9W 1B 6W 4B 23W (a)Image or: Fig: Run-Length Code for a 100-pixel 23 4 6 1 6 4 9 1 916 4 image 23 Length:15characters=1 20bit
  • 12.
     Application ofrun length encoding to a 10X10 image.  10X10 representation is converted to a 100- bit code.  Each pixel is represented by a single bit indicate black or white.  Run-length code consist of length of alternate black or white sequence.  Encoded data stream is a string of number that indicate length of alternate black or white runs.
  • 13.