--- trunk/xvidcore/examples/xvid_bench.c 2003/02/09 19:32:52 824 +++ branches/dev-api-4/xvidcore/examples/xvid_bench.c 2003/06/09 01:25:19 1053 @@ -35,17 +35,19 @@ #include #include -#ifdef WIN32 -#include /* for clock */ -#else -#include /* for gettimeofday */ -#endif #include /* for memset */ #include +#ifndef WIN32 +#include /* for gettimeofday */ +#else +#include +#endif + + #include "xvid.h" -/* inner guts */ +// inner guts #include "dct/idct.h" #include "dct/fdct.h" #include "image/colorspace.h" @@ -60,10 +62,11 @@ #include "bitstream/cbp.h" #include + #ifndef M_PI -# define M_PI 3.14159265359 -# define M_PI_2 1.5707963268 +#define M_PI 3.14159265358979323846 #endif + const int speed_ref = 100; /* on slow machines, decrease this value */ /********************************************************************* @@ -73,12 +76,14 @@ /* returns time in micro-s*/ double gettime_usec() { -#ifdef WIN32 - return clock()*1000; -#else +#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 } @@ -115,13 +120,13 @@ , { "3DNOW ", XVID_CPU_3DNOW } , { "3DNOWE", XVID_CPU_3DNOWEXT } , { "IA64 ", XVID_CPU_IA64 } -/*, { "TSC ", XVID_CPU_TSC } */ +//, { "TSC ", XVID_CPU_TSC } , { 0, 0 } } , cpu_short_list[] = { { "PLAINC", 0 } , { "MMX ", XVID_CPU_MMX } -/*, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } */ +//, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } , { "IA64 ", XVID_CPU_IA64 } , { 0, 0 } } @@ -139,7 +144,7 @@ cpu_type = check_cpu_features() & cpu->cpu; xinit.cpu_flags = cpu_type | XVID_CPU_FORCE; - /* xinit.cpu_flags = XVID_CPU_MMX | XVID_CPU_FORCE; */ + /* xinit.cpu_flags = XVID_CPU_MMX | XVID_CPU_FORCE; */ xerr = xvid_init(NULL, 0, &xinit, NULL); if (cpu->cpu>0 && (cpu_type==0 || xerr!=XVID_ERR_OK)) { printf( "%s - skipped...\n", cpu->name ); @@ -469,8 +474,8 @@ TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2); printf( "%s - 8to16sub2 %.3f usec crc=%d\n", cpu->name, t, s ); if (s!=20384) printf( "*** CRC ERROR! ***\n" ); -/* for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]); */ -/* printf("\n"); */ +// for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]); +// printf("\n"); #endif printf( " --- \n" ); } @@ -767,7 +772,7 @@ } } -/*//////////////////////////////////////////////////////// */ +///* ////////////////////////////////////////////////////// */ /* Pseudo-random generator specified by IEEE 1180 */ static long ieee_seed = 1; @@ -910,7 +915,7 @@ printf( "\n -- FDCT report --\n" ); -/* print_stats(&FStats); */ +// print_stats(&FStats); report_stats(&FStats, 0); /* so far I know, IEEE1180 says nothing for fdct */ for(i=0; i<64; i++) Blk[i] = 0; @@ -919,7 +924,7 @@ printf( "FDCT(0) == 0 ? %s\n", (m!=0) ? "NOPE!" : "yup." ); printf( "\n -- IDCT report --\n" ); -/* print_stats(&IStats); */ +// print_stats(&IStats); report_stats(&IStats, ILimits); @@ -937,9 +942,9 @@ int i, n, p; CPU *cpu; -/* const short IDCT_MAX = 2047; // 12bits input */ -/* const short IDCT_MIN = -2048; */ -/* const short IDCT_OUT = 256; // 9bits ouput */ +// const short IDCT_MAX = 2047; /* 12bits input */ +// const short IDCT_MIN = -2048; +// const short IDCT_OUT = 256; /* 9bits ouput */ const int Partitions = 4; const int Loops = 10000 / Partitions; @@ -987,7 +992,7 @@ report_stats(&Stats, 0); - /* IDCT tests */ + /* IDCT tests // */ #if 0 /* no finished yet */