--- xvid_bench.c 2002/07/07 09:42:41 1.3 +++ xvid_bench.c 2003/02/26 19:05:20 1.10 @@ -24,21 +24,30 @@ * Don't take the checksums and crc too seriouly, they aren't * bullet-proof (should plug some .md5 here)... * - * compiles with something like: - * gcc -o xvid_bench xvid_bench.c -I../src/ -lxvidcore -lm + * compiles best at xvidcore/src-dir with something like + * + * gcc -DARCH_IS_IA32 -DARCH_IS_32BIT -o xvid_bench xvid_bench.c \ + * ../build/generic/libxvidcore.a -lm * * History: * * 06.06.2002 initial coding -Skal- + * 27.02.2003 minor changes (compile, sad16v) * *************************************************************************/ #include #include -#include // for gettimeofday #include // for memset #include +#ifndef WIN32 +#include // for gettimeofday +#else +#include +#endif + + #include "xvid.h" // inner guts @@ -56,6 +65,11 @@ #include "bitstream/cbp.h" #include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + const int speed_ref = 100; // on slow machines, decrease this value /********************************************************************* @@ -65,9 +79,15 @@ /* returns time in micro-s*/ double gettime_usec() { +#ifndef WIN32 struct timeval tv; gettimeofday(&tv, 0); - return tv.tv_sec*1.0e6f + tv.tv_usec; + return tv.tv_sec*1.0e6 + tv.tv_usec; +#else + clock_t clk; + clk = clock(); + return clk * 1000000 / CLOCKS_PER_SEC; +#endif } /* returns squared deviates (mean(v*v)-mean(v)^2) of a 8x8 block */ @@ -102,6 +122,7 @@ , { "SSE2 ", XVID_CPU_SSE2 | XVID_CPU_MMX } , { "3DNOW ", XVID_CPU_3DNOW } , { "3DNOWE", XVID_CPU_3DNOWEXT } +, { "IA64 ", XVID_CPU_IA64 } //, { "TSC ", XVID_CPU_TSC } , { 0, 0 } } @@ -109,6 +130,7 @@ { { "PLAINC", 0 } , { "MMX ", XVID_CPU_MMX } //, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } +, { "IA64 ", XVID_CPU_IA64 } , { 0, 0 } } , cpu_short_list2[] = @@ -197,7 +219,7 @@ void test_sad() { const int nb_tests = 2000*speed_ref; - int tst; + int tst,dummy[4]; CPU *cpu; int i; uint8_t Cur[16*16], Ref1[16*16], Ref2[16*16]; @@ -226,7 +248,7 @@ t = gettime_usec(); emms(); - for(tst=0; tstname, t, s ); @@ -234,6 +256,14 @@ t = gettime_usec(); emms(); + for(tst=0; tstname, t, s ); + if (s!=27214) printf( "*** CRC ERROR! ***\n" ); + + t = gettime_usec(); + emms(); for(tst=0; tst