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

Diff of /branches/dev-api-4/xvidcore/src/xvid.c

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

trunk/xvidcore/src/xvid.c revision 851, Sat Feb 15 15:22:19 2003 UTC branches/dev-api-4/xvidcore/src/xvid.c revision 1031, Sat May 17 13:26:51 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   *   *
20   ****************************************************************************/   * $Id: xvid.c,v 1.45.2.4 2003-05-17 13:26:42 suxen_drol Exp $
   
 /*****************************************************************************  
  *  
  *  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>  
  *  
  *  $Id: xvid.c,v 1.41 2003-02-15 15:22:17 edgomez Exp $  
21   *   *
22   ****************************************************************************/   ****************************************************************************/
23    
# 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(_DEBUG)
49    unsigned int xvid_debug = 0; /* xvid debug mask */
50    #endif
51    
52  #if defined(ARCH_IS_IA32)  #if defined(ARCH_IS_IA32)
53    
54  #if defined(_MSC_VER)  #if defined(_MSC_VER)
# Line 84  Line 68 
68    
69    
70  /*  /*
71  calls the funcptr, and returns whether SIGILL (illegal instruction) was signalled   * Calls the funcptr, and returns whether SIGILL (illegal instruction) was
72  return values:   * signalled
73  -1 : could not determine   *
74  0  : SIGILL was *not* signalled   * Return values:
75  1  : SIGILL was signalled   *  -1 : could not determine
76     *   0 : SIGILL was *not* signalled
77     *   1 : SIGILL was signalled
78  */  */
79    
80  int  int
# Line 171  Line 157 
157    
158    
159  static  static
160  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))  
161          {          {
162                  init_param->cpu_flags = cpu_flags;          unsigned int cpu_flags;
                 return XVID_ERR_OK;  
         }  
163    
164          init_param->cpu_flags = cpu_flags;          if (XVID_MAJOR(init->version) != 1) /* v1.x.x */
165                    return XVID_ERR_VERSION;
166    
167            cpu_flags = (init->cpu_flags & XVID_CPU_FORCE) ? init->cpu_flags : detect_cpu_flags();
168    
169          /* Initialize the function pointers */          /* Initialize the function pointers */
170          idct_int32_init();          idct_int32_init();
# Line 316  Line 282 
282          dev16    = dev16_c;          dev16    = dev16_c;
283          sad16v   = sad16v_c;          sad16v   = sad16v_c;
284    
285  //      Halfpel8_Refine = Halfpel8_Refine_c;  /*      Halfpel8_Refine = Halfpel8_Refine_c; */
286    
287  #if defined(ARCH_IS_IA32)  #if defined(ARCH_IS_IA32)
288    
# Line 526  Line 492 
492  #endif  #endif
493    
494  #if defined(ARCH_IS_IA64)  #if defined(ARCH_IS_IA64)
495          if ((cpu_flags & XVID_CPU_ASM)) { //use assembler routines?          if ((cpu_flags & XVID_CPU_ASM)) { /* use assembler routines? */
496            idct_ia64_init();            idct_ia64_init();
497            fdct = fdct_ia64;            fdct = fdct_ia64;
498            idct = idct_ia64;   //not yet working, crashes            idct = idct_ia64;   /*not yet working, crashes */
499            interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64;            interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64;
500            interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64;            interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64;
501            interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64;            interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64;
# Line 537  Line 503 
503            sad16bi = sad16bi_ia64;            sad16bi = sad16bi_ia64;
504            sad8 = sad8_ia64;            sad8 = sad8_ia64;
505            dev16 = dev16_ia64;            dev16 = dev16_ia64;
506  //        Halfpel8_Refine = Halfpel8_Refine_ia64;  /*        Halfpel8_Refine = Halfpel8_Refine_ia64; */
507            quant_intra = quant_intra_ia64;            quant_intra = quant_intra_ia64;
508            dequant_intra = dequant_intra_ia64;            dequant_intra = dequant_intra_ia64;
509            quant_inter = quant_inter_ia64;            quant_inter = quant_inter_ia64;
# Line 548  Line 514 
514            transfer_8to16sub2 = transfer_8to16sub2_ia64;            transfer_8to16sub2 = transfer_8to16sub2_ia64;
515            transfer_16to8add = transfer_16to8add_ia64;            transfer_16to8add = transfer_16to8add_ia64;
516            transfer8x8_copy = transfer8x8_copy_ia64;            transfer8x8_copy = transfer8x8_copy_ia64;
517            DEBUG("Using IA-64 assembler routines.\n");            DPRINTF(DPRINTF_DEBUG, "Using IA-64 assembler routines.");
518          }          }
519  #endif  #endif
520    
# Line 570  Line 536 
536          }          }
537  #endif  #endif
538    
539          return XVID_ERR_OK;  #if defined(_DEBUG)
540        xvid_debug = init->debug;
541    #endif
542    
543        return 0;
544  }  }
545    
546    
547    static int
548    xvid_gbl_info(xvid_gbl_info_t * info)
549    {
550            if (XVID_MAJOR(info->version) != 1) /* v1.x.x */
551                    return XVID_ERR_VERSION;
552    
553            info->actual_version = XVID_VERSION;
554            info->build = "dev-api-4";
555            info->cpu_flags = detect_cpu_flags();
556    
557    #if defined(_SMP) && defined(WIN32)
558            info->num_threads = pthread_num_processors_np();;
559    #else
560            info->num_threads = 0;
561    #endif
562    
563            return 0;
564    }
565    
566    
567  static int  static int
568  xvid_init_convert(XVID_INIT_CONVERTINFO* convert)  xvid_gbl_convert(xvid_gbl_convert_t* convert)
569  {  {
570          // const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);          int width;
571          const int width = convert->width;          int height;
572          const int height = convert->height;          int width2;
573          const int width2 = convert->width/2;          int height2;
         const int height2 = convert->height/2;  
574          IMAGE img;          IMAGE img;
575    
576          switch (convert->input.colorspace & ~XVID_CSP_VFLIP)          if (XVID_MAJOR(convert->version) != 1)   /* v1.x.x */
577                  return XVID_ERR_VERSION;
578    
579            // const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);
580            width = convert->width;
581            height = convert->height;
582            width2 = convert->width/2;
583            height2 = convert->height/2;
584    
585            switch (convert->input.csp & ~XVID_CSP_VFLIP)
586          {          {
587                  case XVID_CSP_YV12 :                  case XVID_CSP_YV12 :
588                          img.y = convert->input.y;                          img.y = convert->input.plane[0];
589                          img.v = (uint8_t*)convert->input.y + width*height;                          img.v = (uint8_t*)convert->input.plane[0] + convert->input.stride[0]*height;
590                          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;
591                          image_output(&img, width, height, width,                          image_output(&img, width, height, width,
592                                                  convert->output.y, convert->output.y_stride,                                                  (uint8_t**)convert->output.plane, convert->output.stride,
593                                                  convert->output.colorspace, convert->interlacing);                                                  convert->output.csp, convert->interlacing);
594                          break;                          break;
595    
596                  default :                  default :
# Line 602  Line 599 
599    
600    
601          emms();          emms();
602          return XVID_ERR_OK;          return 0;
603  }  }
604    
605    
# Line 651  Line 648 
648  {  {
649          int i, diff = 0;          int i, diff = 0;
650          for (i = 0; i < size; i++)          for (i = 0; i < size; i++)
651                  diff += ABS(blockA[i]-blockB[i]);                  diff += abs(blockA[i]-blockB[i]);
652          return diff;          return diff;
653  }  }
654    
# Line 664  Line 661 
661  #define TEST_FDCT  (TEST_FORWARD)  #define TEST_FDCT  (TEST_FORWARD)
662  #define TEST_IDCT  (0)  #define TEST_IDCT  (0)
663    
664  int test_transform(void * funcA, void * funcB, const char * nameB,  static int test_transform(void * funcA, void * funcB, const char * nameB,
665                                     int test, int flags)                                     int test, int flags)
666  {  {
667          int i;          int i;
# Line 744  Line 741 
741  #define TEST_DEQUANT_INTRA      (TEST_INTRA)  #define TEST_DEQUANT_INTRA      (TEST_INTRA)
742  #define TEST_DEQUANT_INTER      (0)  #define TEST_DEQUANT_INTER      (0)
743    
744  int test_quant(void * funcA, void * funcB, const char * nameB,  static int test_quant(void * funcA, void * funcB, const char * nameB,
745                             int test, int flags)                             int test, int flags)
746  {  {
747          int q,i;          int q,i;
748          int64_t timeSTART;          int64_t timeSTART;
749          int64_t timeA = 0;          int64_t timeA = 0;
750          int64_t timeB = 0;          int64_t timeB = 0;
751          int retA, retB;          int retA = 0, retB = 0;
752          DECLARE_ALIGNED_MATRIX(arrayX, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayX, 1, 64, int16_t, CACHE_LINE);
753          DECLARE_ALIGNED_MATRIX(arrayA, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayA, 1, 64, int16_t, CACHE_LINE);
754          DECLARE_ALIGNED_MATRIX(arrayB, 1, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(arrayB, 1, 64, int16_t, CACHE_LINE);
# Line 825  Line 822 
822    
823  int xvid_init_test(int flags)  int xvid_init_test(int flags)
824  {  {
825    #if defined(ARCH_IS_IA32)
826          int cpu_flags;          int cpu_flags;
827    #endif
828    
829          srand(time(0));          printf("XviD tests\n\n");
   
         printf("xvid_init_test\n");  
830    
831  #if defined(ARCH_X86)  #if defined(ARCH_IS_IA32)
832          cpu_flags = detect_cpu_flags();          cpu_flags = detect_cpu_flags();
833    #endif
834    
835          idct_int32_init();          idct_int32_init();
836          emms_mmx();          emms();
837    
838            srand(time(0));
839    
840            /* fDCT test */
841          printf("--- fdct ---\n");          printf("--- fdct ---\n");
842                  test_transform(fdct_int32, fdct_int32, "c", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_int32, "c", TEST_FDCT, flags);
843    
844    #if defined(ARCH_IS_IA32)
845          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
846                  test_transform(fdct_int32, fdct_mmx, "mmx", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_mmx, "mmx", TEST_FDCT, flags);
847          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
848                  test_transform(fdct_int32, fdct_sse2, "sse2", TEST_FDCT, flags);                  test_transform(fdct_int32, fdct_sse2, "sse2", TEST_FDCT, flags);
849    #endif
850    
851            /* iDCT test */
852          printf("\n--- idct ---\n");          printf("\n--- idct ---\n");
853                  test_transform(idct_int32, idct_int32, "c", TEST_IDCT, flags);                  test_transform(idct_int32, idct_int32, "c", TEST_IDCT, flags);
854    
855    #if defined(ARCH_IS_IA32)
856          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
857                  test_transform(idct_int32, idct_mmx, "mmx", TEST_IDCT, flags);                  test_transform(idct_int32, idct_mmx, "mmx", TEST_IDCT, flags);
858          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 853  Line 861 
861                  test_transform(idct_int32, idct_3dne, "3dne", TEST_IDCT, flags);                  test_transform(idct_int32, idct_3dne, "3dne", TEST_IDCT, flags);
862          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
863                  test_transform(idct_int32, idct_sse2, "sse2", TEST_IDCT, flags);                  test_transform(idct_int32, idct_sse2, "sse2", TEST_IDCT, flags);
864    #endif
865    
866            /* Intra quantization test */
867          printf("\n--- quant intra ---\n");          printf("\n--- quant intra ---\n");
868                  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);
869    
870    #if defined(ARCH_IS_IA32)
871          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
872                  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);
873          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
874                  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);
875          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
876                  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);
877    #endif
878    
879            /* Inter quantization test */
880          printf("\n--- quant inter ---\n");          printf("\n--- quant inter ---\n");
881                  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);
882    
883    #if defined(ARCH_IS_IA32)
884          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
885                  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);
886          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
887                  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);
888          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
889                  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);
890    #endif
891    
892            /* Intra dequantization test */
893          printf("\n--- dequant intra ---\n");          printf("\n--- dequant intra ---\n");
894                  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);
895    
896    #if defined(ARCH_IS_IA32)
897          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
898                  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);
899          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 882  Line 902 
902                  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);
903          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
904                  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);
905    #endif
906    
907            /* Inter dequantization test */
908          printf("\n--- dequant inter ---\n");          printf("\n--- dequant inter ---\n");
909                  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);
910    
911    #if defined(ARCH_IS_IA32)
912          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
913                  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);
914          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
# Line 893  Line 917 
917                  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);
918          if (cpu_flags & XVID_CPU_SSE2)          if (cpu_flags & XVID_CPU_SSE2)
919                  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);
920    #endif
921    
922          printf("\n--- quant4_intra ---\n");          /* Intra quantization test */
923            printf("\n--- quant4 intra ---\n");
924                  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);
925    
926    #if defined(ARCH_IS_IA32)
927          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
928                  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);
929          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
930                  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);
931    #endif
932    
933          printf("\n--- quant4_inter ---\n");          /* Inter quantization test */
934            printf("\n--- quant4 inter ---\n");
935                  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);
936    
937    #if defined(ARCH_IS_IA32)
938          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
939                  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);
940          if (cpu_flags & XVID_CPU_MMXEXT)          if (cpu_flags & XVID_CPU_MMXEXT)
941                  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);
942    #endif
943    
944          printf("\n--- dequant4_intra ---\n");          /* Intra dequantization test */
945            printf("\n--- dequant4 intra ---\n");
946                  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);
947    
948    #if defined(ARCH_IS_IA32)
949          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
950                  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);
951          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
952                  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);
953    #endif
954    
955          printf("\n--- dequant4_inter ---\n");          /* Inter dequantization test */
956            printf("\n--- dequant4 inter ---\n");
957                  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);
958    
959    #if defined(ARCH_IS_IA32)
960          if (cpu_flags & XVID_CPU_MMX)          if (cpu_flags & XVID_CPU_MMX)
961                  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);
962          if (cpu_flags & XVID_CPU_3DNOWEXT)          if (cpu_flags & XVID_CPU_3DNOWEXT)
963                  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();  
   
