342 |
int tst; |
int tst; |
343 |
CPU *cpu; |
CPU *cpu; |
344 |
int i; |
int i; |
345 |
uint8_t Cur[16*16], Ref1[16*16], Ref2[16*16]; |
DECLARE_ALIGNED_MATRIX(Cur, 16, 16, uint8_t, 16); |
346 |
|
DECLARE_ALIGNED_MATRIX(Ref1, 16, 16, uint8_t, 16); |
347 |
|
DECLARE_ALIGNED_MATRIX(Ref2, 16, 16, uint8_t, 16); |
348 |
|
|
349 |
printf( "\n ====== test SAD ======\n" ); |
printf( "\n ====== test SAD ======\n" ); |
350 |
for(i=0; i<16*16;++i) { |
for(i=0; i<16*16;++i) { |
636 |
for(q=1; q<=max_Q; ++q) { \ |
for(q=1; q<=max_Q; ++q) { \ |
637 |
for(tst=0; tst<nb_tests; ++tst) \ |
for(tst=0; tst<nb_tests; ++tst) \ |
638 |
(FUNC)((DST), (SRC), q, mpeg_quant_matrices); \ |
(FUNC)((DST), (SRC), q, mpeg_quant_matrices); \ |
639 |
s = calc_crc((uint8_t*)(DST), sizeof((DST)), s); \ |
s = calc_crc((uint8_t*)(DST), 64*sizeof(int16_t), s); \ |
640 |
} \ |
} \ |
641 |
emms(); \ |
emms(); \ |
642 |
} \ |
} \ |
651 |
for(q=1; q<=max_Q; ++q) { \ |
for(q=1; q<=max_Q; ++q) { \ |
652 |
for(tst=0; tst<nb_tests; ++tst) \ |
for(tst=0; tst<nb_tests; ++tst) \ |
653 |
(FUNC)((DST), (SRC), q, q, mpeg_quant_matrices); \ |
(FUNC)((DST), (SRC), q, q, mpeg_quant_matrices); \ |
654 |
s = calc_crc((uint8_t*)(DST), sizeof((DST)), s); \ |
s = calc_crc((uint8_t*)(DST), 64*sizeof(int16_t), s); \ |
655 |
} \ |
} \ |
656 |
emms(); \ |
emms(); \ |
657 |
} \ |
} \ |
658 |
t = (gettime_usec()-t-overhead)/nb_tests/qm |
t = (gettime_usec()-t-overhead)/nb_tests/qm |
659 |
|
|
660 |
|
#define TEST_INTRA(REFFUNC, NEWFUNC, RANGE) \ |
661 |
|
{ int i,q,s;\ |
662 |
|
DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); \ |
663 |
|
DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); \ |
664 |
|
DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); \ |
665 |
|
for(q=1;q<=max_Q;q++) \ |
666 |
|
for(s=-RANGE;s<RANGE;s++) { \ |
667 |
|
for(i=0;i<64;i++) Src[i]=s; \ |
668 |
|
(REFFUNC)((Dst),(Src),q,q,mpeg_quant_matrices); \ |
669 |
|
(NEWFUNC)((Dst2),(Src),q,q,mpeg_quant_matrices); \ |
670 |
|
for(i=0;i<64;i++) \ |
671 |
|
if(Dst[i]!=Dst2[i]) printf("ERROR : " #NEWFUNC " i%d quant:%d input:%d C_result:%d ASM_result:%d\n",i,q,s,Dst[i],Dst2[i]); \ |
672 |
|
} \ |
673 |
|
} |
674 |
|
|
675 |
|
#define TEST_INTER(REFFUNC, NEWFUNC, RANGE) \ |
676 |
|
{ int i,q,s; \ |
677 |
|
DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); \ |
678 |
|
DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); \ |
679 |
|
DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); \ |
680 |
|
for(q=1;q<=max_Q;q++) \ |
681 |
|
for(s=-RANGE;s<RANGE;s++) { \ |
682 |
|
for(i=0;i<64;i++) Src[i]=s; \ |
683 |
|
(REFFUNC)((Dst),(Src),q,mpeg_quant_matrices); \ |
684 |
|
(NEWFUNC)((Dst2),(Src),q,mpeg_quant_matrices); \ |
685 |
|
emms(); \ |
686 |
|
for(i=0;i<64;i++) \ |
687 |
|
if(Dst[i]!=Dst2[i]) printf("ERROR : " #NEWFUNC " i%d quant:%d input:%d C_result:%d ASM_result:%d\n",i,q,s,Dst[i],Dst2[i]); \ |
688 |
|
} \ |
689 |
|
} |
690 |
|
|
691 |
void test_quant() |
void test_quant() |
692 |
{ |
{ |
693 |
const int nb_tests = 1*speed_ref; |
const int nb_tests = 1*speed_ref; |
694 |
const int max_Q = 31; |
const int max_Q = 31; |
695 |
uint16_t mpeg_quant_matrices[64*8]; |
DECLARE_ALIGNED_MATRIX(mpeg_quant_matrices, 8, 64, uint16_t, 16); |
696 |
|
|
697 |
int i, qm; |
int i, qm; |
698 |
CPU *cpu; |
CPU *cpu; |
699 |
int16_t Src[8*8], Dst[8*8]; |
DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); |
700 |
|
DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); |
701 |
|
DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); |
702 |
uint8_t Quant[8*8]; |
uint8_t Quant[8*8]; |
703 |
|
|
704 |
printf( "\n ===== test quant =====\n" ); |
printf( "\n ===== test quant =====\n" ); |
719 |
if (!init_cpu(cpu)) |
if (!init_cpu(cpu)) |
720 |
continue; |
continue; |
721 |
|
|
722 |
|
// exhaustive tests to compare against the (ref) C-version |
723 |
|
TEST_INTRA(quant_h263_intra_c, quant_h263_intra, 2048); |
724 |
|
TEST_INTRA(dequant_h263_intra_c, dequant_h263_intra , 512 ); |
725 |
|
TEST_INTER(quant_h263_inter_c, quant_h263_inter , 2048); |
726 |
|
TEST_INTER(dequant_h263_inter_c, dequant_h263_inter , 512 ); |
727 |
|
|
728 |
overhead = -gettime_usec(); |
overhead = -gettime_usec(); |
729 |
for(s=0,qm=1; qm<=255; ++qm) { |
for(s=0,qm=1; qm<=255; ++qm) { |
730 |
for(i=0; i<8*8; ++i) Quant[i] = qm; |
for(i=0; i<8*8; ++i) Quant[i] = qm; |
796 |
const int nb_tests = 10000*speed_ref; |
const int nb_tests = 10000*speed_ref; |
797 |
int i; |
int i; |
798 |
CPU *cpu; |
CPU *cpu; |
799 |
int16_t Src1[6*64], Src2[6*64], Src3[6*64], Src4[6*64]; |
DECLARE_ALIGNED_MATRIX(Src1, 6, 64, int16_t, 16); |
800 |
|
DECLARE_ALIGNED_MATRIX(Src2, 6, 64, int16_t, 16); |
801 |
|
DECLARE_ALIGNED_MATRIX(Src3, 6, 64, int16_t, 16); |
802 |
|
DECLARE_ALIGNED_MATRIX(Src4, 6, 64, int16_t, 16); |
803 |
|
|
804 |
printf( "\n ===== test cbp =====\n" ); |
printf( "\n ===== test cbp =====\n" ); |
805 |
|
|
1377 |
void test_dct_precision_diffs() |
void test_dct_precision_diffs() |
1378 |
{ |
{ |
1379 |
CPU *cpu; |
CPU *cpu; |
1380 |
short Blk[8*8], Blk0[8*8]; |
DECLARE_ALIGNED_MATRIX(Blk, 8, 8, int16_t, 16); |
1381 |
|
DECLARE_ALIGNED_MATRIX(Blk0, 8, 8, int16_t, 16); |
1382 |
|
|
1383 |
printf( "\n ===== fdct/idct precision diffs =====\n" ); |
printf( "\n ===== fdct/idct precision diffs =====\n" ); |
1384 |
|
|
1411 |
const int max_Q = 31; |
const int max_Q = 31; |
1412 |
int i, n, qm, q; |
int i, n, qm, q; |
1413 |
CPU *cpu; |
CPU *cpu; |
1414 |
int16_t Src[8*8], Dst[8*8]; |
DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); |
1415 |
|
DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); |
1416 |
uint8_t Quant[8*8]; |
uint8_t Quant[8*8]; |
1417 |
CPU cpu_bug_list[] = { { "PLAINC", 0 }, { "MMX ", XVID_CPU_MMX }, {0,0} }; |
CPU cpu_bug_list[] = { { "PLAINC", 0 }, { "MMX ", XVID_CPU_MMX }, {0,0} }; |
1418 |
uint16_t Crcs_Inter[2][32]; |
uint16_t Crcs_Inter[2][32]; |
1419 |
uint16_t Crcs_Intra[2][32]; |
uint16_t Crcs_Intra[2][32]; |
1420 |
uint16_t mpeg_quant_matrices[64*8]; |
DECLARE_ALIGNED_MATRIX(mpeg_quant_matrices, 8, 64, uint16_t, 16); |
1421 |
|
|
1422 |
printf( "\n ===== test MPEG4-quantize bug =====\n" ); |
printf( "\n ===== test MPEG4-quantize bug =====\n" ); |
1423 |
|
|