[svn] / trunk / xvidcore / examples / xvid_bench.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_bench.c

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

revision 1628, Mon Aug 1 18:37:46 2005 UTC revision 1629, Fri Aug 5 20:49:23 2005 UTC
# Line 19  Line 19 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: xvid_bench.c,v 1.22 2005-06-15 06:07:28 Skal Exp $   * $Id: xvid_bench.c,v 1.23 2005-08-05 20:49:23 Skal Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 905  Line 905 
905   * test non-zero AC counting   * test non-zero AC counting
906   *********************************************************************/   *********************************************************************/
907    
908  #define TEST_CBP(FUNC, SRC)               \  #define TEST_CBP(FUNC, SRC, NB)           \
909  t = gettime_usec();                       \  t = gettime_usec();                       \
910  emms();                                   \  emms();                                   \
911  for(tst=0; tst<nb_tests; ++tst) {         \  for(tst=0; tst<NB; ++tst) {         \
912    cbp = (FUNC)((SRC));                    \    cbp = (FUNC)((SRC));                    \
913  }                                         \  }                                         \
914  emms();                                   \  emms();                                   \
# Line 917  Line 917 
917  void test_cbp()  void test_cbp()
918  {  {
919          const int nb_tests = 10000*speed_ref;          const int nb_tests = 10000*speed_ref;
920          int i;          int i, n, m;
921          CPU *cpu;          CPU *cpu;
922          DECLARE_ALIGNED_MATRIX(Src1, 6, 64, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Src1, 6, 64, int16_t, 16);
923          DECLARE_ALIGNED_MATRIX(Src2, 6, 64, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Src2, 6, 64, int16_t, 16);
# Line 941  Line 941 
941                  if (!init_cpu(cpu))                  if (!init_cpu(cpu))
942                          continue;                          continue;
943    
944                  TEST_CBP(calc_cbp, Src1);                  TEST_CBP(calc_cbp, Src1, nb_tests);
945                  printf("%s -   calc_cbp#1 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#1 %.3f usec       cbp=0x%02x %s\n",
946                             cpu->name, t, cbp, (cbp!=0x15)?"| ERROR": "");                             cpu->name, t, cbp, (cbp!=0x15)?"| ERROR": "");
947                  TEST_CBP(calc_cbp, Src2);                  TEST_CBP(calc_cbp, Src2, nb_tests);
948                  printf("%s -   calc_cbp#2 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#2 %.3f usec       cbp=0x%02x %s\n",
949                             cpu->name, t, cbp, (cbp!=0x38)?"| ERROR": "");                             cpu->name, t, cbp, (cbp!=0x38)?"| ERROR": "");
950                  TEST_CBP(calc_cbp, Src3);                  TEST_CBP(calc_cbp, Src3, nb_tests);
951                  printf("%s -   calc_cbp#3 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#3 %.3f usec       cbp=0x%02x %s\n",
952                             cpu->name, t, cbp, (cbp!=0x0f)?"| ERROR": "" );                             cpu->name, t, cbp, (cbp!=0x0f)?"| ERROR": "" );
953                  TEST_CBP(calc_cbp, Src4);                  TEST_CBP(calc_cbp, Src4, nb_tests);
954                  printf("%s -   calc_cbp#4 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#4 %.3f usec       cbp=0x%02x %s\n",
955                             cpu->name, t, cbp, (cbp!=0x05)?"| ERROR": "" );                             cpu->name, t, cbp, (cbp!=0x05)?"| ERROR": "" );
956                  printf( " --- \n" );                  printf( " --- \n" );
957          }          }
958    
959            for(cpu = cpu_list; cpu->name!=0; ++cpu)  /* bench suggested by Carlo (carlo dot bramix at libero dot it) */
960            {
961                    double t;
962                    int tst, cbp, err;
963    
964                    if (!init_cpu(cpu))
965                            continue;
966    
967        err = 0;
968        for(n=0; n<6; ++n)
969        {
970          for(m=0; m<64; ++m)
971          {
972            for(i=0; i<6*64; ++i)
973              Src1[i] = (i== (m + n*64));
974    
975            TEST_CBP(calc_cbp, Src1, 1);
976            if (cbp!= (((m!=0)<<(5-n))))
977            {
978              printf( "%s -   calc_cbp#5: ERROR at pos %d / %d!\n", cpu->name, n, m);
979              err = 1;
980              break;
981            }
982          }
983        }
984        if (!err)
985          printf( " %s -    calc_cbp#5 : OK\n", cpu->name );
986    
987            }
988  }  }
989    
990  /*********************************************************************  /*********************************************************************

Legend:
Removed from v.1628  
changed lines
  Added in v.1629

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