[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 1652, Thu Nov 3 05:44:07 2005 UTC revision 1988, Wed May 18 09:10:05 2011 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.27 2005-11-03 05:44:07 Skal Exp $   * $Id$
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 47  Line 47 
47  #include "xvid.h"  #include "xvid.h"
48    
49  // inner guts  // inner guts
50    #include "portab.h"
51  #include "dct/idct.h"  #include "dct/idct.h"
52  #include "dct/fdct.h"  #include "dct/fdct.h"
53  #include "image/colorspace.h"  #include "image/colorspace.h"
# Line 58  Line 59 
59  #include "utils/timer.h"  #include "utils/timer.h"
60  #include "quant/quant_matrix.c"  #include "quant/quant_matrix.c"
61  #include "bitstream/cbp.h"  #include "bitstream/cbp.h"
62    #include "bitstream/bitstream.h"
63    
64  #include <math.h>  #include <math.h>
65    
# Line 114  Line 116 
116    
117  CPU cpu_list[] = {  CPU cpu_list[] = {
118          { "PLAINC ", 0 },          { "PLAINC ", 0 },
119  #ifdef ARCH_IS_IA32  #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
120          { "MMX    ", XVID_CPU_MMX },          { "MMX    ", XVID_CPU_MMX },
121          { "MMXEXT ", XVID_CPU_MMXEXT | XVID_CPU_MMX },          { "MMXEXT ", XVID_CPU_MMXEXT | XVID_CPU_MMX },
122          { "SSE2   ", XVID_CPU_SSE2 | XVID_CPU_MMX },          { "SSE2   ", XVID_CPU_SSE2 | XVID_CPU_MMX },
123            { "SSE3   ", XVID_CPU_SSE3 | XVID_CPU_SSE2 | XVID_CPU_MMX },
124            { "SSE41  ", XVID_CPU_SSE41| XVID_CPU_SSE3 | XVID_CPU_SSE2 | XVID_CPU_MMX },
125          { "3DNOW  ", XVID_CPU_3DNOW },          { "3DNOW  ", XVID_CPU_3DNOW },
126          { "3DNOWE ", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT },          { "3DNOWE ", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT },
127  #endif  #endif
128  #ifdef ARCH_IS_PPC  #ifdef ARCH_IS_PPC
129          { "ALTIVEC", XVID_CPU_ALTIVEC },          { "ALTIVEC", XVID_CPU_ALTIVEC },
130  #endif  #endif
 #ifdef ARCH_IS_X86_64  
         { "X86_64 ", XVID_CPU_ASM},  
 #endif  
131  #ifdef ARCH_IS_IA64  #ifdef ARCH_IS_IA64
132  //      { "IA64   ", XVID_CPU_IA64 },  //      { "IA64   ", XVID_CPU_IA64 },
133  #endif  #endif
# Line 413  Line 414 
414    
415                  t = gettime_usec();                  t = gettime_usec();
416                  emms();                  emms();
417                    for(tst=0; tst<nb_tests; ++tst) s = sad8bi(Cur, Ref1, Ref2, 8);
418                    emms();
419                    t = (gettime_usec() - t) / nb_tests;
420                    printf( "%s - sad8bi %.3f usec       sad=%d %s\n",
421                                    cpu->name, t, s,
422                                    (s!=4002)?"| ERROR": "" );
423    
424                    t = gettime_usec();
425                    emms();
426                  for(tst=0; tst<nb_tests; ++tst) s = dev16(Cur, 16);                  for(tst=0; tst<nb_tests; ++tst) s = dev16(Cur, 16);
427                  emms();                  emms();
428                  t = (gettime_usec() - t) / nb_tests;                  t = (gettime_usec() - t) / nb_tests;
# Line 557  Line 567 
567          }          }
568  }  }
569    
570    #undef ENTER
571    #undef LEAVE
572    #undef TEST_MB
573    #undef TEST_MB2
574    
575  /*********************************************************************  /*********************************************************************
576   * test transfer   * test transfer
577   *********************************************************************/   *********************************************************************/
# Line 725  Line 740 
740    set_intra_matrix( mpeg_quant_matrices, Quant );                \    set_intra_matrix( mpeg_quant_matrices, Quant );                \
741    emms();                                   \    emms();                                   \
742    for(q=1; q<=max_Q; ++q) {                 \    for(q=1; q<=max_Q; ++q) {                 \
743            init_intra_matrix( mpeg_quant_matrices, q ); \
744          for(tst=0; tst<nb_tests; ++tst)         \          for(tst=0; tst<nb_tests; ++tst)         \
745            (FUNC)((DST), (SRC), q, q, mpeg_quant_matrices);           \            (FUNC)((DST), (SRC), q, q, mpeg_quant_matrices);           \
746          byte_swap((uint8_t*)(DST), 64*sizeof((DST)[0]), sizeof((DST)[0]));  \          byte_swap((uint8_t*)(DST), 64*sizeof((DST)[0]), sizeof((DST)[0]));  \
# Line 735  Line 751 
751  t = (gettime_usec()-t-overhead)/nb_tests/qm  t = (gettime_usec()-t-overhead)/nb_tests/qm
752    
753  #define TEST_INTRA(REFFUNC, NEWFUNC, RANGE)              \  #define TEST_INTRA(REFFUNC, NEWFUNC, RANGE)              \
754  { int i,q,s;\  { int32_t i,q,s;\
755          DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); \          DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); \
756    DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); \    DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); \
757    DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); \    DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); \
# Line 767  Line 783 
783    
784  void test_quant()  void test_quant()
785  {  {
786          const int nb_tests = 1*speed_ref;          const int32_t nb_tests = 1*speed_ref;
787          const int max_Q = 31;          const int32_t max_Q = 31;
788          DECLARE_ALIGNED_MATRIX(mpeg_quant_matrices, 8, 64, uint16_t, 16);          DECLARE_ALIGNED_MATRIX(mpeg_quant_matrices, 8, 64, uint16_t, 16);
789    
790          int i, qm;          int32_t i, qm;
791          CPU *cpu;          CPU *cpu;
792          DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16);
793          DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16);
# Line 790  Line 806 
806          for(cpu = cpu_list; cpu->name!=0; ++cpu)          for(cpu = cpu_list; cpu->name!=0; ++cpu)
807          {          {
808                  double t, overhead;                  double t, overhead;
809                  int tst, q;                  int32_t tst, q;
810                  uint32_t s;                  uint32_t s;
811    
812                  if (!init_cpu(cpu))                  if (!init_cpu(cpu))
# Line 814  Line 830 
830                  TEST_QUANT2(quant_mpeg_intra, Dst, Src);                  TEST_QUANT2(quant_mpeg_intra, Dst, Src);
831                  printf("%s -   quant_mpeg_intra %.3f usec       crc32=0x%08x %s\n",                  printf("%s -   quant_mpeg_intra %.3f usec       crc32=0x%08x %s\n",
832                             cpu->name, t, s,                             cpu->name, t, s,
833                             (s!=0xfd6a21a4)? "| ERROR": "");                             (s!=0x3b999af6)? "| ERROR": "");
834    
835                  TEST_QUANT(quant_mpeg_inter, Dst, Src);                  TEST_QUANT(quant_mpeg_inter, Dst, Src);
836                  printf("%s -   quant_mpeg_inter %.3f usec       crc32=0x%08x %s\n",                  printf("%s -   quant_mpeg_inter %.3f usec       crc32=0x%08x %s\n",
# Line 1700  Line 1716 
1716          }          }
1717  #endif  #endif
1718  }  }
1719    
1720    /*********************************************************************
1721     * test some YUV func
1722     *********************************************************************/
1723    
1724    #define ENTER \
1725    for(i=0; i<(int)sizeof(Dst0); ++i) Dst0[0][i] = 0;   \
1726    t = gettime_usec();                   \
1727    emms();
1728    
1729    #define LEAVE \
1730    emms();                             \
1731    t = (gettime_usec() - t) / nb_tests;  \
1732            iCrc = calc_crc((uint8_t*)Dst0, sizeof(Dst0), CRC32_INITIAL)
1733    
1734    #define TEST_YUYV(FUNC, S, FLIP)                \
1735    ENTER                               \
1736    for(tst=0; tst<nb_tests; ++tst) (FUNC)(Dst0[0], S*WIDTH, Src0[0], Src0[1], Src0[2], WIDTH, WIDTH/2, WIDTH, HEIGHT, (FLIP)); \
1737    LEAVE
1738    
1739    static const int yuv_CRCs[6][2] = {
1740            {0x0f4fb96b,0x780b6a68}
1741    ,       {0xa986b289,0x65e49b76}
1742    ,       {0x7f19c152,0xd539b86e}
1743    ,       {0x0f4fb96b,0x780b6a68}
1744    ,       {0xa986b289,0x65e49b76}
1745    ,       {0x36ab8b57,0x1cd92fee}
1746    };
1747    
1748    #define WIDTH 128
1749    #define HEIGHT 32
1750    void test_yuv()
1751    {
1752            const int nb_tests = 200*speed_ref;
1753            CPU *cpu;
1754            uint8_t Src0[3][WIDTH*HEIGHT];
1755            uint8_t Dst0[4][WIDTH*HEIGHT];
1756            int i, j, with_flip;
1757            double t;
1758            int tst, iCrc;
1759    
1760            colorspace_init();
1761            ieee_reseed(1);
1762            for(i=0; i<(int)sizeof(Src0); ++i) Src0[0][i] = ieee_rand(0,255);
1763            for(i=0; i<(int)sizeof(Dst0); ++i) Dst0[0][i] = 0x5a;
1764    
1765            printf( "\n ===  test YUV ===\n" );
1766    
1767            for(with_flip=0; with_flip<=1; ++with_flip) {
1768    
1769                    init_cpu(&cpu_list[0]);
1770                    TEST_YUYV(yv12_to_yuyv_c, 4, with_flip);
1771                    printf(" yv12_to_yuyv_c %.3f usec       crc32=0x%08x %s\n",
1772                               t, iCrc, (iCrc!=yuv_CRCs[0][with_flip])?"| ERROR": "" );
1773                    TEST_YUYV(yv12_to_uyvy_c, 4, with_flip);
1774                    printf(" yv12_to_uyvy_c %.3f usec       crc32=0x%08x %s\n",
1775                            t, iCrc, (iCrc!=yuv_CRCs[1][with_flip])?"| ERROR": "" );
1776    
1777                    TEST_YUYV(yv12_to_bgra_c, 4, with_flip);
1778                    printf(" yv12_to_bgra_c %.3f usec       crc32=0x%08x %s\n",
1779                            t, iCrc, (iCrc!=yuv_CRCs[2][with_flip])?"| ERROR": "" );
1780    
1781    #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
1782                    init_cpu(&cpu_list[1]);
1783                    TEST_YUYV(yv12_to_yuyv_mmx, 4, with_flip);
1784                    printf(" yv12_to_yuyv_mmx %.3f usec       crc32=0x%08x %s\n",
1785                            t, iCrc, (iCrc!=yuv_CRCs[3][with_flip])?"| ERROR": "" );
1786    
1787                    TEST_YUYV(yv12_to_uyvy_mmx, 4, with_flip);
1788                    printf(" yv12_to_uyvy_mmx %.3f usec       crc32=0x%08x %s\n",
1789                            t, iCrc, (iCrc!=yuv_CRCs[4][with_flip])?"| ERROR": "" );
1790    
1791                    TEST_YUYV(yv12_to_bgra_mmx, 4, with_flip);
1792                    printf(" yv12_to_bgra_mmx %.3f usec       crc32=0x%08x %s\n",
1793                            t, iCrc, (iCrc!=yuv_CRCs[5][with_flip])?"| ERROR": "" );
1794    
1795    #endif
1796    
1797    #ifdef ARCH_IS_PPC
1798                    init_cpu(&cpu_list[1]);
1799                    TEST_YUYV(yv12_to_yuyv_altivec_c, 4, with_flip);
1800                    printf(" yv12_to_yuyv_altivec_c %.3f usec       crc32=0x%08x %s\n",
1801                            t, iCrc, (iCrc!=yuv_CRCs[3][with_flip])?"| ERROR": "" );
1802    
1803                    TEST_YUYV(yv12_to_uyvy_altivec_c, 4, with_flip);
1804                    printf(" yv12_to_uyvy_altivec_c %.3f usec       crc32=0x%08x %s\n",
1805                            t, iCrc, (iCrc!=yuv_CRCs[4][with_flip])?"| ERROR": "" );
1806    
1807                    TEST_YUYV(yv12_to_bgra_altivec_c, 4, with_flip);
1808                    printf(" yv12_to_bgra_altivec_c %.3f usec       crc32=0x%08x %s\n",
1809                            t, iCrc, (iCrc!=yuv_CRCs[5][with_flip])?"| ERROR": "" );
1810    #endif
1811            }
1812            printf( " --- \n" );
1813    }
1814    
1815    #define TEST_YV2(FUNC, WITH_UV, WITH_FLIP)        \
1816    ENTER                               \
1817    for(tst=0; tst<nb_tests; ++tst) (FUNC)(Dst0[0], Dst0[1], Dst0[2], WIDTH, WIDTH, \
1818            Src0[0], (WITH_UV) ? Src0[1] : 0, (WITH_UV) ? Src0[2] : 0,  WIDTH, WIDTH, \
1819            WIDTH-2, HEIGHT-2, WITH_FLIP); \
1820    LEAVE
1821    
1822    #define PRINT_NxN(DATA,W,H,STR)   {   \
1823            int i,j; \
1824            for(j=0; j<(H); ++j) { \
1825                    for(i=0; i<(W); ++i) printf( "0x%.2x ", (DATA)[i+j*(STR)] );\
1826                    printf("\n"); \
1827            } \
1828            printf("---\n"); \
1829    }
1830    
1831    static const int yv12_CRCs[2][2] = {
1832            {0x5cab7cf0,0xdab46541}
1833    ,       {0xe8bae865,0x1faf77b7}
1834    };
1835    
1836    void test_yuv2()
1837    {
1838            const int nb_tests = 800*speed_ref;
1839            CPU *cpu;
1840            uint8_t Src0[3][WIDTH*HEIGHT];
1841            uint8_t Dst0[3][WIDTH*HEIGHT];
1842            int with_uv, with_flip;
1843            int i, j;
1844            double t;
1845            int tst, iCrc;
1846    
1847            colorspace_init();
1848            ieee_reseed(1);
1849            for(i=0; i<(int)sizeof(Src0); ++i) Src0[0][i] = ieee_rand(0,255);
1850    
1851            printf( "\n ===  test YV2 ===\n" );
1852            for(with_flip=0; with_flip<=1; ++with_flip) {
1853                    for(with_uv=0; with_uv<=1; ++with_uv) {
1854                            init_cpu(&cpu_list[0]);
1855                            TEST_YV2(yv12_to_yv12_c, with_uv, with_flip);
1856                            printf(" yv12_to_yv12_c   %.3f usec      \tcrc32=0x%08x %s\n",
1857                                    t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" );
1858                            /* if (!with_uv) PRINT_NxN(Dst0[1], WIDTH/2, HEIGHT/2, WIDTH ); */
1859    
1860    #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
1861                            init_cpu(&cpu_list[1]);
1862                            TEST_YV2(yv12_to_yv12_mmx, with_uv, with_flip);
1863                            printf(" yv12_to_yv12_mmx %.3f usec     \tcrc32=0x%08x %s\n",
1864                                    t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" );
1865                            /* if (!with_uv) PRINT_NxN(Dst0[1], WIDTH/2, HEIGHT/2, WIDTH ); */
1866    
1867                            TEST_YV2(yv12_to_yv12_xmm, with_uv, with_flip);
1868                            printf(" yv12_to_yv12_xmm %.3f usec     \tcrc32=0x%08x %s\n",
1869                                    t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" );
1870    #endif
1871                    }
1872    
1873                    printf( " --- \n" );
1874            }
1875            printf( " ===== \n" );
1876    }
1877    
1878    #undef WIDTH
1879    #undef HEIGHT
1880    #undef ENTER
1881    #undef LEAVE
1882    
1883  /*********************************************************************/  /*********************************************************************/
1884    
1885  static uint32_t __inline log2bin_v1(uint32_t value)  static uint32_t __inline log2bin_v1(uint32_t value)
# Line 1867  Line 2047 
2047  }  }
2048    
2049  /*********************************************************************  /*********************************************************************
2050     * test SSIM functions
2051     *********************************************************************/
2052    
2053    typedef int (*lumfunc)(uint8_t* ptr, int stride);
2054    typedef void (*csfunc)(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2055    
2056    extern int lum_8x8_c(uint8_t* ptr, int stride);
2057    extern int lum_8x8_mmx(uint8_t* ptr, int stride);
2058    extern int lum_2x8_c(uint8_t* ptr, int stride);
2059    extern void consim_c(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2060    extern void consim_mmx(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2061    extern void consim_sse2(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2062    
2063    void test_SSIM()
2064    {
2065            const int nb_tests = 3000*speed_ref;
2066            int tst;
2067            CPU *cpu;
2068            int i;
2069            int devs[3];
2070            long lumo, lumc;
2071            DECLARE_ALIGNED_MATRIX(Ref1, 16, 16, uint8_t, 16);
2072            DECLARE_ALIGNED_MATRIX(Ref2, 16, 16, uint8_t, 16);
2073            lumfunc lum8x8;
2074            lumfunc lum2x8;
2075            csfunc  csim;
2076    
2077            ieee_reseed(1);
2078            printf( "\n ======  test SSIM ======\n" );
2079            for(i=0; i<16*16;++i) {
2080                    long v1, v2;
2081                    v1 = ieee_rand(-256, 511);
2082                    v2 = ieee_rand(-256, 511);
2083                    Ref1[i] = (v1<0) ? 0 : (v1>255) ? 255 : v1;
2084                    Ref2[i] = (v2<0) ? 0 : (v2>255) ? 255 : v2;
2085            }
2086            lumc = ieee_rand(0, 255);
2087            lumo = ieee_rand(0, 255);
2088    
2089            for(cpu = cpu_list; cpu->name!=0; ++cpu)
2090            {
2091                    double t;
2092                    int m;
2093                    if (!init_cpu(cpu))
2094                            continue;
2095                    lum8x8 = lum_8x8_c;
2096                    lum2x8 = lum_2x8_c;
2097                    csim   = consim_c;
2098    #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
2099                    if (cpu->cpu & XVID_CPU_MMX){
2100                            lum8x8 = lum_8x8_mmx;
2101                            csim = consim_mmx;
2102                    }
2103                    if (cpu->cpu & XVID_CPU_MMX){
2104                            csim = consim_sse2;
2105                    }
2106    #endif
2107                    t = gettime_usec();
2108                    emms();
2109                    for(tst=0; tst<nb_tests; ++tst) m = lum8x8(Ref1, 16);
2110                    emms();
2111                    t = (gettime_usec() - t) / nb_tests;
2112                    printf("%s - ssim-lum8x8    %.3f usec       m=%d %s\n",
2113                               cpu->name, t, m,
2114                               (m!=8230)?"| ERROR": "" );
2115    
2116                    t = gettime_usec();
2117                    emms();
2118                    for(tst=0; tst<nb_tests; ++tst) m = lum2x8(Ref1+8, 16);
2119                    emms();
2120                    t = (gettime_usec() - t) / nb_tests;
2121                    printf("%s - ssim-lum2x8    %.3f usec       m=%d %s\n",
2122                               cpu->name, t, m,
2123                               (m!=681)?"| ERROR": "" );
2124    
2125                    t = gettime_usec();
2126                    emms();
2127                    for(tst=0; tst<nb_tests; ++tst) csim(Ref1, Ref2, 16, lumo, lumc, devs+0, devs+1, devs+2);
2128                    emms();
2129                    t = (gettime_usec() - t) / nb_tests;
2130                    printf("%s - ssim-consim    %.3f usec       devs=[0x%x 0x%x 0x%x] %s\n",
2131                               cpu->name, t, devs[0], devs[1], devs[2],
2132                               (devs[0]!=0x1bdf0f || devs[1]!=0x137258 ||  devs[2]!=0xcdb13)?"| ERROR": "" );
2133                    printf( " --- \n" );
2134            }
2135    }
2136    
2137    /*********************************************************************
2138     * test bitstream functions
2139     *********************************************************************/
2140    
2141    #define BIT_BUF_SIZE 2000
2142    
2143    static void test_bits()
2144    {
2145      const int nb_tests = 50*speed_ref;
2146      int tst;
2147      uint32_t Crc;
2148      uint8_t Buf[BIT_BUF_SIZE];
2149      uint32_t Extracted[BIT_BUF_SIZE*8]; /* worst case: bits read 1 by 1 */
2150      int Lens[BIT_BUF_SIZE*8];
2151      double t1;
2152    
2153    
2154      printf( "\n ===  test bitstream ===\n" );
2155      ieee_reseed(1);
2156      Crc = 0;
2157    
2158      t1 = gettime_usec();
2159      for(tst=0; tst<nb_tests; ++tst) {
2160            Bitstream bs;
2161            int m, m2, l, l2;
2162    
2163            for(l=0; l<BIT_BUF_SIZE; ++l)
2164                    Buf[l] = (uint8_t)ieee_rand(0,255);
2165    
2166            l = BIT_BUF_SIZE - ieee_rand(1,BIT_BUF_SIZE/10);
2167            BitstreamInit(&bs, (void*)(Buf+BIT_BUF_SIZE-l), l);
2168    
2169    
2170            BitstreamReset(&bs);
2171            for(l2=l*8, m=0; l2>0; m++) {
2172                    const int b = ieee_rand(1,32);
2173                    Lens[m] = b;
2174                    l2 -= b;
2175                    if (l2<0) break;
2176                    Extracted[m] = BitstreamShowBits(&bs, b);
2177                    BitstreamSkip(&bs, b);
2178    //              printf( "<= %d: %d 0x%x\n", m, b, Extracted[m]);
2179            }
2180    
2181            BitstreamReset(&bs);
2182            for(m2=0; m2<m; ++m2) {
2183                    const int b = Lens[m2];
2184                    const uint32_t v = BitstreamGetBits(&bs, b);
2185                    Crc |= (v!=Extracted[m2]);
2186    //              printf( "=> %d: %d 0x%x %c\n", m2, b, v, " *"[Crc]);
2187            }
2188      }
2189      t1 = (gettime_usec() - t1) / nb_tests;
2190      printf(" test_bits   %.3f usec   %s\n", t1, (Crc!=0)?"| ERROR": "" );
2191    }
2192    
2193    /*********************************************************************
2194   * main   * main
2195   *********************************************************************/   *********************************************************************/
2196    
# Line 1882  Line 2206 
2206          int width, height;          int width, height;
2207          uint32_t chksum = 0;          uint32_t chksum = 0;
2208    const char * test_bitstream = 0;    const char * test_bitstream = 0;
2209    #if defined(WIN32) && defined(ARCH_IS_X86_64)
2210            DECLARE_ALIGNED_MATRIX(xmm_save, 2, 4, uint64_t, 16);
2211            // assumes xmm6 and xmm7 won't be falsely preserved by C code
2212            for(c=0;c<4;c++)
2213                    xmm_save[c] = read_counter();
2214            prime_xmm(xmm_save);
2215    #endif
2216    
2217          cpu_mask = 0;  // default => will use autodectect          cpu_mask = 0;  // default => will use autodectect
2218          for(c=1; c<argc; ++c)          for(c=1; c<argc; ++c)
# Line 1891  Line 2222 
2222            else if (!strcmp(argv[c], "-mmx"))    cpu_mask = XVID_CPU_MMX    | XVID_CPU_FORCE;            else if (!strcmp(argv[c], "-mmx"))    cpu_mask = XVID_CPU_MMX    | XVID_CPU_FORCE;
2223            else if (!strcmp(argv[c], "-mmxext")) cpu_mask = XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;            else if (!strcmp(argv[c], "-mmxext")) cpu_mask = XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;
2224            else if (!strcmp(argv[c], "-sse2"))   cpu_mask = XVID_CPU_SSE2   | XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;            else if (!strcmp(argv[c], "-sse2"))   cpu_mask = XVID_CPU_SSE2   | XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;
2225              else if (!strcmp(argv[c], "-sse3"))   cpu_mask = XVID_CPU_SSE3   | XVID_CPU_SSE2 | XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;
2226              else if (!strcmp(argv[c], "-sse4"))   cpu_mask = XVID_CPU_SSE41  | XVID_CPU_SSE3 | XVID_CPU_SSE2 | XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;
2227            else if (!strcmp(argv[c], "-3dnow"))  cpu_mask = XVID_CPU_3DNOW  | XVID_CPU_FORCE;            else if (!strcmp(argv[c], "-3dnow"))  cpu_mask = XVID_CPU_3DNOW  | XVID_CPU_FORCE;
2228            else if (!strcmp(argv[c], "-3dnowe")) cpu_mask = XVID_CPU_3DNOW  | XVID_CPU_3DNOWEXT | XVID_CPU_FORCE;            else if (!strcmp(argv[c], "-3dnowe")) cpu_mask = XVID_CPU_3DNOW  | XVID_CPU_3DNOWEXT | XVID_CPU_FORCE;
2229            else if (!strcmp(argv[c], "-altivec")) cpu_mask = XVID_CPU_ALTIVEC | XVID_CPU_FORCE;            else if (!strcmp(argv[c], "-altivec")) cpu_mask = XVID_CPU_ALTIVEC | XVID_CPU_FORCE;
# Line 1935  Line 2268 
2268          if (what==0 || what==11) test_log2bin();          if (what==0 || what==11) test_log2bin();
2269          if (what==0 || what==12) test_gcd();          if (what==0 || what==12) test_gcd();
2270          if (what==0 || what==13) test_compiler();          if (what==0 || what==13) test_compiler();
2271            if (what==0 || what==14) test_yuv();
2272            if (what==0 || what==15) test_SSIM();
2273            if (what==0 || what==16) test_yuv2();
2274            if (what==0 || what==17) test_bits();
2275    
2276          if (what==7) {          if (what==7) {
2277                  test_IEEE1180_compliance(-256, 255, 1);                  test_IEEE1180_compliance(-256, 255, 1);
# Line 1956  Line 2292 
2292          if (what==-2)          if (what==-2)
2293                  test_quant_bug();                  test_quant_bug();
2294    
2295    #if defined(WIN32) && defined(ARCH_IS_X86_64)
2296            get_xmm(xmm_save+4);
2297            if (memcmp(xmm_save, xmm_save+4, 4*sizeof(int64_t))) {
2298                    printf("\nWIN64 ERROR: XMM6 and XMM7 contents not preserved!\n"
2299                           "        XMM6                             XMM7\n"
2300                           "Before: %.16I64X%.16I64X %.16I64X%.16I64X\n"
2301                           "After:  %.16I64X%.16I64X %.16I64X%.16I64X",
2302                            xmm_save[0],xmm_save[1],xmm_save[2],xmm_save[3],
2303                            xmm_save[4],xmm_save[5],xmm_save[6],xmm_save[7]);
2304            } else {
2305                    printf("\nWIN64: XMM6 and XMM7 contents preserved correctly.\n");
2306            }
2307    #endif
2308    
2309          if ((what >= 0 && what <= 6) || what == 10) {          if ((what >= 0 && what <= 6) || what == 10) {
2310                  printf("\n\n"                  printf("\n\n"
2311                             "NB: If a function isn't optimised for a specific set of intructions,\n"                             "NB: If a function isn't optimised for a specific set of intructions,\n"
# Line 1963  Line 2313 
2313                             "    may appear to be slow.\n");                             "    may appear to be slow.\n");
2314          }          }
2315    
2316  #ifdef ARCH_IS_IA32  #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
2317          if (what == 0 || what == 5) {          if (what == 0 || what == 5) {
2318                  printf("\n"                  printf("\n"
2319                             "NB: MMX mpeg4 quantization is known to have very small errors (+/-1 magnitude)\n"                             "NB: MMX mpeg4 quantization is known to have very small errors (+/-1 magnitude)\n"

Legend:
Removed from v.1652  
changed lines
  Added in v.1988

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