22 |
* |
* |
23 |
* 'Reference' output is at the end of file. |
* 'Reference' output is at the end of file. |
24 |
* Don't take the checksums and crc too seriouly, they aren't |
* Don't take the checksums and crc too seriouly, they aren't |
25 |
* bullet-proof... |
* bullet-proof (should plug some .md5 here)... |
26 |
* |
* |
27 |
* compiles with something like: |
* compiles with something like: |
28 |
* gcc -o xvid_bench xvid_bench.c -I../src/ -lxvidcore -lm |
* gcc -o xvid_bench xvid_bench.c -I../src/ -lxvidcore -lm |
35 |
|
|
36 |
#include <stdio.h> |
#include <stdio.h> |
37 |
#include <stdlib.h> |
#include <stdlib.h> |
38 |
#include <sys/time.h> // for gettimeofday |
#ifdef _MSC_VER |
39 |
#include <string.h> // for memset |
#include <time.h> /* for clock */ |
40 |
|
#else |
41 |
|
#include <sys/time.h> /* for gettimeofday */ |
42 |
|
#endif |
43 |
|
#include <string.h> /* for memset */ |
44 |
#include <assert.h> |
#include <assert.h> |
45 |
|
|
46 |
#include "xvid.h" |
#include "xvid.h" |
47 |
|
|
48 |
// inner guts |
/* inner guts */ |
49 |
#include "dct/idct.h" |
#include "dct/idct.h" |
50 |
#include "dct/fdct.h" |
#include "dct/fdct.h" |
51 |
#include "image/colorspace.h" |
#include "image/colorspace.h" |
59 |
#include "quant/quant_matrix.c" |
#include "quant/quant_matrix.c" |
60 |
#include "bitstream/cbp.h" |
#include "bitstream/cbp.h" |
61 |
|
|
62 |
const int speed_ref = 100; // on slow machines, decrease this value |
#include <math.h> |
63 |
|
#ifndef M_PI |
64 |
|
# define M_PI 3.14159265359 |
65 |
|
# define M_PI_2 1.5707963268 |
66 |
|
#endif |
67 |
|
const int speed_ref = 100; /* on slow machines, decrease this value */ |
68 |
|
|
69 |
/********************************************************************* |
/********************************************************************* |
70 |
* misc |
* misc |
73 |
/* returns time in micro-s*/ |
/* returns time in micro-s*/ |
74 |
double gettime_usec() |
double gettime_usec() |
75 |
{ |
{ |
76 |
|
#ifdef WIN32 |
77 |
|
return clock()*1000; |
78 |
|
#else |
79 |
struct timeval tv; |
struct timeval tv; |
80 |
gettimeofday(&tv, 0); |
gettimeofday(&tv, 0); |
81 |
return tv.tv_sec*1.0e6f + tv.tv_usec; |
return tv.tv_sec*1.0e6 + tv.tv_usec; |
82 |
|
#endif |
83 |
} |
} |
84 |
|
|
85 |
/* returns squared deviates (mean(v*v)-mean(v)^2) of a 8x8 block */ |
/* returns squared deviates (mean(v*v)-mean(v)^2) of a 8x8 block */ |
114 |
, { "SSE2 ", XVID_CPU_SSE2 | XVID_CPU_MMX } |
, { "SSE2 ", XVID_CPU_SSE2 | XVID_CPU_MMX } |
115 |
, { "3DNOW ", XVID_CPU_3DNOW } |
, { "3DNOW ", XVID_CPU_3DNOW } |
116 |
, { "3DNOWE", XVID_CPU_3DNOWEXT } |
, { "3DNOWE", XVID_CPU_3DNOWEXT } |
117 |
//, { "TSC ", XVID_CPU_TSC } |
, { "IA64 ", XVID_CPU_IA64 } |
118 |
|
/*, { "TSC ", XVID_CPU_TSC } */ |
119 |
, { 0, 0 } } |
, { 0, 0 } } |
120 |
|
|
121 |
, cpu_short_list[] = |
, cpu_short_list[] = |
122 |
{ { "PLAINC", 0 } |
{ { "PLAINC", 0 } |
123 |
, { "MMX ", XVID_CPU_MMX } |
, { "MMX ", XVID_CPU_MMX } |
124 |
, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } |
/*, { "MMXEXT", XVID_CPU_MMXEXT | XVID_CPU_MMX } */ |
125 |
|
, { "IA64 ", XVID_CPU_IA64 } |
126 |
, { 0, 0 } } |
, { 0, 0 } } |
127 |
|
|
128 |
, cpu_short_list2[] = |
, cpu_short_list2[] = |
139 |
|
|
140 |
cpu_type = check_cpu_features() & cpu->cpu; |
cpu_type = check_cpu_features() & cpu->cpu; |
141 |
xinit.cpu_flags = cpu_type | XVID_CPU_FORCE; |
xinit.cpu_flags = cpu_type | XVID_CPU_FORCE; |
142 |
// xinit.cpu_flags = XVID_CPU_MMX | XVID_CPU_FORCE; |
/* xinit.cpu_flags = XVID_CPU_MMX | XVID_CPU_FORCE; */ |
143 |
xerr = xvid_init(NULL, 0, &xinit, NULL); |
xerr = xvid_init(NULL, 0, &xinit, NULL); |
144 |
if (cpu->cpu>0 && (cpu_type==0 || xerr!=XVID_ERR_OK)) { |
if (cpu->cpu>0 && (cpu_type==0 || xerr!=XVID_ERR_OK)) { |
145 |
printf( "%s - skipped...\n", cpu->name ); |
printf( "%s - skipped...\n", cpu->name ); |
176 |
|
|
177 |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
178 |
{ |
{ |
179 |
double t; |
double t, PSNR, MSE; |
|
int iCrc, fCrc; |
|
180 |
|
|
181 |
if (!init_cpu(cpu)) |
if (!init_cpu(cpu)) |
182 |
continue; |
continue; |
192 |
} |
} |
193 |
emms(); |
emms(); |
194 |
t = (gettime_usec() - t - overhead) / nb_tests; |
t = (gettime_usec() - t - overhead) / nb_tests; |
195 |
iCrc=0; fCrc=0; |
MSE = 0.; |
196 |
for(i=0; i<8*8; ++i) { |
for(i=0; i<8*8; ++i) { |
197 |
iCrc += ABS(iDst[i] - iDst0[i]); |
double delta = 1.0*(iDst[i] - iDst0[i]); |
198 |
fCrc += fDst[i]^i; |
MSE += delta*delta; |
199 |
} |
} |
200 |
printf( "%s - %.3f usec iCrc=%d fCrc=%d\n", |
PSNR = (MSE==0.) ? 1.e6 : -4.3429448*log( MSE/64. ); |
201 |
cpu->name, t, iCrc, fCrc ); |
printf( "%s - %.3f usec PSNR=%.3f MSE=%.3f\n", |
202 |
// the norm tolerates ~1 bit of diff per coeff |
cpu->name, t, PSNR, MSE ); |
203 |
if (ABS(iCrc)>=64) printf( "*** CRC ERROR! ***\n" ); |
if (ABS(MSE)>=64) printf( "*** CRC ERROR! ***\n" ); |
204 |
} |
} |
205 |
} |
} |
206 |
|
|
297 |
const int nb_tests = 2000*speed_ref; |
const int nb_tests = 2000*speed_ref; |
298 |
CPU *cpu; |
CPU *cpu; |
299 |
const uint8_t Src0[16*9] = { |
const uint8_t Src0[16*9] = { |
300 |
// try to have every possible combinaison of rounding... |
/* try to have every possible combinaison of rounding... */ |
301 |
0, 0, 1, 0, 2, 0, 3, 0, 4 ,0,0,0, 0,0,0,0 |
0, 0, 1, 0, 2, 0, 3, 0, 4 ,0,0,0, 0,0,0,0 |
302 |
, 0, 1, 1, 1, 2, 1, 3, 1, 3 ,0,0,0, 0,0,0,0 |
, 0, 1, 1, 1, 2, 1, 3, 1, 3 ,0,0,0, 0,0,0,0 |
303 |
, 0, 2, 1, 2, 2, 2, 3, 2, 2 ,0,0,0, 0,0,0,0 |
, 0, 2, 1, 2, 2, 2, 3, 2, 2 ,0,0,0, 0,0,0,0 |
346 |
printf( "%s - round1 %.3f usec iCrc=%d\n", cpu->name, t, iCrc ); |
printf( "%s - round1 %.3f usec iCrc=%d\n", cpu->name, t, iCrc ); |
347 |
if (iCrc!=8103) printf( "*** CRC ERROR! ***\n" ); |
if (iCrc!=8103) printf( "*** CRC ERROR! ***\n" ); |
348 |
|
|
349 |
|
|
350 |
|
/* this is a new function, as of 06.06.2002 */ |
351 |
|
#if 0 |
352 |
|
TEST_MB2(interpolate8x8_avrg); |
353 |
|
printf( "%s - interpolate8x8_c %.3f usec iCrc=%d\n", cpu->name, t, iCrc ); |
354 |
|
if (iCrc!=8107) printf( "*** CRC ERROR! ***\n" ); |
355 |
|
#endif |
356 |
|
|
357 |
printf( " --- \n" ); |
printf( " --- \n" ); |
358 |
} |
} |
359 |
} |
} |
465 |
s = 0; for(i=0; i<8*32; ++i) { s += (Src8[i]-Ref1[i])&i; } |
s = 0; for(i=0; i<8*32; ++i) { s += (Src8[i]-Ref1[i])&i; } |
466 |
printf( "crc2=%d\n", s); |
printf( "crc2=%d\n", s); |
467 |
if (s!=16256) printf( "*** CRC ERROR! ***\n" ); |
if (s!=16256) printf( "*** CRC ERROR! ***\n" ); |
468 |
|
#if 1 |
469 |
TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2); |
TEST_TRANSFER3(transfer_8to16sub2, Dst16, Src8, Ref1, Ref2); |
470 |
printf( "%s - 8to16sub2 %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - 8to16sub2 %.3f usec crc=%d\n", cpu->name, t, s ); |
471 |
if (s!=20384) printf( "*** CRC ERROR! ***\n" ); |
if (s!=20384) printf( "*** CRC ERROR! ***\n" ); |
472 |
|
/* for(i=0; i<64; ++i) printf( "[%d]", Dst16[i]); */ |
473 |
|
/* printf("\n"); */ |
474 |
|
#endif |
475 |
printf( " --- \n" ); |
printf( " --- \n" ); |
476 |
} |
} |
477 |
} |
} |
482 |
|
|
483 |
#define TEST_QUANT(FUNC, DST, SRC) \ |
#define TEST_QUANT(FUNC, DST, SRC) \ |
484 |
t = gettime_usec(); \ |
t = gettime_usec(); \ |
485 |
|
for(s=0,qm=1; qm<=255; ++qm) { \ |
486 |
|
for(i=0; i<8*8; ++i) Quant[i] = qm; \ |
487 |
|
set_inter_matrix( Quant ); \ |
488 |
emms(); \ |
emms(); \ |
489 |
|
for(q=1; q<=max_Q; ++q) { \ |
490 |
for(tst=0; tst<nb_tests; ++tst) \ |
for(tst=0; tst<nb_tests; ++tst) \ |
|
for(s=0, q=1; q<=max_Q; ++q) { \ |
|
491 |
(FUNC)((DST), (SRC), q); \ |
(FUNC)((DST), (SRC), q); \ |
492 |
for(i=0; i<64; ++i) s+=(DST)[i]^i; \ |
for(i=0; i<64; ++i) s+=(DST)[i]^i^qm; \ |
493 |
} \ |
} \ |
494 |
emms(); \ |
emms(); \ |
495 |
t = (gettime_usec()-t-overhead)/nb_tests; |
} \ |
496 |
|
t = (gettime_usec()-t-overhead)/nb_tests/qm;\ |
497 |
|
s = (s&0xffff)^(s>>16) |
498 |
|
|
499 |
#define TEST_QUANT2(FUNC, DST, SRC, MULT) \ |
#define TEST_QUANT2(FUNC, DST, SRC) \ |
500 |
t = gettime_usec(); \ |
t = gettime_usec(); \ |
501 |
|
for(s=0,qm=1; qm<=255; ++qm) { \ |
502 |
|
for(i=0; i<8*8; ++i) Quant[i] = qm; \ |
503 |
|
set_intra_matrix( Quant ); \ |
504 |
emms(); \ |
emms(); \ |
505 |
|
for(q=1; q<=max_Q; ++q) { \ |
506 |
for(tst=0; tst<nb_tests; ++tst) \ |
for(tst=0; tst<nb_tests; ++tst) \ |
507 |
for(s=0, q=1; q<=max_Q; ++q) { \ |
(FUNC)((DST), (SRC), q, q); \ |
508 |
(FUNC)((DST), (SRC), q, MULT); \ |
for(i=0; i<64; ++i) s+=(DST)[i]^i^qm; \ |
|
for(i=0; i<64; ++i) s+=(DST)[i]^i; \ |
|
509 |
} \ |
} \ |
510 |
emms(); \ |
emms(); \ |
511 |
t = (gettime_usec()-t-overhead)/nb_tests; |
} \ |
512 |
|
t = (gettime_usec()-t-overhead)/nb_tests/qm;\ |
513 |
|
s = (s&0xffff)^(s>>16) |
514 |
|
|
515 |
void test_quant() |
void test_quant() |
516 |
{ |
{ |
517 |
const int nb_tests = 150*speed_ref; |
const int nb_tests = 1*speed_ref; |
518 |
const int max_Q = 31; |
const int max_Q = 31; |
519 |
int i; |
int i, qm; |
520 |
CPU *cpu; |
CPU *cpu; |
521 |
int16_t Src[8*8], Dst[8*8]; |
int16_t Src[8*8], Dst[8*8]; |
522 |
|
uint8_t Quant[8*8]; |
523 |
|
|
524 |
printf( "\n ===== test quant =====\n" ); |
printf( "\n ===== test quant =====\n" ); |
525 |
|
|
526 |
|
/* we deliberately enfringe the norm's specified range [-127,127], */ |
527 |
|
/* to test the robustness of the iquant module */ |
528 |
for(i=0; i<64; ++i) { |
for(i=0; i<64; ++i) { |
529 |
Src[i] = i-32; |
Src[i] = 1 + (i-32) * (i&6); |
530 |
Dst[i] = 0; |
Dst[i] = 0; |
531 |
} |
} |
532 |
|
|
|
|
|
533 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
534 |
{ |
{ |
535 |
double t, overhead; |
double t, overhead; |
536 |
int tst, s, q; |
int tst, q; |
537 |
|
uint32_t s; |
538 |
|
|
539 |
if (!init_cpu(cpu)) |
if (!init_cpu(cpu)) |
540 |
continue; |
continue; |
541 |
|
|
|
set_inter_matrix( get_default_inter_matrix() ); |
|
|
set_intra_matrix( get_default_intra_matrix() ); |
|
542 |
overhead = -gettime_usec(); |
overhead = -gettime_usec(); |
543 |
for(tst=0; tst<nb_tests; ++tst) |
for(s=0,qm=1; qm<=255; ++qm) { |
544 |
for(s=0, q=1; q<=max_Q; ++q) |
for(i=0; i<8*8; ++i) Quant[i] = qm; |
545 |
for(i=0; i<64; ++i) s+=Dst[i]^i; |
set_inter_matrix( Quant ); |
546 |
|
for(q=1; q<=max_Q; ++q) |
547 |
|
for(i=0; i<64; ++i) s+=Dst[i]^i^qm; |
548 |
|
} |
549 |
overhead += gettime_usec(); |
overhead += gettime_usec(); |
550 |
|
|
551 |
TEST_QUANT2(quant4_intra, Dst, Src, 7); |
#if 1 |
552 |
|
TEST_QUANT2(quant4_intra, Dst, Src); |
553 |
printf( "%s - quant4_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant4_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
554 |
if (s!=55827) printf( "*** CRC ERROR! ***\n" ); |
if (s!=29809) printf( "*** CRC ERROR! ***\n" ); |
555 |
|
|
556 |
TEST_QUANT(quant4_inter, Dst, Src); |
TEST_QUANT(quant4_inter, Dst, Src); |
557 |
printf( "%s - quant4_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant4_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
558 |
if (s!=58201) printf( "*** CRC ERROR! ***\n" ); |
if (s!=12574) printf( "*** CRC ERROR! ***\n" ); |
559 |
|
#endif |
560 |
|
#if 1 |
561 |
TEST_QUANT2(dequant4_intra, Dst, Src, 7); |
TEST_QUANT2(dequant4_intra, Dst, Src); |
562 |
printf( "%s - dequant4_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant4_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
563 |
if (s!=193340) printf( "*** CRC ERROR! ***\n" ); |
if (s!=24052) printf( "*** CRC ERROR! ***\n" ); |
564 |
|
|
565 |
TEST_QUANT(dequant4_inter, Dst, Src); |
TEST_QUANT(dequant4_inter, Dst, Src); |
566 |
printf( "%s - dequant4_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant4_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
567 |
if (s!=116483) printf( "*** CRC ERROR! ***\n" ); |
if (s!=63847) printf( "*** CRC ERROR! ***\n" ); |
568 |
|
#endif |
569 |
TEST_QUANT2(quant_intra, Dst, Src, 7); |
#if 1 |
570 |
|
TEST_QUANT2(quant_intra, Dst, Src); |
571 |
printf( "%s - quant_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
572 |
if (s!=56885) printf( "*** CRC ERROR! ***\n" ); |
if (s!=25662) printf( "*** CRC ERROR! ***\n" ); |
573 |
|
|
574 |
TEST_QUANT(quant_inter, Dst, Src); |
TEST_QUANT(quant_inter, Dst, Src); |
575 |
printf( "%s - quant_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - quant_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
576 |
if (s!=58056) printf( "*** CRC ERROR! ***\n" ); |
if (s!=23972) printf( "*** CRC ERROR! ***\n" ); |
577 |
|
#endif |
578 |
TEST_QUANT2(dequant_intra, Dst, Src, 7); |
#if 1 |
579 |
|
TEST_QUANT2(dequant_intra, Dst, Src); |
580 |
printf( "%s - dequant_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant_intra %.3f usec crc=%d\n", cpu->name, t, s ); |
581 |
if (s!=-7936) printf( "*** CRC ERROR! ***\n" ); |
if (s!=49900) printf( "*** CRC ERROR! ***\n" ); |
582 |
|
|
583 |
TEST_QUANT(dequant_inter, Dst, Src); |
TEST_QUANT(dequant_inter, Dst, Src); |
584 |
printf( "%s - dequant_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
printf( "%s - dequant_inter %.3f usec crc=%d\n", cpu->name, t, s ); |
585 |
// { int k,l; for(k=0; k<8; ++k) { for(l=0; l<8; ++l) printf( "[%.4d]", Dst[k*8+l]); printf("\n"); } } |
if (s!=48899) printf( "*** CRC ERROR! ***\n" ); |
586 |
if (s!=-33217) printf( "*** CRC ERROR! ***\n" ); |
#endif |
|
|
|
587 |
printf( " --- \n" ); |
printf( " --- \n" ); |
588 |
} |
} |
589 |
} |
} |
611 |
printf( "\n ===== test cbp =====\n" ); |
printf( "\n ===== test cbp =====\n" ); |
612 |
|
|
613 |
for(i=0; i<6*64; ++i) { |
for(i=0; i<6*64; ++i) { |
614 |
Src1[i] = (i*i*3/8192)&(i/64)&1; // 'random' |
Src1[i] = (i*i*3/8192)&(i/64)&1; /* 'random' */ |
615 |
Src2[i] = (i<3*64); // half-full |
Src2[i] = (i<3*64); /* half-full */ |
616 |
Src3[i] = ((i+32)>3*64); |
Src3[i] = ((i+32)>3*64); |
617 |
Src4[i] = (i==(3*64+2) || i==(5*64+9)); |
Src4[i] = (i==(3*64+2) || i==(5*64+9)); |
618 |
} |
} |
642 |
} |
} |
643 |
|
|
644 |
/********************************************************************* |
/********************************************************************* |
645 |
|
* fdct/idct IEEE1180 compliance |
646 |
|
*********************************************************************/ |
647 |
|
|
648 |
|
typedef struct { |
649 |
|
long Errors[64]; |
650 |
|
long Sqr_Errors[64]; |
651 |
|
long Max_Errors[64]; |
652 |
|
long Nb; |
653 |
|
} STATS_8x8; |
654 |
|
|
655 |
|
void init_stats(STATS_8x8 *S) |
656 |
|
{ |
657 |
|
int i; |
658 |
|
for(i=0; i<64; ++i) { |
659 |
|
S->Errors[i] = 0; |
660 |
|
S->Sqr_Errors[i] = 0; |
661 |
|
S->Max_Errors[i] = 0; |
662 |
|
} |
663 |
|
S->Nb = 0; |
664 |
|
} |
665 |
|
|
666 |
|
void store_stats(STATS_8x8 *S, short Blk[64], short Ref[64]) |
667 |
|
{ |
668 |
|
int i; |
669 |
|
for(i=0; i<64; ++i) |
670 |
|
{ |
671 |
|
short Err = Blk[i] - Ref[i]; |
672 |
|
S->Errors[i] += Err; |
673 |
|
S->Sqr_Errors[i] += Err * Err; |
674 |
|
if (Err<0) Err = -Err; |
675 |
|
if (S->Max_Errors[i]<Err) |
676 |
|
S->Max_Errors[i] = Err; |
677 |
|
} |
678 |
|
S->Nb++; |
679 |
|
} |
680 |
|
|
681 |
|
void print_stats(STATS_8x8 *S) |
682 |
|
{ |
683 |
|
int i; |
684 |
|
double Norm; |
685 |
|
|
686 |
|
assert(S->Nb>0); |
687 |
|
Norm = 1. / (double)S->Nb; |
688 |
|
printf("\n== Max absolute values of errors ==\n"); |
689 |
|
for(i=0; i<64; i++) { |
690 |
|
printf(" %4ld", S->Max_Errors[i]); |
691 |
|
if ((i&7)==7) printf("\n"); |
692 |
|
} |
693 |
|
|
694 |
|
printf("\n== Mean square errors ==\n"); |
695 |
|
for(i=0; i<64; i++) |
696 |
|
{ |
697 |
|
double Err = Norm * (double)S->Sqr_Errors[i]; |
698 |
|
printf(" %.3f", Err); |
699 |
|
if ((i&7)==7) printf("\n"); |
700 |
|
} |
701 |
|
|
702 |
|
printf("\n== Mean errors ==\n"); |
703 |
|
for(i=0; i<64; i++) |
704 |
|
{ |
705 |
|
double Err = Norm * (double)S->Errors[i]; |
706 |
|
printf(" %.3f", Err); |
707 |
|
if ((i&7)==7) printf("\n"); |
708 |
|
} |
709 |
|
printf("\n"); |
710 |
|
} |
711 |
|
|
712 |
|
static const char *CHECK(double v, double l) { |
713 |
|
if (fabs(v)<=l) return "ok"; |
714 |
|
else return "FAIL!"; |
715 |
|
} |
716 |
|
|
717 |
|
void report_stats(STATS_8x8 *S, const double *Limits) |
718 |
|
{ |
719 |
|
int i; |
720 |
|
double Norm, PE, PMSE, OMSE, PME, OME; |
721 |
|
|
722 |
|
assert(S->Nb>0); |
723 |
|
Norm = 1. / (double)S->Nb; |
724 |
|
PE = 0.; |
725 |
|
for(i=0; i<64; i++) { |
726 |
|
if (PE<S->Max_Errors[i]) |
727 |
|
PE = S->Max_Errors[i]; |
728 |
|
} |
729 |
|
|
730 |
|
PMSE = 0.; |
731 |
|
OMSE = 0.; |
732 |
|
for(i=0; i<64; i++) |
733 |
|
{ |
734 |
|
double Err = Norm * (double)S->Sqr_Errors[i]; |
735 |
|
OMSE += Err; |
736 |
|
if (PMSE < Err) PMSE = Err; |
737 |
|
} |
738 |
|
OMSE /= 64.; |
739 |
|
|
740 |
|
PME = 0.; |
741 |
|
OME = 0.; |
742 |
|
for(i=0; i<64; i++) |
743 |
|
{ |
744 |
|
double Err = Norm * (double)S->Errors[i]; |
745 |
|
OME += Err; |
746 |
|
Err = fabs(Err); |
747 |
|
if (PME < Err) PME = Err; |
748 |
|
} |
749 |
|
OME /= 64.; |
750 |
|
|
751 |
|
printf( "Peak error: %4.4f\n", PE ); |
752 |
|
printf( "Peak MSE: %4.4f\n", PMSE ); |
753 |
|
printf( "Overall MSE: %4.4f\n", OMSE ); |
754 |
|
printf( "Peak ME: %4.4f\n", PME ); |
755 |
|
printf( "Overall ME: %4.4f\n", OME ); |
756 |
|
|
757 |
|
if (Limits!=0) |
758 |
|
{ |
759 |
|
printf( "[PE<=%.4f %s] ", Limits[0], CHECK(PE, Limits[0]) ); |
760 |
|
printf( "\n" ); |
761 |
|
printf( "[PMSE<=%.4f %s]", Limits[1], CHECK(PMSE, Limits[1]) ); |
762 |
|
printf( "[OMSE<=%.4f %s]", Limits[2], CHECK(OMSE, Limits[2]) ); |
763 |
|
printf( "\n" ); |
764 |
|
printf( "[PME<=%.4f %s] ", Limits[3], CHECK(PME , Limits[3]) ); |
765 |
|
printf( "[OME<=%.4f %s] ", Limits[4], CHECK(OME , Limits[4]) ); |
766 |
|
printf( "\n" ); |
767 |
|
} |
768 |
|
} |
769 |
|
|
770 |
|
/*//////////////////////////////////////////////////////// */ |
771 |
|
/* Pseudo-random generator specified by IEEE 1180 */ |
772 |
|
|
773 |
|
static long ieee_seed = 1; |
774 |
|
static void ieee_reseed(long s) { |
775 |
|
ieee_seed = s; |
776 |
|
} |
777 |
|
static long ieee_rand(int Min, int Max) |
778 |
|
{ |
779 |
|
static double z = (double) 0x7fffffff; |
780 |
|
|
781 |
|
long i,j; |
782 |
|
double x; |
783 |
|
|
784 |
|
ieee_seed = (ieee_seed * 1103515245) + 12345; |
785 |
|
i = ieee_seed & 0x7ffffffe; |
786 |
|
x = ((double) i) / z; |
787 |
|
x *= (Max-Min+1); |
788 |
|
j = (long)x; |
789 |
|
j = j + Min; |
790 |
|
assert(j>=Min && j<=Max); |
791 |
|
return (short)j; |
792 |
|
} |
793 |
|
|
794 |
|
#define CLAMP(x, M) (x) = ((x)<-(M)) ? (-(M)) : ((x)>=(M) ? ((M)-1) : (x)) |
795 |
|
|
796 |
|
static double Cos[8][8]; |
797 |
|
static void init_ref_dct() |
798 |
|
{ |
799 |
|
int i, j; |
800 |
|
for(i=0; i<8; i++) |
801 |
|
{ |
802 |
|
double scale = (i == 0) ? sqrt(0.125) : 0.5; |
803 |
|
for (j=0; j<8; j++) |
804 |
|
Cos[i][j] = scale*cos( (M_PI/8.0)*i*(j + 0.5) ); |
805 |
|
} |
806 |
|
} |
807 |
|
|
808 |
|
void ref_idct(short *M) |
809 |
|
{ |
810 |
|
int i, j, k; |
811 |
|
double Tmp[8][8]; |
812 |
|
|
813 |
|
for(i=0; i<8; i++) { |
814 |
|
for(j=0; j<8; j++) |
815 |
|
{ |
816 |
|
double Sum = 0.0; |
817 |
|
for (k=0; k<8; k++) Sum += Cos[k][j]*M[8*i+k]; |
818 |
|
Tmp[i][j] = Sum; |
819 |
|
} |
820 |
|
} |
821 |
|
for(i=0; i<8; i++) { |
822 |
|
for(j=0; j<8; j++) { |
823 |
|
double Sum = 0.0; |
824 |
|
for (k=0; k<8; k++) Sum += Cos[k][i]*Tmp[k][j]; |
825 |
|
M[8*i+j] = (short)floor(Sum + .5); |
826 |
|
} |
827 |
|
} |
828 |
|
} |
829 |
|
|
830 |
|
void ref_fdct(short *M) |
831 |
|
{ |
832 |
|
int i, j, k; |
833 |
|
double Tmp[8][8]; |
834 |
|
|
835 |
|
for(i=0; i<8; i++) { |
836 |
|
for(j=0; j<8; j++) |
837 |
|
{ |
838 |
|
double Sum = 0.0; |
839 |
|
for (k=0; k<8; k++) Sum += Cos[j][k]*M[8*i+k]; |
840 |
|
Tmp[i][j] = Sum; |
841 |
|
} |
842 |
|
} |
843 |
|
for(i=0; i<8; i++) { |
844 |
|
for(j=0; j<8; j++) { |
845 |
|
double Sum = 0.0; |
846 |
|
for (k=0; k<8; k++) Sum += Cos[i][k]*Tmp[k][j]; |
847 |
|
M[8*i+j] = (short)floor(Sum + 0.5); |
848 |
|
} |
849 |
|
} |
850 |
|
} |
851 |
|
|
852 |
|
void test_IEEE1180_compliance(int Min, int Max, int Sign) |
853 |
|
{ |
854 |
|
static const double ILimits[5] = { 1., 0.06, 0.02, 0.015, 0.0015 }; |
855 |
|
int Loops = 10000; |
856 |
|
int i, m, n; |
857 |
|
short Blk0[64]; /* reference */ |
858 |
|
short Blk[64], iBlk[64]; |
859 |
|
short Ref_FDCT[64]; |
860 |
|
short Ref_IDCT[64]; |
861 |
|
|
862 |
|
STATS_8x8 FStats; /* forward dct stats */ |
863 |
|
STATS_8x8 IStats; /* inverse dct stats */ |
864 |
|
|
865 |
|
CPU *cpu; |
866 |
|
|
867 |
|
init_ref_dct(); |
868 |
|
|
869 |
|
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
870 |
|
{ |
871 |
|
if (!init_cpu(cpu)) |
872 |
|
continue; |
873 |
|
|
874 |
|
printf( "\n===== IEEE test for %s ==== (Min=%d Max=%d Sign=%d Loops=%d)\n", |
875 |
|
cpu->name, Min, Max, Sign, Loops); |
876 |
|
|
877 |
|
init_stats(&IStats); |
878 |
|
init_stats(&FStats); |
879 |
|
|
880 |
|
ieee_reseed(1); |
881 |
|
for(n=0; n<Loops; ++n) |
882 |
|
{ |
883 |
|
for(i=0; i<64; ++i) |
884 |
|
Blk0[i] = (short)ieee_rand(Min,Max) * Sign; |
885 |
|
|
886 |
|
/* hmm, I'm not quite sure this is exactly */ |
887 |
|
/* the tests described in the norm. check... */ |
888 |
|
|
889 |
|
memcpy(Ref_FDCT, Blk0, 64*sizeof(short)); |
890 |
|
ref_fdct(Ref_FDCT); |
891 |
|
for(i=0; i<64; i++) CLAMP( Ref_FDCT[i], 2048 ); |
892 |
|
|
893 |
|
memcpy(Blk, Blk0, 64*sizeof(short)); |
894 |
|
emms(); fdct(Blk); emms(); |
895 |
|
for(i=0; i<64; i++) CLAMP( Blk[i], 2048 ); |
896 |
|
|
897 |
|
store_stats(&FStats, Blk, Ref_FDCT); |
898 |
|
|
899 |
|
|
900 |
|
memcpy(Ref_IDCT, Ref_FDCT, 64*sizeof(short)); |
901 |
|
ref_idct(Ref_IDCT); |
902 |
|
for (i=0; i<64; i++) CLAMP( Ref_IDCT[i], 256 ); |
903 |
|
|
904 |
|
memcpy(iBlk, Ref_FDCT, 64*sizeof(short)); |
905 |
|
emms(); idct(iBlk); emms(); |
906 |
|
for(i=0; i<64; i++) CLAMP( iBlk[i], 256 ); |
907 |
|
|
908 |
|
store_stats(&IStats, iBlk, Ref_IDCT); |
909 |
|
} |
910 |
|
|
911 |
|
|
912 |
|
printf( "\n -- FDCT report --\n" ); |
913 |
|
/* print_stats(&FStats); */ |
914 |
|
report_stats(&FStats, 0); /* so far I know, IEEE1180 says nothing for fdct */ |
915 |
|
|
916 |
|
for(i=0; i<64; i++) Blk[i] = 0; |
917 |
|
emms(); fdct(Blk); emms(); |
918 |
|
for(m=i=0; i<64; i++) if (Blk[i]!=0) m++; |
919 |
|
printf( "FDCT(0) == 0 ? %s\n", (m!=0) ? "NOPE!" : "yup." ); |
920 |
|
|
921 |
|
printf( "\n -- IDCT report --\n" ); |
922 |
|
/* print_stats(&IStats); */ |
923 |
|
report_stats(&IStats, ILimits); |
924 |
|
|
925 |
|
|
926 |
|
for(i=0; i<64; i++) Blk[i] = 0; |
927 |
|
emms(); idct(Blk); emms(); |
928 |
|
for(m=i=0; i<64; i++) if (Blk[i]!=0) m++; |
929 |
|
printf( "IDCT(0) == 0 ? %s\n", (m!=0) ? "NOPE!" : "yup." ); |
930 |
|
} |
931 |
|
} |
932 |
|
|
933 |
|
|
934 |
|
void test_dct_saturation(int Min, int Max) |
935 |
|
{ |
936 |
|
/* test behaviour on input range fringe */ |
937 |
|
|
938 |
|
int i, n, p; |
939 |
|
CPU *cpu; |
940 |
|
/* const short IDCT_MAX = 2047; // 12bits input */ |
941 |
|
/* const short IDCT_MIN = -2048; */ |
942 |
|
/* const short IDCT_OUT = 256; // 9bits ouput */ |
943 |
|
const int Partitions = 4; |
944 |
|
const int Loops = 10000 / Partitions; |
945 |
|
|
946 |
|
init_ref_dct(); |
947 |
|
|
948 |
|
for(cpu = cpu_list; cpu->name!=0; ++cpu) |
949 |
|
{ |
950 |
|
short Blk0[64], Blk[64]; |
951 |
|
STATS_8x8 Stats; |
952 |
|
|
953 |
|
if (!init_cpu(cpu)) |
954 |
|
continue; |
955 |
|
|
956 |
|
printf( "\n===== IEEE test for %s Min=%d Max=%d =====\n", |
957 |
|
cpu->name, Min, Max ); |
958 |
|
|
959 |
|
/* FDCT tests // */ |
960 |
|
|
961 |
|
init_stats(&Stats); |
962 |
|
|
963 |
|
/* test each computation channels separately */ |
964 |
|
for(i=0; i<64; i++) Blk[i] = Blk0[i] = ((i/8)==(i%8)) ? Max : 0; |
965 |
|
ref_fdct(Blk0); |
966 |
|
emms(); fdct(Blk); emms(); |
967 |
|
store_stats(&Stats, Blk, Blk0); |
968 |
|
|
969 |
|
for(i=0; i<64; i++) Blk[i] = Blk0[i] = ((i/8)==(i%8)) ? Min : 0; |
970 |
|
ref_fdct(Blk0); |
971 |
|
emms(); fdct(Blk); emms(); |
972 |
|
store_stats(&Stats, Blk, Blk0); |
973 |
|
|
974 |
|
/* randomly saturated inputs */ |
975 |
|
for(p=0; p<Partitions; ++p) |
976 |
|
{ |
977 |
|
for(n=0; n<Loops; ++n) |
978 |
|
{ |
979 |
|
for(i=0; i<64; ++i) |
980 |
|
Blk0[i] = Blk[i] = (ieee_rand(0,Partitions)>=p)? Max : Min; |
981 |
|
ref_fdct(Blk0); |
982 |
|
emms(); fdct(Blk); emms(); |
983 |
|
store_stats(&Stats, Blk, Blk0); |
984 |
|
} |
985 |
|
} |
986 |
|
printf( "\n -- FDCT saturation report --\n" ); |
987 |
|
report_stats(&Stats, 0); |
988 |
|
|
989 |
|
|
990 |
|
/* IDCT tests */ |
991 |
|
#if 0 |
992 |
|
/* no finished yet */ |
993 |
|
|
994 |
|
init_stats(&Stats); |
995 |
|
|
996 |
|
/* test each computation channel separately */ |
997 |
|
for(i=0; i<64; i++) Blk[i] = Blk0[i] = ((i/8)==(i%8)) ? IDCT_MAX : 0; |
998 |
|
ref_idct(Blk0); |
999 |
|
emms(); idct(Blk); emms(); |
1000 |
|
for(i=0; i<64; i++) { CLAMP(Blk0[i], IDCT_OUT); CLAMP(Blk[i], IDCT_OUT); } |
1001 |
|
store_stats(&Stats, Blk, Blk0); |
1002 |
|
|
1003 |
|
for(i=0; i<64; i++) Blk[i] = Blk0[i] = ((i/8)==(i%8)) ? IDCT_MIN : 0; |
1004 |
|
ref_idct(Blk0); |
1005 |
|
emms(); idct(Blk); emms(); |
1006 |
|
for(i=0; i<64; i++) { CLAMP(Blk0[i], IDCT_OUT); CLAMP(Blk[i], IDCT_OUT); } |
1007 |
|
store_stats(&Stats, Blk, Blk0); |
1008 |
|
|
1009 |
|
/* randomly saturated inputs */ |
1010 |
|
for(p=0; p<Partitions; ++p) |
1011 |
|
{ |
1012 |
|
for(n=0; n<Loops; ++n) |
1013 |
|
{ |
1014 |
|
for(i=0; i<64; ++i) |
1015 |
|
Blk0[i] = Blk[i] = (ieee_rand(0,Partitions)>=p)? IDCT_MAX : IDCT_MIN; |
1016 |
|
ref_idct(Blk0); |
1017 |
|
emms(); idct(Blk); emms(); |
1018 |
|
for(i=0; i<64; i++) { CLAMP(Blk0[i],IDCT_OUT); CLAMP(Blk[i],IDCT_OUT); } |
1019 |
|
store_stats(&Stats, Blk, Blk0); |
1020 |
|
} |
1021 |
|
} |
1022 |
|
|
1023 |
|
printf( "\n -- IDCT saturation report --\n" ); |
1024 |
|
print_stats(&Stats); |
1025 |
|
report_stats(&Stats, 0); |
1026 |
|
#endif |
1027 |
|
} |
1028 |
|
} |
1029 |
|
|
1030 |
|
/********************************************************************* |
1031 |
* measure raw decoding speed |
* measure raw decoding speed |
1032 |
*********************************************************************/ |
*********************************************************************/ |
1033 |
|
|
1046 |
int buf_size, pos; |
int buf_size, pos; |
1047 |
uint32_t chksum = 0; |
uint32_t chksum = 0; |
1048 |
|
|
1049 |
xinit.cpu_flags = 0; |
xinit.cpu_flags = XVID_CPU_MMX | XVID_CPU_FORCE; |
1050 |
xvid_init(NULL, 0, &xinit, NULL); |
xvid_init(NULL, 0, &xinit, NULL); |
1051 |
printf( "API version: %d, core build:%d\n", xinit.api_version, xinit.core_build); |
printf( "API version: %d, core build:%d\n", xinit.api_version, xinit.core_build); |
1052 |
|
|
1075 |
} |
} |
1076 |
else printf( "Input size: %d\n", buf_size); |
else printf( "Input size: %d\n", buf_size); |
1077 |
|
|
1078 |
buf = malloc(buf_size); // should be enuf' |
buf = malloc(buf_size); /* should be enuf' */ |
1079 |
rgb_out = calloc(4, width*height); // <-room for _RGB24 |
rgb_out = calloc(4, width*height); /* <-room for _RGB24 */ |
1080 |
if (buf==0 || rgb_out==0) { |
if (buf==0 || rgb_out==0) { |
1081 |
printf( "malloc failed!\n" ); |
printf( "malloc failed!\n" ); |
1082 |
goto End; |
goto End; |
1148 |
|
|
1149 |
for(i=0; i<64; ++i) Src[i] = i-32; |
for(i=0; i<64; ++i) Src[i] = i-32; |
1150 |
set_intra_matrix( get_default_intra_matrix() ); |
set_intra_matrix( get_default_intra_matrix() ); |
1151 |
dequant4_intra(Dst, Src, 32, 5); |
dequant4_intra(Dst, Src, 31, 5); |
1152 |
printf( "dequant4_intra with CPU=%s: ", cpu->name); |
printf( "dequant4_intra with CPU=%s: ", cpu->name); |
1153 |
printf( " Out[]= " ); |
printf( " Out[]= " ); |
1154 |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
1167 |
|
|
1168 |
for(i=0; i<64; ++i) Src[i] = i-32; |
for(i=0; i<64; ++i) Src[i] = i-32; |
1169 |
set_inter_matrix( get_default_inter_matrix() ); |
set_inter_matrix( get_default_inter_matrix() ); |
1170 |
dequant4_inter(Dst, Src, 32); |
dequant4_inter(Dst, Src, 31); |
1171 |
printf( "dequant4_inter with CPU=%s: ", cpu->name); |
printf( "dequant4_inter with CPU=%s: ", cpu->name); |
1172 |
printf( " Out[]= " ); |
printf( " Out[]= " ); |
1173 |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
for(i=0; i<64; ++i) printf( "[%d]", Dst[i]); |
1180 |
CPU *cpu; |
CPU *cpu; |
1181 |
short Blk[8*8], Blk0[8*8]; |
short Blk[8*8], Blk0[8*8]; |
1182 |
|
|
1183 |
printf( "\n ===== fdct/idct saturation diffs =====\n" ); |
printf( "\n ===== fdct/idct precision diffs =====\n" ); |
1184 |
|
|
1185 |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
for(cpu = cpu_short_list; cpu->name!=0; ++cpu) |
1186 |
{ |
{ |
1206 |
} |
} |
1207 |
} |
} |
1208 |
|
|
1209 |
|
void test_quant_bug() |
1210 |
|
{ |
1211 |
|
const int max_Q = 31; |
1212 |
|
int i, n, qm, q; |
1213 |
|
CPU *cpu; |
1214 |
|
int16_t Src[8*8], Dst[8*8]; |
1215 |
|
uint8_t Quant[8*8]; |
1216 |
|
CPU cpu_bug_list[] = { { "PLAINC", 0 }, { "MMX ", XVID_CPU_MMX }, {0,0} }; |
1217 |
|
uint16_t Crcs_Inter[2][32]; |
1218 |
|
uint16_t Crcs_Intra[2][32]; |
1219 |
|
printf( "\n ===== test MPEG4-quantize bug =====\n" ); |
1220 |
|
|
1221 |
|
for(i=0; i<64; ++i) Src[i] = 2048*(i-32)/32; |
1222 |
|
|
1223 |
|
#if 1 |
1224 |
|
for(qm=1; qm<=255; ++qm) |
1225 |
|
{ |
1226 |
|
for(i=0; i<8*8; ++i) Quant[i] = qm; |
1227 |
|
set_inter_matrix( Quant ); |
1228 |
|
|
1229 |
|
for(n=0, cpu = cpu_bug_list; cpu->name!=0; ++cpu, ++n) |
1230 |
|
{ |
1231 |
|
uint16_t s; |
1232 |
|
|
1233 |
|
if (!init_cpu(cpu)) |
1234 |
|
continue; |
1235 |
|
|
1236 |
|
for(q=1; q<=max_Q; ++q) { |
1237 |
|
emms(); |
1238 |
|
quant4_inter( Dst, Src, q ); |
1239 |
|
emms(); |
1240 |
|
for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i; |
1241 |
|
Crcs_Inter[n][q] = s; |
1242 |
|
} |
1243 |
|
} |
1244 |
|
|
1245 |
|
for(q=1; q<=max_Q; ++q) |
1246 |
|
for(i=0; i<n-1; ++i) |
1247 |
|
if (Crcs_Inter[i][q]!=Crcs_Inter[i+1][q]) |
1248 |
|
printf( "Discrepancy Inter: qm=%d, q=%d -> %d/%d !\n", |
1249 |
|
qm, q, Crcs_Inter[i][q], Crcs_Inter[i+1][q]); |
1250 |
|
} |
1251 |
|
#endif |
1252 |
|
|
1253 |
|
#if 1 |
1254 |
|
for(qm=1; qm<=255; ++qm) |
1255 |
|
{ |
1256 |
|
for(i=0; i<8*8; ++i) Quant[i] = qm; |
1257 |
|
set_intra_matrix( Quant ); |
1258 |
|
|
1259 |
|
for(n=0, cpu = cpu_bug_list; cpu->name!=0; ++cpu, ++n) |
1260 |
|
{ |
1261 |
|
uint16_t s; |
1262 |
|
|
1263 |
|
if (!init_cpu(cpu)) |
1264 |
|
continue; |
1265 |
|
|
1266 |
|
for(q=1; q<=max_Q; ++q) { |
1267 |
|
emms(); |
1268 |
|
quant4_intra( Dst, Src, q, q); |
1269 |
|
emms(); |
1270 |
|
for(s=0, i=0; i<64; ++i) s+=((uint16_t)Dst[i])^i; |
1271 |
|
Crcs_Intra[n][q] = s; |
1272 |
|
} |
1273 |
|
} |
1274 |
|
|
1275 |
|
for(q=1; q<=max_Q; ++q) |
1276 |
|
for(i=0; i<n-1; ++i) |
1277 |
|
if (Crcs_Intra[i][q]!=Crcs_Intra[i+1][q]) |
1278 |
|
printf( "Discrepancy Intra: qm=%d, q=%d -> %d/%d!\n", |
1279 |
|
qm, q, Crcs_Inter[i][q], Crcs_Inter[i+1][q]); |
1280 |
|
} |
1281 |
|
#endif |
1282 |
|
} |
1283 |
|
|
1284 |
/********************************************************************* |
/********************************************************************* |
1285 |
* main |
* main |
1296 |
if (what==0 || what==5) test_quant(); |
if (what==0 || what==5) test_quant(); |
1297 |
if (what==0 || what==6) test_cbp(); |
if (what==0 || what==6) test_cbp(); |
1298 |
|
|
1299 |
if (what==8) { |
if (what==7) { |
1300 |
|
test_IEEE1180_compliance(-256, 255, 1); |
1301 |
|
#if 0 |
1302 |
|
test_IEEE1180_compliance(-256, 255,-1); |
1303 |
|
test_IEEE1180_compliance( -5, 5, 1); |
1304 |
|
test_IEEE1180_compliance( -5, 5,-1); |
1305 |
|
test_IEEE1180_compliance(-300, 300, 1); |
1306 |
|
test_IEEE1180_compliance(-300, 300,-1); |
1307 |
|
#endif |
1308 |
|
} |
1309 |
|
if (what==8) test_dct_saturation(-256, 255); |
1310 |
|
|
1311 |
|
if (what==9) { |
1312 |
int width, height; |
int width, height; |
1313 |
if (argc<5) { |
if (argc<5) { |
1314 |
printf("usage: %s %d [bitstream] [width] [height]\n", argv[0], what); |
printf("usage: %s %d [bitstream] [width] [height]\n", argv[0], what); |
1320 |
} |
} |
1321 |
|
|
1322 |
if (what==-1) { |
if (what==-1) { |
|
test_bugs1(); |
|
1323 |
test_dct_precision_diffs(); |
test_dct_precision_diffs(); |
1324 |
|
test_bugs1(); |
1325 |
} |
} |
1326 |
|
if (what==-2) |
1327 |
|
test_quant_bug(); |
1328 |
|
|
1329 |
return 0; |
return 0; |
1330 |
} |
} |
1331 |
|
|
1332 |
/********************************************************************* |
/********************************************************************* |
1333 |
* 'Reference' output (except for timing) on a PIII 1.13Ghz/linux |
* 'Reference' output (except for timing) on a PIII 1.13Ghz/linux |
1334 |
*********************************************************************/ |
*********************************************************************/ |
1335 |
|
|
1336 |
|
/* as of 07/01/2002, there's a problem with mpeg4-quantization */ |
1337 |
/* |
/* |
1338 |
|
|
1339 |
===== test fdct/idct ===== |
===== test fdct/idct ===== |
1340 |
PLAINC - 2.631 usec iCrc=3 fCrc=-85 |
PLAINC - 3.312 usec PSNR=13.291 MSE=3.000 |
1341 |
MMX - 0.596 usec iCrc=3 fCrc=-67 |
MMX - 0.591 usec PSNR=13.291 MSE=3.000 |
1342 |
MMXEXT - 0.608 usec iCrc=3 fCrc=-67 |
MMXEXT - 0.577 usec PSNR=13.291 MSE=3.000 |
1343 |
SSE2 - 0.605 usec iCrc=3 fCrc=-67 |
SSE2 - 0.588 usec PSNR=13.291 MSE=3.000 |
1344 |
3DNOW - skipped... |
3DNOW - skipped... |
1345 |
3DNOWE - skipped... |
3DNOWE - skipped... |
1346 |
|
|
1347 |
=== test block motion === |
=== test block motion === |
1348 |
PLAINC - interp- h-round0 1.031 usec iCrc=8107 |
PLAINC - interp- h-round0 0.911 usec iCrc=8107 |
1349 |
PLAINC - round1 1.022 usec iCrc=8100 |
PLAINC - round1 0.863 usec iCrc=8100 |
1350 |
PLAINC - interp- v-round0 1.002 usec iCrc=8108 |
PLAINC - interp- v-round0 0.860 usec iCrc=8108 |
1351 |
PLAINC - round1 1.011 usec iCrc=8105 |
PLAINC - round1 0.857 usec iCrc=8105 |
1352 |
PLAINC - interp-hv-round0 1.623 usec iCrc=8112 |
PLAINC - interp-hv-round0 2.103 usec iCrc=8112 |
1353 |
PLAINC - round1 1.621 usec iCrc=8103 |
PLAINC - round1 2.050 usec iCrc=8103 |
|
PLAINC - interpolate8x8_c 0.229 usec iCrc=8107 |
|
1354 |
--- |
--- |
1355 |
MMX - interp- h-round0 0.105 usec iCrc=8107 |
MMX - interp- h-round0 0.105 usec iCrc=8107 |
1356 |
MMX - round1 0.105 usec iCrc=8100 |
MMX - round1 0.106 usec iCrc=8100 |
1357 |
MMX - interp- v-round0 0.106 usec iCrc=8108 |
MMX - interp- v-round0 0.106 usec iCrc=8108 |
1358 |
MMX - round1 0.107 usec iCrc=8105 |
MMX - round1 0.106 usec iCrc=8105 |
1359 |
MMX - interp-hv-round0 0.145 usec iCrc=8112 |
MMX - interp-hv-round0 0.145 usec iCrc=8112 |
1360 |
MMX - round1 0.145 usec iCrc=8103 |
MMX - round1 0.145 usec iCrc=8103 |
|
MMX - interpolate8x8_c 0.229 usec iCrc=8107 |
|
1361 |
--- |
--- |
1362 |
MMXEXT - interp- h-round0 0.027 usec iCrc=8107 |
MMXEXT - interp- h-round0 0.028 usec iCrc=8107 |
1363 |
MMXEXT - round1 0.041 usec iCrc=8100 |
MMXEXT - round1 0.041 usec iCrc=8100 |
1364 |
MMXEXT - interp- v-round0 0.027 usec iCrc=8108 |
MMXEXT - interp- v-round0 0.027 usec iCrc=8108 |
1365 |
MMXEXT - round1 0.040 usec iCrc=8105 |
MMXEXT - round1 0.041 usec iCrc=8105 |
1366 |
MMXEXT - interp-hv-round0 0.070 usec iCrc=8112 |
MMXEXT - interp-hv-round0 0.066 usec iCrc=8112 |
1367 |
MMXEXT - round1 0.066 usec iCrc=8103 |
MMXEXT - round1 0.065 usec iCrc=8103 |
|
MMXEXT - interpolate8x8_c 0.027 usec iCrc=8107 |
|
1368 |
--- |
--- |
1369 |
SSE2 - interp- h-round0 0.106 usec iCrc=8107 |
SSE2 - interp- h-round0 0.109 usec iCrc=8107 |
1370 |
SSE2 - round1 0.105 usec iCrc=8100 |
SSE2 - round1 0.105 usec iCrc=8100 |
1371 |
SSE2 - interp- v-round0 0.106 usec iCrc=8108 |
SSE2 - interp- v-round0 0.106 usec iCrc=8108 |
1372 |
SSE2 - round1 0.106 usec iCrc=8105 |
SSE2 - round1 0.109 usec iCrc=8105 |
1373 |
SSE2 - interp-hv-round0 0.145 usec iCrc=8112 |
SSE2 - interp-hv-round0 0.145 usec iCrc=8112 |
1374 |
SSE2 - round1 0.145 usec iCrc=8103 |
SSE2 - round1 0.145 usec iCrc=8103 |
|
SSE2 - interpolate8x8_c 0.237 usec iCrc=8107 |
|
1375 |
--- |
--- |
1376 |
3DNOW - skipped... |
3DNOW - skipped... |
1377 |
3DNOWE - skipped... |
3DNOWE - skipped... |
1378 |
|
|
1379 |
====== test SAD ====== |
====== test SAD ====== |
1380 |
PLAINC - sad8 0.296 usec sad=3776 |
PLAINC - sad8 0.251 usec sad=3776 |
1381 |
PLAINC - sad16 1.599 usec sad=27214 |
PLAINC - sad16 1.601 usec sad=27214 |
1382 |
PLAINC - sad16bi 2.350 usec sad=26274 |
PLAINC - sad16bi 2.371 usec sad=26274 |
1383 |
PLAINC - dev16 1.610 usec sad=3344 |
PLAINC - dev16 1.564 usec sad=3344 |
1384 |
--- |
--- |
1385 |
MMX - sad8 0.057 usec sad=3776 |
MMX - sad8 0.057 usec sad=3776 |
1386 |
MMX - sad16 0.178 usec sad=27214 |
MMX - sad16 0.182 usec sad=27214 |
1387 |
MMX - sad16bi 2.381 usec sad=26274 |
MMX - sad16bi 2.462 usec sad=26274 |
1388 |
MMX - dev16 0.312 usec sad=3344 |
MMX - dev16 0.311 usec sad=3344 |
1389 |
--- |
--- |
1390 |
MMXEXT - sad8 0.036 usec sad=3776 |
MMXEXT - sad8 0.036 usec sad=3776 |
1391 |
MMXEXT - sad16 0.106 usec sad=27214 |
MMXEXT - sad16 0.109 usec sad=27214 |
1392 |
MMXEXT - sad16bi 0.182 usec sad=26274 |
MMXEXT - sad16bi 0.143 usec sad=26274 |
1393 |
MMXEXT - dev16 0.193 usec sad=3344 |
MMXEXT - dev16 0.192 usec sad=3344 |
1394 |
--- |
--- |
1395 |
SSE2 - sad8 0.057 usec sad=3776 |
SSE2 - sad8 0.057 usec sad=3776 |
1396 |
SSE2 - sad16 0.178 usec sad=27214 |
SSE2 - sad16 0.179 usec sad=27214 |
1397 |
SSE2 - sad16bi 2.427 usec sad=26274 |
SSE2 - sad16bi 2.456 usec sad=26274 |
1398 |
SSE2 - dev16 0.313 usec sad=3344 |
SSE2 - dev16 0.321 usec sad=3344 |
1399 |
--- |
--- |
1400 |
3DNOW - skipped... |
3DNOW - skipped... |
1401 |
3DNOWE - skipped... |
3DNOWE - skipped... |
1402 |
|
|
1403 |
=== test transfer === |
=== test transfer === |
1404 |
PLAINC - 8to16 0.124 usec crc=28288 |
PLAINC - 8to16 0.151 usec crc=28288 |
1405 |
PLAINC - 16to8 0.753 usec crc=28288 |
PLAINC - 16to8 1.113 usec crc=28288 |
1406 |
PLAINC - 8to8 0.041 usec crc=20352 |
PLAINC - 8to8 0.043 usec crc=20352 |
1407 |
PLAINC - 16to8add 0.916 usec crc=25536 |
PLAINC - 16to8add 1.069 usec crc=25536 |
1408 |
PLAINC - 8to16sub 0.812 usec crc1=28064 crc2=16256 |
PLAINC - 8to16sub 0.631 usec crc1=28064 crc2=16256 |
1409 |
PLAINC - 8to16sub2 0.954 usec crc=20384 |
PLAINC - 8to16sub2 0.597 usec crc=20384 |
1410 |
--- |
--- |
1411 |
MMX - 8to16 0.037 usec crc=28288 |
MMX - 8to16 0.032 usec crc=28288 |
1412 |
MMX - 16to8 0.016 usec crc=28288 |
MMX - 16to8 0.024 usec crc=28288 |
1413 |
MMX - 8to8 0.018 usec crc=20352 |
MMX - 8to8 0.020 usec crc=20352 |
1414 |
MMX - 16to8add 0.044 usec crc=25536 |
MMX - 16to8add 0.043 usec crc=25536 |
1415 |
MMX - 8to16sub 0.065 usec crc1=28064 crc2=16256 |
MMX - 8to16sub 0.066 usec crc1=28064 crc2=16256 |
1416 |
MMX - 8to16sub2 0.110 usec crc=20384 |
MMX - 8to16sub2 0.111 usec crc=20384 |
|
--- |
|
|
MMXEXT - 8to16 0.032 usec crc=28288 |
|
|
MMXEXT - 16to8 0.023 usec crc=28288 |
|
|
MMXEXT - 8to8 0.018 usec crc=20352 |
|
|
MMXEXT - 16to8add 0.041 usec crc=25536 |
|
|
MMXEXT - 8to16sub 0.065 usec crc1=28064 crc2=16256 |
|
|
MMXEXT - 8to16sub2 0.069 usec crc=20384 |
|
1417 |
--- |
--- |
1418 |
|
|
1419 |
===== test quant ===== |
===== test quant ===== |
1420 |
PLAINC - quant4_intra 78.889 usec crc=55827 |
PLAINC - quant4_intra 74.248 usec crc=29809 |
1421 |
PLAINC - quant4_inter 71.957 usec crc=58201 |
PLAINC - quant4_inter 70.850 usec crc=12574 |
1422 |
PLAINC - dequant4_intra 34.968 usec crc=193340 |
PLAINC - dequant4_intra 40.628 usec crc=24052 |
1423 |
PLAINC - dequant4_inter 40.792 usec crc=116483 |
PLAINC - dequant4_inter 45.691 usec crc=63847 |
1424 |
PLAINC - quant_intra 30.845 usec crc=56885 |
PLAINC - quant_intra 43.357 usec crc=25662 |
1425 |
PLAINC - quant_inter 34.842 usec crc=58056 |
PLAINC - quant_inter 33.410 usec crc=23972 |
1426 |
PLAINC - dequant_intra 33.211 usec crc=-7936 |
PLAINC - dequant_intra 36.384 usec crc=49900 |
1427 |
PLAINC - dequant_inter 45.486 usec crc=-33217 |
PLAINC - dequant_inter 48.930 usec crc=48899 |
1428 |
--- |
--- |
1429 |
MMX - quant4_intra 9.030 usec crc=55827 |
MMX - quant4_intra 7.445 usec crc=3459 |
1430 |
MMX - quant4_inter 8.234 usec crc=58201 |
*** CRC ERROR! *** |
1431 |
MMX - dequant4_intra 18.330 usec crc=193340 |
MMX - quant4_inter 5.384 usec crc=51072 |
1432 |
MMX - dequant4_inter 19.181 usec crc=116483 |
*** CRC ERROR! *** |
1433 |
MMX - quant_intra 7.124 usec crc=56885 |
MMX - dequant4_intra 5.515 usec crc=24052 |
1434 |
MMX - quant_inter 6.861 usec crc=58056 |
MMX - dequant4_inter 7.745 usec crc=63847 |
1435 |
MMX - dequant_intra 9.048 usec crc=-7936 |
MMX - quant_intra 4.661 usec crc=25662 |
1436 |
MMX - dequant_inter 8.203 usec crc=-33217 |
MMX - quant_inter 4.406 usec crc=23972 |
1437 |
--- |
MMX - dequant_intra 4.928 usec crc=49900 |
1438 |
MMXEXT - quant4_intra 9.045 usec crc=55827 |
MMX - dequant_inter 4.532 usec crc=48899 |
|
MMXEXT - quant4_inter 8.232 usec crc=58201 |
|
|
MMXEXT - dequant4_intra 18.250 usec crc=193340 |
|
|
MMXEXT - dequant4_inter 19.256 usec crc=116483 |
|
|
MMXEXT - quant_intra 7.121 usec crc=56885 |
|
|
MMXEXT - quant_inter 6.855 usec crc=58056 |
|
|
MMXEXT - dequant_intra 9.034 usec crc=-7936 |
|
|
MMXEXT - dequant_inter 8.202 usec crc=-33217 |
|
1439 |
--- |
--- |
1440 |
|
|
1441 |
===== test cbp ===== |
===== test cbp ===== |
1442 |
PLAINC - calc_cbp#1 0.545 usec cbp=0x15 |
PLAINC - calc_cbp#1 0.371 usec cbp=0x15 |
1443 |
PLAINC - calc_cbp#2 0.540 usec cbp=0x38 |
PLAINC - calc_cbp#2 0.432 usec cbp=0x38 |
1444 |
PLAINC - calc_cbp#3 0.477 usec cbp=0xf |
PLAINC - calc_cbp#3 0.339 usec cbp=0xf |
1445 |
PLAINC - calc_cbp#4 0.739 usec cbp=0x5 |
PLAINC - calc_cbp#4 0.506 usec cbp=0x5 |
1446 |
--- |
--- |
1447 |
MMX - calc_cbp#1 0.136 usec cbp=0x15 |
MMX - calc_cbp#1 0.136 usec cbp=0x15 |
1448 |
MMX - calc_cbp#2 0.131 usec cbp=0x38 |
MMX - calc_cbp#2 0.134 usec cbp=0x38 |
1449 |
MMX - calc_cbp#3 0.132 usec cbp=0xf |
MMX - calc_cbp#3 0.138 usec cbp=0xf |
1450 |
MMX - calc_cbp#4 0.135 usec cbp=0x5 |
MMX - calc_cbp#4 0.135 usec cbp=0x5 |
1451 |
--- |
--- |
1452 |
SSE2 - calc_cbp#1 0.135 usec cbp=0x15 |
SSE2 - calc_cbp#1 0.136 usec cbp=0x15 |
1453 |
SSE2 - calc_cbp#2 0.131 usec cbp=0x38 |
SSE2 - calc_cbp#2 0.133 usec cbp=0x38 |
1454 |
SSE2 - calc_cbp#3 0.134 usec cbp=0xf |
SSE2 - calc_cbp#3 0.133 usec cbp=0xf |
1455 |
SSE2 - calc_cbp#4 0.136 usec cbp=0x5 |
SSE2 - calc_cbp#4 0.141 usec cbp=0x5 |
1456 |
--- |
--- |
1457 |
|
|
1458 |
*/ |
*/ |