Video Coding/decoding 3: transformation, quantification, and entropy Encoding

Source: Internet
Author: User

Chapter 2 transform Encoding

1. Transform Encoding

  • Purpose of Transcoding
    • Remove spatial signal correlation
    • The capability of spatial signals is concentrated on a small part of the low frequency coefficient in the frequency domain.
    • Small coefficients can be quantified without seriously affecting the quality of reconstructed images.
  • Block and Global Transformations
    • Block transform: discrete cosine transform (discrete cosine transform, DCT), 4x4, 8x8, 16x16
    • Global Transformation: Wavelet)
  • ENERGY CONCENTRATION OF TRANSFORMATION
    • DCT Encoding

2. Conversion Type

  • K-L Transformation
  • Fourier transform
  • Cosine transformation
  • Wavelet Transform

3. KL transformation

  • Optimal Transformation
  • The basis function is determined based on the specific image.
  • No quick algorithm
  • Rarely used
    • Extremely complex

  • K-L transformation is very complex and not practical
    • Covariance matrix to be calculatedU
    • Feature vectors need to be calculated
    • Need to be sent to Decoder

4. Discrete Fourier Transformation

5. Properties of Discrete Fourier Transformation

6. discrete cosine transformation

  • Fourier transformation is less complex than K-L transformation.
  • Second only to K-L Transformation
  • Quick Algorithms can speed up the transformation
  • Integer transformation can be used to further reduce complexity.

7. Relationship between DCT and DFT

8. Important Properties of discrete cosine transformation

 

9. fast DCT Transformation

Is a dynamic display:

 

 

10. Integer discrete cosine transformation

  • Convert Discrete Cosine to floating point operation
    • Requires 64-bit precision
    • High floating point computing complexity
    • High conversion precision
  • Integer Transformation: integer approximation of discrete cosine transformation
    • Requires less Bit Width
    • Low integer computing complexity
    • The conversion accuracy of a good integer transformation is close to that of a floating point transformation.
  • Floating Point Approximation

4x4 integer transformation in 264 H.264

12. Wavelet Transformation

  • New Transformation Method
  • Avoid block effects caused by block Encoding
  • More suitable for hierarchical encoding of video Space

 

Chapter 1 quantification

1. QuantizationQuantization

  • The process of displaying a larger set with a smaller set
    • Finite approximation of signal sources
    • Lossy Process
    • Application
      • A/D Conversion
      • Compression
    • Quantization Method
      • Scalar Quantization
      • Vector Quantization

2. Basic Idea of quantification

  • Ing an input interval to an integer
  • Reduce bit of source encoding
  • Generally, the reconstruction value is different from the input value.

3. Quantitative Model

4. Optimized quantified Rate Distortion

  • Design of the Quantizer
    • Quantize the number of bins.
    • Decision boundary: Bin Boundary
    • Reconstruction level
  • The quantizer is designed to optimize rate distortion.
    • To reduce the bit rate, we need to reduce the number of bins.
    • The decrease in the number of bin leads to an increase in the refactoring error, and the distortion increases.

5. Distortion Measurement

6. quantizer Design

  • Two aspects of the design of the Quantizer
    • Number of quantitative levelsM, Locate the decision BoundaryXIAnd reconstruction level
      Minimum MSE
    • Given distortion limitD, Find the quantitative levelM, Decision BoundaryXIAnd reconstruction levelYiMake MSE <=D

7.Uniform quantization)

8. quantization and Peak Signal-to-Noise Ratio

9.Midrise Quantizer)

10.Midtread Quantizer)

11.Deadzone Quantizer)

12.Non-uniform quantization)

  • If the source is not evenly distributed, uniform quantization is not optimal.
  • For non-even quantization, to reduce MSE, when the probability density functionFX(X) When it is high, the quantitative step of bin is reduced when the probability density functionFX(X) When the bin is low, increase the quantitative step of the bin.

13. Optimal scalar Quantization

14. quantization Encoding

  • Fixed-length encoding quantification level
    • Encode each quantization level using an equi-length code word. The length of the code word is as follows:
  • Entropy encoding quantification level
    • Encode each quantization level with a variable-length codeword Based on the probability distribution of the quantization level
    • Average codeword Length
    • Higher efficiency than fixed-length encoding
    • Widely used in image and video encoding

