FDCT Transformation Formula method

Source: Internet
Author: User
Tags cos

FDCT Transformation of luminance signals
Storage array for @param data luminance signal

void Compressencode::standardfdct (BYTE data[matrixsize][matrixsize])
{
BYTE Output[matrixsize][matrixsize];
Double alpha, Beta;
Short U = 0, v = 0;
Short x = 0, y = 0;
for (v = 0; v < matrixsize; ++v) {//Vertical
for (U = 0; u < matrixsize; ++u) {//Horizontal
Set C (U), C (v) factor
Alpha = 1;
if (U = = 0) Alpha = sqrt (1.0/2.0);

beta = 1;
if (v = = 0) Beta = sqrt (1.0/2.0);

Double tmp = 0.0;
for (x = 0; x < matrixsize; ++x) {
for (y = 0; y < matrixsize; ++y) {
The variable value of the DCT receives is [-128,127], so the variables are reduced by 128
TMP + = (Data[x][y]-128)
*cos ((2 * x + 1) *u*m_pi/(2.0*matrixsize))
*cos ((2 * y + 1) *v*m_pi/(2.0*matrixsize));
}
}

OUTPUT[U][V] = round_double ((ALPHA*BETA/4) *tmp);
}

Write the transformation results back to the original buffer
memset (data, 0, matrixsize*matrixsize * sizeof (BYTE));
memcpy (data, output, matrixsize*matrixsize * sizeof (BYTE));
}
}

FDCT Transformation Formula method

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.