35 |
|
|
36 |
#include <stdio.h> |
#include <stdio.h> |
37 |
#include <stdlib.h> |
#include <stdlib.h> |
|
#ifdef WIN32 |
|
|
#include <time.h> /* for clock */ |
|
|
#else |
|
|
#include <sys/time.h> /* for gettimeofday */ |
|
|
#endif |
|
38 |
#include <string.h> /* for memset */ |
#include <string.h> /* for memset */ |
39 |
#include <assert.h> |
#include <assert.h> |
40 |
|
|
41 |
|
#ifndef WIN32 |
42 |
|
#include <sys/time.h> /* for gettimeofday */ |
43 |
|
#else |
44 |
|
#include <time.h> |
45 |
|
#endif |
46 |
|
|
47 |
|
|
48 |
#include "xvid.h" |
#include "xvid.h" |
49 |
|
|
50 |
/* inner guts */ |
// inner guts |
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" |
62 |
#include "bitstream/cbp.h" |
#include "bitstream/cbp.h" |
63 |
|
|
64 |
#include <math.h> |
#include <math.h> |
65 |
|
|
66 |
#ifndef M_PI |
#ifndef M_PI |
67 |
# define M_PI 3.14159265359 |
#define M_PI 3.14159265358979323846 |
|
# define M_PI_2 1.5707963268 |
|
68 |
#endif |
#endif |
69 |
|
|
70 |
const int speed_ref = 100; /* on slow machines, decrease this value */ |
const int speed_ref = 100; /* on slow machines, decrease this value */ |
71 |
|
|
72 |
/********************************************************************* |
/********************************************************************* |
76 |
/* returns time in micro-s*/ |
/* returns time in micro-s*/ |
77 |
double gettime_usec() |
double gettime_usec() |
78 |
{ |
{ |
79 |
#ifdef WIN32 |
#ifndef WIN32 |
|
return clock()*1000; |
|
|
#else |
|
80 |
struct timeval tv; |
struct timeval tv; |
81 |
gettimeofday(&tv, 0); |
gettimeofday(&tv, 0); |
82 |
return tv.tv_sec*1.0e6 + tv.tv_usec; |
return tv.tv_sec*1.0e6 + tv.tv_usec; |
83 |
|
#else |
84 |
|
clock_t clk; |
85 |
|
clk = clock(); |
86 |
|
return clk * 1000000 / CLOCKS_PER_SEC; |
87 |
#endif |
#endif |
88 |
} |
} |
89 |
|
|
120 |
, { "3DNOW ", XVID_CPU_3DNOW } |
, { "3DNOW ", XVID_CPU_3DNOW } |
121 |
, { "3DNOWE", XVID_CPU_3DNOWEXT } |
, { "3DNOWE", XVID_CPU_3DNOWEXT } |
122 |
, { "IA64 ", XVID_CPU_IA64 } |
, { "IA64 ", XVID_CPU_IA64 } |
123 |
/*, { "TSC ", XVID_CPU_TSC } */ |
//, { "TSC ", XVID_CPU_TSC } |
124 |
, { 0, 0 } } |
, { 0, 0 } } |
125 |
|
|
126 |
, cpu_short_list[] = |
, cpu_short_list[] = |
127 |
{ { "PLAINC", 0 } |
{ { "PLAINC", 0 } |
128 |
, { "MMX ", XVID_CPU_MMX } |
, { "MMX ", XVID_CPU_MMX } |
129 |
/*, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } */ |
//, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } |
130 |
, { "IA64 ", XVID_CPU_IA64 } |
, { "IA64 ", XVID_CPU_IA64 } |
131 |
, { 0, 0 } } |
, { 0, 0 } } |
132 |
|
|
474 |
TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2); |
TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2); |
475 |
printf( "%s - 8to16sub2 %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - 8to16sub2 %.3f usec crc=%d\n", cpu->name, t, s ); |
476 |
if (s!=20384) printf( "*** CRC ERROR! ***\n" ); |
if (s!=20384) printf( "*** CRC ERROR! ***\n" ); |
477 |
/* for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]); */ |
// for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]); |
478 |
/* printf("\n"); */ |
// printf("\n"); |
479 |
#endif |
#endif |
480 |
printf( " --- \n" ); |
printf( " --- \n" ); |
481 |
} |
} |
772 |
} |
} |
773 |
} |
} |
774 |
|
|
775 |
/*//////////////////////////////////////////////////////// */ |
///* ////////////////////////////////////////////////////// */ |
776 |
/* Pseudo-random generator specified by IEEE 1180 */ |
/* Pseudo-random generator specified by IEEE 1180 */ |
777 |
|
|
778 |
static long ieee_seed = 1; |
static long ieee_seed = 1; |
915 |
|
|
916 |
|
|
917 |
printf( "\n -- FDCT report --\n" ); |
printf( "\n -- FDCT report --\n" ); |
918 |
/* print_stats(&FStats); */ |
// print_stats(&FStats); |
919 |
report_stats(&FStats, 0); /* so far I know, IEEE1180 says nothing for fdct */ |
report_stats(&FStats, 0); /* so far I know, IEEE1180 says nothing for fdct */ |
920 |
|
|
921 |
for(i=0; i<64; i++) Blk[i] = 0; |
for(i=0; i<64; i++) Blk[i] = 0; |
924 |
printf( "FDCT(0) == 0 ? %s\n", (m!=0) ? "NOPE!" : "yup." ); |
printf( "FDCT(0) == 0 ? %s\n", (m!=0) ? "NOPE!" : "yup." ); |
925 |
|
|
926 |
printf( "\n -- IDCT report --\n" ); |
printf( "\n -- IDCT report --\n" ); |
927 |
/* print_stats(&IStats); */ |
// print_stats(&IStats); |
928 |
report_stats(&IStats, ILimits); |
report_stats(&IStats, ILimits); |
929 |
|
|
930 |
|
|
942 |
|
|
943 |
int i, n, p; |
int i, n, p; |
944 |
CPU *cpu; |
CPU *cpu; |
945 |
/* const short IDCT_MAX = 2047; // 12bits input */ |
// const short IDCT_MAX = 2047; /* 12bits input */ |
946 |
/* const short IDCT_MIN = -2048; */ |
// const short IDCT_MIN = -2048; |
947 |
/* const short IDCT_OUT = 256; // 9bits ouput */ |
// const short IDCT_OUT = 256; /* 9bits ouput */ |
948 |
const int Partitions = 4; |
const int Partitions = 4; |
949 |
const int Loops = 10000 / Partitions; |
const int Loops = 10000 / Partitions; |
950 |
|
|
992 |
report_stats(&Stats, 0); |
report_stats(&Stats, 0); |
993 |
|
|
994 |
|
|
995 |
/* IDCT tests */ |
/* IDCT tests // */ |
996 |
#if 0 |
#if 0 |
997 |
/* no finished yet */ |
/* no finished yet */ |
998 |
|
|