[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.25, Sun Jul 7 13:21:34 2002 UTC revision 1.33, Tue Jul 23 12:59:57 2002 UTC
# Line 52  Line 52 
52  #include "utils/mem_transfer.h"  #include "utils/mem_transfer.h"
53  #include "quant/quant_h263.h"  #include "quant/quant_h263.h"
54  #include "quant/quant_mpeg4.h"  #include "quant/quant_mpeg4.h"
55    #include "motion/motion.h"
56  #include "motion/sad.h"  #include "motion/sad.h"
57  #include "utils/emms.h"  #include "utils/emms.h"
58  #include "utils/timer.h"  #include "utils/timer.h"
59  #include "bitstream/mbcoding.h"  #include "bitstream/mbcoding.h"
60    
61    #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE)
62    
63    #ifdef WIN32
64    #include <windows.h>
65    #else
66    #include <signal.h>
67    #include <setjmp.h>
68    #endif
69    
70    
71    #ifndef WIN32
72    
73    static jmp_buf mark;
74    
75    static void
76    sigill_handler(int signal)
77    {
78       longjmp(mark, 1);
79    }
80    #endif
81    
82    
83    /*
84    calls the funcptr, and returns whether SIGILL (illegal instruction) was signalled
85    return values:
86    -1 : could not determine
87    0  : SIGILL was *not* signalled
88    1  : SIGILL was signalled
89    */
90    
91    int
92    sigill_check(void (*func)())
93    {
94    #ifdef WIN32
95            _try {
96                    func();
97            }
98            _except(EXCEPTION_EXECUTE_HANDLER) {
99    
100                    if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION)
101                            return 1;
102            }
103            return 0;
104    #else
105        void * old_handler;
106        int jmpret;
107    
108    
109        old_handler = signal(SIGILL, sigill_handler);
110        if (old_handler == SIG_ERR)
111        {
112            return -1;
113        }
114    
115        jmpret = setjmp(mark);
116        if (jmpret == 0)
117        {
118            func();
119        }
120    
121        signal(SIGILL, old_handler);
122    
123        return jmpret;
124    #endif
125    }
126    #endif
127    
128  /*****************************************************************************  /*****************************************************************************
129   * XviD Init Entry point   * XviD Init Entry point
130   *   *
# Line 88  Line 156 
156          /* Inform the client the core build - unused because we're still alpha */          /* Inform the client the core build - unused because we're still alpha */
157          init_param->core_build = 1000;          init_param->core_build = 1000;
158    
         if ((init_param->cpu_flags & XVID_CPU_CHKONLY))  
         {  
                 init_param->cpu_flags = check_cpu_features();  
                 return XVID_ERR_OK;  
         }  
   
159          /* Do we have to force CPU features  ? */          /* Do we have to force CPU features  ? */
160          if ((init_param->cpu_flags & XVID_CPU_FORCE) > 0) {          if ((init_param->cpu_flags & XVID_CPU_FORCE)) {
161    
162                  cpu_flags = init_param->cpu_flags;                  cpu_flags = init_param->cpu_flags;
163    
164          } else {          } else {
165    
166                  cpu_flags = check_cpu_features();                  cpu_flags = check_cpu_features();
167    
168    #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE)
169                    if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger))
170                            cpu_flags &= ~XVID_CPU_SSE;
171    
172                    if ((cpu_flags & XVID_CPU_SSE2) && sigill_check(sse2_os_trigger))
173                            cpu_flags &= ~XVID_CPU_SSE2;
174    #endif
175            }
176    
177            if ((init_param->cpu_flags & XVID_CPU_CHKONLY))
178            {
179                  init_param->cpu_flags = cpu_flags;                  init_param->cpu_flags = cpu_flags;
180                    return XVID_ERR_OK;
181          }          }
182    
183            init_param->cpu_flags = cpu_flags;
184    
185    
186          /* Initialize the function pointers */          /* Initialize the function pointers */
187          idct_int32_init();          idct_int32_init();
188          init_vlc_tables();          init_vlc_tables();
# Line 165  Line 245 
245          /* Functions used in motion estimation algorithms */          /* Functions used in motion estimation algorithms */
246          calc_cbp = calc_cbp_c;          calc_cbp = calc_cbp_c;
247          sad16    = sad16_c;          sad16    = sad16_c;
         sad16bi  = sad16bi_c;  
248          sad8     = sad8_c;          sad8     = sad8_c;
249            sad16bi  = sad16bi_c;
250            sad8bi   = sad8bi_c;
251          dev16    = dev16_c;          dev16    = dev16_c;
252    
253            Halfpel8_Refine = Halfpel8_Refine_c;
254    
255  #ifdef ARCH_X86  #ifdef ARCH_X86
256          if ((cpu_flags & XVID_CPU_MMX) > 0) {          if ((cpu_flags & XVID_CPU_MMX) > 0) {
257    
# Line 221  Line 304 
304                  calc_cbp = calc_cbp_mmx;                  calc_cbp = calc_cbp_mmx;
305                  sad16    = sad16_mmx;                  sad16    = sad16_mmx;
306                  sad8     = sad8_mmx;                  sad8     = sad8_mmx;
307                    sad16bi = sad16bi_mmx;
308                    sad8bi  = sad8bi_mmx;
309                  dev16    = dev16_mmx;                  dev16    = dev16_mmx;
310    
311          }          }
312    
313            /* these 3dnow functions are faster than mmx, but slower than xmm. */
314            if ((cpu_flags & XVID_CPU_3DNOW) > 0) {
315    
316                    /* ME functions */
317                    sad16bi = sad16bi_3dn;
318                    sad8bi  = sad8bi_3dn;
319            }
320    
321    
322          if ((cpu_flags & XVID_CPU_MMXEXT) > 0) {          if ((cpu_flags & XVID_CPU_MMXEXT) > 0) {
323    
324                  /* Inverse DCT */                  /* Inverse DCT */
# Line 247  Line 341 
341    
342                  /* ME functions */                  /* ME functions */
343                  sad16 = sad16_xmm;                  sad16 = sad16_xmm;
                 sad16bi = sad16bi_xmm;  
344                  sad8  = sad8_xmm;                  sad8  = sad8_xmm;
345                    sad16bi = sad16bi_xmm;
346                    sad8bi  = sad8bi_xmm;
347                  dev16 = dev16_xmm;                  dev16 = dev16_xmm;
348    
349          }          }
# Line 296  Line 391 
391            sad16bi = sad16bi_ia64;            sad16bi = sad16bi_ia64;
392            sad8 = sad8_ia64;            sad8 = sad8_ia64;
393            dev16 = dev16_ia64;            dev16 = dev16_ia64;
394              Halfpel8_Refine = Halfpel8_Refine_ia64;
395            quant_intra = quant_intra_ia64;            quant_intra = quant_intra_ia64;
396            dequant_intra = dequant_intra_ia64;            dequant_intra = dequant_intra_ia64;
397            quant_inter = quant_inter_ia64;            quant_inter = quant_inter_ia64;

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.33

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