[cvs] / xvidcore / src / xvid.c Repository:
ViewVC logotype

Diff of /xvidcore/src/xvid.c

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

revision 1.33.2.21, Fri Jan 3 16:25:14 2003 UTC revision 1.44, Thu Feb 20 22:46:18 2003 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - Native API implementation  -   *  - Native API implementation  -
5   *   *
  *  This program is an implementation of a part of one or more MPEG-4  
  *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  
  *  to use this software module in hardware or software products are  
  *  advised that its use may infringe existing patents or copyrights, and  
  *  any such use would be at such party's own risk.  The original  
  *  developer of this software module and his/her company, and subsequent  
  *  editors and their companies, will have no liability for use of this  
  *  software or modifications or derivatives thereof.  
  *  
6   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
8   *  the Free Software Foundation ; either version 2 of the License, or   *  the Free Software Foundation ; either version 2 of the License, or
# Line 26  Line 17 
17   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19   *   *
  ****************************************************************************/  
   
 /*****************************************************************************  
  *  
  *  History  
  *  
  *      - 23.06.2002    added XVID_CPU_CHKONLY  
  *  - 17.03.2002        Added interpolate8x8_halfpel_hv_xmm  
  *  - 22.12.2001  API change: added xvid_init() - Isibaar  
  *  - 16.12.2001        inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>  
  *  
20   *  $Id$   *  $Id$
21   *   *
22   ****************************************************************************/   ****************************************************************************/
# Line 65  Line 45 
45  #include "utils/timer.h"  #include "utils/timer.h"
46  #include "bitstream/mbcoding.h"  #include "bitstream/mbcoding.h"
47    
48  #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE)  #if defined(ARCH_IS_IA32)
49    
50  #ifdef WIN32  #if defined(_MSC_VER)
51  #include <windows.h>  #include <windows.h>
52  #else  #else
53  #include <signal.h>  #include <signal.h>
54  #include <setjmp.h>  #include <setjmp.h>
 #endif  
   
   
 #ifndef WIN32  
55    
56  static jmp_buf mark;  static jmp_buf mark;
57    
# Line 88  Line 64 
64    
65    
66  /*  /*
67  calls the funcptr, and returns whether SIGILL (illegal instruction) was signalled   * Calls the funcptr, and returns whether SIGILL (illegal instruction) was
68  return values:   * signalled
69  -1 : could not determine   *
70  0  : SIGILL was *not* signalled   * Return values:
71  1  : SIGILL was signalled   *  -1 : could not determine
72     *   0 : SIGILL was *not* signalled
73     *   1 : SIGILL was signalled
74  */  */
75    
76  int  int
77  sigill_check(void (*func)())  sigill_check(void (*func)())
78  {  {
79  #ifdef WIN32  #if defined(_MSC_VER)
80          _try {          _try {
81                  func();                  func();
82          }          }
# Line 132  Line 110 
110  }  }
111  #endif  #endif
112    
113    
114    /* detect cpu flags  */
115    static unsigned int
116    detect_cpu_flags()
117    {
118            /* enable native assembly optimizations by default */
119            unsigned int cpu_flags = XVID_CPU_ASM;
120    
121    #if defined(ARCH_IS_IA32)
122            cpu_flags |= check_cpu_features();
123            if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger))
124                    cpu_flags &= ~XVID_CPU_SSE;
125    
126            if ((cpu_flags & XVID_CPU_SSE2) && sigill_check(sse2_os_trigger))
127                    cpu_flags &= ~XVID_CPU_SSE2;
128    #endif
129    
130    #if defined(ARCH_IS_PPC)
131    #if defined(ARCH_IS_PPC_ALTIVEC)
132            cpu_flags |= XVID_CPU_ALTIVEC;
133    #endif
134    #endif
135    
136            return cpu_flags;
137    }
138    
139    
140  /*****************************************************************************  /*****************************************************************************
141   * XviD Init Entry point   * XviD Init Entry point
142   *   *
# Line 165  Line 170 
170    
171          } else {          } else {
172    
173                  cpu_flags = check_cpu_features();                  cpu_flags = detect_cpu_flags();
   
 #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE)  
                 if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger))  
                         cpu_flags &= ~XVID_CPU_SSE;  
   
                 if ((cpu_flags & XVID_CPU_SSE2) && sigill_check(sse2_os_trigger))  
                         cpu_flags &= ~XVID_CPU_SSE2;  
 #endif  
174          }          }
175    
176          if ((init_param->cpu_flags & XVID_CPU_CHKONLY))          if ((init_param->cpu_flags & XVID_CPU_CHKONLY))
# Line 214  Line 211 
211          transfer_8to16copy = transfer_8to16copy_c;          transfer_8to16copy = transfer_8to16copy_c;
212          transfer_16to8copy = transfer_16to8copy_c;          transfer_16to8copy = transfer_16to8copy_c;
213          transfer_8to16sub  = transfer_8to16sub_c;          transfer_8to16sub  = transfer_8to16sub_c;
214            transfer_8to16subro  = transfer_8to16subro_c;
215          transfer_8to16sub2 = transfer_8to16sub2_c;          transfer_8to16sub2 = transfer_8to16sub2_c;
216          transfer_16to8add  = transfer_16to8add_c;          transfer_16to8add  = transfer_16to8add_c;
217          transfer8x8_copy   = transfer8x8_copy_c;          transfer8x8_copy   = transfer8x8_copy_c;
# Line 241  Line 239 
239          interpolate8x8_avg4 = interpolate8x8_avg4_c;          interpolate8x8_avg4 = interpolate8x8_avg4_c;
240    
241          /* reduced resoltuion */          /* reduced resoltuion */
   
