[svn] / branches / dev-api-4 / xvidcore / examples / xvid_bench.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/examples/xvid_bench.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/xvidcore/examples/xvid_bench.c revision 684, Wed Nov 27 21:09:10 2002 UTC branches/dev-api-4/xvidcore/examples/xvid_bench.c revision 1054, Mon Jun 9 13:55:56 2003 UTC
# Line 1  Line 1 
1  /**************************************************************************  /*****************************************************************************
2   *   *
3   *      XVID MPEG-4 VIDEO CODEC - Unit tests and benches   *  XVID MPEG-4 VIDEO CODEC
4     *  - Unit tests and benches -
5     *
6     *  Copyright(C) 2002 Pascal Massimino <skal@planet-d.net>
7   *   *
8   *      This program is free software; you can redistribute it and/or modify   *      This program is free software; you can redistribute it and/or modify
9   *      it under the terms of the GNU General Public License as published by   *      it under the terms of the GNU General Public License as published by
# Line 14  Line 17 
17   *   *
18   *      You should have received a copy of the GNU General Public License   *      You should have received a copy of the GNU General Public License
19   *      along with this program; if not, write to the Free Software   *      along with this program; if not, write to the Free Software
20   *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21     *
22     * $Id: xvid_bench.c,v 1.9.2.2 2003-06-09 13:49:00 edgomez Exp $
23   *   *
24   *************************************************************************/   ****************************************************************************/
25    
26  /************************************************************************  /*****************************************************************************
27   *   *
28   *  'Reference' output is at the end of file.   *  'Reference' output is at the end of file.
29   *  Don't take the checksums and crc too seriouly, they aren't   *  Don't take the checksums and crc too seriouly, they aren't
# Line 27  Line 32 
32   *   compiles with something like:   *   compiles with something like:
33   *   gcc -o xvid_bench xvid_bench.c  -I../src/ -lxvidcore -lm   *   gcc -o xvid_bench xvid_bench.c  -I../src/ -lxvidcore -lm
34   *   *
35   *      History:   ****************************************************************************/
  *  
  *      06.06.2002  initial coding      -Skal-  
  *  
  *************************************************************************/  
36    
37  #include <stdio.h>  #include <stdio.h>
38  #include <stdlib.h>  #include <stdlib.h>
 #ifdef  WIN32  
 #include <time.h>  /* for clock */  
 #else  
 #include <sys/time.h>  /* for gettimeofday */  
 #endif  
39  #include <string.h>    /* for memset */  #include <string.h>    /* for memset */
40  #include <assert.h>  #include <assert.h>
41    
42    #ifndef WIN32
43    #include <sys/time.h>   /* for gettimeofday */
44    #else
45    #include <time.h>
46    #endif
47    
48    
49  #include "xvid.h"  #include "xvid.h"
50    
51  /* inner guts */  // inner guts
52  #include "dct/idct.h"  #include "dct/idct.h"
53  #include "dct/fdct.h"  #include "dct/fdct.h"
54  #include "image/colorspace.h"  #include "image/colorspace.h"
# Line 60  Line 63 
63  #include "bitstream/cbp.h"  #include "bitstream/cbp.h"
64    
65  #include <math.h>  #include <math.h>
66    
67  #ifndef M_PI  #ifndef M_PI
68  #  define M_PI     3.14159265359  #define M_PI            3.14159265358979323846
 #  define M_PI_2   1.5707963268  
