[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 2021, Wed Jul 6 10:25:14 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    #endif
1807            }
1808            printf( " --- \n" );
1809    }
1810    
1811    #define TEST_YV2(FUNC, WITH_UV, WITH_FLIP)        \
1812    ENTER                               \
1813    for(tst=0; tst<nb_tests; ++tst) (FUNC)(Dst0[0], Dst0[1], Dst0[2], WIDTH, WIDTH, \
1814            Src0[0], (WITH_UV) ? Src0[1] : 0, (WITH_UV) ? Src0[2] : 0,  WIDTH, WIDTH, \
1815            WIDTH-2, HEIGHT-2, WITH_FLIP); \
1816    LEAVE
1817    
1818    #define PRINT_NxN(DATA,W,H,STR)   {   \
1819            int i,j; \
1820            for(j=0; j<(H); ++j) { \
1821                    for(i=0; i<(W); ++i) printf( "0x%.2x ", (DATA)[i+j*(STR)] );\
1822                    printf("\n"); \
1823            } \
1824            printf("---\n"); \
1825    }
1826    
1827    static const int yv12_CRCs[2][2] = {
1828            {0x5cab7cf0,0xdab46541}
1829    ,       {0xe8bae865,0x1faf77b7}
1830    };
1831    
1832    void test_yuv2()
1833    {
1834            const int nb_tests = 800*speed_ref;
1835            CPU *cpu;
1836            uint8_t Src0[3][WIDTH*HEIGHT];
1837            uint8_t Dst0[3][WIDTH*HEIGHT];
1838            int with_uv, with_flip;
1839            int i, j;
1840            double t;
1841            int tst, iCrc;
1842    
1843            colorspace_init();
1844            ieee_reseed(1);
1845            for(i=0; i<(int)sizeof(Src0); ++i) Src0[0][i] = ieee_rand(0,255);
1846    
1847            printf( "\n ===  test YV2 ===\n" );
1848            for(with_flip=0; with_flip<=1; ++with_flip) {
1849                    for(with_uv=0; with_uv<=1; ++with_uv) {
1850                            init_cpu(&cpu_list[0]);
1851                            TEST_YV2(yv12_to_yv12_c, with_uv, with_flip);
1852                            printf(" yv12_to_yv12_c   %.3f usec      \tcrc32=0x%08x %s\n",
1853                                    t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" );
1854                            /* if (!with_uv) PRINT_NxN(Dst0[1], WIDTH/2, HEIGHT/2, WIDTH ); */
1855    
1856    #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
1857                            init_cpu(&cpu_list[1]);
1858                            TEST_YV2(yv12_to_yv12_mmx, with_uv, with_flip);
1859                            printf(" yv12_to_yv12_mmx %.3f usec     \tcrc32=0x%08x %s\n",
1860                                    t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" );
1861                            /* if (!with_uv) PRINT_NxN(Dst0[1], WIDTH/2, HEIGHT/2, WIDTH ); */
1862    
1863                            TEST_YV2(yv12_to_yv12_xmm, with_uv, with_flip);
1864                            printf(" yv12_to_yv12_xmm %.3f usec     \tcrc32=0x%08x %s\n",
1865                                    t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" );
1866    #endif
1867                    }
1868    
1869                    printf( " --- \n" );
1870            }
1871            printf( " ===== \n" );
1872    }
1873    
1874    #undef WIDTH
1875    #undef HEIGHT
1876    #undef ENTER
1877    #undef LEAVE
1878    
1879  /*********************************************************************/  /*********************************************************************/
1880    
1881  static uint32_t __inline log2bin_v1(uint32_t value)  static uint32_t __inline log2bin_v1(uint32_t value)
# Line 1867  Line 2043 
2043  }  }
2044    
2045  /*********************************************************************  /*********************************************************************
2046     * test SSIM functions
2047     *********************************************************************/
2048    
2049    typedef int (*lumfunc)(uint8_t* ptr, int stride);
2050    typedef void (*csfunc)(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2051    
2052    extern int lum_8x8_c(uint8_t* ptr, int stride);
2053    extern int lum_8x8_mmx(uint8_t* ptr, int stride);
2054    extern int lum_2x8_c(uint8_t* ptr, int stride);
2055    extern void consim_c(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2056    extern void consim_mmx(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2057    extern void consim_sse2(uint8_t* ptro, uint8_t* ptrc, int stride, int lumo, int lumc, int* pdevo, int* pdevc, int* pcorr);
2058    
2059    void test_SSIM()
2060    {
2061            const int nb_tests = 3000*speed_ref;
2062            int tst;
2063            CPU *cpu;
2064            int i;
2065            int devs[3];
2066            long lumo, lumc;
2067            DECLARE_ALIGNED_MATRIX(Ref1, 16, 16, uint8_t, 16);
2068            DECLARE_ALIGNED_MATRIX(Ref2, 16, 16, uint8_t, 16);
2069            lumfunc lum8x8;
2070            lumfunc lum2x8;
2071            csfunc  csim;
2072    
2073            ieee_reseed(1);
2074            printf( "\n ======  test SSIM ======\n" );
2075            for(i=0; i<16*16;++i) {
2076                    long v1, v2;
2077                    v1 = ieee_rand(-256, 511);
2078                    v2 = ieee_rand(-256, 511);
2079                    Ref1[i] = (v1<0) ? 0 : (v1>255) ? 255 : v1;
2080                    Ref2[i] = (v2<0) ? 0 : (v2>255) ? 255 : v2;
2081            }
2082            lumc = ieee_rand(0, 255);
2083            lumo = ieee_rand(0, 255);
2084    
2085            for(cpu = cpu_list; cpu->name!=0; ++cpu)
2086            {
2087                    double t;
2088                    int m;
2089                    if (!init_cpu(cpu))
2090                            continue;
2091                    lum8x8 = lum_8x8_c;
2092                    lum2x8 = lum_2x8_c;
2093                    csim   = consim_c;
2094    #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
2095                    if (cpu->cpu & XVID_CPU_MMX){
2096                            lum8x8 = lum_8x8_mmx;
2097                            csim = consim_mmx;
2098                    }
2099                    if (cpu->cpu & XVID_CPU_MMX){
2100                            csim = consim_sse2;
2101                    }
2102    #endif
2103                    t = gettime_usec();
2104                    emms();
2105                    for(tst=0; tst<nb_tests; ++tst) m = lum8x8(Ref1, 16);
2106                    emms();
2107                    t = (gettime_usec() - t) / nb_tests;
2108                    printf("%s - ssim-lum8x8    %.3f usec       m=%d %s\n",
2109                               cpu->name, t, m,
2110                               (m!=8230)?"| ERROR": "" );
2111    
2112                    t = gettime_usec();
2113                    emms();
2114                    for(tst=0; tst<nb_tests; ++tst) m = lum2x8(Ref1+8, 16);
2115                    emms();
2116                    t = (gettime_usec() - t) / nb_tests;
2117                    printf("%s - ssim-lum2x8    %.3f usec       m=%d %s\n",
2118                               cpu->name, t, m,
2119                               (m!=681)?"| ERROR": "" );
2120    
2121                    t = gettime_usec();
2122                    emms();
2123                    for(tst=0; tst<nb_tests; ++tst) csim(Ref1, Ref2, 16, lumo, lumc, devs+0, devs+1, devs+2);
2124                    emms();
2125                    t = (gettime_usec() - t) / nb_tests;
2126                    printf("%s - ssim-consim    %.3f usec       devs=[0x%x 0x%x 0x%x] %s\n",
2127                               cpu->name, t, devs[0], devs[1], devs[2],
2128                               (devs[0]!=0x1bdf0f || devs[1]!=0x137258 ||  devs[2]!=0xcdb13)?"| ERROR": "" );
2129                    printf( " --- \n" );
2130            }
2131    }
2132    
2133    /*********************************************************************
2134     * test bitstream functions
2135     *********************************************************************/
2136    
2137    #define BIT_BUF_SIZE 2000
2138    
2139    static void test_bits()
2140    {
2141      const int nb_tests = 50*speed_ref;
2142      int tst;
2143      uint32_t Crc;
2144      uint8_t Buf[BIT_BUF_SIZE];
2145      uint32_t Extracted[BIT_BUF_SIZE*8]; /* worst case: bits read 1 by 1 */
2146      int Lens[BIT_BUF_SIZE*8];
2147      double t1;
2148    
2149    
2150      printf( "\n ===  test bitstream ===\n" );
2151      ieee_reseed(1);
2152      Crc = 0;
2153    
2154      t1 = gettime_usec();
2155      for(tst=0; tst<nb_tests; ++tst) {
2156            Bitstream bs;
2157            int m, m2, l, l2;
2158    
2159            for(l=0; l<BIT_BUF_SIZE; ++l)
2160                    Buf[l] = (uint8_t)ieee_rand(0,255);
2161    
2162            l = BIT_BUF_SIZE - ieee_rand(1,BIT_BUF_SIZE/10);
2163            BitstreamInit(&bs, (void*)(Buf+BIT_BUF_SIZE-l), l);
2164    
2165    
2166            BitstreamReset(&bs);
2167            for(l2=l*8, m=0; l2>0; m++) {
2168                    const int b = ieee_rand(1,32);
2169                    Lens[m] = b;
2170                    l2 -= b;
2171                    if (l2<0) break;
2172                    Extracted[m] = BitstreamShowBits(&bs, b);
2173                    BitstreamSkip(&bs, b);
2174    //              printf( "<= %d: %d 0x%x\n", m, b, Extracted[m]);
2175            }
2176    
2177            BitstreamReset(&bs);
2178            for(m2=0; m2<m; ++m2) {
2179                    const int b = Lens[m2];
2180                    const uint32_t v = BitstreamGetBits(&bs, b);
2181                    Crc |= (v!=Extracted[m2]);
2182    //              printf( "=> %d: %d 0x%x %c\n", m2, b, v, " *"[Crc]);
2183            }
2184      }
2185      t1 = (gettime_usec() - t1) / nb_tests;
2186      printf(" test_bits   %.3f usec   %s\n", t1, (Crc!=0)?"| ERROR": "" );
2187    }
2188    
2189    /*********************************************************************
2190   * main   * main
2191   *********************************************************************/   *********************************************************************/
2192    
# Line 1882  Line 2202 
2202          int width, height;          int width, height;
2203          uint32_t chksum = 0;          uint32_t chksum = 0;
2204    const char * test_bitstream = 0;    const char * test_bitstream = 0;
2205    #if defined(WIN32) && defined(ARCH_IS_X86_64)
2206            DECLARE_ALIGNED_MATRIX(xmm_save, 2, 4, uint64_t, 16);
2207            // assumes xmm6 and xmm7 won't be falsely preserved by C code
2208            for(c=0;c<4;c++)
2209                    xmm_save[c] = read_counter();
2210            prime_xmm(xmm_save);
2211    #endif
2212    
2213          cpu_mask = 0;  // default => will use autodectect          cpu_mask = 0;  // default => will use autodectect
2214          for(c=1; c<argc; ++c)          for(c=1; c<argc; ++c)
# Line 1891  Line 2218 
2218            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;
2219            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;
2220            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;
2221              else if (!strcmp(argv[c], "-sse3"))   cpu_mask = XVID_CPU_SSE3   | XVID_CPU_SSE2 | XVID_CPU_MMXEXT | XVID_CPU_MMX | XVID_CPU_FORCE;
2222              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;
2223            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;
2224            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;
2225            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 2264 
2264          if (what==0 || what==11) test_log2bin();          if (what==0 || what==11) test_log2bin();
2265          if (what==0 || what==12) test_gcd();          if (what==0 || what==12) test_gcd();
2266          if (what==0 || what==13) test_compiler();          if (what==0 || what==13) test_compiler();
2267            if (what==0 || what==14) test_yuv();
2268            if (what==0 || what==15) test_SSIM();
2269            if (what==0 || what==16) test_yuv2();
2270            if (what==0 || what==17) test_bits();
2271    
2272          if (what==7) {          if (what==7) {
2273                  test_IEEE1180_compliance(-256, 255, 1);                  test_IEEE1180_compliance(-256, 255, 1);
# Line 1956  Line 2288 
2288          if (what==-2)          if (what==-2)
2289                  test_quant_bug();                  test_quant_bug();
2290    
2291    #if defined(WIN32) && defined(ARCH_IS_X86_64)
2292            get_xmm(xmm_save+4);
2293            if (memcmp(xmm_save, xmm_save+4, 4*sizeof(int64_t))) {
2294                    printf("\nWIN64 ERROR: XMM6 and XMM7 contents not preserved!\n"
2295                           "        XMM6                             XMM7\n"
2296                           "Before: %.16I64X%.16I64X %.16I64X%.16I64X\n"
2297                           "After:  %.16I64X%.16I64X %.16I64X%.16I64X",
2298                            xmm_save[0],xmm_save[1],xmm_save[2],xmm_save[3],
2299                            xmm_save[4],xmm_save[5],xmm_save[6],xmm_save[7]);
2300            } else {
2301                    printf("\nWIN64: XMM6 and XMM7 contents preserved correctly.\n");
2302            }
2303    #endif
2304    
2305          if ((what >= 0 && what <= 6) || what == 10) {          if ((what >= 0 && what <= 6) || what == 10) {
2306                  printf("\n\n"                  printf("\n\n"
2307                             "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 2309 
2309                             "    may appear to be slow.\n");                             "    may appear to be slow.\n");
2310          }          }
2311    
2312  #ifdef ARCH_IS_IA32  #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
2313          if (what == 0 || what == 5) {          if (what == 0 || what == 5) {
2314                  printf("\n"                  printf("\n"
2315                             "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.2021

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