--- xvid_bench.c 2003/02/09 19:32:52 1.7 +++ xvid_bench.c 2003/06/09 13:49:00 1.9.2.2 @@ -1,24 +1,29 @@ -/************************************************************************** +/***************************************************************************** * - * XVID MPEG-4 VIDEO CODEC - Unit tests and benches + * XVID MPEG-4 VIDEO CODEC + * - Unit tests and benches - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright(C) 2002 Pascal Massimino * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - *************************************************************************/ + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: xvid_bench.c,v 1.9.2.2 2003/06/09 13:49:00 edgomez Exp $ + * + ****************************************************************************/ -/************************************************************************ +/***************************************************************************** * * 'Reference' output is at the end of file. * Don't take the checksums and crc too seriouly, they aren't @@ -27,25 +32,23 @@ * compiles with something like: * gcc -o xvid_bench xvid_bench.c -I../src/ -lxvidcore -lm * - * History: - * - * 06.06.2002 initial coding -Skal- - * - *************************************************************************/ + ****************************************************************************/ #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 +63,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 +77,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 +121,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 +145,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 +475,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 +773,7 @@ } } -/*//////////////////////////////////////////////////////// */ +///* ////////////////////////////////////////////////////// */ /* Pseudo-random generator specified by IEEE 1180 */ static long ieee_seed = 1; @@ -910,7 +916,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 +925,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 +943,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 +993,7 @@ report_stats(&Stats, 0); - /* IDCT tests */ + /* IDCT tests // */ #if 0 /* no finished yet */