[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 1382, Mon Mar 22 22:36:25 2004 UTC revision 1412, Mon Apr 5 20:36:37 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.13 2004-04-05 20:36:36 edgomez Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 121  Line 121 
121    , { "3DNOW ", XVID_CPU_3DNOW }    , { "3DNOW ", XVID_CPU_3DNOW }
122    , { "3DNOWE", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT }    , { "3DNOWE", XVID_CPU_3DNOW | XVID_CPU_3DNOWEXT }
123  #endif  #endif
124    #ifdef ARCH_IS_PPC
125      , { "ALTIVEC", XVID_CPU_ALTIVEC }
126    #endif
127  //, { "IA64  ", XVID_CPU_IA64 }  //, { "IA64  ", XVID_CPU_IA64 }
128  //, { "TSC   ", XVID_CPU_TSC }  //, { "TSC   ", XVID_CPU_TSC }
129    , { 0, 0 } };    , { 0, 0 } };
# Line 657  Line 660 
660  }                                           \  }                                           \
661  t = (gettime_usec()-t-overhead)/nb_tests/qm  t = (gettime_usec()-t-overhead)/nb_tests/qm
662    
663    #define TEST_INTRA(REFFUNC, NEWFUNC, RANGE)              \
664    { int i,q,s;\
665            DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); \
666      DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); \
667      DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); \
668      for(q=1;q<=max_Q;q++)          \
669        for(s=-RANGE;s<RANGE;s++) { \
670          for(i=0;i<64;i++) Src[i]=s; \
671          (REFFUNC)((Dst),(Src),q,q,mpeg_quant_matrices);   \
672          (NEWFUNC)((Dst2),(Src),q,q,mpeg_quant_matrices);  \
673          for(i=0;i<64;i++)     \
674            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]);  \
675        }      \
676    }
677    
678    #define TEST_INTER(REFFUNC, NEWFUNC, RANGE)              \
679    { int i,q,s;  \
680            DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16); \
681      DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16); \
682      DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16); \
683      for(q=1;q<=max_Q;q++)  \
684        for(s=-RANGE;s<RANGE;s++) {   \
685          for(i=0;i<64;i++) Src[i]=s; \
686          (REFFUNC)((Dst),(Src),q,mpeg_quant_matrices);  \
687          (NEWFUNC)((Dst2),(Src),q,mpeg_quant_matrices); \
688          emms();           \
689          for(i=0;i<64;i++) \
690            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]); \
691        } \
692    }
693    
694  void test_quant()  void test_quant()
695  {  {
696          const int nb_tests = 1*speed_ref;          const int nb_tests = 1*speed_ref;
# Line 667  Line 701 
701          CPU *cpu;          CPU *cpu;
702          DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Src, 8, 8, int16_t, 16);
703          DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16);          DECLARE_ALIGNED_MATRIX(Dst, 8, 8, int16_t, 16);
704            DECLARE_ALIGNED_MATRIX(Dst2,8, 8, int16_t, 16);
705          uint8_t Quant[8*8];          uint8_t Quant[8*8];
706    
707          printf( "\n =====  test quant =====\n" );          printf( "\n =====  test quant =====\n" );
# Line 687  Line 722 
722                  if (!init_cpu(cpu))                  if (!init_cpu(cpu))
723                  continue;                  continue;
724    
725                    // exhaustive tests to compare against the (ref) C-version
726                    TEST_INTRA(quant_h263_intra_c,   quant_h263_intra,    2048);
727                    TEST_INTRA(dequant_h263_intra_c, dequant_h263_intra , 512 );
728                    TEST_INTER(quant_h263_inter_c,   quant_h263_inter ,   2048);
729                    TEST_INTER(dequant_h263_inter_c, dequant_h263_inter , 512 );
730    
731                  overhead = -gettime_usec();                  overhead = -gettime_usec();
732                  for(s=0,qm=1; qm<=255; ++qm) {                  for(s=0,qm=1; qm<=255; ++qm) {
733                          for(i=0; i<8*8; ++i) Quant[i] = qm;                          for(i=0; i<8*8; ++i) Quant[i] = qm;

Legend:
Removed from v.1382  
changed lines
  Added in v.1412

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