[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 1620, Tue Jun 14 13:58:21 2005 UTC revision 1621, Wed Jun 15 06:07:28 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.21 2005-06-14 13:58:21 Skal Exp $   * $Id: xvid_bench.c,v 1.22 2005-06-15 06:07:28 Skal Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 112  Line 112 
112          unsigned int cpu;          unsigned int cpu;
113  } CPU;  } CPU;
114    
115  CPU cpu_list[] =  CPU cpu_list[] = {
116  { { "PLAINC", 0 }          { "PLAINC ", 0 },
117  #ifdef ARCH_IS_IA32  #ifdef ARCH_IS_IA32
118    , { "MMX   ", XVID_CPU_MMX }          { "MMX    ", XVID_CPU_MMX },
119    , { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX }          { "MMXEXT ", XVID_CPU_MMXEXT | XVID_CPU_MMX },
120    , { "SSE2  ", XVID_CPU_SSE2 | XVID_CPU_MMX }          { "SSE2   ", XVID_CPU_SSE2 | XVID_CPU_MMX },
121    , { "3DNOW ", XVID_CPU_3DNOW }          { "3DNOW  ", XVID_CPU_3DNOW },
122    , { "3DNOWE", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT }          { "3DNOWE ", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT },
123  #endif  #endif
124  #ifdef ARCH_IS_PPC  #ifdef ARCH_IS_PPC
125    , { "ALTIVEC", XVID_CPU_ALTIVEC }          { "ALTIVEC", XVID_CPU_ALTIVEC },
126  #endif  #endif
127  #ifdef ARCH_IS_X86_64  #ifdef ARCH_IS_X86_64
128    , { "X86_64", XVID_CPU_ASM}          { "X86_64 ", XVID_CPU_ASM},
129  #endif  #endif
130  //, { "IA64  ", XVID_CPU_IA64 }  #ifdef ARCH_IS_IA64
131  //, { "TSC   ", XVID_CPU_TSC }  //      { "IA64   ", XVID_CPU_IA64 },
   , { 0, 0 } };  
   
 CPU  cpu_short_list[] =  
 { { "PLAINC", 0 }  
 #ifdef ARCH_IS_IA32  
   , { "MMX   ", XVID_CPU_MMX }  
 //, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX }  
 #endif  
 //, { "IA64  ", XVID_CPU_IA64 }  
   , { 0, 0 } };  
   
 CPU cpu_short_list2[] =  
 { { "PLAINC", 0 }  
 #ifdef ARCH_IS_IA32  
   , { "MMX   ", XVID_CPU_MMX }  
   , { "SSE2  ", XVID_CPU_SSE2 | XVID_CPU_MMX }  
132  #endif  #endif
133    , { 0, 0 } };  //      { "TSC    ", XVID_CPU_TSC },
134            { 0, 0 }
135    };
136    
137    
138  int init_cpu(CPU *cpu)  int init_cpu(CPU *cpu)
# Line 274  Line 260 
260          return crc;          return crc;
261  }  }
262    
263    void byte_swap(uint8_t *mem, int len, int element_size) {
264    #ifdef ARCH_IS_BIG_ENDIAN
265            int i;
266    
267            if(element_size == 1) {
268                    /* No need to swap */
269            } else if(element_size == 2) {
270                    uint8_t temp[2];
271    
272                    for(i=0; i < (len/2); i++ ) {
273                            temp[0] = mem[0];
274                            temp[1] = mem[1];
275                            mem[0] = temp[1];
276                            mem[1] = temp[0];
277    
278                            mem += 2;
279                    }
280            } else if(element_size == 4) {
281                    uint8_t temp[4];
282    
283                    for(i=0; i < (len/4); i++ ) {
284                            temp[0] = mem[0];
285                            temp[1] = mem[1];
286                            temp[2] = mem[2];
287                            temp[3] = mem[3];
288                            mem[0] = temp[3];
289                            mem[1] = temp[2];
290                            mem[2] = temp[1];
291                            mem[3] = temp[0];
292    
293                            mem += 4;
294                    }
295            } else {
296                    printf("ERROR: byte_swap unsupported element_size(%u)\n", element_size);
297            }
298    #endif
299    }
300    
301  /*********************************************************************  /*********************************************************************
302   * test DCT   * test DCT
303   *********************************************************************/   *********************************************************************/
# Line 527  Line 551 
551  }                                         \  }                                         \
552  emms();                                   \  emms();                                   \
553  t = (gettime_usec()-t -overhead) / nb_tests;\  t = (gettime_usec()-t -overhead) / nb_tests;\
554    byte_swap((uint8_t*)(DST), 8*32*sizeof((DST)[0]), sizeof((DST)[0]));  \
555  s = calc_crc((uint8_t*)(DST), 8*32*sizeof((DST)[0]), CRC32_INITIAL)  s = calc_crc((uint8_t*)(DST), 8*32*sizeof((DST)[0]), CRC32_INITIAL)
556    
557  #define TEST_TRANSFER(FUNC, DST, SRC)         \  #define TEST_TRANSFER(FUNC, DST, SRC)         \
# Line 553  Line 578 
578  }                                         \  }                                         \
579  emms();                                   \  emms();                                   \
580  t = (gettime_usec()-t -overhead) / nb_tests;\  t = (gettime_usec()-t -overhead) / nb_tests;\
581    byte_swap((uint8_t*)(DST), 8*32*sizeof((DST)[0]), sizeof((DST)[0]));  \
582  s = calc_crc((uint8_t*)(DST), 8*32*sizeof((DST)[0]), CRC32_INITIAL)  s = calc_crc((uint8_t*)(DST), 8*32*sizeof((DST)[0]), CRC32_INITIAL)
583    
584  #define TEST_TRANSFER2(FUNC, DST, SRC, R1)    \  #define TEST_TRANSFER2(FUNC, DST, SRC, R1)    \
# Line 642  Line 668 
668    for(q=1; q<=max_Q; ++q) {                 \    for(q=1; q<=max_Q; ++q) {                 \
669          for(tst=0; tst<nb_tests; ++tst)         \          for(tst=0; tst<nb_tests; ++tst)         \
670            (FUNC)((DST), (SRC), q, mpeg_quant_matrices);              \            (FUNC)((DST), (SRC), q, mpeg_quant_matrices);              \
671          s = calc_crc((uint8_t*)(DST), 64*sizeof(int16_t), s); \          byte_swap((uint8_t*)(DST), 64*sizeof((DST)[0]), sizeof((DST)[0]));  \
672            s = calc_crc((uint8_t*)(DST), 64*sizeof((DST)[0]), s); \
673    }                                         \    }                                         \
674    emms();                                   \    emms();                                   \
675  }                                           \  }                                           \
# Line 657  Line 684 
684    for(q=1; q<=max_Q; ++q) {                 \    for(q=1; q<=max_Q; ++q) {                 \
685          for(tst=0; tst<nb_tests; ++tst)         \          for(tst=0; tst<nb_tests; ++tst)         \
686            (FUNC)((DST), (SRC), q, q, mpeg_quant_matrices);           \            (FUNC)((DST), (SRC), q, q, mpeg_quant_matrices);           \
687          s = calc_crc((uint8_t*)(DST), 64*sizeof(int16_t), s); \          byte_swap((uint8_t*)(DST), 64*sizeof((DST)[0]), sizeof((DST)[0]));  \
688            s = calc_crc((uint8_t*)(DST), 64*sizeof((DST)[0]), s); \
689    }                                         \    }                                         \
690    emms();                                   \    emms();                                   \
691  }                                           \  }                                           \

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

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