[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.45.2.2, Wed Mar 26 11:01:03 2003 UTC revision 1.45.2.13, Fri Aug 22 15:52:35 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     *  Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>
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
10   *  the Free Software Foundation ; either version 2 of the License, or   *  the Free Software Foundation ; either version 2 of the License, or
# Line 44  Line 46 
46  #include "utils/emms.h"  #include "utils/emms.h"
47  #include "utils/timer.h"  #include "utils/timer.h"
48  #include "bitstream/mbcoding.h"  #include "bitstream/mbcoding.h"
49    #include "image/qpel.h"
50    
51    #if defined(_DEBUG)
52    unsigned int xvid_debug = 0; /* xvid debug mask */
53    #endif
54    
55  #if defined(ARCH_IS_IA32)  #if defined(ARCH_IS_IA32)
56    
# Line 157  Line 164 
164  {  {
165          unsigned int cpu_flags;          unsigned int cpu_flags;
166    
167          if (XVID_MAJOR(init->version) != 1) /* v1.x.x */          if (XVID_VERSION_MAJOR(init->version) != 1) /* v1.x.x */
168                  return XVID_ERR_VERSION;                  return XVID_ERR_VERSION;
169    
170          cpu_flags = (init->cpu_flags & XVID_CPU_FORCE) ? init->cpu_flags : detect_cpu_flags();          cpu_flags = (init->cpu_flags & XVID_CPU_FORCE) ? init->cpu_flags : detect_cpu_flags();
# Line 176  Line 183 
183          /* Restore FPU context : emms_c is a nop functions */          /* Restore FPU context : emms_c is a nop functions */
184          emms = emms_c;          emms = emms_c;
185    
186            /* Qpel stuff */
187            xvid_QP_Funcs = &xvid_QP_Funcs_C;
188            xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_C;
189            xvid_Init_QP_mmx();
190    
191          /* Quantization functions */          /* Quantization functions */
192          quant_intra   = quant_intra_c;          quant_intra   = quant_intra_c;
193          dequant_intra = dequant_intra_c;          dequant_intra = dequant_intra_c;
# Line 282  Line 294 
294    
295  #if defined(ARCH_IS_IA32)  #if defined(ARCH_IS_IA32)
296    
297          if ((cpu_flags & XVID_CPU_ASM))          if ((cpu_flags & XVID_CPU_ASM)) {
         {  
298                  vfilter_31 = xvid_VFilter_31_x86;                  vfilter_31 = xvid_VFilter_31_x86;
299                  hfilter_31 = xvid_HFilter_31_x86;                  hfilter_31 = xvid_HFilter_31_x86;
300          }          }
# Line 302  Line 313 
313                  fdct = fdct_mmx;                  fdct = fdct_mmx;
314                  idct = idct_mmx;                  idct = idct_mmx;
315    
316                    /* Qpel stuff */
317                    xvid_QP_Funcs = &xvid_QP_Funcs_mmx;
318                    xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_mmx;
319    
320                  /* Quantization related functions */                  /* Quantization related functions */
321                  quant_intra   = quant_intra_mmx;                  quant_intra   = quant_intra_mmx;
322                  dequant_intra = dequant_intra_mmx;                  dequant_intra = dequant_intra_mmx;
# Line 465  Line 480 
480                  interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dne;                  interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dne;
481          }          }
482    
483    #if defined(EXPERIMENTAL_SSE2_CODE) /* mark the whole SSE2 stuff as experimental. At least on
484                                                                               my P4, it crashes... */
485          if ((cpu_flags & XVID_CPU_SSE2)) {          if ((cpu_flags & XVID_CPU_SSE2)) {
486    
487                  calc_cbp = calc_cbp_sse2;                  calc_cbp = calc_cbp_sse2;
# Line 476  Line 492 
492                  quant_inter   = quant_inter_sse2;                  quant_inter   = quant_inter_sse2;
493                  dequant_inter = dequant_inter_sse2;                  dequant_inter = dequant_inter_sse2;
494    
 #if defined(EXPERIMENTAL_SSE2_CODE)  
495                  /* ME; slower than xmm */                  /* ME; slower than xmm */
496                  sad16    = sad16_sse2;                  sad16    = sad16_sse2;
497                  dev16    = dev16_sse2;                  dev16    = dev16_sse2;
 #endif  
498                  /* Forward and Inverse DCT */                  /* Forward and Inverse DCT */
499    #if 0 /* Both function are known to be unprecise, better keep them deactivated */
500                  idct  = idct_sse2;                  idct  = idct_sse2;
501                  fdct = fdct_sse2;                  fdct = fdct_sse2;
502    #endif
503          }          }
504  #endif  #endif
505    #endif
506    
507  #if defined(ARCH_IS_IA64)  #if defined(ARCH_IS_IA64)
508          if ((cpu_flags & XVID_CPU_ASM)) { /* use assembler routines? */          if ((cpu_flags & XVID_CPU_ASM)) { /* use assembler routines? */
# Line 510  Line 527 
527            transfer_8to16sub2 = transfer_8to16sub2_ia64;            transfer_8to16sub2 = transfer_8to16sub2_ia64;
528            transfer_16to8add = transfer_16to8add_ia64;            transfer_16to8add = transfer_16to8add_ia64;
529            transfer8x8_copy = transfer8x8_copy_ia64;            transfer8x8_copy = transfer8x8_copy_ia64;
           DPRINTF(DPRINTF_DEBUG, "Using IA-64 assembler routines.");  
530          }          }
531  #endif  #endif
532    
# Line 532  Line 548 
548          }          }
549  #endif  #endif
550    
551    #if defined(_DEBUG)
552        xvid_debug = init->debug;
553    #endif
554    
555          return 0;          return 0;
556  }  }
557    
# Line 539  Line 559 
559  static int  static int
560  xvid_gbl_info(xvid_gbl_info_t * info)  xvid_gbl_info(xvid_gbl_info_t * info)
561  {  {
562          if (XVID_MAJOR(info->version) != 1) /* v1.x.x */          if (XVID_VERSION_MAJOR(info->version) != 1) /* v1.x.x */
563                  return XVID_ERR_VERSION;                  return XVID_ERR_VERSION;
564    
565          info->actual_version = XVID_VERSION;          info->actual_version = XVID_VERSION;
# Line 565  Line 585 
585          int height2;          int height2;
586          IMAGE img;          IMAGE img;
587    
588          if (XVID_MAJOR(convert->version) != 1)   /* v1.x.x */          if (XVID_VERSION_MAJOR(convert->version) != 1)   /* v1.x.x */
589                return XVID_ERR_VERSION;                return XVID_ERR_VERSION;
590    
591          // const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);  #if 0
592            const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP);
593    #endif
594          width = convert->width;          width = convert->width;
595          height = convert->height;          height = convert->height;
596          width2 = convert->width/2;          width2 = convert->width/2;
# Line 640  Line 662 
662  {  {
663          int i, diff = 0;          int i, diff = 0;
664          for (i = 0; i < size; i++)          for (i = 0; i < size; i++)
665                  diff += ABS(blockA[i]-blockB[i]);                  diff += abs(blockA[i]-blockB[i]);
666          return diff;          return diff;
667  }  }
668    

Legend:
Removed from v.1.45.2.2  
changed lines
  Added in v.1.45.2.13

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