15. Vector Quantization

  • Scalar quantization: quantifies data one by one. It is called scalar quantization.
  • Vector Quantization: grouping data. K pieces of data in each group constitute K-dimensional vectors, which are then quantified using vectors as processing units.
    • Vector Quantization is a multi-dimensional extension of scalar quantization.
    • Scalar quantization is a special case of vector quantization.
  • Vector Quantization

  • Two-Dimensional Vector Quantization

  • Advantages of Vector Quantization
    • Only passing the subscript of the code word, high encoding Efficiency
    • Smaller than scalar quantization distortion at the same Bit Rate
    • The bitrate is lower than that of scalar quantization under the same distortion.
  • Disadvantages of Vector Quantization: complexity increases exponentially with the increase of dimensions

 

Chapter 2 entropy Encoding

1. Entropy Encoding

  • Entropy: the average Information volume of the source. More accurately, it indicates the average bit number of information contained by all symbols of the source.
    • Source Coding should minimize the redundancy of the source to bring it closer to entropy.
    • Transmit more source information with fewer bits
  • Entropy Coding: minimizes the entropy of a message based on the probability model of the message source in data compression.
    • Lossless Compression
    • Variable-Length Encoding

2. Entropy

  • Information volume:

Unit: Bit

  • Entropy:

Unit: bit/Symbol

3. Fixed Length Encoding

4. variable-length encoding

  • Variable-length encoding: each symbol is represented by different bits.
    • Assign a short code word to frequently occurring symbols
    • Assign long code words to rarely occurring symbols
    • Higher efficiency than fixed-length encoding
  • Common variable-length coding
    • Huffman Encoding
    • Arithmetic Coding

5. Huffman Encoding

  • Prefix: Any codeword is not the prefix of any other codeword.
    • If 011 is a valid code word, 0, 1, and 11 are not valid.
    • Does not cause decoding Ambiguity
  • Huffman:
    • Binary Tree
    • Tree node: symbol or symbol combination
    • Branch: one of the two branches represents "0", and the other represents "1"

  • Uniqueness of Huffman
    • Each branch has two options: 0, 1

    • The same probability produces different combinations

  • Disadvantages:
    • It is difficult to calculate the probability change of data in real time.
    • The Huffman tree must be encoded and transmitted to the decoder.
    • OnlyP(XI) = 1/2Ki
      Always optimal Encoding
    • Minimum codeword length: 1 bit/Symbol
  • If there is a binary source, the probability of the two symbols is very different.
    • For example:P(1) = 0.0625,P(0) = 0.9375H= 0.3373 bits/symbol, Huffman encoding average code length = 1 bits/Symbol
    • Two-symbol joint encoding is more efficient

6. Extended Huffman Encoding

7. paradigm Huffman Encoding

  • Construction Rules of the paradigm Huffman tree
    • The left branch of the node is set to 0, and the right branch is set to 1.
    • The depth of the tree increases from left to right.
    • Each symbol is placed on the first satisfied leaf node.

  • Features
    • The first code word is a string of 0
    • The value of the codeword with the same length is continuous.
    • If all the code words are supplemented with 0 at the low position, 0000 <0100 <1000 <1010 <1100 <1110 <1111 <
    • The relationship between the length of a codeword N and n + 1 is as follows:
      • C (n + 1, 1) = (C (n, last) + 1) <1
    • The relationship between the length of a codeword N and n + 2 is as follows:
      • C (n + 2, 1) = (C (n, last) + 1) <2

8. One dollar code

  • Encode a non-negative integer N with N numbers 1 and 0
  • No need to store the code table
  • It can be represented by the Huffman tree.

  • Code length increases too fast: N = 100, code length 101

9. Columbus code

  • Divides the source symbol into several groups, each group has a corresponding number
  • Small allocation code word is short, and the number is very long.
  • The same group of symbols have an equi-length code word, which is slower than the code word length of a metacode.

  • Codeword allocation



 

10. Exponential Columbus code

  • The Columbus Code has the same size as the source symbol grouping.
  • Exponential increase in the packet size of Columbus codes for source symbols
  • Index Columbus code is still in the form of a dollar code plus a fixed length code
  • Index of the Columbus codeK= 0, 1, 2 ,...


