[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.41, Sat Feb 15 15:22:17 2003 UTC revision 1.45.2.8, Wed Jun 11 14:10:40 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   *   *
6   *  This program is an implementation of a part of one or more MPEG-4   *  Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>
  *  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.  
7   *   *
8   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
9   *  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
# Line 26  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   *   *
  ****************************************************************************/  
   
 /*****************************************************************************  
  *  
  *  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>  
  *  
22   *  $Id$   *  $Id$
23   *   *
24   ****************************************************************************/   ****************************************************************************/
# Line 65  Line 47 
47  #include "utils/timer.h"  #include "utils/timer.h"
48  #include "bitstream/mbcoding.h"  #include "bitstream/mbcoding.h"
49    
50    #if defined(_DEBUG)
51    unsigned int xvid_debug = 0; /* xvid debug mask */
52    #endif
53    
54  #if defined(ARCH_IS_IA32)  #if defined(ARCH_IS_IA32)
55    
56  #if defined(_MSC_VER)  #if defined(_MSC_VER)
# Line 84  Line 70 
70    
71    
72  /*  /*
73  calls the funcptr, and returns whether SIGILL (illegal instruction) was signalled   * Calls the funcptr, and returns whether SIGILL (illegal instruction) was
74  return values:   * signalled
75  -1 : could not determine   *
76  0  : SIGILL was *not* signalled   * Return values:
77  1  : SIGILL was signalled   *  -1 : could not determine
78     *   0 : SIGILL was *not* signalled
79     *   1 : SIGILL was signalled
80  */  */
81    
82  int  int
# Line 171  Line 159 
159    
160    
161  static  static
162  int xvid_init_init(XVID_INIT_PARAM * init_param)  int xvid_gbl_init(xvid_gbl_init_t * init)
 {  
         int cpu_flags;  
   
         /* Inform the client the API version */  
         init_param->api_version = API_VERSION;  
   
         /* Inform the client the core build - unused because we're still alpha */  
         init_param->core_build = 1000;  
   
         /* Do we have to force CPU features  ? */  
         if ((init_param->cpu_flags & XVID_CPU_FORCE)) {  
   
                 cpu_flags = init_param->cpu_flags;  
   
         } else {  
   
                 cpu_flags = detect_cpu_flags();  
         }  
   
         if ((init_param->cpu_flags & XVID_CPU_CHKONLY))  
163          {          {
164                  init_param->cpu_flags = cpu_flags;          unsigned int cpu_flags;
                 return XVID_ERR_OK;  
         }  
165    
166          init_param->cpu_flags = cpu_flags;          if (XVID_MAJOR(init->version) != 1) /* v1.x.x */
167                    return XVID_ERR_VERSION;
168    
169            cpu_flags = (init->cpu_flags & XVID_CPU_FORCE) ? init->cpu_flags : detect_cpu_flags();
170    
171          /* Initialize the function pointers */          /* Initialize the function pointers */
172          idct_int32_init();          idct_int32_init();
# Line 316  Line 284 
284          dev16    = dev16_c;          dev16    = dev16_c;
285          sad16v   = sad16v_c;          sad16v   = sad16v_c;
286    
287  //      Halfpel8_Refine = Halfpel8_Refine_c;  /*      Halfpel8_Refine = Halfpel8_Refine_c; */
288    
289  #if defined(ARCH_IS_IA32)  #if defined(ARCH_IS_IA32)
290    
291          if ((cpu_flags & XVID_CPU_ASM))          if ((cpu_flags & XVID_CPU_ASM)) {
         {  
292                  vfilter_31 = xvid_VFilter_31_x86;                  vfilter_31 = xvid_VFilter_31_x86;
293                  hfilter_31 = xvid_HFilter_31_x86;                  hfilter_31 = xvid_HFilter_31_x86;
294          }          }
# Line 520  Line 487 
487                  dev16    = dev16_sse2;                  dev16    = dev16_sse2;
488  #endif  #endif
489                  /* Forward and Inverse DCT */                  /* Forward and Inverse DCT */
490    #if 0 /* Both function are known to be unprecise, better keep them deactivated */
491                  idct  = idct_sse2;                  idct  = idct_sse2;
492                  fdct = fdct_sse2;                  fdct = fdct_sse2;
493    #endif
494          }          }
495  #endif  #endif
496    
497  #if defined(ARCH_IS_IA64)  #if defined(ARCH_IS_IA64)
498          if ((cpu_flags & XVID_CPU_ASM)) { //use assembler routines?          if ((cpu_flags & XVID_CPU_ASM)) { /* use assembler routines? */
499            idct_ia64_init();            idct_ia64_init();
500            fdct = fdct_ia64;            fdct = fdct_ia64;
501            idct = idct_ia64;   //not yet working, crashes            idct = idct_ia64;   /*not yet working, crashes */
502            interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64;            interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64;
503            interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64;            interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64;
504            interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64;            interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64;
# Line 537  Line 506 
506            sad16bi = sad16bi_ia64;            sad16bi = sad16bi_ia64;
507            sad8 = sad8_ia64;            sad8 = sad8_ia64;
508            dev16 = dev16_ia64;            dev16 = dev16_ia64;
509  //        Halfpel8_Refine = Halfpel8_Refine_ia64;  /*        Halfpel8_Refine = Halfpel8_Refine_ia64; */
510            quant_intra = quant_intra_ia64;            quant_intra = quant_intra_ia64;
511            dequant_intra = dequant_intra_ia64;            dequant_intra = dequant_intra_ia64;
512            quant_inter = quant_inter_ia64;            quant_inter = quant_inter_ia64;
# Line 548  Line 517 
517            transfer_8to16sub2 = transfer_8to16sub2_ia64;            transfer_8to16sub2 = transfer_8to16sub2_ia64;
518            transfer_16to8add = transfer_16to8add_ia64;            transfer_16to8add = transfer_16to8add_ia64;
519            transfer8x8_copy = transfer8x8_copy_ia64;            transfer8x8_copy = transfer8x8_copy_ia64;
520            DEBUG("Using IA-64 assembler routines.\n");            DPRINTF(DPRINTF_DEBUG, "Using IA-64 assembler routines.");
521          }          }
522  #endif  #endif
523    
# Line 570  Line 539 
539          }          }
540  #endif  #endif
541    
542          return XVID_ERR_OK;  #if defined(_DEBUG)
543        xvid_debug = init->debug;
544    #endif
545    
546        return 0;
547  }  }
548    
549    
550    static int
551    xvid_gbl_info(xvid_gbl_info_t * info)
552    {
553            if (XVID_MAJOR(info->version) != 1) /* v1.x.x */
554                    return XVID_ERR_VERSION;
555    
556            info->actual_version = XVID_VERSION;
557            info->build = "dev-api-4";
558            info->cpu_flags = detect_cpu_flags();
559    
560    #if defined(_SMP) && defined(WIN32)
561            info->num_threads = pthread_num_processors_np();;
562    #else
563            info->num_threads = 0;
564    #endif
565    
566            return 0;
567    }
568    
569    
570  static int  static int
571  xvid_init_convert(XVID_INIT_CONVERTINFO* convert)  xvid_gbl_convert(xvid_gbl_convert_t* convert)
572  {  {
573          // const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);          int width;
574          const int width = convert->width;          int height;
575          const int height = convert->height;          int width2;
576          const int width2 = convert->width/2;          int height2;
         const int height2 = convert->height/2;  
577          IMAGE img;          IMAGE img;
578    
579          switch (convert->input.colorspace & ~XVID_CSP_VFLIP)          if (XVID_MAJOR(convert->version) != 1)   /* v1.x.x */
580                  return XVID_ERR_VERSION;
581    
582    #if 0
583            const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);
584    #endif
585            width = convert->width;
586            height = convert->height;
587            width2 = convert->width/2;
588            height2 = convert->height/2;
589    
590            switch (convert->input.csp & ~XVID_CSP_VFLIP)
591          {          {
592                  case XVID_CSP_YV12 :                  case XVID_CSP_YV12 :
593                          img.y = convert->input.y;                          img.y = convert->input.plane[0];
594                          img.v = (uint8_t*)convert->input.y + width*height;                          img.v = (uint8_t*)convert->input.plane[0] + convert->input.stride[0]*height;
595                          img.u = (uint8_t*)convert->input.y + width*height + width2*height2;                          img.u = (uint8_t*)convert->input.plane[0] + convert->input.stride[0]*height + (convert->input.stride[0]/2)*height2;
596                          image_output(&img, width, height, width,                          image_output(&img, width, height, width,
597                                                  convert->output.y, convert->output.y_stride,                                                  (uint8_t**)convert->output.plane, convert->output.stride,
598                                                  convert->output.colorspace, convert->interlacing);                                                  convert->output.csp, convert->interlacing);
599                          break;                          break;
600    
601                  default :                  default :
# Line 602  Line 604 
604    
605    
606          emms();          emms();
607          return XVID_ERR_OK;          return 0;
608  }  }
609    
610    
# Line 651  Line 653 
653  {  {
654          int i, diff = 0;          int i, diff = 0;
655          for (i = 0; i < size; i++)          for (i = 0; i < size; i++)
656                  diff += ABS(blockA[i]-blockB[i]);                  diff += abs(blockA[i]-blockB[i]);
657          return diff;          return diff;
658  }  }
659    
# Line 664  Line 666 
666  #define TEST_FDCT  (TEST_FORWARD)  #define TEST_FDCT  (TEST_FORWARD)
667  #define TEST_IDCT  (0)  #define TEST_IDCT  (0)
668    
669  int test_transform(void * funcA, void * funcB, const char * nameB,  static int test_transform(void * funcA, void * funcB, const char * nameB,
670                                     int test, int flags)                                     int test, int flags)
671  {  {
672          int i;          int i;
# Line 744  Line 746 
746  #define TEST_DEQUANT_INTRA      (TEST_INTRA)  #define TEST_DEQUANT_INTRA      (TEST_INTRA)
747  #define TEST_DEQUANT_INTER      (0)  #define TEST_DEQUANT_INTER      (0)
748    
749  int test_quant(void * funcA, void * funcB, const char * nameB,  static int test_quant(void * funcA, void * funcB, const char * nameB,
750                             int test, int flags)                             int test, int flags)
751  {  {
752          int q,i;          int q,i;
753          int64_t timeSTART;          int64_t timeSTART;
754          int64_t timeA = 0;          int64_t timeA = 0;
755          int64_t timeB = 0;          int64_t timeB = 0;
756          int retA, retB;          int retA = 0, retB = 0;
757          DECLARE_ALIGNED_MATRIX(arrayX, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayX, 1, 64, int16_t, CACHE_LINE);
758          DECLARE_ALIGNED_MATRIX(arrayA, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayA, 1, 64, int16_t, CACHE_LINE);
759          DECLARE_ALIGNED_MATRIX(arrayB, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayB, 1, 64, int16_t, CACHE_LINE);
# Line 825  Line 827 
827    
828  int xvid_init_test(int flags)  int xvid_init_test(int flags)
829  {  {
830    #if defined(ARCH_IS_IA32)
831          int cpu_flags;          int cpu_flags;
832    #endif
833    
834          srand(time(0));          printf("XviD tests\n\n");
   
         printf("xvid_init_test\n");  
835    
836  #if defined(ARCH_X86)  #if defined(ARCH_IS_IA32)
837          cpu_flags = detect_cpu_flags();          cpu_flags = detect_cpu_flags();
838    #endif
839    
840          idct_int32_init();          idct_int32_init();
841          emms_mmx();          emms();
842    
843            srand(time(0));
844    
845            /* fDCT test */
846          printf("--- fdct ---\n");          printf("--- fdct ---\n");
847                  test_transform(fdct_int32, fdct_int32, "c", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_int32, "c", TEST_FDCT, flags);
848    
849    #if defined(ARCH_IS_IA32)
850          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
851                  test_transform(fdct_int32, fdct_mmx, "mmx", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_mmx, "mmx", TEST_FDCT, flags);
852          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
853                  test_transform(fdct_int32, fdct_sse2, "sse2", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_sse2, "sse2", TEST_FDCT, flags);
854    #endif
855    
856            /* iDCT test */
857          printf("\n--- idct ---\n");          printf("\n--- idct ---\n");
858                  test_transform(idct_int32, idct_int32, "c", TEST_IDCT, flags);                  test_transform(idct_int32, idct_int32, "c", TEST_IDCT, flags);
859    
860    #if defined(ARCH_IS_IA32)
861          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
862                  test_transform(idct_int32, idct_mmx, "mmx", TEST_IDCT, flags);                  test_transform(idct_int32, idct_mmx, "mmx", TEST_IDCT, flags);
863          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 853  Line 866 
866                  test_transform(idct_int32, idct_3dne, "3dne", TEST_IDCT, flags);                  test_transform(idct_int32, idct_3dne, "3dne", TEST_IDCT, flags);
867          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
868                  test_transform(idct_int32, idct_sse2, "sse2", TEST_IDCT, flags);                  test_transform(idct_int32, idct_sse2, "sse2", TEST_IDCT, flags);
869    #endif
870    
871            /* Intra quantization test */
872          printf("\n--- quant intra ---\n");          printf("\n--- quant intra ---\n");
873                  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);
874    
875    #if defined(ARCH_IS_IA32)
876          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
877                  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);
878          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
879                  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);
880          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
881                  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);
882    #endif
883    
884            /* Inter quantization test */
885          printf("\n--- quant inter ---\n");          printf("\n--- quant inter ---\n");
886                  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);
887    
888    #if defined(ARCH_IS_IA32)
889          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
890                  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);
891          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
892                  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);
893          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
894                  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);
895    #endif
896    
897            /* Intra dequantization test */
898          printf("\n--- dequant intra ---\n");          printf("\n--- dequant intra ---\n");
899                  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);
900    
901    #if defined(ARCH_IS_IA32)
902          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
903                  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);
904          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 882  Line 907 
907                  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);
908          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
909                  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);
910    #endif
911    
912            /* Inter dequantization test */
913          printf("\n--- dequant inter ---\n");          printf("\n--- dequant inter ---\n");
914                  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);
915    
916    #if defined(ARCH_IS_IA32)
917          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
918                  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);
919          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 893  Line 922 
922                  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);
923          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
924                  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);
925    #endif
926    
927          printf("\n--- quant4_intra ---\n");          /* Intra quantization test */
928            printf("\n--- quant4 intra ---\n");
929                  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);
930    
931    #if defined(ARCH_IS_IA32)
932          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
933                  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);
934          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
935                  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);
936    #endif
937    
938          printf("\n--- quant4_inter ---\n");          /* Inter quantization test */
939            printf("\n--- quant4 inter ---\n");
940                  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);
941    
942    #if defined(ARCH_IS_IA32)
943          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
944                  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);
945          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
946                  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);
947    #endif
948    
949          printf("\n--- dequant4_intra ---\n");          /* Intra dequantization test */
950            printf("\n--- dequant4 intra ---\n");
951                  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);
952    
953    #if defined(ARCH_IS_IA32)
954          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
955                  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);
956          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
957                  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);
958    #endif
959    
960          printf("\n--- dequant4_inter ---\n");          /* Inter dequantization test */
961            printf("\n--- dequant4 inter ---\n");
962                  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);
963    
964    #if defined(ARCH_IS_IA32)
965          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
966                  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);
967          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
968                  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();  
   
