54 |
#include "image/colorspace.h" |
#include "image/colorspace.h" |
55 |
#include "image/interpolate8x8.h" |
#include "image/interpolate8x8.h" |
56 |
#include "utils/mem_transfer.h" |
#include "utils/mem_transfer.h" |
57 |
#include "quant/quant_h263.h" |
#include "quant/quant.h" |
|
#include "quant/quant_mpeg4.h" |
|
58 |
#include "motion/sad.h" |
#include "motion/sad.h" |
59 |
#include "utils/emms.h" |
#include "utils/emms.h" |
60 |
#include "utils/timer.h" |
#include "utils/timer.h" |
148 |
int xerr, cpu_type; |
int xerr, cpu_type; |
149 |
xvid_gbl_init_t xinit; |
xvid_gbl_init_t xinit; |
150 |
|
|
|
#ifdef ARCH_IS_IA32 |
|
|
cpu_type = check_cpu_features() & cpu->cpu; |
|
|
#else |
|
|
cpu_type = XVID_CPU_ASM; |
|
|
#endif |
|
151 |
memset(&xinit, 0, sizeof(xinit)); |
memset(&xinit, 0, sizeof(xinit)); |
152 |
xinit.cpu_flags = cpu_type | XVID_CPU_FORCE; |
xinit.cpu_flags = cpu->cpu | XVID_CPU_FORCE; |
153 |
xinit.version = XVID_VERSION; |
xinit.version = XVID_VERSION; |
154 |
xerr = xvid_global(NULL, 0, &xinit, NULL); |
xerr = xvid_global(NULL, 0, &xinit, NULL); |
155 |
if (cpu->cpu>0 && (cpu_type==0 || xerr==XVID_ERR_FAIL)) { |
if (cpu->cpu>0 && xerr==XVID_ERR_FAIL) { |
156 |
printf( "%s - skipped...\n", cpu->name ); |
printf( "%s - skipped...\n", cpu->name ); |
157 |
return 0; |
return 0; |
158 |
} |
} |
446 |
|
|
447 |
printf( "\n === test transfer ===\n" ); |
printf( "\n === test transfer ===\n" ); |
448 |
|
|
449 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
450 |
{ |
{ |
451 |
double t, overhead; |
double t, overhead; |
452 |
int tst, s; |
int tst, s; |
541 |
Dst[i] = 0; |
Dst[i] = 0; |
542 |
} |
} |
543 |
|
|
544 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
545 |
{ |
{ |
546 |
double t, overhead; |
double t, overhead; |
547 |
int tst, q; |
int tst, q; |
560 |
overhead += gettime_usec(); |
overhead += gettime_usec(); |
561 |
|
|
562 |
#if 1 |
#if 1 |
563 |
TEST_QUANT2(quant4_intra, Dst, Src); |
TEST_QUANT2(quant_mpeg_intra, Dst, Src); |
564 |
printf( "%s - quant4_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant_mpeg_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
565 |
if (s!=29809) printf( "*** CRC ERROR! ***\n" ); |
if (s!=29809) printf( "*** CRC ERROR! ***\n" ); |
566 |
|
|
567 |
TEST_QUANT(quant4_inter, Dst, Src); |
TEST_QUANT(quant_mpeg_inter, Dst, Src); |
568 |
printf( "%s - quant4_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant_mpeg_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
569 |
if (s!=12574) printf( "*** CRC ERROR! ***\n" ); |
if (s!=12574) printf( "*** CRC ERROR! ***\n" ); |
570 |
#endif |
#endif |
571 |
#if 1 |
#if 1 |
572 |
TEST_QUANT2(dequant4_intra, Dst, Src); |
TEST_QUANT2(dequant_mpeg_intra, Dst, Src); |
573 |
printf( "%s - dequant4_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant_mpeg_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
574 |
if (s!=24052) printf( "*** CRC ERROR! ***\n" ); |
if (s!=24052) printf( "*** CRC ERROR! ***\n" ); |
575 |
|
|
576 |
TEST_QUANT(dequant4_inter, Dst, Src); |
TEST_QUANT(dequant_mpeg_inter, Dst, Src); |
577 |
printf( "%s - dequant4_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant_mpeg_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
578 |
if (s!=63847) printf( "*** CRC ERROR! ***\n" ); |
if (s!=63847) printf( "*** CRC ERROR! ***\n" ); |
579 |
#endif |
#endif |
580 |
#if 1 |
#if 1 |
581 |
TEST_QUANT2(quant_intra, Dst, Src); |
TEST_QUANT2(quant_h263_intra, Dst, Src); |
582 |
printf( "%s - quant_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant_h263_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
583 |
if (s!=25662) printf( "*** CRC ERROR! ***\n" ); |
if (s!=25662) printf( "*** CRC ERROR! ***\n" ); |
584 |
|
|
585 |
TEST_QUANT(quant_inter, Dst, Src); |
TEST_QUANT(quant_h263_inter, Dst, Src); |
586 |
printf( "%s - quant_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant_h263_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
587 |
if (s!=23972) printf( "*** CRC ERROR! ***\n" ); |
if (s!=23972) printf( "*** CRC ERROR! ***\n" ); |
588 |
#endif |
#endif |
589 |
#if 1 |
#if 1 |
590 |
TEST_QUANT2(dequant_intra, Dst, Src); |
TEST_QUANT2(dequant_h263_intra, Dst, Src); |
591 |
printf( "%s - dequant_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant_h263_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
592 |
if (s!=49900) printf( "*** CRC ERROR! ***\n" ); |
if (s!=49900) printf( "*** CRC ERROR! ***\n" ); |
593 |
|
|
594 |
TEST_QUANT(dequant_inter, Dst, Src); |
TEST_QUANT(dequant_h263_inter, Dst, Src); |
595 |
printf( "%s - dequant_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant_h263_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
596 |
if (s!=48899) printf( "*** CRC ERROR! ***\n" ); |
if (s!=48899) printf( "*** CRC ERROR! ***\n" ); |
597 |
#endif |
#endif |
598 |
printf( " --- \n" ); |
printf( " --- \n" ); |
628 |
Src4[i] = (i==(3*64+2) || i==(5*64+9)); |
Src4[i] = (i==(3*64+2) || i==(5*64+9)); |
629 |
} |
} |
630 |
|
|
631 |
for(cpu = cpu_short_list2; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
632 |
{ |
{ |
633 |
double t; |
double t; |
634 |
int tst, cbp; |
int tst, cbp; |
1153 |
|
|
1154 |
printf( "\n ===== (de)quant4_intra saturation bug? =====\n" ); |
printf( "\n ===== (de)quant4_intra saturation bug? =====\n" ); |
1155 |
|
|
1156 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
1157 |
{ |
{ |
1158 |
int i; |
int i; |
1159 |
int16_t Src[8*8], Dst[8*8]; |
int16_t Src[8*8], Dst[8*8]; |
1163 |
|
|
1164 |
for(i=0; i<64; ++i) Src[i] = i-32; |
for(i=0; i<64; ++i) Src[i] = i-32; |
1165 |
set_intra_matrix( get_default_intra_matrix() ); |
set_intra_matrix( get_default_intra_matrix() ); |
1166 |
dequant4_intra(Dst, Src, 31, 5); |
dequant_mpeg_intra(Dst, Src, 31, 5); |
1167 |
printf( "dequant4_intra with CPU=%s: ", cpu->name); |
printf( "dequant_mpeg_intra with CPU=%s: ", cpu->name); |
1168 |
printf( " Out[]= " ); |
printf( " Out[]= " ); |
1169 |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
1170 |
printf( "\n" ); |
printf( "\n" ); |
1172 |
|
|
1173 |
printf( "\n ===== (de)quant4_inter saturation bug? =====\n" ); |
printf( "\n ===== (de)quant4_inter saturation bug? =====\n" ); |
1174 |
|
|
1175 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
1176 |
{ |
{ |
1177 |
int i; |
int i; |
1178 |
int16_t Src[8*8], Dst[8*8]; |
int16_t Src[8*8], Dst[8*8]; |
1182 |
|
|
1183 |
for(i=0; i<64; ++i) Src[i] = i-32; |
for(i=0; i<64; ++i) Src[i] = i-32; |
1184 |
set_inter_matrix( get_default_inter_matrix() ); |
set_inter_matrix( get_default_inter_matrix() ); |
1185 |
dequant4_inter(Dst, Src, 31); |
dequant_mpeg_inter(Dst, Src, 31); |
1186 |
printf( "dequant4_inter with CPU=%s: ", cpu->name); |
printf( "dequant_mpeg_inter with CPU=%s: ", cpu->name); |
1187 |
printf( " Out[]= " ); |
printf( " Out[]= " ); |
1188 |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
1189 |
printf( "\n" ); |
printf( "\n" ); |
1197 |
|
|
1198 |
printf( "\n ===== fdct/idct precision diffs =====\n" ); |
printf( "\n ===== fdct/idct precision diffs =====\n" ); |
1199 |
|
|
1200 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
1201 |
{ |
{ |
1202 |
int i; |
int i; |
1203 |
|
|
1250 |
|
|
1251 |
for(q=1; q<=max_Q; ++q) { |
for(q=1; q<=max_Q; ++q) { |
1252 |
emms(); |
emms(); |
1253 |
quant4_inter( Dst, Src, q ); |
quant_mpeg_inter( Dst, Src, q ); |
1254 |
emms(); |
emms(); |
1255 |
for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i; |
for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i; |
1256 |
Crcs_Inter[n][q] = s; |
Crcs_Inter[n][q] = s; |
1280 |
|
|
1281 |
for(q=1; q<=max_Q; ++q) { |
for(q=1; q<=max_Q; ++q) { |
1282 |
emms(); |
emms(); |
1283 |
quant4_intra( Dst, Src, q, q); |
quant_mpeg_intra( Dst, Src, q, q); |
1284 |
emms(); |
emms(); |
1285 |
for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i; |
for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i; |
1286 |
Crcs_Intra[n][q] = s; |
Crcs_Intra[n][q] = s; |