Mercurial > libavcodec.hg
diff simple_idct.c @ 1008:fb6cbb8a04a3 libavcodec
fixing DCTELEM != short
author | michaelni |
---|---|
date | Wed, 15 Jan 2003 19:21:21 +0000 |
parents | caa77cd960c0 |
children | b32afefe7d33 |
line wrap: on
line diff
--- a/simple_idct.c Wed Jan 15 18:05:23 2003 +0000 +++ b/simple_idct.c Wed Jan 15 19:21:21 2003 +0000 @@ -67,7 +67,7 @@ #endif -static inline void idctRowCondDC (int16_t * row) +static inline void idctRowCondDC (DCTELEM * row) { int a0, a1, a2, a3, b0, b1, b2, b3; #ifdef FAST_64BIT @@ -82,26 +82,40 @@ #else #define ROW0_MASK 0xffffLL #endif - if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) | - ((uint64_t *)row)[1]) == 0) { - temp = (row[0] << 3) & 0xffff; - temp += temp << 16; - temp += temp << 32; - ((uint64_t *)row)[0] = temp; - ((uint64_t *)row)[1] = temp; - return; - } + if(sizeof(DCTELEM)==2){ + if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) | + ((uint64_t *)row)[1]) == 0) { + temp = (row[0] << 3) & 0xffff; + temp += temp << 16; + temp += temp << 32; + ((uint64_t *)row)[0] = temp; + ((uint64_t *)row)[1] = temp; + return; + } + }else{ + if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) { + row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3; + return; + } + } #else - if (!(((uint32_t*)row)[1] | - ((uint32_t*)row)[2] | - ((uint32_t*)row)[3] | - row[1])) { - temp = (row[0] << 3) & 0xffff; - temp += temp << 16; - ((uint32_t*)row)[0]=((uint32_t*)row)[1] = - ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp; - return; - } + if(sizeof(DCTELEM)==2){ + if (!(((uint32_t*)row)[1] | + ((uint32_t*)row)[2] | + ((uint32_t*)row)[3] | + row[1])) { + temp = (row[0] << 3) & 0xffff; + temp += temp << 16; + ((uint32_t*)row)[0]=((uint32_t*)row)[1] = + ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp; + return; + } + }else{ + if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) { + row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3; + return; + } + } #endif a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1)); @@ -159,7 +173,7 @@ } static inline void idctSparseColPut (UINT8 *dest, int line_size, - int16_t * col) + DCTELEM * col) { int a0, a1, a2, a3, b0, b1, b2, b3; UINT8 *cm = cropTbl + MAX_NEG_CROP; @@ -231,7 +245,7 @@ } static inline void idctSparseColAdd (UINT8 *dest, int line_size, - int16_t * col) + DCTELEM * col) { int a0, a1, a2, a3, b0, b1, b2, b3; UINT8 *cm = cropTbl + MAX_NEG_CROP; @@ -302,7 +316,7 @@ dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)]; } -static inline void idctSparseCol (int16_t * col) +static inline void idctSparseCol (DCTELEM * col) { int a0, a1, a2, a3, b0, b1, b2, b3; @@ -365,7 +379,7 @@ col[56] = ((a0 - b0) >> COL_SHIFT); } -void simple_idct_put(UINT8 *dest, int line_size, INT16 *block) +void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block) { int i; for(i=0; i<8; i++) @@ -375,7 +389,7 @@ idctSparseColPut(dest + i, line_size, block + i); } -void simple_idct_add(UINT8 *dest, int line_size, INT16 *block) +void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block) { int i; for(i=0; i<8; i++) @@ -385,7 +399,7 @@ idctSparseColAdd(dest + i, line_size, block + i); } -void simple_idct(INT16 *block) +void simple_idct(DCTELEM *block) { int i; for(i=0; i<8; i++) @@ -406,7 +420,7 @@ and the butterfly must be multiplied by 0.5 * sqrt(2.0) */ #define C_SHIFT (4+1+12) -static inline void idct4col(UINT8 *dest, int line_size, const INT16 *col) +static inline void idct4col(UINT8 *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; const UINT8 *cm = cropTbl + MAX_NEG_CROP; @@ -443,10 +457,10 @@ /* XXX: I think a 1.0/sqrt(2) normalization should be needed to compensate the extra butterfly stage - I don't have the full DV specification */ -void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block) +void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block) { int i; - INT16 *ptr; + DCTELEM *ptr; /* butterfly */ ptr = block; @@ -486,7 +500,7 @@ #define C2 C_FIX(0.2705980501) #define C3 C_FIX(0.5) #define C_SHIFT (4+1+12) -static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col) +static inline void idct4col_add(UINT8 *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; const UINT8 *cm = cropTbl + MAX_NEG_CROP; @@ -514,7 +528,7 @@ #define R2 R_FIX(0.2705980501) #define R3 R_FIX(0.5) #define R_SHIFT 11 -static inline void idct4row(INT16 *row) +static inline void idct4row(DCTELEM *row) { int c0, c1, c2, c3, a0, a1, a2, a3; const UINT8 *cm = cropTbl + MAX_NEG_CROP; @@ -533,7 +547,7 @@ row[3]= (c0 - c1) >> R_SHIFT; } -void simple_idct84_add(UINT8 *dest, int line_size, INT16 *block) +void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block) { int i; @@ -548,7 +562,7 @@ } } -void simple_idct48_add(UINT8 *dest, int line_size, INT16 *block) +void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block) { int i;