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.9.2.5 2003-10-09 18:50:22 edgomez Exp $ |
* $Id: xvid_bench.c,v 1.9.2.7 2003-11-03 19:58:16 edgomez Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
145 |
|
|
146 |
int init_cpu(CPU *cpu) |
int init_cpu(CPU *cpu) |
147 |
{ |
{ |
148 |
int xerr, cpu_type; |
xvid_gbl_info_t xinfo; |
149 |
xvid_gbl_init_t xinit; |
|
150 |
|
/* Get the available CPU flags */ |
151 |
|
memset(&xinfo, 0, sizeof(xinfo)); |
152 |
|
xinfo.version = XVID_VERSION; |
153 |
|
xvid_global(NULL, XVID_GBL_INFO, &xinfo, NULL); |
154 |
|
|
155 |
|
/* Are we trying to test a subset of the host CPU features */ |
156 |
|
if ((xinfo.cpu_flags & cpu->cpu) == cpu->cpu) { |
157 |
|
int xerr; |
158 |
|
xvid_gbl_init_t xinit; |
159 |
memset(&xinit, 0, sizeof(xinit)); |
memset(&xinit, 0, sizeof(xinit)); |
160 |
xinit.cpu_flags = cpu->cpu | XVID_CPU_FORCE; |
xinit.cpu_flags = cpu->cpu | XVID_CPU_FORCE; |
161 |
xinit.version = XVID_VERSION; |
xinit.version = XVID_VERSION; |
162 |
xerr = xvid_global(NULL, 0, &xinit, NULL); |
xerr = xvid_global(NULL, XVID_GBL_INIT, &xinit, NULL); |
163 |
if (cpu->cpu>0 && xerr==XVID_ERR_FAIL) { |
if (xerr==XVID_ERR_FAIL) { |
164 |
printf( "%s - skipped...\n", cpu->name ); |
/* libxvidcore failed to init */ |
165 |
return 0; |
return 0; |
166 |
} |
} |
167 |
|
} else { |
168 |
|
/* The host CPU doesn't support some required feature for this test */ |
169 |
|
return(0); |
170 |
|
} |
171 |
return 1; |
return 1; |
172 |
} |
} |
173 |
|
|
183 |
int tst; |
int tst; |
184 |
CPU *cpu; |
CPU *cpu; |
185 |
int i; |
int i; |
186 |
short iDst0[8*8], iDst[8*8], fDst[8*8]; |
DECLARE_ALIGNED_MATRIX(iDst0, 8, 8, short, 16); |
187 |
|
DECLARE_ALIGNED_MATRIX(iDst, 8, 8, short, 16); |
188 |
|
DECLARE_ALIGNED_MATRIX(fDst, 8, 8, short, 16); |
189 |
double overhead; |
double overhead; |
190 |
|
|
191 |
printf( "\n ===== test fdct/idct =====\n" ); |
printf( "\n ===== test fdct/idct =====\n" ); |
879 |
static const double ILimits[5] = { 1., 0.06, 0.02, 0.015, 0.0015 }; |
static const double ILimits[5] = { 1., 0.06, 0.02, 0.015, 0.0015 }; |
880 |
int Loops = 10000; |
int Loops = 10000; |
881 |
int i, m, n; |
int i, m, n; |
882 |
short Blk0[64]; /* reference */ |
DECLARE_ALIGNED_MATRIX(Blk0, 8, 8, short, 16); /* reference */ |
883 |
short Blk[64], iBlk[64]; |
DECLARE_ALIGNED_MATRIX(Blk, 8, 8, short, 16); |
884 |
short Ref_FDCT[64]; |
DECLARE_ALIGNED_MATRIX(iBlk, 8, 8, short, 16); |
885 |
short Ref_IDCT[64]; |
DECLARE_ALIGNED_MATRIX(Ref_FDCT, 8, 8, short, 16); |
886 |
|
DECLARE_ALIGNED_MATRIX(Ref_IDCT, 8, 8, short, 16); |
887 |
|
|
888 |
STATS_8x8 FStats; /* forward dct stats */ |
STATS_8x8 FStats; /* forward dct stats */ |
889 |
STATS_8x8 IStats; /* inverse dct stats */ |
STATS_8x8 IStats; /* inverse dct stats */ |
1328 |
|
|
1329 |
if (what==7) { |
if (what==7) { |
1330 |
test_IEEE1180_compliance(-256, 255, 1); |
test_IEEE1180_compliance(-256, 255, 1); |
|
#if 0 |
|
1331 |
test_IEEE1180_compliance(-256, 255,-1); |
test_IEEE1180_compliance(-256, 255,-1); |
1332 |
test_IEEE1180_compliance( -5, 5, 1); |
test_IEEE1180_compliance( -5, 5, 1); |
1333 |
test_IEEE1180_compliance( -5, 5,-1); |
test_IEEE1180_compliance( -5, 5,-1); |
1334 |
test_IEEE1180_compliance(-300, 300, 1); |
test_IEEE1180_compliance(-300, 300, 1); |
1335 |
test_IEEE1180_compliance(-300, 300,-1); |
test_IEEE1180_compliance(-300, 300,-1); |
|
#endif |
|
1336 |
} |
} |
1337 |
if (what==8) test_dct_saturation(-256, 255); |
if (what==8) test_dct_saturation(-256, 255); |
1338 |
|
|