Fast transform of DCT

Source: Internet
Author: User

First, the introduction

DCT transform is an important transform in digital image processing, many important image algorithms and image applications are based on DCT transform, such as JPEG image coding. For large size two-dimensional numerical matrices, if the ordinary DCT transform is used, the time spent will be unbearable or even impossible to achieve practical. To overcome this difficulty, the fast algorithm of DCT transform is very attractive.

For now, the fast algorithm of DCT transform has the following two ways:

1. As the FFT algorithm is used, it is relatively easy to use FFT to realize the fast algorithm of DCT transform. But there is also a shortage of this approach: the computational process involves complex numbers. Since the data before and after the DCT transform is real, in the calculation, the plural is introduced, and the addition of a pair of complex numbers equals the addition of two pairs of real numbers, and the multiplication of a pair of complex numbers equals the multiplication of four to real numbers and the addition of two to real numbers, which obviously increases the computational volume and puts forward higher requirements for hardware storage.

2. Fast transform of DCT directly in real field. Obviously, this method is better than the former in terms of both computational and hardware requirements.

In view of this, this paper uses the second method to realize the fast algorithm of DCT transform.

Second, theoretical deduction

Limited to space, this can not be listed, the specific derivation process can be seen in the new DCT fast algorithm and filter structure research and wavelet transform domain image denoising Research, South China University of Technology doctoral dissertation.

III. implementation of the procedure

Fast transform of DCT

Considering that the coefficients in the DCT transform are to be repeated, the lookup table can be used to improve the efficiency of the operation, so long as the DCT transform can be computed once before the DCT transform, it is possible to find only without calculating coefficients.

void initDCTParam(int deg)
   // deg 为DCT变换数据长度的幂
       return; //不用再计算查找表
   int total, halftotal, i, group, endstart, factor;
   total = 1 << deg;
   if(C != NULL) delete []C;
   C = (double *)new double[total];
   halftotal = total >> 1;
   for(i=0; i < halftotal; i++)
   for(group=0; group < deg-1; group++)
       endstart=1 << (deg-1-group);
       int len = endstart >> 1;
       factor=1 << (group+1);
       for(int j = 0;j < len; j++)
          C[endstart-j-1] = factor*C[total-j-1];
   for(i=1; i < total; i++)
       C[i] = 2.0*cos(C[i]*PI/(total << 1)); ///C[0]空着,没使用

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: 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.