[svn] / trunk / xvidcore / examples / xvid_bench.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_bench.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1397, Thu Apr 1 11:11:28 2004 UTC revision 1398, Fri Apr 2 21:29:21 2004 UTC
# Line 19  Line 19 
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.11 2004-03-22 22:36:23 edgomez Exp $   * $Id: xvid_bench.c,v 1.12 2004-04-02 21:29:21 edgomez Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 657  Line 657 
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;
# Line 667  Line 698 
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" );
# Line 687  Line 719 
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;

Legend:
Removed from v.1397  
changed lines
  Added in v.1398

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4