Explanation
- The following classification for a variety of coding is not entirely true comparisons are summarized for convenience only memory
- Prefix code is not strictly necessarily so, for in the face, it may be able to see at a glance what kind of coding
- For encoding no detailed explanation, only a brief description about regarding specific coding process, there are many online information
- utf encoding problem small end https://blog.csdn.net/byf0521hlyp/article/details/80365045
- base family https://blog.csdn.net/lili13897741554/article/details/82177472
The character and common network coding
coding | purpose | Prefix or Features | Coding form | Common or special memory |
---|---|---|---|---|
url encoded | Some of the printable ascii characters are encoded | Prefix% | % To prefix, followed by two hexadecimal characters of ascii code | 20% empty spaces% 00% 25 Percent + byte also represents url spaces |
html coding | For the safety of the use of certain characters in html document | Or & or & # & # x | Followed by 10 character hexadecimal ascii code, & # x as the prefix followed by the character hexadecimal ascii code | "Or as & quot or 34 & # & # x22> as & gt <is & lt |
Hexadecimal encoding | To encode binary data in hexadecimal | |||
base64 | Encoding binary data for converting the data into a non-ASCII characters in the ASCII character | Often end = | Capital letters A ~ Z, lowercase letters a ~ z, numbers 0 to 9 and "+", "/" is used to fill and = | |
base32 | Encoding binary data for converting the data into a non-ASCII characters in the ASCII character | Often end = | A ~ Z capital letters and figures 2 to 7 and used for fill = | |
base16 | Encoding binary data for converting the data into a non-ASCII characters in the ASCII character | Numbers 0-9 and the letters A ~ F | ||
unicode | Character encoding for all the world | U + | Is encoded with four bytes for each character, generally indicated by 16 hexadecimal characters | |
Utfa8 | The unicode character encoding, transmission of stored coded to facilitate | % | Using one to four bytes per character encoding | |
Utfal6 | The unicode character encoding, transmission of stored coded to facilitate | in% | Using two or four bytes for each character encoding | |
utf32 | The unicode character encoding, transmission of stored coded to facilitate | in% | Using four bytes for each character encoding | |
ascii code | 128 keyboard character encoding | A 7-bit binary numbers to represent all the uppercase and lowercase letters, numbers 0-9, punctuation, and special control characters used in American English | ||
gbk | Of Chinese character encoding | Two byte code | ||
bcd code | Encoding binary data | Using 4 binary numbers to represent a decimal number of 0 to 9 ten digital, there are 8,421 yards, 2,421 yards, more than 3 cyclic code, etc. |
The digital signal coding
NRZ coding NRE-- high and low are represented by 0 and 1
Manchester encoding - 0 indicates a low level from the high jump, high jump from the low level indicates a
differential Manchester encoding - each intermediate bit transitions, the clock used to indicate when each transition represents the start with a 0, 1 represents no
Other common coding
Huffman coding
For compression, MP3 coding
simple binary Huffman encoding process as
it is encoded e is 1, c is encoded as 01, f is encoded as 000, h 001 encoding
Fano coding
Fenno simple binary coding process is as follows, constantly divided into two groups of similar probability
Run Length Encoding
Satellite for encoding, such as medical images, the use of run-length, such as image pixels
3333
4333
2211 is
1111
gray: 3,4,3,2,1,1
length: 4,1,3,2,2,4
gradation with two, with a length of two 1011,1100,1010,0101,0001,0011
Error control code
Parity
Increasing an odd (even) parity bit and is stored or transmitted together
, such as: 1111000 added in an even-number of bits representing a bit is 0 is an even number, it becomes 11110000, if an error occurs during transmission becomes 10110000, then you know there was an error occurred. If an even number of bit errors, can not be found
Crc cyclic redundancy code
一个k位的二进制数据,左移r位,除以一个给定的r+1位的多项式相除,得到的r位余数就为校验码,拼到k位的二进制数后面
只要将接受到的数据和校验位用约定好的同样的生成多项式除,如果能除尽,表明没有发生错误(不一定,也有可能错误);若除不尽,则表明某些数据位发生了错误
如信息码为1100,生成多项式为\(x^{3}+x+1\)
则1100平移3位1100000 除以1011,余数为010,拼在1100后面为1100010
海明校验码
能够纠正一位错误或者检测两位错误并纠一正位错误
设信息码为k位,校验码为r位,海明码为k+r位
如果能够纠正一位错则应满足\(2^{r}-1\geq k+r\)
如果能够发现两位错并纠正一位错则应满足\(2^{r-1}\geq k+r\)
编码规律为
- 每个校验位\(p_{i}\)放在海明码中位号为\(2^{i-1}\)的位置
- 海明码的每一位(数据位和校验位)由多个校验位进行校验:被校验位的位号=校验位位号之和
例如求01101110的海明码,使其能纠正一位错误
一 确定校验位数
\(2^{4}-1\geq 8+4\) 所以r为4
二 确定校验位所在位置
\(2^{1-1}\),\(2^{2-1}\),\(2^{3-1}\),\(2^{4-1}\)所以海明码的1,2,4,8为校验位
三 分组
四 确定校验位
每一组除本身校验位外,所有位异或,如第一组为\({D}_{7} \oplus{D}_{6} \oplus{D}_{4} \oplus{D}_{3} \oplus{D}_{1}={1}\)
四个校验码分别为1101,所以海明码为110011011110
五 校验
将每一组与本组的校验位异或,即\({P}_{1} \oplus{D}_{7} \oplus{D}_{6} \oplus{D}_{4} \oplus{D}_{3} \oplus{D}_{1}\),如果校验位都为0,则无错,如果有错,校验位二进制编码即为出错位号,如,如果校验位为1010,则第第10位错,即\({D}_{2}\)出错