Anda di halaman 1dari 2

Entropy or lossless coding [Lossy is called source coding]

Ideally, the most recurring symbol should have the shortest binary string, and the least recurring, the
longest. This will ensure that our coded data has a good chance of being much smaller in size than
the original data. Each symbol is given a binary string

SF coding
1. Works from root to leaves (top down)
2. Based on statistics (probability of each symbol) obtained from the data to be coded
3. Doesn’t always generate an optimal code

Huffman Coding
1. Works from leaves to root (bottom up)
2. conceptually very similar to SF but more effective than SF

The main disadvantage of Static Huffman Coding is a need to care statistics information together with
encoded stream of symbols. Also the statistics of sensor data may be varying.

Codes are stored in a Code Book which may be constructed for each image or a set of images. In all
cases the code book plus encoded data must be transmitted to enable decoding.
Used in JPEG compression. It produces optimal and compact code but relatively slow. Huffman
algorithm is based on statistical model which adds to overhead.
It requires prior knowledge of the probabilities of the source sequence. If this knowledge is not
available, Huffman coding becomes a two pass procedure: the statistics are collected in the first pass
and the source is encoded in the second pass.

Adaptive Huffman coding (Dynamic)


Technique based on Huffman coding, building the code as the symbols are being transmitted, having no
initial knowledge of source distribution, that allows one-pass encoding and adaptation to changing
conditions in data. Avoids transmitting statistics data. Statistics information is gathered in the same pass
and Huffman tree is updated accordingly. This way Encoder and Decoder both build Huffman tree while
reading stream of data.

The benefit of one-pass procedure is that the source can be encoded in real time, though it becomes
more sensitive to transmission errors, since just a single loss ruins the whole code.

Prefix code:
Since each symbol can be represented by different amount of bits, it is important that no symbol code is
a prefix of other symbol code. A code with this property is called the Prefix Code.

But the disadvantage in this algorithm is its complexity in constructing the binary tree which makes it
unsuitable for sensor nodes.

It permits building the code as the symbols are being transmitted, having no initial knowledge of source
distribution, that allows one-pass encoding and adaptation to changing conditions in data.
In Adaptive Huffman, neither transmitter nor receiver knows anything about the statistics of the
source sequence at the start of transmission. The tree at both the transmitter and the receiver
consists of a single node that corresponds to all symbols Not Yet Transmitted (NYT) and has a
weight of 0. As transmission progresses, nodes corresponding to symbols transmitted will be added
to the tree and the tree is reconfigured using an update procedure.

Considering a simple 4 bit ADC representation for each data, then before the beginning of
transmission, a fixed 4 or 5 bit code depending whether the symbol is positive or negative is
agreed upon between the transmitter and receiver. The actual code consists of two parts: The
prefix corresponding to the code obtained by traversing the tree and the suffix corresponding to
4 or 5 bit binary representation corresponding to positive or negative data respectively. In the
process of coding, the probability for the incoming source sequence is assigned as the elements get
in to the tree formed. This gives rise to a problem where the elements which come in the initial stages
of tree formation having lesser probability hold smaller codes. Thereby, the compression ratio
obtained is lesser.

Using Adaptive Huffman algorithm, we derived probabilities which dyanamically changed with the
incoming data, through Binary tree construction. Thus the Adaptive Huffman algorithm provides
effective compression by just transmitting the node position in the tree without transmitting the
entire code. Unlike static huffman algorithm the statistics of the sensor data need not be
known for encoding the data.

Anda mungkin juga menyukai