69  #endif  #endif
70    
71  const int speed_ref = 100;  /* on slow machines, decrease this value */  const int speed_ref = 100;  /* on slow machines, decrease this value */
72    
73  /*********************************************************************  /*********************************************************************
# Line 73  Line 77 
77   /* returns time in micro-s*/   /* returns time in micro-s*/
78  double gettime_usec()  double gettime_usec()
79  {  {
80  #ifdef  WIN32  #ifndef WIN32
   return clock()*1000;  
 #else  
81    struct timeval  tv;    struct timeval  tv;
82    gettimeofday(&tv, 0);    gettimeofday(&tv, 0);
83    return tv.tv_sec*1.0e6 + tv.tv_usec;    return tv.tv_sec*1.0e6 + tv.tv_usec;
84    #else
85            clock_t clk;
86            clk = clock();
87            return clk * 1000000 / CLOCKS_PER_SEC;
88  #endif  #endif
89  }  }
90    
# Line 115  Line 121 
121  , { "3DNOW ", XVID_CPU_3DNOW }  , { "3DNOW ", XVID_CPU_3DNOW }
122  , { "3DNOWE", XVID_CPU_3DNOWEXT }  , { "3DNOWE", XVID_CPU_3DNOWEXT }
123  , { "IA64  ", XVID_CPU_IA64 }  , { "IA64  ", XVID_CPU_IA64 }
124  /*, { "TSC   ", XVID_CPU_TSC } */  //, { "TSC   ", XVID_CPU_TSC }
125  , { 0, 0 } }  , { 0, 0 } }
126    
127  , cpu_short_list[] =  , cpu_short_list[] =
128  { { "PLAINC", 0 }  { { "PLAINC", 0 }
129  , { "MMX   ", XVID_CPU_MMX }  , { "MMX   ", XVID_CPU_MMX }
130  /*, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } */  //, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX }
131  , { "IA64  ", XVID_CPU_IA64 }  , { "IA64  ", XVID_CPU_IA64 }
132  , { 0, 0 } }  , { 0, 0 } }
133    
# Line 469  Line 475 
475      TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2);      TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2);
476      printf( "%s - 8to16sub2 %.3f usec       crc=%d\n", cpu->name, t, s );      printf( "%s - 8to16sub2 %.3f usec       crc=%d\n", cpu->name, t, s );
477      if (s!=20384) printf( "*** CRC ERROR! ***\n" );      if (s!=20384) printf( "*** CRC ERROR! ***\n" );
478  /*    for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]); */  //    for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]);
479  /*    printf("\n"); */  //    printf("\n");
480  #endif  #endif
481      printf( " --- \n" );      printf( " --- \n" );
482    }    }
# Line 767  Line 773 
773    }    }
774  }  }
775    
776  /*//////////////////////////////////////////////////////// */  ///* ////////////////////////////////////////////////////// */
777  /* Pseudo-random generator specified by IEEE 1180 */  /* Pseudo-random generator specified by IEEE 1180 */
778    
779  static long ieee_seed = 1;  static long ieee_seed = 1;
# Line 910  Line 916 
916    
917    
918      printf( "\n  -- FDCT report --\n" );      printf( "\n  -- FDCT report --\n" );
919  /*    print_stats(&FStats); */  //    print_stats(&FStats);
920      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 */
921    
922      for(i=0; i<64; i++) Blk[i] = 0;      for(i=0; i<64; i++) Blk[i] = 0;
# Line 919  Line 925 
925      printf( "FDCT(0) == 0 ?  %s\n", (m!=0) ? "NOPE!" : "yup." );      printf( "FDCT(0) == 0 ?  %s\n", (m!=0) ? "NOPE!" : "yup." );
926    
927      printf( "\n  -- IDCT report --\n" );      printf( "\n  -- IDCT report --\n" );
928  /*    print_stats(&IStats); */  //    print_stats(&IStats);
929      report_stats(&IStats, ILimits);      report_stats(&IStats, ILimits);
930    
931    
# Line 937  Line 943 
943    
944    int i, n, p;    int i, n, p;
945    CPU *cpu;    CPU *cpu;
946  /*  const short IDCT_MAX =  2047;  // 12bits input */  //  const short IDCT_MAX =  2047;  /* 12bits input */
947  /*  const short IDCT_MIN = -2048; */  //  const short IDCT_MIN = -2048;
948  /*  const short IDCT_OUT =   256;  // 9bits ouput */  //  const short IDCT_OUT =   256;  /* 9bits ouput */
949    const int Partitions = 4;    const int Partitions = 4;
950    const int Loops = 10000 / Partitions;    const int Loops = 10000 / Partitions;
951    
# Line 987  Line 993 
993      report_stats(&Stats, 0);      report_stats(&Stats, 0);
994    
995    
996                /* IDCT tests */                /* IDCT tests // */
997  #if 0  #if 0
998        /* no finished yet */        /* no finished yet */
999    

Legend:
Removed from v.684  
changed lines
  Added in v.1054

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4