📄 img_fdct_8x8.h
字号:
/* // in Q1, since we do not explicitly multiply // */
/* // by 0.5. // */
/* // -------------------------------------------- // */
/* g0 = f0 + f7; // Results in Q1 // */
/* g1 = f1 + f6; // Results in Q1 // */
/* h1 = f2 + f5; // Results in Q1 // */
/* h0 = f3 + f4; // Results in Q1 // */
/* g2 = f3 - f4; // Results in Q1 // */
/* g3 = f2 - f5; // Results in Q1 // */
/* h3 = f1 - f6; // Results in Q1 // */
/* h2 = f0 - f7; // Results in Q1 // */
/* */
/* // -------------------------------------------- // */
/* // Stage 2 // */
/* // // */
/* // Note, on the odd-half, the results are in // */
/* // Q1.5 since those values are scaled upwards // */
/* // by sqrt(2) at this point. // */
/* // -------------------------------------------- // */
/* p0 = g0 + h0; // Results in Q1 // */
/* p1 = g1 + h1; // Results in Q1 // */
/* r0 = g0 - h0; // Results in Q1 // */
/* r1 = g1 - h1; // Results in Q1 // */
/* */
/* q1a = g2 + g2; // q1a is now Q2 // */
/* s1a = h2 + h2; // s1a is now Q2 // */
/* q1 = (q1a * C4 + 0x8000) >> 16; // .. in Q1.5 // */
/* s1 = (s1a * C4 + 0x8000) >> 16; // .. in Q1.5 // */
/* */
/* s0 = h3 + g3; // Results in Q1.5 // */
/* q0 = h3 - g3; // Results in Q1.5 // */
/* */
/* // -------------------------------------------- // */
/* // Stage 3 // */
/* // // */
/* // Now, the even-half ends up in Q1.5. On P0 // */
/* // and P1, this happens because the multiply- // */
/* // by-C4 was canceled with an upward scaling // */
/* // by sqrt(2). On R0 and R1, this happens // */
/* // because C2 and C6 are at Q15.5, and we // */
/* // scale r0 and r1 to Q2 before we multiply. // */
/* // -------------------------------------------- // */
/* P0 = p0 + p1; // Results in Q1.5 // */
/* P1 = p0 - p1; // Results in Q1.5 // */
/* */
/* r0_= r0 + r0; // r0_ is now Q2 // */
/* r1_= r1 + r1; // r1_ is now Q2 // */
/* R1 = (C6 * r1_+ C2 * r0_+ 0x8000) >>16; // Q1.5 // */
/* R0 = (C6 * r0_- C2 * r1_+ 0x8000) >>16; // Q1.5 // */
/* */
/* Q1 = q1 + q0; // Results in Q1.5 // */
/* S1 = s1 + s0; // Results in Q1.5 // */
/* Q0 = q1 - q0; // Results in Q1.5 // */
/* S0 = s1 - s0; // Results in Q1.5 // */
/* */
/* // -------------------------------------------- // */
/* // Stage 4 // */
/* // No further changes in Q-point happen here. // */
/* // -------------------------------------------- // */
/* F0 = P0; // Results in Q1.5 // */
/* F4 = P1; // Results in Q1.5 // */
/* F2 = R1; // Results in Q1.5 // */
/* F6 = R0; // Results in Q1.5 // */
/* */
/* F1 = (C7 * Q1 + C1 * S1 + 0x8000) >>16; // Q1.5 // */
/* F7 = (C7 * S1 - C1 * Q1 + 0x8000) >>16; // Q1.5 // */
/* F5 = (C3 * Q0 + C5 * S0 + 0x8000) >>16; // Q1.5 // */
/* F3 = (C3 * S0 - C5 * Q0 + 0x8000) >>16; // Q1.5 // */
/* */
/* // -------------------------------------------- // */
/* // Store the frequency domain results. // */
/* // These values are all at Q1.5 precision. // */
/* // -------------------------------------------- // */
/* dct_io_ptr[ 0] = F0; */
/* dct_io_ptr[ 8] = F1; */
/* dct_io_ptr[16] = F2; */
/* dct_io_ptr[24] = F3; */
/* dct_io_ptr[32] = F4; */
/* dct_io_ptr[40] = F5; */
/* dct_io_ptr[48] = F6; */
/* dct_io_ptr[56] = F7; */
/* */
/* dct_io_ptr++; */
/* } */
/* // ------------------------------------------------ // */
/* // Update pointer to next 8x8 FDCT block. // */
/* // ------------------------------------------------ // */
/* dct_io_ptr += 56; */
/* } */
/* */
/* // ---------------------------------------------------- // */
/* // Perform Horizontal 1-D FDCT on each 8x8 block. // */
/* // ---------------------------------------------------- // */
/* dct_io_ptr = dct_data; */
/* for (i = 0; i < 8 * num_fdcts; i++) */
/* { */
/* // ------------------------------------------------ // */
/* // Load the spatial-domain samples. // */
/* // The incoming terms are at Q1.5 precision from // */
/* // the first pass. // */
/* // ------------------------------------------------ // */
/* f0 = dct_io_ptr[0]; */
/* f1 = dct_io_ptr[1]; */
/* f2 = dct_io_ptr[2]; */
/* f3 = dct_io_ptr[3]; */
/* f4 = dct_io_ptr[4]; */
/* f5 = dct_io_ptr[5]; */
/* f6 = dct_io_ptr[6]; */
/* f7 = dct_io_ptr[7]; */
/* */
/* // ------------------------------------------------ // */
/* // Stage 1: Separate into even and odd halves. // */
/* // // */
/* // The results of this stage are implicitly in // */
/* // Q2.5, since we do not explicitly multiply by // */
/* // 0.5. // */
/* // ------------------------------------------------ // */
/* g0 = f0 + f7; // Results in Q2.5 // */
/* g1 = f1 + f6; // Results in Q2.5 // */
/* h1 = f2 + f5; // Results in Q2.5 // */
/* h0 = f3 + f4; // Results in Q2.5 // */
/* g2 = f3 - f4; // Results in Q2.5 // */
/* g3 = f2 - f5; // Results in Q2.5 // */
/* h3 = f1 - f6; // Results in Q2.5 // */
/* h2 = f0 - f7; // Results in Q2.5 // */
/* */
/* // ------------------------------------------------ // */
/* // Stage 2 // */
/* // // */
/* // Note, on the odd-half, the results are in Q3 // */
/* // since those values are scaled upwards by // */
/* // sqrt(2) at this point. The order of operations // */
/* // differs in this pass as compared to the first // */
/* // due to overflow concerns. // */
/* // // */
/* // We also inject a rounding term into the DC // */
/* // term which will also round the Nyquist term, // */
/* // F4. This trick works despite the fact that we // */
/* // are technically still at Q2.5 here, since // */
/* // the step from Q2.5 to Q3 later is done // */
/* // implicitly, rather than with a multiply. (This // */
/* // is due to the sqrt(2) terms cancelling on the // */
/* // P0/P1 butterfly.) // */
/* // ------------------------------------------------ // */
/* p0 = g0 + h0 + 4; // Results in Q2.5 // */
/* p1 = g1 + h1; // Results in Q2.5 // */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -