Commit aed45b88 authored by michaelni's avatar michaelni

dct-test update

 test simple-idct and ijg int DCT too
 do tests with random & sparse matrixes
 print systematic error matrixes


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@892 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 83a9f933
...@@ -131,8 +131,8 @@ cpuid_test: i386/cputest.c ...@@ -131,8 +131,8 @@ cpuid_test: i386/cputest.c
imgresample-test: imgresample.c imgresample-test: imgresample.c
$(CC) $(CFLAGS) -DTEST -o $@ $^ $(CC) $(CFLAGS) -DTEST -o $@ $^
dct-test: dct-test.o jfdctfst.o i386/fdct_mmx.o \ dct-test: dct-test.o jfdctfst.o jfdctint.o i386/fdct_mmx.o\
fdctref.o jrevdct.o i386/idct_mmx.o fdctref.o jrevdct.o i386/idct_mmx.o simple_idct.o i386/simple_idct_mmx.o
$(CC) -o $@ $^ -lm $(CC) -o $@ $^ -lm
motion-test: motion_test.o $(LIB) motion-test: motion_test.o $(LIB)
......
This diff is collapsed.
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "dsputil.h" #include "dsputil.h"
#include "simple_idct.h" #include "simple_idct.h"
//#define ARCH_ALPHA
#if 0 #if 0
#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
...@@ -83,10 +85,13 @@ static inline int idctRowCondDC(int16_t *row) ...@@ -83,10 +85,13 @@ static inline int idctRowCondDC(int16_t *row)
return 0; return 0;
if ((lrow[0] & ~0xffffULL) == 0) { if ((lrow[0] & ~0xffffULL) == 0) {
uint64_t v; uint64_t v;
#if 1 //is ok if |a0| < 1024 than theres an +-1 error (for the *W4 case for W4=16383 !!!)
a0 = row[0]<<3;
#else
a0 = W4 * row[0]; a0 = W4 * row[0];
a0 += 1 << (ROW_SHIFT - 1); a0 += 1 << (ROW_SHIFT - 1);
a0 >>= ROW_SHIFT; a0 >>= ROW_SHIFT;
#endif
v = (uint16_t) a0; v = (uint16_t) a0;
v += v << 16; v += v << 16;
v += v << 32; v += v << 32;
...@@ -478,6 +483,71 @@ static inline void idctSparseColAdd (UINT8 *dest, int line_size, ...@@ -478,6 +483,71 @@ static inline void idctSparseColAdd (UINT8 *dest, int line_size,
dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)]; dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
} }
static inline void idctSparseCol (int16_t * col)
{
int a0, a1, a2, a3, b0, b1, b2, b3;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
/* XXX: I did that only to give same values as previous code */
a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
a1 = a0;
a2 = a0;
a3 = a0;
a0 += + W2*col[8*2];
a1 += + W6*col[8*2];
a2 += - W6*col[8*2];
a3 += - W2*col[8*2];
MUL16(b0, W1, col[8*1]);
MUL16(b1, W3, col[8*1]);
MUL16(b2, W5, col[8*1]);
MUL16(b3, W7, col[8*1]);
MAC16(b0, + W3, col[8*3]);
MAC16(b1, - W7, col[8*3]);
MAC16(b2, - W1, col[8*3]);
MAC16(b3, - W5, col[8*3]);
if(col[8*4]){
a0 += + W4*col[8*4];
a1 += - W4*col[8*4];
a2 += - W4*col[8*4];
a3 += + W4*col[8*4];
}
if (col[8*5]) {
MAC16(b0, + W5, col[8*5]);
MAC16(b1, - W1, col[8*5]);
MAC16(b2, + W7, col[8*5]);
MAC16(b3, + W3, col[8*5]);
}
if(col[8*6]){
a0 += + W6*col[8*6];
a1 += - W2*col[8*6];
a2 += + W2*col[8*6];
a3 += - W6*col[8*6];
}
if (col[8*7]) {
MAC16(b0, + W7, col[8*7]);
MAC16(b1, - W5, col[8*7]);
MAC16(b2, + W3, col[8*7]);
MAC16(b3, - W1, col[8*7]);
}
col[0 ] = ((a0 + b0) >> COL_SHIFT);
col[8 ] = ((a1 + b1) >> COL_SHIFT);
col[16] = ((a2 + b2) >> COL_SHIFT);
col[24] = ((a3 + b3) >> COL_SHIFT);
col[32] = ((a3 - b3) >> COL_SHIFT);
col[40] = ((a2 - b2) >> COL_SHIFT);
col[48] = ((a1 - b1) >> COL_SHIFT);
col[56] = ((a0 - b0) >> COL_SHIFT);
}
#ifdef ARCH_ALPHA #ifdef ARCH_ALPHA
/* If all rows but the first one are zero after row transformation, /* If all rows but the first one are zero after row transformation,
all rows will be identical after column transformation. */ all rows will be identical after column transformation. */
...@@ -578,6 +648,16 @@ void simple_idct_add(UINT8 *dest, int line_size, INT16 *block) ...@@ -578,6 +648,16 @@ void simple_idct_add(UINT8 *dest, int line_size, INT16 *block)
idctSparseColAdd(dest + i, line_size, block + i); idctSparseColAdd(dest + i, line_size, block + i);
} }
void simple_idct(INT16 *block)
{
int i;
for(i=0; i<8; i++)
idctRowCondDC(block + i*8);
for(i=0; i<8; i++)
idctSparseCol(block + i);
}
#endif #endif
#undef COL_SHIFT #undef COL_SHIFT
...@@ -21,3 +21,4 @@ ...@@ -21,3 +21,4 @@
void simple_idct_put(UINT8 *dest, int line_size, INT16 *block); void simple_idct_put(UINT8 *dest, int line_size, INT16 *block);
void simple_idct_add(UINT8 *dest, int line_size, INT16 *block); void simple_idct_add(UINT8 *dest, int line_size, INT16 *block);
void simple_idct_mmx(short *block); void simple_idct_mmx(short *block);
void simple_idct(short *block);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment