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; |
698 |
CPU *cpu; |
CPU *cpu; |
699 |
DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); |
DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); |
700 |
DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); |
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; |