11.Cavlc (context-Based Adaptive Variable Length Code)

  • The coefficient distribution of the current block is related to the coefficient distribution of the adjacent block.
    • NX is the number of non-zero coefficients of block X. The encoding code table of the first coefficient of Block C is determined by NC. nc = (Na + Nb)/2

  • There is a correlation between the current awaiting encoding coefficient and the preceding encoding coefficient.
    • The code table of other coefficients of current Block C is determined by the amplitude of the previous coefficient. cofN-1 => golombtab_x, cofn encoded with golombtab_x

12. Arithmetic Coding

  • Amount of information => Number of symbolic encoded bits
  • The Huffman encoding allocates a code word for each symbol. This indicates that the maximum compression capacity of the Huffman encoding is 1 bit/symbol.
  • Arithmetic code several symbols can be encoded into 1 bit
  • Arithmetic Coding represents the source as the [0, 1] interval on the real number axis. Each symbol in the source is used to shorten this interval.
    • Output a real number in the range [0, 1] to indicate a string of encoding symbols.
    • More effective than Huffman Encoding
  • Coding Ideology
    • The encoder uses the entropy encoding algorithm to encode a string of symbols to generate a real number in the range [0, 1] and transmit a binary representation of the real number to the decoder.
    • Decoder decodes a string of symbols using entropy Decoding Algorithms
  • Binary representation of decimal places

  • Source symbol probability distribution

  • String: X2 X3 X3 X6 X5 X7
  • Huffman encoding, 01 01 100 100 00 11 1011, 18bit

  • Arithmetic Coding is closer to entropy
  • Limited-precision arithmetic coding is a near-optimal code that sends an integer bit to the decoder.
  • The code word is output only when the last character encoding ends.
  • High encoding complexity

13. Binary Arithmetic Coding

13. adaptive binary arithmetic coding

  • Because the probability of occurrence of the source 0 and 1 is constantly changing, the probability interval between 0 and 1 should also be constantly changing.
  • Adaptive binary arithmetic coding re-calculates the probabilities of 0 and 1 for each encoding and re-divides the range [0, 1 ).
  • The probability statistics model at codec end is consistent, and the same [0, 1) interval division can be obtained.

 

14.Cabac (context-based adaptive binary arithmetic coding)


  • The probability distribution of the syntax elements of the current block is related to the probability distribution of the syntax elements of the adjacent block.
    • The syntax elements SA and SB of the adjacent blocks A and B of the current block C can select a probability model for the syntax element SC of the encoded block C.
  • Binarization
    • Convert the syntax element value to a binary value string
  • Probability Model update
    • Re-estimate the probability of a binary string based on the encoded bit and update the probability model. The next bit is encoded using the new probability model.

15. Run Length Encoding

  • Technology for encoding by the repeatability of source characters
  • The source code with long and many repeated characters is very effective.
  • Repeated characters are called run, and the number of repeated characters is called run length.
  • Run-length encoding can be used together with other entropy codes to compress data.

16. dictionary Encoding

  • Dictionary encoding: Based on the Combination characteristics of the source symbol (Message), a dictionary containing a variety of symbol combinations is established to encode the indexes of these symbol combinations.
    • Lz78 => WinZip
    • LZW => GIF
  • Suitable for Data Compression in general sense, removing statistical redundancy of data

17. LZW

  • Encode the index of each character or string that appears for the first time in the string output from the source to the bitstream.
  • Based on the characters decoded from the bitstream, the decoder creates a dictionary exactly the same as that of the encoder online and restores the source output string.
  • This method is suitable for repeated occurrences of a large number of sub-strings. The more repetitions, the better the compression effect.
  • A single symbol is assigned a value between 0 and.
  • The initial code table that contains 256 symbols with a value of 0 to 255. The symbols with a value greater than are empty.
  • The encoder determines the combination of Characters Based on the encoding symbol to a value ranging from 256 to 4095.
  • During encoding, the encoder recognizes new character combinations and adds them to the code table.
  • The value encoding corresponding to the symbol combination in the code table of the Encoder

  • During decompression, the LZW decoder can generate a code table exactly the same as the encoder.
  • Initialize all single characters like encoder and assign values between 0 and to them.
  • In addition to decoding the first character, the code table must be updated when decoding other characters.
  • Read the codes and decode them into corresponding characters or character combinations based on the values in the code table.

18. lz78

References:

  • LZW: http://www.cs.usyd.edu.au /~ Loki/cs2csys/GIF-info/lzw.html
  • Lz78: http://www.cs.usyd.edu.au /~ Loki/cs2csys/GIF-info/lz78.html

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.