969  #endif  #endif
970    
971          return XVID_ERR_OK;          emms();
972    
973            return 0;
974  }  }
975    
976    
977    /*****************************************************************************
978     * XviD Global Entry point
979     *
980     * Well this function initialize all internal function pointers according
981     * to the CPU features forced by the library client or autodetected (depending
982     * on the XVID_CPU_FORCE flag). It also initializes vlc coding tables and all
983     * image colorspace transformation tables.
984     *
985     ****************************************************************************/
986    
987    
988  int  int
989  xvid_init(void *handle,  xvid_global(void *handle,
990                    int opt,                    int opt,
991                    void *param1,                    void *param1,
992                    void *param2)                    void *param2)
993  {  {
994          switch(opt)          switch(opt)
995          {          {
996                  case XVID_INIT_INIT :                  case XVID_GBL_INIT :
997                          return xvid_init_init((XVID_INIT_PARAM*)param1);                          return xvid_gbl_init((xvid_gbl_init_t*)param1);
998    
999                  case XVID_INIT_CONVERT :          case XVID_GBL_INFO :
1000                          return xvid_init_convert((XVID_INIT_CONVERTINFO*)param1);              return xvid_gbl_info((xvid_gbl_info_t*)param1);
1001    
1002                  case XVID_INIT_TEST :                  case XVID_GBL_CONVERT :
1003                          return xvid_init_test((int)param1);                          return xvid_gbl_convert((xvid_gbl_convert_t*)param1);
1004    
1005                    case XVID_GBL_TEST :
1006                    {
1007                            ptr_t flags = (ptr_t)param1;
1008                            return xvid_init_test((int)flags);
1009                    }
1010                  default :                  default :
1011                          return XVID_ERR_FAIL;                          return XVID_ERR_FAIL;
1012          }          }
# Line 969  Line 1029 
1029                          void *param2)                          void *param2)
1030  {  {
1031          switch (opt) {          switch (opt) {
         case XVID_DEC_DECODE:  
                 return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1, (XVID_DEC_STATS*) param2);  
   
1032          case XVID_DEC_CREATE:          case XVID_DEC_CREATE:
1033                  return decoder_create((XVID_DEC_PARAM *) param1);                  return decoder_create((xvid_dec_create_t *) param1);
1034    
1035          case XVID_DEC_DESTROY:          case XVID_DEC_DESTROY:
1036                  return decoder_destroy((DECODER *) handle);                  return decoder_destroy((DECODER *) handle);
1037    
1038            case XVID_DEC_DECODE:
1039                    return decoder_decode((DECODER *) handle, (xvid_dec_frame_t *) param1, (xvid_dec_stats_t*) param2);
1040    
1041          default:          default:
1042                  return XVID_ERR_FAIL;                  return XVID_ERR_FAIL;
1043          }          }
# Line 1003  Line 1063 
1063          switch (opt) {          switch (opt) {
1064          case XVID_ENC_ENCODE:          case XVID_ENC_ENCODE:
1065    
1066                  if (((Encoder *) handle)->mbParam.max_bframes >= 0)                  return enc_encode((Encoder *) handle,
1067                  return encoder_encode_bframes((Encoder *) handle, (XVID_ENC_FRAME *) param1,                                                            (xvid_enc_frame_t *) param1,
1068                                                            (XVID_ENC_STATS *) param2);                                                            (xvid_enc_stats_t *) param2);
                 else  
                 return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1,  
                                                           (XVID_ENC_STATS *) param2);  
1069    
1070          case XVID_ENC_CREATE:          case XVID_ENC_CREATE:
1071                  return encoder_create((XVID_ENC_PARAM *) param1);                  return enc_create((xvid_enc_create_t *) param1);
1072    
1073          case XVID_ENC_DESTROY:          case XVID_ENC_DESTROY:
1074                  return encoder_destroy((Encoder *) handle);                  return enc_destroy((Encoder *) handle);
1075    
1076          default:          default:
1077                  return XVID_ERR_FAIL;                  return XVID_ERR_FAIL;

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.45.2.8

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