--- xvid_bench.c 2003/02/16 05:11:39 1.9 +++ 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,19 +32,15 @@ * compiles with something like: * gcc -o xvid_bench xvid_bench.c -I../src/ -lxvidcore -lm * - * History: - * - * 06.06.2002 initial coding -Skal- - * - *************************************************************************/ + ****************************************************************************/ #include #include -#include // for memset +#include /* for memset */ #include #ifndef WIN32 -#include // for gettimeofday +#include /* for gettimeofday */ #else #include #endif @@ -67,7 +68,7 @@ #define M_PI 3.14159265358979323846 #endif -const int speed_ref = 100; // on slow machines, decrease this value +const int speed_ref = 100; /* on slow machines, decrease this value */ /********************************************************************* * misc @@ -144,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 ); @@ -302,7 +303,7 @@ const int nb_tests = 2000*speed_ref; CPU *cpu; const uint8_t Src0[16*9] = { - // try to have every possible combinaison of rounding... + /* try to have every possible combinaison of rounding... */ 0, 0, 1, 0, 2, 0, 3, 0, 4 ,0,0,0, 0,0,0,0 , 0, 1, 1, 1, 2, 1, 3, 1, 3 ,0,0,0, 0,0,0,0 , 0, 2, 1, 2, 2, 2, 3, 2, 2 ,0,0,0, 0,0,0,0 @@ -352,7 +353,7 @@ if (iCrc!=8103) printf( "*** CRC ERROR! ***\n" ); - // this is a new function, as of 06.06.2002 + /* this is a new function, as of 06.06.2002 */ #if 0 TEST_MB2(interpolate8x8_avrg); printf( "%s - interpolate8x8_c %.3f usec iCrc=%d\n", cpu->name, t, iCrc ); @@ -528,8 +529,8 @@ printf( "\n ===== test quant =====\n" ); - // we deliberately enfringe the norm's specified range [-127,127], - // to test the robustness of the iquant module + /* we deliberately enfringe the norm's specified range [-127,127], */ + /* to test the robustness of the iquant module */ for(i=0; i<64; ++i) { Src[i] = 1 + (i-32) * (i&6); Dst[i] = 0; @@ -616,8 +617,8 @@ printf( "\n ===== test cbp =====\n" ); for(i=0; i<6*64; ++i) { - Src1[i] = (i*i*3/8192)&(i/64)&1; // 'random' - Src2[i] = (i<3*64); // half-full + Src1[i] = (i*i*3/8192)&(i/64)&1; /* 'random' */ + Src2[i] = (i<3*64); /* half-full */ Src3[i] = ((i+32)>3*64); Src4[i] = (i==(3*64+2) || i==(5*64+9)); } @@ -772,7 +773,7 @@ } } -////////////////////////////////////////////////////////// +///* ////////////////////////////////////////////////////// */ /* Pseudo-random generator specified by IEEE 1180 */ static long ieee_seed = 1; @@ -859,13 +860,13 @@ static const double ILimits[5] = { 1., 0.06, 0.02, 0.015, 0.0015 }; int Loops = 10000; int i, m, n; - short Blk0[64]; // reference + short Blk0[64]; /* reference */ short Blk[64], iBlk[64]; short Ref_FDCT[64]; short Ref_IDCT[64]; - STATS_8x8 FStats; // forward dct stats - STATS_8x8 IStats; // inverse dct stats + STATS_8x8 FStats; /* forward dct stats */ + STATS_8x8 IStats; /* inverse dct stats */ CPU *cpu; @@ -888,8 +889,8 @@ for(i=0; i<64; ++i) Blk0[i] = (short)ieee_rand(Min,Max) * Sign; - // hmm, I'm not quite sure this is exactly - // the tests described in the norm. check... + /* hmm, I'm not quite sure this is exactly */ + /* the tests described in the norm. check... */ memcpy(Ref_FDCT, Blk0, 64*sizeof(short)); ref_fdct(Ref_FDCT); @@ -916,7 +917,7 @@ printf( "\n -- FDCT report --\n" ); // print_stats(&FStats); - report_stats(&FStats, 0); // so far I know, IEEE1180 says nothing for fdct + report_stats(&FStats, 0); /* so far I know, IEEE1180 says nothing for fdct */ for(i=0; i<64; i++) Blk[i] = 0; emms(); fdct(Blk); emms(); @@ -938,13 +939,13 @@ void test_dct_saturation(int Min, int Max) { - // test behaviour on input range fringe + /* test behaviour on input range fringe */ int i, n, p; CPU *cpu; -// const short IDCT_MAX = 2047; // 12bits input +// const short IDCT_MAX = 2047; /* 12bits input */ // const short IDCT_MIN = -2048; -// const short IDCT_OUT = 256; // 9bits ouput +// const short IDCT_OUT = 256; /* 9bits ouput */ const int Partitions = 4; const int Loops = 10000 / Partitions; @@ -961,11 +962,11 @@ printf( "\n===== IEEE test for %s Min=%d Max=%d =====\n", cpu->name, Min, Max ); - // FDCT tests // + /* FDCT tests // */ init_stats(&Stats); - // test each computation channels separately + /* test each computation channels separately */ for(i=0; i<64; i++) Blk[i] = Blk0[i] = ((i/8)==(i%8)) ? Max : 0; ref_fdct(Blk0); emms(); fdct(Blk); emms(); @@ -976,7 +977,7 @@ emms(); fdct(Blk); emms(); store_stats(&Stats, Blk, Blk0); - // randomly saturated inputs + /* randomly saturated inputs */ for(p=0; p