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.33 2006-10-30 11:21:42 Skal Exp $ |
* $Id: xvid_bench.c,v 1.38.2.1 2008-12-02 14:00:09 Isibaar Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
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" |
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 |
|
|
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 |
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; |
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])); \ |
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); \ |
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); |
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)) |
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", |
1731 |
t = (gettime_usec() - t) / nb_tests; \ |
t = (gettime_usec() - t) / nb_tests; \ |
1732 |
iCrc = calc_crc((uint8_t*)Dst0, sizeof(Dst0), CRC32_INITIAL) |
iCrc = calc_crc((uint8_t*)Dst0, sizeof(Dst0), CRC32_INITIAL) |
1733 |
|
|
1734 |
#define TEST_YUYV(FUNC, S) \ |
#define TEST_YUYV(FUNC, S, FLIP) \ |
1735 |
ENTER \ |
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, 0); \ |
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 |
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 |
#define WIDTH 128 |
1749 |
#define HEIGHT 32 |
#define HEIGHT 32 |
1750 |
void test_yuv() |
void test_yuv() |
1753 |
CPU *cpu; |
CPU *cpu; |
1754 |
uint8_t Src0[3][WIDTH*HEIGHT]; |
uint8_t Src0[3][WIDTH*HEIGHT]; |
1755 |
uint8_t Dst0[4][WIDTH*HEIGHT]; |
uint8_t Dst0[4][WIDTH*HEIGHT]; |
1756 |
int i, j; |
int i, j, with_flip; |
1757 |
double t; |
double t; |
1758 |
int tst, iCrc; |
int tst, iCrc; |
1759 |
|
|
1764 |
|
|
1765 |
printf( "\n === test YUV ===\n" ); |
printf( "\n === test YUV ===\n" ); |
1766 |
|
|
1767 |
|
for(with_flip=0; with_flip<=1; ++with_flip) { |
1768 |
|
|
1769 |
init_cpu(&cpu_list[0]); |
init_cpu(&cpu_list[0]); |
1770 |
TEST_YUYV(yv12_to_yuyv_c, 4); |
TEST_YUYV(yv12_to_yuyv_c, 4, with_flip); |
1771 |
printf(" yv12_to_yuyv_c %.3f usec crc32=0x%08x %s\n", |
printf(" yv12_to_yuyv_c %.3f usec crc32=0x%08x %s\n", |
1772 |
t, iCrc, (iCrc!=0xeb1a0b0a)?"| ERROR": "" ); |
t, iCrc, (iCrc!=yuv_CRCs[0][with_flip])?"| ERROR": "" ); |
1773 |
TEST_YUYV(yv12_to_uyvy_c, 4); |
TEST_YUYV(yv12_to_uyvy_c, 4, with_flip); |
1774 |
printf(" yv12_to_uyvy_c %.3f usec crc32=0x%08x %s\n", |
printf(" yv12_to_uyvy_c %.3f usec crc32=0x%08x %s\n", |
1775 |
t, iCrc, (iCrc!=0x6e82f55b)?"| ERROR": "" ); |
t, iCrc, (iCrc!=yuv_CRCs[1][with_flip])?"| ERROR": "" ); |
1776 |
|
|
1777 |
#ifdef ARCH_IS_IA32 |
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]); |
init_cpu(&cpu_list[1]); |
1783 |
TEST_YUYV(yv12_to_yuyv_mmx, 4); |
TEST_YUYV(yv12_to_yuyv_mmx, 4, with_flip); |
1784 |
printf(" yv12_to_yuyv_mmx %.3f usec crc32=0x%08x %s\n", |
printf(" yv12_to_yuyv_mmx %.3f usec crc32=0x%08x %s\n", |
1785 |
t, iCrc, (iCrc!=0xeb1a0b0a)?"| ERROR": "" ); |
t, iCrc, (iCrc!=yuv_CRCs[3][with_flip])?"| ERROR": "" ); |
1786 |
|
|
1787 |
TEST_YUYV(yv12_to_uyvy_mmx, 4); |
TEST_YUYV(yv12_to_uyvy_mmx, 4, with_flip); |
1788 |
printf(" yv12_to_uyvy_mmx %.3f usec crc32=0x%08x %s\n", |
printf(" yv12_to_uyvy_mmx %.3f usec crc32=0x%08x %s\n", |
1789 |
t, iCrc, (iCrc!=0x6e82f55b)?"| ERROR": "" ); |
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 |
#endif |
1796 |
|
|
1797 |
#ifdef ARCH_IS_PPC |
#ifdef ARCH_IS_PPC |
1798 |
init_cpu(&cpu_list[1]); |
init_cpu(&cpu_list[1]); |
1799 |
TEST_YUYV(yv12_to_yuyv_altivec_c, 4); |
TEST_YUYV(yv12_to_yuyv_altivec_c, 4, with_flip); |
1800 |
printf(" yv12_to_yuyv_altivec_c %.3f usec crc32=0x%08x %s\n", |
printf(" yv12_to_yuyv_altivec_c %.3f usec crc32=0x%08x %s\n", |
1801 |
t, iCrc, (iCrc!=0xeb1a0b0a)?"| ERROR": "" ); |
t, iCrc, (iCrc!=yuv_CRCs[3][with_flip])?"| ERROR": "" ); |
1802 |
|
|
1803 |
TEST_YUYV(yv12_to_uyvy_altivec_c, 4); |
TEST_YUYV(yv12_to_uyvy_altivec_c, 4, with_flip); |
1804 |
printf(" yv12_to_uyvy_altivec_c %.3f usec crc32=0x%08x %s\n", |
printf(" yv12_to_uyvy_altivec_c %.3f usec crc32=0x%08x %s\n", |
1805 |
t, iCrc, (iCrc!=0x6e82f55b)?"| ERROR": "" ); |
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 |
#endif |
1811 |
|
} |
1812 |
printf( " --- \n" ); |
printf( " --- \n" ); |
1813 |
} |
} |
1814 |
|
|
1857 |
t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" ); |
t, iCrc, (iCrc!=yv12_CRCs[with_flip][with_uv])?"| ERROR": "" ); |
1858 |
/* if (!with_uv) PRINT_NxN(Dst0[1], WIDTH/2, HEIGHT/2, WIDTH ); */ |
/* if (!with_uv) PRINT_NxN(Dst0[1], WIDTH/2, HEIGHT/2, WIDTH ); */ |
1859 |
|
|
1860 |
#ifdef ARCH_IS_IA32 |
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
1861 |
init_cpu(&cpu_list[1]); |
init_cpu(&cpu_list[1]); |
1862 |
TEST_YV2(yv12_to_yv12_mmx, with_uv, with_flip); |
TEST_YV2(yv12_to_yv12_mmx, with_uv, with_flip); |
1863 |
printf(" yv12_to_yv12_mmx %.3f usec \tcrc32=0x%08x %s\n", |
printf(" yv12_to_yv12_mmx %.3f usec \tcrc32=0x%08x %s\n", |
2045 |
printf( "ERROR! please post your platform/compiler specs to xvid-devel@xvid.org !\n" ); |
printf( "ERROR! please post your platform/compiler specs to xvid-devel@xvid.org !\n" ); |
2046 |
} |
} |
2047 |
} |
} |
2048 |
|
|
2049 |
/********************************************************************* |
/********************************************************************* |
2050 |
* test SSIM functions |
* test SSIM functions |
2051 |
*********************************************************************/ |
*********************************************************************/ |
2095 |
lum8x8 = lum_8x8_c; |
lum8x8 = lum_8x8_c; |
2096 |
lum2x8 = lum_2x8_c; |
lum2x8 = lum_2x8_c; |
2097 |
csim = consim_c; |
csim = consim_c; |
2098 |
|
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
2099 |
if (cpu->cpu & XVID_CPU_MMX){ |
if (cpu->cpu & XVID_CPU_MMX){ |
2100 |
lum8x8 = lum_8x8_mmx; |
lum8x8 = lum_8x8_mmx; |
2101 |
csim = consim_mmx; |
csim = consim_mmx; |
2103 |
if (cpu->cpu & XVID_CPU_MMX){ |
if (cpu->cpu & XVID_CPU_MMX){ |
2104 |
csim = consim_sse2; |
csim = consim_sse2; |
2105 |
} |
} |
2106 |
|
#endif |
2107 |
t = gettime_usec(); |
t = gettime_usec(); |
2108 |
emms(); |
emms(); |
2109 |
for(tst=0; tst<nb_tests; ++tst) m = lum8x8(Ref1, 16); |
for(tst=0; tst<nb_tests; ++tst) m = lum8x8(Ref1, 16); |
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 |
|
|
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) |
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; |
2271 |
if (what==0 || what==14) test_yuv(); |
if (what==0 || what==14) test_yuv(); |
2272 |
if (what==0 || what==15) test_SSIM(); |
if (what==0 || what==15) test_SSIM(); |
2273 |
if (what==0 || what==16) test_yuv2(); |
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); |
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" |
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" |