242          copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_C;          copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_C;
243          add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_C;          add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_C;
 #ifdef ARCH_X86  
         vfilter_31 = xvid_VFilter_31_x86;  
         hfilter_31 = xvid_HFilter_31_x86;  
 #else  
244          vfilter_31 = xvid_VFilter_31_C;          vfilter_31 = xvid_VFilter_31_C;
245          hfilter_31 = xvid_HFilter_31_C;          hfilter_31 = xvid_HFilter_31_C;
 #endif  
246          filter_18x18_to_8x8 = xvid_Filter_18x18_To_8x8_C;          filter_18x18_to_8x8 = xvid_Filter_18x18_To_8x8_C;
247          filter_diff_18x18_to_8x8 = xvid_Filter_Diff_18x18_To_8x8_C;          filter_diff_18x18_to_8x8 = xvid_Filter_Diff_18x18_To_8x8_C;
248    
# Line 306  Line 298 
298          dev16    = dev16_c;          dev16    = dev16_c;
299          sad16v   = sad16v_c;          sad16v   = sad16v_c;
300    
301  //      Halfpel8_Refine = Halfpel8_Refine_c;  /*      Halfpel8_Refine = Halfpel8_Refine_c; */
302    
303  #ifdef ARCH_X86  #if defined(ARCH_IS_IA32)
304    
305            if ((cpu_flags & XVID_CPU_ASM))
306            {
307                    vfilter_31 = xvid_VFilter_31_x86;
308                    hfilter_31 = xvid_HFilter_31_x86;
309            }
310    
311          if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) ||          if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) ||
312                  (cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) ||                  (cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) ||
# Line 318  Line 316 
316                  emms = emms_mmx;                  emms = emms_mmx;
317          }          }
318    
319          if ((cpu_flags & XVID_CPU_MMX) > 0) {          if ((cpu_flags & XVID_CPU_MMX)) {
320    
321                  /* Forward and Inverse Discrete Cosine Transformation functions */                  /* Forward and Inverse Discrete Cosine Transformation functions */
322                  fdct = fdct_mmx;                  fdct = fdct_mmx;
# Line 339  Line 337 
337                  transfer_8to16copy = transfer_8to16copy_mmx;                  transfer_8to16copy = transfer_8to16copy_mmx;
338                  transfer_16to8copy = transfer_16to8copy_mmx;                  transfer_16to8copy = transfer_16to8copy_mmx;
339                  transfer_8to16sub  = transfer_8to16sub_mmx;                  transfer_8to16sub  = transfer_8to16sub_mmx;
340                    transfer_8to16subro  = transfer_8to16subro_mmx;
341                  transfer_8to16sub2 = transfer_8to16sub2_mmx;                  transfer_8to16sub2 = transfer_8to16sub2_mmx;
342                  transfer_16to8add  = transfer_16to8add_mmx;                  transfer_16to8add  = transfer_16to8add_mmx;
343                  transfer8x8_copy   = transfer8x8_copy_mmx;                  transfer8x8_copy   = transfer8x8_copy_mmx;
# Line 388  Line 387 
387                  sad8bi  = sad8bi_mmx;                  sad8bi  = sad8bi_mmx;
388                  dev16    = dev16_mmx;                  dev16    = dev16_mmx;
389                  sad16v   = sad16v_mmx;                  sad16v   = sad16v_mmx;
   
390          }          }
391    
392          /* these 3dnow functions are faster than mmx, but slower than xmm. */          /* these 3dnow functions are faster than mmx, but slower than xmm. */
393          if ((cpu_flags & XVID_CPU_3DNOW) > 0) {          if ((cpu_flags & XVID_CPU_3DNOW)) {
394    
395                    emms = emms_3dn;
396    
397                  /* ME functions */                  /* ME functions */
398                  sad16bi = sad16bi_3dn;                  sad16bi = sad16bi_3dn;
# Line 403  Line 403 
403          }          }
404    
405    
406          if ((cpu_flags & XVID_CPU_MMXEXT) > 0) {          if ((cpu_flags & XVID_CPU_MMXEXT)) {
407    
408                  /* Inverse DCT */                  /* Inverse DCT */
409                  idct = idct_xmm;                  idct = idct_xmm;
# Line 441  Line 441 
441                  sad16v   = sad16v_xmm;                  sad16v   = sad16v_xmm;
442          }          }
443    
444          if ((cpu_flags & XVID_CPU_3DNOW) > 0) {          if ((cpu_flags & XVID_CPU_3DNOW)) {
445    
446                  /* Interpolation */                  /* Interpolation */
447                  interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn;                  interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn;
# Line 449  Line 449 
449                  interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn;                  interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn;
450          }          }
451    
452          if ((cpu_flags & XVID_CPU_3DNOWEXT) > 0) {          if ((cpu_flags & XVID_CPU_3DNOWEXT)) {
453    
454                  /* Inverse DCT */                  /* Inverse DCT */
455                  idct =  idct_3dne;                  idct =  idct_3dne;
# Line 458  Line 458 
458                  transfer_8to16copy =  transfer_8to16copy_3dne;                  transfer_8to16copy =  transfer_8to16copy_3dne;
459                  transfer_16to8copy = transfer_16to8copy_3dne;                  transfer_16to8copy = transfer_16to8copy_3dne;
460                  transfer_8to16sub =  transfer_8to16sub_3dne;                  transfer_8to16sub =  transfer_8to16sub_3dne;
461                    transfer_8to16subro =  transfer_8to16subro_3dne;
462                  transfer_8to16sub2 =  transfer_8to16sub2_3dne;                  transfer_8to16sub2 =  transfer_8to16sub2_3dne;
463                  transfer_16to8add = transfer_16to8add_3dne;                  transfer_16to8add = transfer_16to8add_3dne;
464                  transfer8x8_copy = transfer8x8_copy_3dne;                  transfer8x8_copy = transfer8x8_copy_3dne;
# Line 485  Line 486 
486          }          }
487    
488    
489          if ((cpu_flags & XVID_CPU_SSE2) > 0) {          if ((cpu_flags & XVID_CPU_SSE2)) {
 #ifdef EXPERIMENTAL_SSE2_CODE  
490    
491                  calc_cbp = calc_cbp_sse2;                  calc_cbp = calc_cbp_sse2;
492    
# Line 496  Line 496 
496                  quant_inter   = quant_inter_sse2;                  quant_inter   = quant_inter_sse2;
497                  dequant_inter = dequant_inter_sse2;                  dequant_inter = dequant_inter_sse2;
498    
499                  /* ME */  #if defined(EXPERIMENTAL_SSE2_CODE)
500                    /* ME; slower than xmm */
501                  sad16    = sad16_sse2;                  sad16    = sad16_sse2;
502                  dev16    = dev16_sse2;                  dev16    = dev16_sse2;
503    #endif
504                  /* Forward and Inverse DCT */                  /* Forward and Inverse DCT */
505                  idct  = idct_sse2;                  idct  = idct_sse2;
506                  fdct = fdct_sse2;                  fdct = fdct_sse2;
 #endif  
507          }          }
   
