diff -ur xvidcore-1.4.orig/src/encoder.c xvidcore-1.4/src/encoder.c
--- xvidcore-1.4.orig/src/encoder.c	2011-05-18 18:10:05 +0900
+++ xvidcore-1.4/src/encoder.c	2013-09-29 21:27:29 +0900
@@ -449,7 +449,7 @@
 
 	/* multithreaded stuff */
 	if (create->num_threads > 0) {
-#ifndef HAVE_PTHREAD
+#if !defined(HAVE_PTHREAD) && !defined(WIN32)
 		int t = MAX(1, create->num_threads);
 #else
 		int t = MIN(create->num_threads, (int) (pEnc->mbParam.mb_height>>1)); /* at least two rows per thread */
@@ -1651,7 +1651,7 @@
 	int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
 	int slices_per_thread = (num_slices*1024 / num_threads);
 	int mb_height = pEnc->mbParam.mb_height;
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	void * status = NULL;
 #endif
 	uint16_t k;
@@ -1694,7 +1694,7 @@
 	pEnc->smpData[0].bs = bs;
 	pEnc->smpData[0].sStat = &pEnc->current->sStat;
 
-#ifdef HAVE_PTHREAD	
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&pEnc->smpData[k].handle, NULL, 
@@ -1704,7 +1704,7 @@
 
 	SliceCodeI(&pEnc->smpData[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(pEnc->smpData[k].handle, &status);
@@ -1918,7 +1918,7 @@
 
 	int k = 0, bound = 0, num_slices = pEnc->num_slices;
 	int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	void * status = NULL;
 	int threads_per_slice = (pEnc->num_threads*1024 / num_threads);
 #endif
@@ -2017,7 +2017,7 @@
 		}
 	}
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	if (pEnc->num_threads > 0) {
 
 		/* multithreaded motion estimation - dispatch threads */
@@ -2118,7 +2118,7 @@
 	pEnc->smpData[0].bs = bs;
 	pEnc->smpData[0].sStat = &current->sStat;
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&pEnc->smpData[k].handle, NULL, 
@@ -2128,7 +2128,7 @@
 
 	SliceCodeP(&pEnc->smpData[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(pEnc->smpData[k].handle, &status);
@@ -2296,7 +2296,7 @@
 	int bits = BitstreamPos(bs);
 	int k = 0, bound = 0, num_slices = pEnc->num_slices;
 	int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	void * status = NULL;
 	int threads_per_slice = (pEnc->num_threads*1024 / num_threads);
 #endif
@@ -2367,7 +2367,7 @@
 
 	start_timer();
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	if (pEnc->num_threads > 0) {
 
 		/* multithreaded motion estimation - dispatch threads */
@@ -2475,7 +2475,7 @@
 		}
 	}
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&pEnc->smpData[k].handle, NULL, 
 			(void*)SliceCodeB, (void*)&pEnc->smpData[k]);
@@ -2486,7 +2486,7 @@
 	pEnc->smpData[0].sStat = &frame->sStat;
 	SliceCodeB(&pEnc->smpData[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(pEnc->smpData[k].handle, &status);
 	}
diff -ur xvidcore-1.4.orig/src/image/postprocessing.c xvidcore-1.4/src/image/postprocessing.c
--- xvidcore-1.4.orig/src/image/postprocessing.c	2011-05-18 18:10:05 +0900
+++ xvidcore-1.4/src/image/postprocessing.c	2013-09-29 21:27:29 +0900
@@ -133,7 +133,7 @@
 				int flags, int brightness, int frame_num, int bvop, int threads)
 {
 	int k;
-#ifndef HAVE_PTHREAD
+#if !defined(HAVE_PTHREAD) && !defined(WIN32)
 	int num_threads = 1;
 #else
 	int num_threads = MAX(1, MIN(threads, 4));
@@ -155,7 +155,7 @@
 
 		data[k].stop_y = mb_height*2;
 	}
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&data[k].handle, NULL, 
@@ -164,7 +164,7 @@
 #endif
 	stripe_deblock_h(&data[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(data[k].handle, &status);
@@ -178,7 +178,7 @@
 		data[k].stop_x = mb_width*2;
 	}
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&data[k].handle, NULL, 
@@ -187,7 +187,7 @@
 #endif
 	stripe_deblock_v(&data[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(data[k].handle, &status);
diff -ur xvidcore-1.4.orig/src/portab.h xvidcore-1.4/src/portab.h
--- xvidcore-1.4.orig/src/portab.h	2011-05-18 18:10:05 +0900
+++ xvidcore-1.4/src/portab.h	2013-09-29 21:27:29 +0900
@@ -74,11 +74,16 @@
 #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); \
+
+# ifdef HAVE_PTHREAD
+#  include <pthread.h>
+# else
+#  include <process.h>
+#  define pthread_t				HANDLE
+#  define pthread_create(t,u,f,d) *(t)=_beginthreadex(NULL,0,f,d,0,NULL)
+#  define pthread_join(t,s)		{ WaitForSingleObject(t,INFINITE); \
 									CloseHandle(t); } 
-# define sched_yield()			Sleep(0);
+#  define sched_yield()			Sleep(0);
 static __inline int pthread_num_processors_np() 
 {
 	DWORD p_aff, s_aff, r = 0;
@@ -86,6 +91,7 @@
 	for(; p_aff != 0; p_aff>>=1) r += p_aff&1;
 	return r;
 }
+# endif
 
 #elif defined(__amigaos4__)
 
