FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/Variable-width_encoding

Variable-length encoding

Contents
    Uniquely decodable codes
References
Further reading

In coding theory, variable-length encoding is a symbol encoding scheme in which codes of differing lengths are used to encode symbols for representation through a communication channel or in a storage medium. The equivalent concept in computer science is bit string.

Variable-length codes can allow sources to be compressed and decompressed with zero error (lossless data compression) and still be read back symbol by symbol. An independent and identically-distributed source may be compressed almost arbitrarily close to its entropy. This is in contrast to fixed-length coding methods, for which data compression is only possible for large blocks of data, and any compression beyond the logarithm of the total number of possibilities comes with a finite (though perhaps arbitrarily small) probability of failure.

For these reasons, they were sometimes used to pack English text into fewer bytes in adventure games for early microcomputers. However, disks, increases in computer memory, and general purpose compression algorithms have rendered such methods obsolete.

Multibyte encodings are usually the result of a need to increase the number of characters which can be encoded without breaking backward compatibility with an existing constraint. For example, with one byte (8Β bits) per character, one can encode 256 possible characters; in order to encode more than 256 characters, the obvious choice would be to use two or more bytes per encoding unit, two bytes (16Β bits) would allow 65,536 possible characters, but such a change would break compatibility with existing systems and therefore might not be feasible at all.

Unlikely source symbols can be assigned longer codewords while likely source symbols can be assigned shorter codewords, thus giving a low expected codeword length. Some examples of well-known variable-length coding strategies are Huffman coding, Lempel–Ziv coding, arithmetic coding, and context-adaptive variable-length coding.

49, I, E2 is a lead unit and S and S to a sequence of symbols over Sβˆ— into a and M2={πšŠβ†¦πŸ·,πš‹β†¦πŸΆπŸ·πŸ·,πšŒβ†¦πŸΆπŸ·πŸ·πŸ·πŸΆ,πšβ†¦πŸ·πŸ·πŸ·πŸΆ,πšŽβ†¦πŸ·πŸΆπŸΆπŸ·πŸ·,πšβ†¦πŸΆ} is non-singular; its extension will generate a lossless coding, which will be useful for general data transmission (but this feature is not always required). It is not necessary for the non-singular code to be more compact than the source (and in many applications, a larger code is useful, for example as a way to detect or recover from encoding or transmission errors, or in security applications to protect a source from undetectable tampering).

Uniquely decodable codes

edit

A code is uniquely decodable if its extension is Β§ non-singular. Whether a given code is uniquely decodable can be decided with the Sardinas–Patterson algorithm.

The mapping M2 from the previous section. This code is not uniquely decodable, since the string 011 – 1 – 011 – 10011. Two possible decodings of this encoded string are thus given by M3 above is not a prefix code because we do not know after reading the bit string b or 0 c111

Example of encoding and decoding:
|0|0|10|0|110|111|0|10| β†’ (12,14,18,18), the expected number of bits used to represent a source symbol using the code above would be:

  1. ↑ As a real-life example of this, UTF-16, which represents the most common characters in exactly the manner just described (and uses pairs of 16-bit code units for less-common characters) never gained traction as an encoding for text intended for interchange due to its incompatibility with the ubiquitous 7-/8-bit ASCII encoding, with its intended role instead being taken by UTF-8, which does preserve ASCII compatibility.

References

edit
  1. ↑ Crispin, M. (2005-04-01). UTF-9 and UTF-18 Efficient Transformation Formats of Unicode. IETF. doi:10.17487/rfc4042.
  2. 1 2 This code is based on an example found in Berstel et al. (2009), Example 2.3.1, p. 63.

Further reading

edit