[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 1621, Wed Jun 15 06:07:28 2005 UTC revision 1641, Fri Sep 23 12:53:35 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.25 2005-09-23 12:53:35 suxen_drol 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);
924          DECLARE_ALIGNED_MATRIX(Src3, 6, 64, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Src3, 6, 64, int16_t, 16);
925          DECLARE_ALIGNED_MATRIX(Src4, 6, 64, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Src4, 6, 64, int16_t, 16);
926      DECLARE_ALIGNED_MATRIX(Src5, 6, 64, int16_t, 16);
927    
928          printf( "\n =====  test cbp =====\n" );          printf( "\n =====  test cbp =====\n" );
929    
# Line 931  Line 932 
932                  Src2[i] = (i<3*64);               /* half-full */                  Src2[i] = (i<3*64);               /* half-full */
933                  Src3[i] = ((i+32)>3*64);                  Src3[i] = ((i+32)>3*64);
934                  Src4[i] = (i==(3*64+2) || i==(5*64+9));                  Src4[i] = (i==(3*64+2) || i==(5*64+9));
935        Src5[i] = ieee_rand(0,1) ? -1 : 1;  /* +/- test */
936          }          }
937    
938          for(cpu = cpu_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
# Line 941  Line 943 
943                  if (!init_cpu(cpu))                  if (!init_cpu(cpu))
944                          continue;                          continue;
945    
946                  TEST_CBP(calc_cbp, Src1);                  TEST_CBP(calc_cbp, Src1, nb_tests);
947                  printf("%s -   calc_cbp#1 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#1 %.3f usec       cbp=0x%02x %s\n",
948                             cpu->name, t, cbp, (cbp!=0x15)?"| ERROR": "");                             cpu->name, t, cbp, (cbp!=0x15)?"| ERROR": "");
949                  TEST_CBP(calc_cbp, Src2);                  TEST_CBP(calc_cbp, Src2, nb_tests);
950                  printf("%s -   calc_cbp#2 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#2 %.3f usec       cbp=0x%02x %s\n",
951                             cpu->name, t, cbp, (cbp!=0x38)?"| ERROR": "");                             cpu->name, t, cbp, (cbp!=0x38)?"| ERROR": "");
952                  TEST_CBP(calc_cbp, Src3);                  TEST_CBP(calc_cbp, Src3, nb_tests);
953                  printf("%s -   calc_cbp#3 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#3 %.3f usec       cbp=0x%02x %s\n",
954                             cpu->name, t, cbp, (cbp!=0x0f)?"| ERROR": "" );                             cpu->name, t, cbp, (cbp!=0x0f)?"| ERROR": "" );
955                  TEST_CBP(calc_cbp, Src4);                  TEST_CBP(calc_cbp, Src4, nb_tests);
956                  printf("%s -   calc_cbp#4 %.3f usec       cbp=0x%02x %s\n",                  printf("%s -   calc_cbp#4 %.3f usec       cbp=0x%02x %s\n",
957                             cpu->name, t, cbp, (cbp!=0x05)?"| ERROR": "" );                             cpu->name, t, cbp, (cbp!=0x05)?"| ERROR": "" );
958                    TEST_CBP(calc_cbp, Src5, nb_tests);
959                    printf("%s -   calc_cbp#4 %.3f usec       cbp=0x%02x %s\n",
960                               cpu->name, t, cbp, (cbp!=0x3f)?"| ERROR": "" );
961                  printf( " --- \n" );                  printf( " --- \n" );
962          }          }
963    
964            for(cpu = cpu_list; cpu->name!=0; ++cpu)  /* bench suggested by Carlo (carlo dot bramix at libero dot it) */
965            {
966                    double t;
967                    int tst, cbp, err;
968    
969                    if (!init_cpu(cpu))
970                            continue;
971    
972        err = 0;
973        for(n=0; n<6; ++n)
974        {
975          for(m=0; m<64; ++m)
976          {
977            for(i=0; i<6*64; ++i)
978              Src1[i] = (i== (m + n*64));
979    
980            TEST_CBP(calc_cbp, Src1, 1);
981            if (cbp!= (((m!=0)<<(5-n))))
982            {
983              printf( "%s -   calc_cbp#5: ERROR at pos %d / %d!\n", cpu->name, n, m);
984              err = 1;
985              break;
986            }
987          }
988        }
989        if (!err)
990          printf( " %s -    calc_cbp#5 : OK\n", cpu->name );
991    
992            }
993  }  }
994    
995  /*********************************************************************  /*********************************************************************
# Line 1417  Line 1452 
1452                  xframe.bitstream = buf + pos;                  xframe.bitstream = buf + pos;
1453                  xframe.length = buf_size - pos;                  xframe.length = buf_size - pos;
1454                  xframe.output.plane[0] = (uint8_t*)(((size_t)yuv_out + 15) & ~15);                  xframe.output.plane[0] = (uint8_t*)(((size_t)yuv_out + 15) & ~15);
1455                  xframe.output.plane[1] = xframe.output.plane[0] + bps*height;                  xframe.output.plane[1] = (uint8_t*)xframe.output.plane[0] + bps*height;
1456                  xframe.output.plane[2] = xframe.output.plane[1] + bps/2;                  xframe.output.plane[2] = (uint8_t*)xframe.output.plane[1] + bps/2;
1457                  xframe.output.stride[0] = bps;                  xframe.output.stride[0] = bps;
1458                  xframe.output.stride[1] = bps;                  xframe.output.stride[1] = bps;
1459                  xframe.output.stride[2] = bps;                  xframe.output.stride[2] = bps;
# Line 1436  Line 1471 
1471                  nb++;                  nb++;
1472    
1473      for(y=0; y<height/2; ++y) {      for(y=0; y<height/2; ++y) {
1474                    chksum = calc_crc(xframe.output.plane[0] + (2*y+0)*bps, width, chksum);                    chksum = calc_crc((uint8_t*)xframe.output.plane[0] + (2*y+0)*bps, width, chksum);
1475                          chksum = calc_crc(xframe.output.plane[0] + (2*y+1)*bps, width, chksum);                          chksum = calc_crc((uint8_t*)xframe.output.plane[0] + (2*y+1)*bps, width, chksum);
1476                          chksum = calc_crc(xframe.output.plane[1] + y*bps, width/2, chksum);                          chksum = calc_crc((uint8_t*)xframe.output.plane[1] + y*bps, width/2, chksum);
1477                          chksum = calc_crc(xframe.output.plane[2] + y*bps, width/2, chksum);                          chksum = calc_crc((uint8_t*)xframe.output.plane[2] + y*bps, width/2, chksum);
1478                  }                  }
1479                  if (pos==buf_size)                  if (pos==buf_size)
1480                          break;                          break;

Legend:
Removed from v.1621  
changed lines
  Added in v.1641

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