diff options
Diffstat (limited to 'psxdev/idctfst.c')
-rw-r--r-- | psxdev/idctfst.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/psxdev/idctfst.c b/psxdev/idctfst.c index 22faae6..345cdb1 100644 --- a/psxdev/idctfst.c +++ b/psxdev/idctfst.c @@ -59,7 +59,7 @@ * machines, and may also reduce the cost of multiplication (since there * are fewer one-bits in the constants). */ -
+ #define BITS_IN_JSAMPLE 8 #if BITS_IN_JSAMPLE == 8 @@ -108,7 +108,7 @@ * multiplication will do. For 12-bit data, the multiplier table is * declared INT32, so a 32-bit multiply will be used. */ -
+ #if BITS_IN_JSAMPLE == 8 #define DEQUANTIZE(coef,quantval) (coef) #else @@ -121,24 +121,24 @@ * We assume that int right shift is unsigned if INT32 right shift is. */ -#define DESCALE(x,n) ((x)>>(n))
+#define DESCALE(x,n) ((x)>>(n)) #define RANGE(n) (n) -#define BLOCK int
+#define BLOCK int /* * Perform dequantization and inverse DCT on one block of coefficients. */ -#define DCTSIZE 8
-#define DCTSIZE2 64
-
-static void IDCT1(BLOCK *block)
-{
+#define DCTSIZE 8 +#define DCTSIZE2 64 + +static void IDCT1(BLOCK *block) +{ int val = RANGE(DESCALE(block[0], PASS1_BITS+3)); - int i;
- for(i=0;i<DCTSIZE2;i++) block[i]=val;
-}
-
-void IDCT(BLOCK *block,int k)
+ int i; + for(i=0;i<DCTSIZE2;i++) block[i]=val; +} + +void IDCT(BLOCK *block,int k) { int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int z5, z10, z11, z12, z13; @@ -146,9 +146,9 @@ void IDCT(BLOCK *block,int k) int i; /* Pass 1: process columns from input, store into work array. */ - switch(k){
- case 1:IDCT1(block); return;
- }
+ switch(k){ + case 1:IDCT1(block); return; + } ptr = block; for (i = 0; i< DCTSIZE; i++,ptr++) { @@ -197,7 +197,7 @@ void IDCT(BLOCK *block,int k) z11 = ptr[DCTSIZE*1] + ptr[DCTSIZE*7]; z12 = ptr[DCTSIZE*1] - ptr[DCTSIZE*7]; - z5 = MULTIPLY(z12 - z10, FIX_1_847759065);
+ z5 = MULTIPLY(z12 - z10, FIX_1_847759065); tmp7 = z11 + z13; /* phase 5 */ tmp6 = MULTIPLY(z10, FIX_2_613125930) + z5 - tmp7; /* phase 2 */ tmp5 = MULTIPLY(z11 - z13, FIX_1_414213562) - tmp6; @@ -232,14 +232,14 @@ void IDCT(BLOCK *block,int k) if ((ptr[1] | ptr[2] | ptr[3] | ptr[4] | ptr[5] | ptr[6] | ptr[7]) == 0) { /* AC terms all zero */ - ptr[0] =
- ptr[1] =
- ptr[2] =
- ptr[3] =
- ptr[4] =
- ptr[5] =
- ptr[6] =
- ptr[7] =
+ ptr[0] = + ptr[1] = + ptr[2] = + ptr[3] = + ptr[4] = + ptr[5] = + ptr[6] = + ptr[7] = RANGE(DESCALE(ptr[0], PASS1_BITS+3));; continue; @@ -247,7 +247,7 @@ void IDCT(BLOCK *block,int k) #endif /* Even part */ -
+ z10 = ptr[0] + ptr[4]; z11 = ptr[0] - ptr[4]; z13 = ptr[2] + ptr[6]; @@ -265,7 +265,7 @@ void IDCT(BLOCK *block,int k) z11 = ptr[1] + ptr[7]; z12 = ptr[1] - ptr[7]; - z5 = MULTIPLY(z12 - z10, FIX_1_847759065);
+ z5 = MULTIPLY(z12 - z10, FIX_1_847759065); tmp7 = z11 + z13; /* phase 5 */ tmp6 = MULTIPLY(z10, FIX_2_613125930) + z5 - tmp7; /* phase 2 */ tmp5 = MULTIPLY(z11 - z13, FIX_1_414213562) - tmp6; |