[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 1122, Wed Aug 13 11:44:02 2003 UTC revision 1197, Sun Nov 2 23:02:52 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.6 2003-11-02 23:02:52 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 146  Line 145 
145    
146  int init_cpu(CPU *cpu)  int init_cpu(CPU *cpu)
147  {  {
148          int xerr, cpu_type;          xvid_gbl_info_t xinfo;
         xvid_gbl_init_t xinit;  
149    
150  #ifdef ARCH_IS_IA32          /* Get the available CPU flags */
151          cpu_type = check_cpu_features() & cpu->cpu;          memset(&xinfo, 0, sizeof(xinfo));
152  #else          xinfo.version = XVID_VERSION;
153          cpu_type = XVID_CPU_ASM;          xvid_global(NULL, XVID_GBL_INFO, &xinfo, NULL);
154  #endif  
155            /* Are we trying to test a subset of the host CPU features */
156            if ((xinfo.cpu_flags & cpu->cpu) == cpu->cpu) {
157                    int xerr;
158                    xvid_gbl_init_t xinit;
159          memset(&xinit, 0, sizeof(xinit));          memset(&xinit, 0, sizeof(xinit));
160          xinit.cpu_flags = cpu_type | XVID_CPU_FORCE;                  xinit.cpu_flags = cpu->cpu | XVID_CPU_FORCE;
161          xinit.version = XVID_VERSION;          xinit.version = XVID_VERSION;
162          xerr = xvid_global(NULL, 0, &xinit, NULL);                  xerr = xvid_global(NULL, XVID_GBL_INIT, &xinit, NULL);
163          if (cpu->cpu>0 && (cpu_type==0 || xerr==XVID_ERR_FAIL)) {                  if (xerr==XVID_ERR_FAIL) {
164                  printf( "%s - skipped...\n", cpu->name );                          /* libxvidcore failed to init */
165                  return 0;                  return 0;
166          }          }
167            } else {
168                    /* The host CPU doesn't support some required feature for this test */
169                    return(0);
170            }
171          return 1;          return 1;
172  }  }
173    
# Line 452  Line 458 
458    
459          printf( "\n ===  test transfer ===\n" );          printf( "\n ===  test transfer ===\n" );
460    
461          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
462          {          {
463                  double t, overhead;                  double t, overhead;
464                  int tst, s;                  int tst, s;
# Line 547  Line 553 
553                  Dst[i] = 0;                  Dst[i] = 0;
554          }          }
555    
556          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
557          {          {
558                  double t, overhead;                  double t, overhead;
559                  int tst, q;                  int tst, q;
# Line 566  Line 572 
572                  overhead += gettime_usec();                  overhead += gettime_usec();
573    
574  #if 1  #if 1
575                  TEST_QUANT2(quant4_intra, Dst, Src);                  TEST_QUANT2(quant_mpeg_intra, Dst, Src);
576                  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 );
577                  if (s!=29809) printf( "*** CRC ERROR! ***\n" );                  if (s!=29809) printf( "*** CRC ERROR! ***\n" );
578    
579                  TEST_QUANT(quant4_inter, Dst, Src);                  TEST_QUANT(quant_mpeg_inter, Dst, Src);
580                  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 );
581                  if (s!=12574) printf( "*** CRC ERROR! ***\n" );                  if (s!=12574) printf( "*** CRC ERROR! ***\n" );
582  #endif  #endif
583  #if 1  #if 1
584                  TEST_QUANT2(dequant4_intra, Dst, Src);                  TEST_QUANT2(dequant_mpeg_intra, Dst, Src);
585                  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 );
586                  if (s!=24052) printf( "*** CRC ERROR! ***\n" );                  if (s!=24052) printf( "*** CRC ERROR! ***\n" );
587    
588                  TEST_QUANT(dequant4_inter, Dst, Src);                  TEST_QUANT(dequant_mpeg_inter, Dst, Src);
589                  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 );
590                  if (s!=63847) printf( "*** CRC ERROR! ***\n" );                  if (s!=63847) printf( "*** CRC ERROR! ***\n" );
591  #endif  #endif
592  #if 1  #if 1
593                  TEST_QUANT2(quant_intra, Dst, Src);                  TEST_QUANT2(quant_h263_intra, Dst, Src);
594                  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 );
595                  if (s!=25662) printf( "*** CRC ERROR! ***\n" );                  if (s!=25662) printf( "*** CRC ERROR! ***\n" );
596    
597                  TEST_QUANT(quant_inter, Dst, Src);                  TEST_QUANT(quant_h263_inter, Dst, Src);
598                  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 );
599                  if (s!=23972) printf( "*** CRC ERROR! ***\n" );                  if (s!=23972) printf( "*** CRC ERROR! ***\n" );
600  #endif  #endif
601  #if 1  #if 1
602                  TEST_QUANT2(dequant_intra, Dst, Src);                  TEST_QUANT2(dequant_h263_intra, Dst, Src);
603                  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 );
604                  if (s!=49900) printf( "*** CRC ERROR! ***\n" );                  if (s!=49900) printf( "*** CRC ERROR! ***\n" );
605    
606                  TEST_QUANT(dequant_inter, Dst, Src);                  TEST_QUANT(dequant_h263_inter, Dst, Src);
607                  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 );
608                  if (s!=48899) printf( "*** CRC ERROR! ***\n" );                  if (s!=48899) printf( "*** CRC ERROR! ***\n" );
609  #endif  #endif
610                  printf( " --- \n" );                  printf( " --- \n" );
# Line 634  Line 640 
640                  Src4[i] = (i==(3*64+2) || i==(5*64+9));                  Src4[i] = (i==(3*64+2) || i==(5*64+9));
641          }          }
642    
643          for(cpu = cpu_short_list2; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
644          {          {
645                  double t;                  double t;
646                  int tst, cbp;                  int tst, cbp;
# Line 1159  Line 1165 
1165    
1166          printf( "\n =====  (de)quant4_intra saturation bug? =====\n" );          printf( "\n =====  (de)quant4_intra saturation bug? =====\n" );
1167    
1168          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
1169          {          {
1170                  int i;                  int i;
1171                  int16_t  Src[8*8], Dst[8*8];                  int16_t  Src[8*8], Dst[8*8];
# Line 1169  Line 1175 
1175    
1176                  for(i=0; i<64; ++i) Src[i] = i-32;                  for(i=0; i<64; ++i) Src[i] = i-32;
1177                  set_intra_matrix( get_default_intra_matrix() );                  set_intra_matrix( get_default_intra_matrix() );
1178                  dequant4_intra(Dst, Src, 31, 5);                  dequant_mpeg_intra(Dst, Src, 31, 5);
1179                  printf( "dequant4_intra with CPU=%s:  ", cpu->name);                  printf( "dequant_mpeg_intra with CPU=%s:  ", cpu->name);
1180                  printf( "  Out[]= " );                  printf( "  Out[]= " );
1181                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);
1182                  printf( "\n" );                  printf( "\n" );
# Line 1178  Line 1184 
1184    
1185          printf( "\n =====  (de)quant4_inter saturation bug? =====\n" );          printf( "\n =====  (de)quant4_inter saturation bug? =====\n" );
1186    
1187          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
1188          {          {
1189                  int i;                  int i;
1190                  int16_t  Src[8*8], Dst[8*8];                  int16_t  Src[8*8], Dst[8*8];
# Line 1188  Line 1194 
1194    
1195                  for(i=0; i<64; ++i) Src[i] = i-32;                  for(i=0; i<64; ++i) Src[i] = i-32;
1196                  set_inter_matrix( get_default_inter_matrix() );                  set_inter_matrix( get_default_inter_matrix() );
1197                  dequant4_inter(Dst, Src, 31);                  dequant_mpeg_inter(Dst, Src, 31);
1198                  printf( "dequant4_inter with CPU=%s:  ", cpu->name);                  printf( "dequant_mpeg_inter with CPU=%s:  ", cpu->name);
1199                  printf( "  Out[]= " );                  printf( "  Out[]= " );
1200                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);                  for(i=0; i<64; ++i) printf( "[%d]", Dst[i]);
1201                  printf( "\n" );                  printf( "\n" );
# Line 1203  Line 1209 
1209    
1210          printf( "\n =====  fdct/idct precision diffs =====\n" );          printf( "\n =====  fdct/idct precision diffs =====\n" );
1211    
1212          for(cpu = cpu_short_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
1213          {          {
1214                  int i;                  int i;
1215    
# Line 1256  Line 1262 
1262    
1263                          for(q=1; q<=max_Q; ++q) {                          for(q=1; q<=max_Q; ++q) {
1264                                  emms();                                  emms();
1265                                  quant4_inter( Dst, Src, q );                                  quant_mpeg_inter( Dst, Src, q );
1266                                  emms();                                  emms();
1267                                  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;
1268                                  Crcs_Inter[n][q] = s;                                  Crcs_Inter[n][q] = s;
# Line 1286  Line 1292 
1292    
1293                          for(q=1; q<=max_Q; ++q) {                          for(q=1; q<=max_Q; ++q) {
1294                                  emms();                                  emms();
1295                                  quant4_intra( Dst, Src, q, q);                                  quant_mpeg_intra( Dst, Src, q, q);
1296                                  emms();                                  emms();
1297                                  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;
1298                                  Crcs_Intra[n][q] = s;                                  Crcs_Intra[n][q] = s;
# Line 1319  Line 1325 
1325    
1326          if (what==7) {          if (what==7) {
1327                  test_IEEE1180_compliance(-256, 255, 1);                  test_IEEE1180_compliance(-256, 255, 1);
 #if 0  
1328                  test_IEEE1180_compliance(-256, 255,-1);                  test_IEEE1180_compliance(-256, 255,-1);
1329                  test_IEEE1180_compliance(  -5,   5, 1);                  test_IEEE1180_compliance(  -5,   5, 1);
1330                  test_IEEE1180_compliance(  -5,   5,-1);                  test_IEEE1180_compliance(  -5,   5,-1);
1331                  test_IEEE1180_compliance(-300, 300, 1);                  test_IEEE1180_compliance(-300, 300, 1);
1332                  test_IEEE1180_compliance(-300, 300,-1);                  test_IEEE1180_compliance(-300, 300,-1);
 #endif  
1333          }          }
1334          if (what==8) test_dct_saturation(-256, 255);          if (what==8) test_dct_saturation(-256, 255);
1335    

Legend:
Removed from v.1122  
changed lines
  Added in v.1197

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