508  #endif  #endif
509    
510  #ifdef ARCH_IA64  #if defined(ARCH_IS_IA64)
511          if ((cpu_flags & XVID_CPU_IA64) > 0) { //use assembler routines?          if ((cpu_flags & XVID_CPU_ASM)) { /* use assembler routines? */
512            idct_ia64_init();            idct_ia64_init();
513            fdct = fdct_ia64;            fdct = fdct_ia64;
514            idct = idct_ia64;   //not yet working, crashes            idct = idct_ia64;   /*not yet working, crashes */
515            interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64;            interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64;
516            interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64;            interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64;
517            interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64;            interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64;
# Line 520  Line 519 
519            sad16bi = sad16bi_ia64;            sad16bi = sad16bi_ia64;
520            sad8 = sad8_ia64;            sad8 = sad8_ia64;
521            dev16 = dev16_ia64;            dev16 = dev16_ia64;
522  //        Halfpel8_Refine = Halfpel8_Refine_ia64;  /*        Halfpel8_Refine = Halfpel8_Refine_ia64; */
523            quant_intra = quant_intra_ia64;            quant_intra = quant_intra_ia64;
524            dequant_intra = dequant_intra_ia64;            dequant_intra = dequant_intra_ia64;
525            quant_inter = quant_inter_ia64;            quant_inter = quant_inter_ia64;
# Line 531  Line 530 
530            transfer_8to16sub2 = transfer_8to16sub2_ia64;            transfer_8to16sub2 = transfer_8to16sub2_ia64;
531            transfer_16to8add = transfer_16to8add_ia64;            transfer_16to8add = transfer_16to8add_ia64;
532            transfer8x8_copy = transfer8x8_copy_ia64;            transfer8x8_copy = transfer8x8_copy_ia64;
533            DEBUG("Using IA-64 assembler routines.\n");            DPRINTF(DPRINTF_DEBUG, "Using IA-64 assembler routines.");
534          }          }
535  #endif  #endif
536    
537  #ifdef ARCH_PPC  #if defined(ARCH_IS_PPC)
538  #ifdef ARCH_PPC_ALTIVEC          if ((cpu_flags & XVID_CPU_ASM))
539            {
540                    calc_cbp = calc_cbp_ppc;
541            }
542    
543            if ((cpu_flags & XVID_CPU_ALTIVEC))
544            {
545          calc_cbp = calc_cbp_altivec;          calc_cbp = calc_cbp_altivec;
546          fdct = fdct_altivec;          fdct = fdct_altivec;
547          idct = idct_altivec;          idct = idct_altivec;
# Line 544  Line 549 
549          sad16 = sad16_altivec;          sad16 = sad16_altivec;
550          sad8 = sad8_altivec;          sad8 = sad8_altivec;
551          dev16 = dev16_altivec;          dev16 = dev16_altivec;
552  #else          }
         calc_cbp = calc_cbp_ppc;  
 #endif  
553  #endif  #endif
554    
555          return XVID_ERR_OK;          return XVID_ERR_OK;
# Line 557  Line 560 
560  static int  static int
561  xvid_init_convert(XVID_INIT_CONVERTINFO* convert)  xvid_init_convert(XVID_INIT_CONVERTINFO* convert)
562  {  {
563          // const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);  /*
564            const int flip1 =
565                    (convert->input.colorspace & XVID_CSP_VFLIP) ^
566                    (convert->output.colorspace & XVID_CSP_VFLIP);
567    */
568          const int width = convert->width;          const int width = convert->width;
569          const int height = convert->height;          const int height = convert->height;
570          const int width2 = convert->width/2;          const int width2 = convert->width/2;
# Line 643  Line 650 
650  #define TEST_FDCT  (TEST_FORWARD)  #define TEST_FDCT  (TEST_FORWARD)
651  #define TEST_IDCT  (0)  #define TEST_IDCT  (0)
652    
653  int test_transform(void * funcA, void * funcB, const char * nameB,  static int test_transform(void * funcA, void * funcB, const char * nameB,
654                                     int test, int flags)                                     int test, int flags)
655  {  {
656          int i;          int i;
# Line 723  Line 730 
730  #define TEST_DEQUANT_INTRA      (TEST_INTRA)  #define TEST_DEQUANT_INTRA      (TEST_INTRA)
731  #define TEST_DEQUANT_INTER      (0)  #define TEST_DEQUANT_INTER      (0)
732    
733  int test_quant(void * funcA, void * funcB, const char * nameB,  static int test_quant(void * funcA, void * funcB, const char * nameB,
734                             int test, int flags)                             int test, int flags)
735  {  {
736          int q,i;          int q,i;
737          int64_t timeSTART;          int64_t timeSTART;
738          int64_t timeA = 0;          int64_t timeA = 0;
739          int64_t timeB = 0;          int64_t timeB = 0;
740          int retA, retB;          int retA = 0, retB = 0;
741          DECLARE_ALIGNED_MATRIX(arrayX, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayX, 1, 64, int16_t, CACHE_LINE);
742          DECLARE_ALIGNED_MATRIX(arrayA, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayA, 1, 64, int16_t, CACHE_LINE);
743          DECLARE_ALIGNED_MATRIX(arrayB, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayB, 1, 64, int16_t, CACHE_LINE);
# Line 804  Line 811 
811    
812  int xvid_init_test(int flags)  int xvid_init_test(int flags)
813  {  {
814          int cpu_flags;          int cpu_flags = 0;
815    
816          srand(time(0));          srand(time(0));
817    
818          printf("xvid_init_test\n");          printf("XviD tests\n\n");
819    
820    #if defined(ARCH_IS_IA32)
821            cpu_flags = detect_cpu_flags();
822    #endif
823    
 #if defined(ARCH_X86)  
         cpu_flags = check_cpu_features();  
824          idct_int32_init();          idct_int32_init();
825          emms_mmx();          emms();
826    
827            /* fDCT test */
828          printf("--- fdct ---\n");          printf("--- fdct ---\n");
829                  test_transform(fdct_int32, fdct_int32, "c", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_int32, "c", TEST_FDCT, flags);
830    
831    #if defined(ARCH_IS_IA32)
832          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
833                  test_transform(fdct_int32, fdct_mmx, "mmx", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_mmx, "mmx", TEST_FDCT, flags);
834          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
835                  test_transform(fdct_int32, fdct_sse2, "sse2", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_sse2, "sse2", TEST_FDCT, flags);
836    #endif
837    
838            /* iDCT test */
839          printf("\n--- idct ---\n");          printf("\n--- idct ---\n");
840                  test_transform(idct_int32, idct_int32, "c", TEST_IDCT, flags);                  test_transform(idct_int32, idct_int32, "c", TEST_IDCT, flags);
841    
842    #if defined(ARCH_IS_IA32)
843          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
844                  test_transform(idct_int32, idct_mmx, "mmx", TEST_IDCT, flags);                  test_transform(idct_int32, idct_mmx, "mmx", TEST_IDCT, flags);
845          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 832  Line 848 
848                  test_transform(idct_int32, idct_3dne, "3dne", TEST_IDCT, flags);                  test_transform(idct_int32, idct_3dne, "3dne", TEST_IDCT, flags);
849          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
850                  test_transform(idct_int32, idct_sse2, "sse2", TEST_IDCT, flags);                  test_transform(idct_int32, idct_sse2, "sse2", TEST_IDCT, flags);
851    #endif
852    
853            /* Intra quantization test */
854          printf("\n--- quant intra ---\n");          printf("\n--- quant intra ---\n");
855                  test_quant(quant_intra_c, quant_intra_c, "c", TEST_QUANT_INTRA, flags);                  test_quant(quant_intra_c, quant_intra_c, "c", TEST_QUANT_INTRA, flags);
856    
857    #if defined(ARCH_IS_IA32)
858          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
859                  test_quant(quant_intra_c, quant_intra_mmx, "mmx", TEST_QUANT_INTRA, flags);                  test_quant(quant_intra_c, quant_intra_mmx, "mmx", TEST_QUANT_INTRA, flags);
860          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
861                  test_quant(quant_intra_c, quant_intra_3dne, "3dne", TEST_QUANT_INTRA, flags);                  test_quant(quant_intra_c, quant_intra_3dne, "3dne", TEST_QUANT_INTRA, flags);
862          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
863                  test_quant(quant_intra_c, quant_intra_sse2, "sse2", TEST_QUANT_INTRA, flags);                  test_quant(quant_intra_c, quant_intra_sse2, "sse2", TEST_QUANT_INTRA, flags);
864    #endif
865    
866            /* Inter quantization test */
867          printf("\n--- quant inter ---\n");          printf("\n--- quant inter ---\n");
868                  test_quant(quant_inter_c, quant_inter_c, "c", TEST_QUANT_INTER, flags);                  test_quant(quant_inter_c, quant_inter_c, "c", TEST_QUANT_INTER, flags);
869    
870    #if defined(ARCH_IS_IA32)
871          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
872                  test_quant(quant_inter_c, quant_inter_mmx, "mmx", TEST_QUANT_INTER, flags);                  test_quant(quant_inter_c, quant_inter_mmx, "mmx", TEST_QUANT_INTER, flags);
873          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
874                  test_quant(quant_inter_c, quant_inter_3dne, "3dne", TEST_QUANT_INTER, flags);                  test_quant(quant_inter_c, quant_inter_3dne, "3dne", TEST_QUANT_INTER, flags);
875          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
876                  test_quant(quant_inter_c, quant_inter_sse2, "sse2", TEST_QUANT_INTER, flags);                  test_quant(quant_inter_c, quant_inter_sse2, "sse2", TEST_QUANT_INTER, flags);
877    #endif
878    
879            /* Intra dequantization test */
880          printf("\n--- dequant intra ---\n");          printf("\n--- dequant intra ---\n");
881                  test_quant(dequant_intra_c, dequant_intra_c, "c", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant_intra_c, dequant_intra_c, "c", TEST_DEQUANT_INTRA, flags);
882    
883    #if defined(ARCH_IS_IA32)
884          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
885                  test_quant(dequant_intra_c, dequant_intra_mmx, "mmx", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant_intra_c, dequant_intra_mmx, "mmx", TEST_DEQUANT_INTRA, flags);
886          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 861  Line 889 
889                  test_quant(dequant_intra_c, dequant_intra_3dne, "3dne", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant_intra_c, dequant_intra_3dne, "3dne", TEST_DEQUANT_INTRA, flags);
890          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
891                  test_quant(dequant_intra_c, dequant_intra_sse2, "sse2", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant_intra_c, dequant_intra_sse2, "sse2", TEST_DEQUANT_INTRA, flags);
892    #endif
893    
894            /* Inter dequantization test */
895          printf("\n--- dequant inter ---\n");          printf("\n--- dequant inter ---\n");
896                  test_quant(dequant_inter_c, dequant_inter_c, "c", TEST_DEQUANT_INTER, flags);                  test_quant(dequant_inter_c, dequant_inter_c, "c", TEST_DEQUANT_INTER, flags);
897    
898    #if defined(ARCH_IS_IA32)
899          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
900                  test_quant(dequant_inter_c, dequant_inter_mmx, "mmx", TEST_DEQUANT_INTER, flags);                  test_quant(dequant_inter_c, dequant_inter_mmx, "mmx", TEST_DEQUANT_INTER, flags);
901          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 872  Line 904 
904                  test_quant(dequant_inter_c, dequant_inter_3dne, "3dne", TEST_DEQUANT_INTER, flags);                  test_quant(dequant_inter_c, dequant_inter_3dne, "3dne", TEST_DEQUANT_INTER, flags);
905          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
906                  test_quant(dequant_inter_c, dequant_inter_sse2, "sse2", TEST_DEQUANT_INTER, flags);                  test_quant(dequant_inter_c, dequant_inter_sse2, "sse2", TEST_DEQUANT_INTER, flags);
907    #endif
908    
909          printf("\n--- quant4_intra ---\n");          /* Intra quantization test */
910            printf("\n--- quant4 intra ---\n");
911                  test_quant(quant4_intra_c, quant4_intra_c, "c", TEST_QUANT_INTRA, flags);                  test_quant(quant4_intra_c, quant4_intra_c, "c", TEST_QUANT_INTRA, flags);
912    
913    #if defined(ARCH_IS_IA32)
914          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
915                  test_quant(quant4_intra_c, quant4_intra_mmx, "mmx", TEST_QUANT_INTRA, flags);                  test_quant(quant4_intra_c, quant4_intra_mmx, "mmx", TEST_QUANT_INTRA, flags);
916          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
917                  test_quant(quant4_intra_c, quant4_intra_xmm, "xmm", TEST_QUANT_INTRA, flags);                  test_quant(quant4_intra_c, quant4_intra_xmm, "xmm", TEST_QUANT_INTRA, flags);
918    #endif
919    
920          printf("\n--- quant4_inter ---\n");          /* Inter quantization test */
921            printf("\n--- quant4 inter ---\n");
922                  test_quant(quant4_inter_c, quant4_inter_c, "c", TEST_QUANT_INTER, flags);                  test_quant(quant4_inter_c, quant4_inter_c, "c", TEST_QUANT_INTER, flags);
923    
924    #if defined(ARCH_IS_IA32)
925          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
926                  test_quant(quant4_inter_c, quant4_inter_mmx, "mmx", TEST_QUANT_INTER, flags);                  test_quant(quant4_inter_c, quant4_inter_mmx, "mmx", TEST_QUANT_INTER, flags);
927          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
928                  test_quant(quant4_inter_c, quant4_inter_xmm, "xmm", TEST_QUANT_INTER, flags);                  test_quant(quant4_inter_c, quant4_inter_xmm, "xmm", TEST_QUANT_INTER, flags);
929    #endif
930    
931          printf("\n--- dequant4_intra ---\n");          /* Intra dequantization test */
932            printf("\n--- dequant4 intra ---\n");
933                  test_quant(dequant4_intra_c, dequant4_intra_c, "c", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant4_intra_c, dequant4_intra_c, "c", TEST_DEQUANT_INTRA, flags);
934    
935    #if defined(ARCH_IS_IA32)
936          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
937                  test_quant(dequant4_intra_c, dequant4_intra_mmx, "mmx", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant4_intra_c, dequant4_intra_mmx, "mmx", TEST_DEQUANT_INTRA, flags);
938          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
939                  test_quant(dequant4_intra_c, dequant4_intra_3dne, "3dne", TEST_DEQUANT_INTRA, flags);                  test_quant(dequant4_intra_c, dequant4_intra_3dne, "3dne", TEST_DEQUANT_INTRA, flags);
940    #endif
941    
942          printf("\n--- dequant4_inter ---\n");          /* Inter dequantization test */
943            printf("\n--- dequant4 inter ---\n");
944                  test_quant(dequant4_inter_c, dequant4_inter_c, "c", TEST_DEQUANT_INTER, flags);                  test_quant(dequant4_inter_c, dequant4_inter_c, "c", TEST_DEQUANT_INTER, flags);
945    
946    #if defined(ARCH_IS_IA32)
947          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
948                  test_quant(dequant4_inter_c, dequant4_inter_mmx, "mmx", TEST_DEQUANT_INTER, flags);                  test_quant(dequant4_inter_c, dequant4_inter_mmx, "mmx", TEST_DEQUANT_INTER, flags);
949          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
950                  test_quant(dequant4_inter_c, dequant4_inter_3dne, "3dne", TEST_DEQUANT_INTER, flags);                  test_quant(dequant4_inter_c, dequant4_inter_3dne, "3dne", TEST_DEQUANT_INTER, flags);
   
         emms_mmx();  
   
951  #endif  #endif
952    
953            emms();
954    
955          return XVID_ERR_OK;          return XVID_ERR_OK;
956  }  }
957    
# Line 924  Line 971 
971                          return xvid_init_convert((XVID_INIT_CONVERTINFO*)param1);                          return xvid_init_convert((XVID_INIT_CONVERTINFO*)param1);
972    
973                  case XVID_INIT_TEST :                  case XVID_INIT_TEST :
974                          return xvid_init_test((int)param1);                  {
975                            ptr_t flags = (ptr_t)param1;
976                            return xvid_init_test((int)flags);
977                    }
978                  default :                  default :
979                          return XVID_ERR_FAIL;                          return XVID_ERR_FAIL;
980          }          }
# Line 983  Line 1032 
1032          case XVID_ENC_ENCODE:          case XVID_ENC_ENCODE:
1033    
1034                  if (((Encoder *) handle)->mbParam.max_bframes >= 0)                  if (((Encoder *) handle)->mbParam.max_bframes >= 0)
1035                  return encoder_encode_bframes((Encoder *) handle, (XVID_ENC_FRAME *) param1,                          return encoder_encode_bframes((Encoder *) handle,
1036                                                                                      (XVID_ENC_FRAME *) param1,
1037                                                            (XVID_ENC_STATS *) param2);                                                            (XVID_ENC_STATS *) param2);
1038                  else                  else
1039                  return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1,                          return encoder_encode((Encoder *) handle,
1040                                                                      (XVID_ENC_FRAME *) param1,
1041                                                            (XVID_ENC_STATS *) param2);                                                            (XVID_ENC_STATS *) param2);
1042    
1043          case XVID_ENC_CREATE:          case XVID_ENC_CREATE:

Legend:
Removed from v.1.33.2.21  
changed lines
  Added in v.1.44

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