964  #endif  #endif
965    
966          return XVID_ERR_OK;          emms();
967    
968            return 0;
969  }  }
970    
971    
972    /*****************************************************************************
973     * XviD Global Entry point
974     *
975     * Well this function initialize all internal function pointers according
976     * to the CPU features forced by the library client or autodetected (depending
977     * on the XVID_CPU_FORCE flag). It also initializes vlc coding tables and all
978     * image colorspace transformation tables.
979     *
980     ****************************************************************************/
981    
982    
983  int  int
984  xvid_init(void *handle,  xvid_global(void *handle,
985                    int opt,                    int opt,
986                    void *param1,                    void *param1,
987                    void *param2)                    void *param2)
988  {  {
989          switch(opt)          switch(opt)
990          {          {
991                  case XVID_INIT_INIT :                  case XVID_GBL_INIT :
992                          return xvid_init_init((XVID_INIT_PARAM*)param1);                          return xvid_gbl_init((xvid_gbl_init_t*)param1);
993    
994                  case XVID_INIT_CONVERT :          case XVID_GBL_INFO :
995                          return xvid_init_convert((XVID_INIT_CONVERTINFO*)param1);              return xvid_gbl_info((xvid_gbl_info_t*)param1);
996    
997                  case XVID_INIT_TEST :                  case XVID_GBL_CONVERT :
998                          return xvid_init_test((int)param1);                          return xvid_gbl_convert((xvid_gbl_convert_t*)param1);
999    
1000                    case XVID_GBL_TEST :
1001                    {
1002                            ptr_t flags = (ptr_t)param1;
1003                            return xvid_init_test((int)flags);
1004                    }
1005                  default :                  default :
1006                          return XVID_ERR_FAIL;                          return XVID_ERR_FAIL;
1007          }          }
# Line 969  Line 1024 
1024                          void *param2)                          void *param2)
1025  {  {
1026          switch (opt) {          switch (opt) {
         case XVID_DEC_DECODE:  
                 return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1, (XVID_DEC_STATS*) param2);  
   
1027          case XVID_DEC_CREATE:          case XVID_DEC_CREATE:
1028                  return decoder_create((XVID_DEC_PARAM *) param1);                  return decoder_create((xvid_dec_create_t *) param1);
1029    
1030          case XVID_DEC_DESTROY:          case XVID_DEC_DESTROY:
1031                  return decoder_destroy((DECODER *) handle);                  return decoder_destroy((DECODER *) handle);
1032    
1033            case XVID_DEC_DECODE:
1034                    return decoder_decode((DECODER *) handle, (xvid_dec_frame_t *) param1, (xvid_dec_stats_t*) param2);
1035    
1036          default:          default:
1037                  return XVID_ERR_FAIL;                  return XVID_ERR_FAIL;
1038          }          }
# Line 1003  Line 1058 
1058          switch (opt) {          switch (opt) {
1059          case XVID_ENC_ENCODE:          case XVID_ENC_ENCODE:
1060    
1061                  if (((Encoder *) handle)->mbParam.max_bframes >= 0)                  return enc_encode((Encoder *) handle,
1062                  return encoder_encode_bframes((Encoder *) handle, (XVID_ENC_FRAME *) param1,                                                            (xvid_enc_frame_t *) param1,
1063                                                            (XVID_ENC_STATS *) param2);                                                            (xvid_enc_stats_t *) param2);
                 else  
                 return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1,  
                                                           (XVID_ENC_STATS *) param2);  
1064    
1065          case XVID_ENC_CREATE:          case XVID_ENC_CREATE:
1066                  return encoder_create((XVID_ENC_PARAM *) param1);                  return enc_create((xvid_enc_create_t *) param1);
1067    
1068          case XVID_ENC_DESTROY:          case XVID_ENC_DESTROY:
1069                  return encoder_destroy((Encoder *) handle);                  return enc_destroy((Encoder *) handle);
1070    
1071          default:          default:
1072                  return XVID_ERR_FAIL;                  return XVID_ERR_FAIL;

Legend:
Removed from v.851  
changed lines
  Added in v.1031

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