22 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
* |
* |
25 |
* $Id: motion_smp.h,v 1.5 2008-11-26 01:04:34 Isibaar Exp $ |
* $Id$ |
26 |
* |
* |
27 |
****************************************************************************/ |
****************************************************************************/ |
28 |
|
|
29 |
#ifndef SMP_MOTION_H |
#ifndef SMP_MOTION_H |
30 |
#define SMP_MOTION_H |
#define SMP_MOTION_H |
31 |
|
|
|
#ifdef WIN32 |
|
|
|
|
|
# include <windows.h> |
|
|
# 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 __inline int pthread_num_processors_np() |
|
|
{ |
|
|
DWORD p_aff, s_aff, r = 0; |
|
|
GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR) &p_aff, (PDWORD_PTR) &s_aff); |
|
|
for(; p_aff != 0; p_aff>>=1) r += p_aff&1; |
|
|
return r; |
|
|
} |
|
|
|
|
|
#elif defined(SYS_BEOS) |
|
|
|
|
|
# include <kernel/OS.h> |
|
|
# 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 <pthread.h> |
|
|
#endif |
|
|
|
|
32 |
typedef struct |
typedef struct |
33 |
{ |
{ |
34 |
pthread_t handle; /* thread's handle */ |
pthread_t handle; /* thread's handle */ |
|
const MBParam * pParam; |
|
35 |
const FRAMEINFO * current; |
const FRAMEINFO * current; |
|
const FRAMEINFO * reference; |
|
|
const IMAGE * pRefH; |
|
|
const IMAGE * pRefV; |
|
|
const IMAGE * pRefHV; |
|
|
const IMAGE * pGMC; |
|
36 |
uint8_t * RefQ; |
uint8_t * RefQ; |
37 |
|
int y_row; |
38 |
int y_step; |
int y_step; |
39 |
int start_y; |
int start_y; |
40 |
|
int stop_y; |
41 |
int * complete_count_self; |
int * complete_count_self; |
42 |
int * complete_count_above; |
int * complete_count_above; |
43 |
|
|
|
/* bvop stuff */ |
|
|
int time_bp, time_pp; |
|
|
const MACROBLOCK * f_mbs; |
|
|
const IMAGE * pRef; |
|
|
const IMAGE * fRef; |
|
|
const IMAGE * fRefH; |
|
|
const IMAGE * fRefV; |
|
|
const IMAGE * fRefHV; |
|
|
|
|
44 |
int MVmax, mvSum, mvCount; /* out */ |
int MVmax, mvSum, mvCount; /* out */ |
45 |
|
|
46 |
int minfcode, minbcode; |
uint32_t minfcode, minbcode; |
47 |
} SMPmotionData; |
|
48 |
|
uint8_t *tmp_buffer; |
49 |
|
Bitstream *bs; |
50 |
|
|
51 |
|
Statistics *sStat; |
52 |
|
void *pEnc; |
53 |
|
} SMPData; |
54 |
|
|
55 |
|
|
56 |
void MotionEstimateSMP(SMPmotionData * h); |
void MotionEstimateSMP(SMPData * h); |
57 |
void SMPMotionEstimationBVOP(SMPmotionData * h); |
void SMPMotionEstimationBVOP(SMPData * h); |
58 |
|
|
59 |
#endif /* SMP_MOTION_H */ |
#endif /* SMP_MOTION_H */ |