[svn] / trunk / xvidcore / src / motion / motion_smp.h Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/motion/motion_smp.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1874 - (view) (download)

1 : syskin 1682 /*****************************************************************************
2 :     *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - multithreaded Motion Estimation header -
5 :     *
6 :     * Copyright(C) 2005 Radoslaw Czyz <xvid@syskin.cjb.net>
7 :     *
8 :     * significant portions derived from x264 project,
9 :     * original authors: Trax, Gianluigi Tiesi, Eric Petit
10 :     *
11 :     * This program is free software ; you can redistribute it and/or modify
12 :     * it under the terms of the GNU General Public License as published by
13 :     * the Free Software Foundation ; either version 2 of the License, or
14 :     * (at your option) any later version.
15 :     *
16 :     * This program is distributed in the hope that it will be useful,
17 :     * but WITHOUT ANY WARRANTY ; without even the implied warranty of
18 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 :     * GNU General Public License for more details.
20 :     *
21 :     * You should have received a copy of the GNU General Public License
22 :     * along with this program ; if not, write to the Free Software
23 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 :     *
25 : Isibaar 1874 * $Id: motion_smp.h,v 1.6 2009-06-05 07:58:41 Isibaar Exp $
26 : syskin 1682 *
27 :     ****************************************************************************/
28 :    
29 :     #ifndef SMP_MOTION_H
30 :     #define SMP_MOTION_H
31 :    
32 :     #ifdef WIN32
33 :    
34 : syskin 1690 # include <windows.h>
35 :     # define pthread_t HANDLE
36 :     # define pthread_create(t,u,f,d) *(t)=CreateThread(NULL,0,f,d,0,NULL)
37 :     # define pthread_join(t,s) { WaitForSingleObject(t,INFINITE); \
38 :     CloseHandle(t); }
39 :     # define sched_yield() Sleep(0);
40 : suxen_drol 1692 static __inline int pthread_num_processors_np()
41 : syskin 1690 {
42 : suxen_drol 1692 DWORD p_aff, s_aff, r = 0;
43 : Isibaar 1795 GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR) &p_aff, (PDWORD_PTR) &s_aff);
44 : syskin 1690 for(; p_aff != 0; p_aff>>=1) r += p_aff&1;
45 :     return r;
46 :     }
47 :    
48 : Isibaar 1874 #elif defined(__amigaos4__)
49 :    
50 :     # include <pthread.h>
51 :     # include <proto/dos.h>
52 :     # define sched_yield() IDOS->Delay(1)
53 :    
54 : syskin 1682 #elif defined(SYS_BEOS)
55 :    
56 : syskin 1690 # include <kernel/OS.h>
57 :     # define pthread_t thread_id
58 :     # define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \
59 :     resume_thread(*(t)); }
60 :     # define pthread_join(t,s) wait_for_thread(t,(long*)s)
61 :     # define sched_yield() snooze(0) /* is this correct? */
62 : syskin 1682
63 : syskin 1690 #else
64 :     # include <pthread.h>
65 :     #endif
66 : syskin 1682
67 :     typedef struct
68 :     {
69 :     pthread_t handle; /* thread's handle */
70 :     const MBParam * pParam;
71 :     const FRAMEINFO * current;
72 :     const FRAMEINFO * reference;
73 :     const IMAGE * pRefH;
74 :     const IMAGE * pRefV;
75 :     const IMAGE * pRefHV;
76 :     const IMAGE * pGMC;
77 :     uint8_t * RefQ;
78 :     int y_step;
79 :     int start_y;
80 :     int * complete_count_self;
81 :     int * complete_count_above;
82 :    
83 :     /* bvop stuff */
84 :     int time_bp, time_pp;
85 :     const MACROBLOCK * f_mbs;
86 :     const IMAGE * pRef;
87 :     const IMAGE * fRef;
88 :     const IMAGE * fRefH;
89 :     const IMAGE * fRefV;
90 :     const IMAGE * fRefHV;
91 :    
92 :     int MVmax, mvSum, mvCount; /* out */
93 : suxen_drol 1686
94 : syskin 1690 int minfcode, minbcode;
95 : syskin 1682 } SMPmotionData;
96 :    
97 :    
98 :     void MotionEstimateSMP(SMPmotionData * h);
99 :     void SMPMotionEstimationBVOP(SMPmotionData * h);
100 :    
101 : syskin 1690 #endif /* SMP_MOTION_H */

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