[svn] / branches / dev-api-4 / xvidcore / examples / xvid_bench.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/examples/xvid_bench.c

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

revision 1261, Sat Dec 13 00:04:09 2003 UTC revision 1392, Tue Mar 30 21:38:19 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.9.2.10 2003-12-13 00:04:08 edgomez Exp $   * $Id: xvid_bench.c,v 1.9.2.11 2004-03-30 21:38:19 Skal 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    
705    
706          printf( "\n =====  test quant =====\n" );          printf( "\n =====  test quant =====\n" );
707    
708  /* we deliberately enfringe the norm's specified range [-127,127], */  /* we deliberately enfringe the norm's specified range [-127,127], */
# Line 687  Line 721 
721                  if (!init_cpu(cpu))                  if (!init_cpu(cpu))
722                  continue;                  continue;
723    
724          // exhaustive tests to compare against the (ref) C-version
725        TEST_INTRA(quant_h263_intra_c,   quant_h263_intra,    2048);
726        TEST_INTRA(dequant_h263_intra_c, dequant_h263_intra , 512 );
727        TEST_INTER(quant_h263_inter_c,   quant_h263_inter ,   2048);
728        TEST_INTER(dequant_h263_inter_c, dequant_h263_inter , 512 );
729    
730                  overhead = -gettime_usec();                  overhead = -gettime_usec();
731                  for(s=0,qm=1; qm<=255; ++qm) {                  for(s=0,qm=1; qm<=255; ++qm) {
732                          for(i=0; i<8*8; ++i) Quant[i] = qm;                          for(i=0; i<8*8; ++i) Quant[i] = qm;

Legend:
Removed from v.1261  
changed lines
  Added in v.1392

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