--- trunk/xvidcore/src/motion/motion_smp.h 2006/02/26 01:52:34 1689 +++ trunk/xvidcore/src/motion/motion_smp.h 2006/02/27 00:22:31 1690 @@ -22,7 +22,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: motion_smp.h,v 1.2 2006-02-24 23:35:04 suxen_drol Exp $ + * $Id: motion_smp.h,v 1.3 2006-02-27 00:22:31 syskin Exp $ * ****************************************************************************/ @@ -30,29 +30,34 @@ #define SMP_MOTION_H #ifdef WIN32 -#include -#define pthread_t HANDLE -#define pthread_create(t,u,f,d) *(t)=CreateThread(NULL,0,f,d,0,NULL) -#define pthread_join(t,s) { WaitForSingleObject(t,INFINITE); \ - CloseHandle(t); } -#define sched_yield() Sleep(0) -#define HAVE_PTHREAD 1 -#elif defined(SYS_BEOS) -#include -#define pthread_t thread_id -#define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \ - resume_thread(*(t)); } -#define pthread_join(t,s) wait_for_thread(t,(long*)s) -#define sched_yield() snooze(0) /* is this correct? */ -#define HAVE_PTHREAD 1 - -#elif HAVE_PTHREAD -#include -#endif +# include +# include +# define pthread_t HANDLE +# define pthread_create(t,u,f,d) *(t)=CreateThread(NULL,0,f,d,0,NULL) +# define pthread_join(t,s) { WaitForSingleObject(t,INFINITE); \ + CloseHandle(t); } +# define sched_yield() Sleep(0); +static int pthread_num_processors_np() +{ + unsigned int p_aff, s_aff, r = 0; + GetProcessAffinityMask(GetCurrentProcess(), &p_aff, &s_aff); + for(; p_aff != 0; p_aff>>=1) r += p_aff&1; + return r; +} +#elif defined(SYS_BEOS) -#define THREADS 3 +# include +# define pthread_t thread_id +# define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \ + resume_thread(*(t)); } +# define pthread_join(t,s) wait_for_thread(t,(long*)s) +# define sched_yield() snooze(0) /* is this correct? */ + +#else +# include +#endif typedef struct { @@ -81,12 +86,11 @@ int MVmax, mvSum, mvCount; /* out */ - uint32_t minfcode; - uint32_t minbcode; + int minfcode, minbcode; } SMPmotionData; void MotionEstimateSMP(SMPmotionData * h); void SMPMotionEstimationBVOP(SMPmotionData * h); -#endif /* SMP_MOTION_H */ \ No newline at end of file +#endif /* SMP_MOTION_H */