summaryrefslogtreecommitdiff
path: root/libavcodec/simple_idct.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-01-15 19:21:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-01-15 19:21:21 +0000
commit0e15384d9d154a1e4c5bc3a8d0f0e4618b6b5628 (patch)
treec1041c65ed3c9afd5c23e5d48f998fe2a33be197 /libavcodec/simple_idct.c
parent3a87ac948f0cd95218e62d5a98b8b8d5e4c11366 (diff)
fixing DCTELEM != short
Originally committed as revision 1462 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/simple_idct.c')
-rw-r--r--libavcodec/simple_idct.c80
1 files changed, 47 insertions, 33 deletions
diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
index 8c9ce7b936..703e94f213 100644
--- a/libavcodec/simple_idct.c
+++ b/libavcodec/simple_idct.c
@@ -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 @@ static inline void idctRowCondDC (int16_t * row)
#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 idctRowCondDC (int16_t * row)
}
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 idctSparseColPut (UINT8 *dest, int line_size,
}
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 @@ static inline void idctSparseColAdd (UINT8 *dest, int line_size,
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 @@ static inline void idctSparseCol (int16_t * col)
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 @@ void simple_idct_put(UINT8 *dest, int line_size, INT16 *block)
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 @@ void simple_idct_add(UINT8 *dest, int line_size, INT16 *block)
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 @@ void simple_idct(INT16 *block)
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 @@ static inline void idct4col(UINT8 *dest, int line_size, const INT16 *col)
/* 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 @@ void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block)
#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 @@ static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col)
#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 @@ static inline void idct4row(INT16 *row)
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_idct84_add(UINT8 *dest, int line_size, INT16 *block)
}
}
-void simple_idct48_add(UINT8 *dest, int line_size, INT16 *block)
+void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block)
{
int i;