0% found this document useful (0 votes)
19 views18 pages

TOPIC

Uploaded by

Nidhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views18 pages

TOPIC

Uploaded by

Nidhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Other

 examples  of  
 source  coding  algorithms  
So  far  we  have  seen  examples  of:  
VARIABLE  LENGTH  CODING  (VLC)    
!  Huffman  
!  Shannon    
!  Shannon-­‐Fano  
!  ArithmeHc    

Here  we  will  consider  other  codes  

The  examples  in  these  slides  and  the  VLCs,  


all  belongs  to  the  so  called    
Entropic  Coding  family  
(lossless  coding)  
Very  simple  idea  exploiHng  repeHHons….  
- Run-length encoding (RLE) is probably the simplest method of
compression. It can be used to compress data made of any
combination of symbols.

- It does not need to know the frequency of occurrence of symbols

- The general idea behind this method is to replace consecutive


repeating occurrences of a symbol by one occurrence of the
symbol followed by the number of occurrences.
Run-length encoding example
Run-length encoding other example

15.6  
Run-length encoding (RLE) -another example
The following string:

• BBBBHHDDXXXXKKKKWWZZZZ

can be encoded as:

• 4B2H2D4X4K2W4Z

Here "4B" means four B's, and 2H means two H's, and so on.

In this case, the number of repetitions is put “before” instead of


“later” (just another example)…….
Run-length encoding (RLE) for two symbols
Consider  the  “space  between  1’s”  

Consider  the  “distance  


between  1’s”  

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.

MPEG-2 (8x8)   H.264 (4x4)  

STyCIB: T2. Técnicas de Codificación Intra-frame


11
DicHonary  –  based  algorithms    
Example  of  DicHonary  –  based  algorithm    
Example  of  DicHonary  –  based  algorithm    
Lempel Ziv encoding

Lempel Ziv (LZ) encoding is an example of a category of


algorithms called dictionary-based encoding.

-The idea is to create a adaptively dictionary (a table) of


strings used during the communication session.
Basic idea:
In this phase there are two concurrent events:
(1) building an indexed dictionary,
(2) and compressing a string of symbols.

-The algorithm extracts the smallest substring that cannot be


found in the dictionary from the remaining uncompressed
string. It then stores a copy of this substring in the dictionary
as a new entry and assigns it an index value.
“B”  is  not  in  the  
table/dicConary  

“A”  is  already  in  the  


table  as  “entry  2”  
“AB”  is  not  in  the  table  
“AB”  is  already  in  the  
table  as  “entry  3”   “ABB”  is  not  in  the  table  
“B”  is  already  in  the  
table  as  “entry  1”   “BA”  is  not  in  the  table  
“ABB”  is  already  in  
the  table  as  “entry  4”   “ABBB”  is  not  in  the  table  
“BA”  is  already  in  the  
table  as  “entry  5”   “BAA”  is  not  in  the  table  

You  can  also  think  to  


A=1  and  B=2  
An example of Lempel Ziv encoding
Decoder  

An example of Lempel Ziv decoding

You might also like