--- trunk/xvidcore/examples/xvid_bench.c 2006/10/30 10:52:00 1742 +++ trunk/xvidcore/examples/xvid_bench.c 2008/11/14 15:43:28 1794 @@ -19,7 +19,7 @@ * 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.32 2006-10-30 10:52:00 Skal Exp $ + * $Id: xvid_bench.c,v 1.36 2008-11-14 15:43:27 Isibaar Exp $ * ****************************************************************************/ @@ -58,6 +58,7 @@ #include "utils/timer.h" #include "quant/quant_matrix.c" #include "bitstream/cbp.h" +#include "bitstream/bitstream.h" #include @@ -118,7 +119,9 @@ { "MMX ", XVID_CPU_MMX }, { "MMXEXT ", XVID_CPU_MMXEXT | XVID_CPU_MMX }, { "SSE2 ", XVID_CPU_SSE2 | XVID_CPU_MMX }, - { "3DNOW ", XVID_CPU_3DNOW }, + { "SSE3 ", XVID_CPU_SSE3 | XVID_CPU_SSE2 | XVID_CPU_MMX }, + { "SSE41 ", XVID_CPU_SSE41| XVID_CPU_SSE3 | XVID_CPU_SSE2 | XVID_CPU_MMX }, + { "3DNOW ", XVID_CPU_3DNOW }, { "3DNOWE ", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT }, #endif #ifdef ARCH_IS_PPC @@ -1932,7 +1935,7 @@ void test_gcd() { - const int nb_tests = 10*speed_ref; + const int nb_tests = 10*speed_ref; int i; uint32_t crc1=0, crc2=0; uint32_t n0, n, d0, d; @@ -2009,6 +2012,7 @@ printf( "ERROR! please post your platform/compiler specs to xvid-devel@xvid.org !\n" ); } } + /********************************************************************* * test SSIM functions *********************************************************************/ @@ -2019,7 +2023,7 @@ extern int lum_8x8_c(uint8_t* ptr, int stride); extern int lum_8x8_mmx(uint8_t* ptr, int stride); extern int lum_2x8_c(uint8_t* ptr, int stride); -extern void iconsim_c(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr); +extern void consim_c(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr); extern void consim_mmx(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr); extern void consim_sse2(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr); @@ -2057,7 +2061,8 @@ continue; lum8x8 = lum_8x8_c; lum2x8 = lum_2x8_c; - csim = iconsim_c; + csim = consim_c; +#ifdef ARCH_IS_IA32 if (cpu->cpu & XVID_CPU_MMX){ lum8x8 = lum_8x8_mmx; csim = consim_mmx; @@ -2065,7 +2070,7 @@ if (cpu->cpu & XVID_CPU_MMX){ csim = consim_sse2; } - +#endif t = gettime_usec(); emms(); for(tst=0; tstname, t, devs[0], devs[1], devs[2], - (devs[0]!=0xeba80 || devs[1]!=0x1053e7 || devs[2]!=0x51215)?"| ERROR": "" ); - + (devs[0]!=0x1bdf0f || devs[1]!=0x137258 || devs[2]!=0xcdb13)?"| ERROR": "" ); printf( " --- \n" ); } } /********************************************************************* + * test bitstream functions + *********************************************************************/ + +#define BIT_BUF_SIZE 2000 + +static void test_bits() +{ + const int nb_tests = 50*speed_ref; + int tst; + uint32_t Crc; + uint8_t Buf[BIT_BUF_SIZE]; + uint32_t Extracted[BIT_BUF_SIZE*8]; /* worst case: bits read 1 by 1 */ + int Lens[BIT_BUF_SIZE*8]; + double t1; + + + printf( "\n === test bitstream ===\n" ); + ieee_reseed(1); + Crc = 0; + + t1 = gettime_usec(); + for(tst=0; tst0; m++) { + const int b = ieee_rand(1,32); + Lens[m] = b; + l2 -= b; + if (l2<0) break; + Extracted[m] = BitstreamShowBits(&bs, b); + BitstreamSkip(&bs, b); +// printf( "<= %d: %d 0x%x\n", m, b, Extracted[m]); + } + + BitstreamReset(&bs); + for(m2=0; m2 %d: %d 0x%x %c\n", m2, b, v, " *"[Crc]); + } + } + t1 = (gettime_usec() - t1) / nb_tests; + printf(" test_bits %.3f usec %s\n", t1, (Crc!=0)?"| ERROR": "" ); +} + +/********************************************************************* * main *********************************************************************/ @@ -2112,7 +2172,7 @@ int c, what = 0; int width, height; uint32_t chksum = 0; - const char * test_bitstream = 0; + const char * test_bitstream = 0; cpu_mask = 0; // default => will use autodectect for(c=1; c