TOPIC
TOPIC
examples
of
source
coding
algorithms
So
far
we
have
seen
examples
of:
VARIABLE
LENGTH
CODING
(VLC)
!
Huffman
!
Shannon
!
Shannon-‐Fano
!
ArithmeHc
15.6
Run-length encoding (RLE) -another example
The following string:
• BBBBHHDDXXXXKKKKWWZZZZ
• 4B2H2D4X4K2W4Z
Here "4B" means four B's, and 2H means two H's, and so on.
1 · 23 + 1 · 22 + 1 · 21 + 0 · 20 = 14
0 · 23 + 1 · 22 + 0 · 21 + 0 · 20 = 4
0 · 23 + 0 · 22 + 0 · 21 + 0 · 20 = 0
1 · 23 + 1 · 22 + 0 · 21 + 0 · 20 = 12
<latexit sha1_base64="GOYid9QgJdnaMH2T+rrgUu0I+ZQ=">AAACunichZFLSwMxEMez66vWV9Wjl2CxCIWSbBf0oFDw4rGCVaG7lmyaraHZB8msUIofUm9+G9OHotXiQODHf+bPTGaiXEkDhLw77srq2vpGabO8tb2zu1fZP7gzWaG56PBMZfohYkYomYoOSFDiIdeCJZES99HwapK/fxbayCy9hVEuwoQNUhlLzsBKvcprjQa8nwH2Hpt1/MXeN6Z1TD6ZXFIfB0G5Rpa4yN8uf9FD/veQaaNl4y0xUa9XqZIGmQb+DXQOVTSPdq/yFvQzXiQiBa6YMV1KcgjHTIPkSryUg8KInPEhG4iuxZQlwoTj6epf8IlV+jjOtH0p4Kn63TFmiTGjJLKVCYMns5ibiH/lugXE5+FYpnkBIuWzRnGhMGR4ckfcl1pwUCMLjGtpZ8X8iWnGwV67bJdAF7/8G+68Bm02vBu/2vLn6yihI3SMThFFZ6iFrlEbdRB3zpzQiZ2Be+FGrnSHs1LXmXsO0Y9w4QMujcYU</latexit>
Run-length encoding (examples)
As another example, consider the storage of a rectangular image. As a single color bitmapped image, it
can be stored as:
The rectangular image can be compressed with run-length encoding by counting identical bits as
follows:
• 0, 40
• 0, 40
• 0,10 1,20 0,10 The first line says that the first line of the bitmap consists of
• 0,10 1,1 0,18 1,1 0,10 40 0's. The third line says that the third line of the bitmap
• 0,10 1,1 0,18 1,1 0,10 consists of 10 0's followed by 20 1's followed by 10 more 0's,
• 0,10 1,1 0,18 1,1 0,10 and so on for the other lines
• 0,10 1,20 0,10
• 0,40
(examples)
Zig-‐Zag
scanning
Run-Length Encoding (RLE)
o Codificadores de video como MPEG-2, H.264 y HEVC, utilizan codificación RLE pero
no directamente sobre los pixeles de la imagen, sino aplicado a los coeficientes
transformados y cuantificados resultados de la 2D-DCT, con distinto patrones
especiales denominados Zig-Zag scanning.