AAN algorithm C language example

zhaozj2021-02-11  169

Static int Spresc [64] = {16384, 22725, 21407, 19266, 16384, 128725, 31521, 29692, 2672, 22725, 17855, 122992, 27969, 25172, 21407, 16819, 11585, 5906, 19266, 26722, 25172, 22654, 1926, 15137, 10426, 5315, 16384, 22725, 21407, 19266, 16384, 12873, 17855, 16819, 15137, 25746, 20228, 13933, 7103, 17734, 24598, 23170, 20853, 17734, 13933, 9597, 4892, 18081, 25080, 23624, 21268, 18081, 14206, 9785, 4988};

/ * Use this table to multiply the block [J] in the decode_macroblock stage; after Multiply, Shift To Right 13 Bits; (17-4)

* /

#define c2 30274 // 2 COS (PI / 8) 1.84776 # Define C4 23171 // SQRT (2) 1.41421 #define C6 12540 // 2 sin (pi / 8) 0.76537 # define C6pc2 42814 file: // C6 C2 2.61313 # Define C6SC2 (-17734) // -1.08239 # Define RC0 14 # Define RC1 18 # Define Round (1 << (RC1-1))

// DO 80 Times of Multiply; FastIDCT: 176;

#define idct_unit (a, b) {x4 = x5 - x3; / t1 = x5 x3; / x3 = (x2 x6) << rc0; / x2 = (x2-x6) * C4-x3; / t0 = X1 X7; / x6 = x1 - x7; / x7 = (t0 t1) << RC0; / X5 = (T0 - T0 - T1) * C4; / t0 = c6 * (x4 x6); / x4 = C6SC2 * X4-T0; / X6 = C6PC2 * X6-T0; / T0 = x6-x7; / x1 = (ab) << RC0; / T1 = T0-X5; / X6 = (A B) << RC0; / X0 = x4-T1; / x4 = x3 x6; / x6- = x3; / x3 = x1 x2; / x5 = x1-x2;} static void IDCTAAN_C (Short * block) {INT X0, X1, X2, X3, X4, X5, X6, X7; INT T0, T1; Short * BLK; // Field One BLK = Block; for (INT I = 0; I <8; I ) {IF (! ((x 1 = BLK [1]) | (x2 = BLK [2]) | (x4 = BLK [4]) | (x5 = BLK [5]) | (x6 = BLK [6 ]) | (X7 = BLK [7])))) {// BLK [0] = BLK [1] = BLK [2] = BLK [3] = BLK [4] = BLK [5] = BLK [6] = BLK [7] = (BLK [0]);} else {

IDCT_UNIT (BLK [0], BLK [4])

BLK [0] = (x4 x7) >> RC0; BLK [7] = (x4-x7) >> RC0; BLK [1] = (x3 t0) >> RC0; BLK [6] = (x3- T0) >> RC0; BLK [2] = (X5-T1) >> RC0; BLK [5] = (x5 T1) >> RC0; BLK [3] = (x6-x0) >> RC0; BLK [ 4] = (x6 x0) >> RC0;} BLK = 8;} file: // field two blk = block; for (i = 0; i <8; i ) {if (! (((X1 = blk [ 8]) | (x2 = BLK [16]) | (x4 = BLK [32]) | (x5 = BLK [40]) | (x6 = BLK [48]) | x7 = BLK [56])) {BLK [0] = BLK [8] = BLK [16] = BLK [24] = BLK [32] = BLK [40] = BLK [48] = BLK [56] = ICLP [BLK [0] >> 4];} else {IDCT_UNIT (BLK [0 * 8], BLK [4 * 8])

BLK [0 * 8] = ICLP [(X4 X7 ROUND) >> RC1]; BLK [7 * 8] = ICLP [(X4-x7 round) >> RC1]; BLK [1 * 8] = ICLP [(X3 T0 ROUND) >> RC1]; BLK [6 * 8] = ICLP [(X3-T0 ROUND) >> RC1]; BLK [2 * 8] = ICLP [(X5-T1 ROUND) >> RC1]; BLK [5 * 8] = ICLP [(X5 T1 ROUND) >> RC1]; BLK [3 * 8] = ICLP [(X6-X0 Round) >> RC1]; BLK [4 * 8] = ICLP [(x6 x0 round) >> rc1];} BLK ;}}

转载请注明原文地址:https://www.9cbs.com/read-5520.html

New Post(0)