DICOM PS3.5 2019c - Data Structures and Encoding

G.3.2 The RLE Decoder (Current)
Prev | G.3 The RLE Algorithm | Next

### G.3.2 The RLE Decoder

Pseudo code for the RLE decoder is shown below:

- Loop until the number of output bytes equals the uncompressed segment size

  - Read the next source byte into n

  - If n> =0 and n <= 127 then

    - output the next n+1 bytes literally

  - Elseif n <= - 1 and n >= -127 then

    - output the next byte -n+1 times

  - Elseif n = - 128 then

    - output nothing

  - Endif

- Endloop

Prev | Up | Next
G.3 The RLE Algorithm | Home | G.4 Organization of RLE Compressed Frame

DICOM PS3.5 2019c - Data Structures and Encoding