--- xvid_bench.c 2002/07/10 13:23:29 1.4 +++ 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.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 */ @@ -199,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]; @@ -228,7 +248,7 @@ t = gettime_usec(); emms(); - for(tst=0; tstname, t, s ); @@ -236,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