[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

revision 1175, Tue Oct 7 14:16:29 2003 UTC revision 1176, Thu Oct 9 18:50:22 2003 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.9.2.4 2003-08-13 11:43:45 edgomez Exp $   * $Id: xvid_bench.c,v 1.9.2.5 2003-10-09 18:50:22 edgomez Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 54  Line 54 
54  #include "image/colorspace.h"  #include "image/colorspace.h"
55  #include "image/interpolate8x8.h"  #include "image/interpolate8x8.h"
56  #include "utils/mem_transfer.h"  #include "utils/mem_transfer.h"
57  #include "quant/quant_h263.h"  #include "quant/quant.h"
 #include "quant/quant_mpeg4.h"  
58  #include "motion/sad.h"  #include "motion/sad.h"
59  #include "utils/emms.h"  #include "utils/emms.h"
60  #include "utils/timer.h"  #include "utils/timer.h"
# Line 149  Line 148 
148          int xerr, cpu_type;          int xerr, cpu_type;
149          xvid_gbl_init_t xinit;          xvid_gbl_init_t xinit;
150    
 #ifdef ARCH_IS_IA32  
         cpu_type = check_cpu_features() & cpu->cpu;  
 #else  
         cpu_type = XVID_CPU_ASM;  
 #endif  
151          memset(&xinit, 0, sizeof(xinit));          memset(&xinit, 0, sizeof(xinit));
152          xinit.cpu_flags = cpu_type | XVID_CPU_FORCE;          xinit.cpu_flags = cpu->cpu | XVID_CPU_FORCE;
153          xinit.version = XVID_VERSION;          xinit.version = XVID_VERSION;
154          xerr = xvid_global(NULL, 0, &xinit, NULL);          xerr = xvid_global(NULL, 0, &xinit, NULL);
155          if (cpu->cpu>0 && (cpu_type==0 || xerr==XVID_ERR_FAIL)) {          if (cpu->cpu>0 && xerr==XVID_ERR_FAIL) {
156                  printf( "%s - skipped...\n", cpu->name );                  printf( "%s - skipped...\n", cpu->name );
157                  return 0;                  return 0;
158          }          }
# Line 452  Line 446 
446    
447          printf( "\n ===  test transfer ===\n" );          printf( "\n ===  test transfer ===\n" );
448    
449          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
450          {          {
451                  double t, overhead;                  double t, overhead;
452                  int tst, s;                  int tst, s;
# Line 547  Line 541 
541                  Dst[i] = 0;                  Dst[i] = 0;
542          }          }
543    
544          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
545          {          {
546                  double t, overhead;                  double t, overhead;
547                  int tst, q;                  int tst, q;
# Line 566  Line 560 
560                  overhead += gettime_usec();                  overhead += gettime_usec();
561    
562  #if 1  #if 1
563                  TEST_QUANT2(quant4_intra, Dst, Src);                  TEST_QUANT2(quant_mpeg_intra, Dst, Src);
564                  printf( "%s -   quant4_intra %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s -   quant_mpeg_intra %.3f usec       crc=%d\n", cpu->name, t, s );
565                  if (s!=29809) printf( "*** CRC ERROR! ***\n" );                  if (s!=29809) printf( "*** CRC ERROR! ***\n" );
566    
567                  TEST_QUANT(quant4_inter, Dst, Src);                  TEST_QUANT(quant_mpeg_inter, Dst, Src);
568                  printf( "%s -   quant4_inter %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s -   quant_mpeg_inter %.3f usec       crc=%d\n", cpu->name, t, s );
569                  if (s!=12574) printf( "*** CRC ERROR! ***\n" );                  if (s!=12574) printf( "*** CRC ERROR! ***\n" );
570  #endif  #endif
571  #if 1  #if 1
572                  TEST_QUANT2(dequant4_intra, Dst, Src);                  TEST_QUANT2(dequant_mpeg_intra, Dst, Src);
573                  printf( "%s - dequant4_intra %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s - dequant_mpeg_intra %.3f usec       crc=%d\n", cpu->name, t, s );
574                  if (s!=24052) printf( "*** CRC ERROR! ***\n" );                  if (s!=24052) printf( "*** CRC ERROR! ***\n" );
575    
576                  TEST_QUANT(dequant4_inter, Dst, Src);                  TEST_QUANT(dequant_mpeg_inter, Dst, Src);
577                  printf( "%s - dequant4_inter %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s - dequant_mpeg_inter %.3f usec       crc=%d\n", cpu->name, t, s );
578                  if (s!=63847) printf( "*** CRC ERROR! ***\n" );                  if (s!=63847) printf( "*** CRC ERROR! ***\n" );
579  #endif  #endif
580  #if 1  #if 1
581                  TEST_QUANT2(quant_intra, Dst, Src);                  TEST_QUANT2(quant_h263_intra, Dst, Src);
582                  printf( "%s -    quant_intra %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s -   quant_h263_intra %.3f usec       crc=%d\n", cpu->name, t, s );
583                  if (s!=25662) printf( "*** CRC ERROR! ***\n" );                  if (s!=25662) printf( "*** CRC ERROR! ***\n" );
584    
585                  TEST_QUANT(quant_inter, Dst, Src);                  TEST_QUANT(quant_h263_inter, Dst, Src);
586                  printf( "%s -    quant_inter %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s -   quant_h263_inter %.3f usec       crc=%d\n", cpu->name, t, s );
587                  if (s!=23972) printf( "*** CRC ERROR! ***\n" );                  if (s!=23972) printf( "*** CRC ERROR! ***\n" );
588  #endif  #endif
589  #if 1  #if 1
590                  TEST_QUANT2(dequant_intra, Dst, Src);                  TEST_QUANT2(dequant_h263_intra, Dst, Src);
591                  printf( "%s -  dequant_intra %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s - dequant_h263_intra %.3f usec       crc=%d\n", cpu->name, t, s );
592                  if (s!=49900) printf( "*** CRC ERROR! ***\n" );                  if (s!=49900) printf( "*** CRC ERROR! ***\n" );
593    
594                  TEST_QUANT(dequant_inter, Dst, Src);                  TEST_QUANT(dequant_h263_inter, Dst, Src);
595                  printf( "%s -  dequant_inter %.3f usec       crc=%d\n", cpu->name, t, s );                  printf( "%s - dequant_h263_inter %.3f usec       crc=%d\n", cpu->name, t, s );
596                  if (s!=48899) printf( "*** CRC ERROR! ***\n" );                  if (s!=48899) printf( "*** CRC ERROR! ***\n" );
597  #endif  #endif
598                  printf( " --- \n" );                  printf( " --- \n" );
# Line 634  Line 628 
628                  Src4[i] = (i==(3*64+2) || i==(5*64+9));                  Src4[i] = (i==(3*64+2) || i==(5*64+9));
629          }          }
630    
631          for(cpu = cpu_short_list2; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
632          {          {
633                  double t;                  double t;
634                  int tst, cbp;                  int tst, cbp;
# Line 1159  Line 1153 
1153    
1154          printf( "\n =====  (de)quant4_intra saturation bug? =====\n" );          printf( "\n =====  (de)quant4_intra saturation bug? =====\n" );
1155    
1156          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
1157          {          {
1158                  int i;                  int i;
1159                  int16_t  Src[8*8], Dst[8*8];                  int16_t  Src[8*8], Dst[8*8];
# Line 1169  Line 1163 
1163    
1164                  for(i=0; i<64; ++i) Src[i] = i-32;                  for(i=0; i<64; ++i) Src[i] = i-32;
1165                  set_intra_matrix( get_default_intra_matrix() );                  set_intra_matrix( get_default_intra_matrix() );
1166                  dequant4_intra(Dst, Src, 31, 5);                  dequant_mpeg_intra(Dst, Src, 31, 5);
1167                  printf( "dequant4_intra with CPU=%s:  ", cpu->name);                  printf( "dequant_mpeg_intra with CPU=%s:  ", cpu->name);
1168                  printf( "  Out[]= " );                  printf( "  Out[]= " );
1169                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);
1170                  printf( "\n" );                  printf( "\n" );
# Line 1178  Line 1172 
1172    
1173          printf( "\n =====  (de)quant4_inter saturation bug? =====\n" );          printf( "\n =====  (de)quant4_inter saturation bug? =====\n" );
1174    
1175          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
1176          {          {
1177                  int i;                  int i;
1178                  int16_t  Src[8*8], Dst[8*8];                  int16_t  Src[8*8], Dst[8*8];
# Line 1188  Line 1182 
1182    
1183                  for(i=0; i<64; ++i) Src[i] = i-32;                  for(i=0; i<64; ++i) Src[i] = i-32;
1184                  set_inter_matrix( get_default_inter_matrix() );                  set_inter_matrix( get_default_inter_matrix() );
1185                  dequant4_inter(Dst, Src, 31);                  dequant_mpeg_inter(Dst, Src, 31);
1186                  printf( "dequant4_inter with CPU=%s:  ", cpu->name);                  printf( "dequant_mpeg_inter with CPU=%s:  ", cpu->name);
1187                  printf( "  Out[]= " );                  printf( "  Out[]= " );
1188                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);
1189                  printf( "\n" );                  printf( "\n" );
# Line 1203  Line 1197 
1197    
1198          printf( "\n =====  fdct/idct precision diffs =====\n" );          printf( "\n =====  fdct/idct precision diffs =====\n" );
1199    
1200          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
1201          {          {
1202                  int i;                  int i;
1203    
# Line 1256  Line 1250 
1250    
1251                          for(q=1; q<=max_Q; ++q) {                          for(q=1; q<=max_Q; ++q) {
1252                                  emms();                                  emms();
1253                                  quant4_inter( Dst, Src, q );                                  quant_mpeg_inter( Dst, Src, q );
1254                                  emms();                                  emms();
1255                                  for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i;                                  for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i;
1256                                  Crcs_Inter[n][q] = s;                                  Crcs_Inter[n][q] = s;
# Line 1286  Line 1280 
1280    
1281                          for(q=1; q<=max_Q; ++q) {                          for(q=1; q<=max_Q; ++q) {
1282                                  emms();                                  emms();
1283                                  quant4_intra( Dst, Src, q, q);                                  quant_mpeg_intra( Dst, Src, q, q);
1284                                  emms();                                  emms();
1285                                  for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i;                                  for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i;
1286                                  Crcs_Intra[n][q] = s;                                  Crcs_Intra[n][q] = s;

Legend:
Removed from v.1175  
changed lines
  Added in v.1176

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