[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 1692 - (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 : suxen_drol 1692 * $Id: motion_smp.h,v 1.4 2006-02-27 12:16:04 suxen_drol 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 : syskin 1690 GetProcessAffinityMask(GetCurrentProcess(), &p_aff, &s_aff);
44 :     for(; p_aff != 0; p_aff>>=1) r += p_aff&1;
45 :     return r;
46 :     }
47 :    
48 : syskin 1682 #elif defined(SYS_BEOS)
49 :    
50 : syskin 1690 # include <kernel/OS.h>
51 :     # define pthread_t thread_id
52 :     # define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \
53 :     resume_thread(*(t)); }
54 :     # define pthread_join(t,s) wait_for_thread(t,(long*)s)
55 :     # define sched_yield() snooze(0) /* is this correct? */
56 : syskin 1682
57 : syskin 1690 #else
58 :     # include <pthread.h>
59 :     #endif
60 : syskin 1682
61 :     typedef struct
62 :     {
63 :     pthread_t handle; /* thread's handle */
64 :     const MBParam * pParam;
65 :     const FRAMEINFO * current;
66 :     const FRAMEINFO * reference;
67 :     const IMAGE * pRefH;
68 :     const IMAGE * pRefV;
69 :     const IMAGE * pRefHV;
70 :     const IMAGE * pGMC;
71 :     uint8_t * RefQ;
72 :     int y_step;
73 :     int start_y;
74 :     int * complete_count_self;
75 :     int * complete_count_above;
76 :    
77 :     /* bvop stuff */
78 :     int time_bp, time_pp;
79 :     const MACROBLOCK * f_mbs;
80 :     const IMAGE * pRef;
81 :     const IMAGE * fRef;
82 :     const IMAGE * fRefH;
83 :     const IMAGE * fRefV;
84 :     const IMAGE * fRefHV;
85 :    
86 :     int MVmax, mvSum, mvCount; /* out */
87 : suxen_drol 1686
88 : syskin 1690 int minfcode, minbcode;
89 : syskin 1682 } SMPmotionData;
90 :    
91 :    
92 :     void MotionEstimateSMP(SMPmotionData * h);
93 :     void SMPMotionEstimationBVOP(SMPmotionData * h);
94 :    
95 : syskin 1690 #endif /* SMP_MOTION_H */

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