JPEG decoding: Anti-DCT transformation (1)

Source: Internet
Author: User

DCT (discrete cosine transform) discrete cosine transformation is a typical spectral analysis method. It is a special case of Discrete Fourier transformation. That is, only the cosine is included in the transformed Fourier series, the changed data is concentrated. After DCT transformation, the image can be converted from the color domain to the frequency domain, and the information block of the original image can be converted to the coefficient set representing different frequency components. It is a widely used compression method. First, each color image component is divided into 8x8 image blocks. After two-dimensional DCT transformation, its low frequency components are concentrated in the upper left corner, high-frequency components are distributed in the lower right corner. After the conversion, it is still 8x8 data blocks. That is to say, the DCT transform itself does not compress data, but it lays an essential foundation for future data compression.

The data transformed by DCT has two advantages: 1. The signal usually concentrates most of its energy in a small range of frequency domains. As a result, describe unimportant components that only require a small number of BITs; 2. the frequency domain decomposition maps the processing process of human visual systems and allows subsequent quantization processes to meet their sensitivity requirements. For the transformed 8x8 data matrix block, the DC (DC) coefficient in the upper left corner of the matrix is the largest, and the other DCT coefficients to the right and downward are based on the DC coefficient, the farther away the DC component, the higher the frequency and the smaller the amplitude value. That is, most of the image information is concentrated on the DC coefficient and its nearby low frequency spectrum, the high-frequency spectrum, which is farther and farther away from the DC coefficient, does not contain image information or even only contain clutter.

 

The compressed image is an image after DCT transformation. to decompress the compressed image, we need to perform "inverse DCT transformation (DCT inverse transformation)" on the compressed data )". There are several methods for Inverse DCT transformation. Here we use the row-column decomposition method.

The inverse DCT transformation formula is:

It can be rewritten:

F = a tau fa

 

A is the matrix:

Deformation of the above formula

Y = fa

F = at y

FT = (at y) t = yt

F Data Block.

The analysis shows that it takes four steps to complete a DCT Inverse Transformation:

1: compress the data block (8x8) matrix by multiplying the matrix A (8x8) to obtain the matrix Y (8x8 ).

2: Perform rank conversion on matrix Y (8 × 8 ).

3: Y's transformation rank is multiplied by matrix A to obtain the 8 × 8 matrix ft.

4: Perform rank conversion on FT to obtain F.

 

Therefore, two modules are required in the design. One is used to multiply the matrix and the other is used to convert the rank of the matrix.

The overall design is as follows:

 

 

The a matrix multiplier is used to multiply the input matrix and a matrix. Note that matrix A is on the right of multiplication.

The IDCT transformation object is a data unit of 8 × 8, which is a total of 64 input data, input by line, each 8 data is a row. Each input row of data is multiplied and added to each column of matrix A respectively. Each time such a multiplication operation is completed, the result is output. Since the input is on the left, the output is in the sequence of rows in the matrix. For example, the first row of input data is multiplied by the columns of matrix A and eight results are output in order. These eight results are the first row of the output matrix; when the second row of data is input, eight results are also output. These eight results are the second row of the output matrix. Therefore, after the first matrix multiplication, the y matrix is obtained.

 

The result of ranking is to rearrange 64 data.

For example:

On the left is the order of unconverted data, and on the right is the order of converted data.

 

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.