libxvidcore OS4 port (source code changes)

Fredrik Wikstrom <[email protected]>
Newsgroups gmane.comp.video.xvid.devel
Message-ID <[email protected]>
Hi,

I have ported the libxvidcore library to AmigaOS 4.

I've attached diffs of the source code changes I made. Would be nice if 
they were included in the official xvidcore sources.

The diffs are made against the version 1.2.2 release.

Best Regards,
Fredrik Wikstrom

_______________________________________________
Xvid-devel mailing list
[email protected]
http://list.xvid.org/mailman/listinfo/xvid-devel
altivec_trigger.c.diff (text/plain, 391 B)
*** src/utils/ppc_asm/altivec_trigger.c.old	2009-06-03 12:27:15 
--- src/utils/ppc_asm/altivec_trigger.c	2009-06-03 12:27:20 
***************
*** 30,35 ****
--- 30,36 ----
  #include "../../portab.h"
  #include "../emms.h"
  
+ #if !defined(__amigaos4__)
  void
  altivec_trigger(void)
  {
***************
*** 38,40 ****
--- 39,42 ----
  	var1 = vec_add(var1, var2);
  	return;
  }
+ #endif
motion_smp.h.diff (text/plain, 349 B)
*** src/motion/motion_smp.h.old	2009-06-03 12:33:44 
--- src/motion/motion_smp.h	2009-06-03 12:35:24 
***************
*** 45,50 ****
--- 45,56 ----
  	return r;
  }
  
+ #elif defined(__amigaos4__)
+ 
+ # include <pthread.h>
+ # include <proto/dos.h>
+ # define sched_yield() IDOS->Delay(1)
+ 
  #elif defined(SYS_BEOS)
  
  # include <kernel/OS.h>
xvid.c.diff (text/plain, 2.2 KB)
*** src/xvid.c.old	2009-06-03 11:38:50 
--- src/xvid.c	2009-06-03 13:10:25 
***************
*** 32,37 ****
--- 32,42 ----
    #include <unistd.h>
  #endif
  
+ #if defined(__amigaos4__)
+ #include <exec/exec.h>
+ #include <proto/exec.h>
+ #endif
+ 
  #include "xvid.h"
  #include "decoder.h"
  #include "encoder.h"
***************
*** 56,61 ****
--- 61,67 ----
  unsigned int xvid_debug = 0; /* xvid debug mask */
  #endif
  
+ #if !defined(__amigaos4__)
  #if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER)
  #	include <windows.h>
  #elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC)
***************
*** 70,75 ****
--- 76,82 ----
  	   longjmp(mark, 1);
  	}
  #endif
+ #endif
  
  
  /*
***************
*** 81,86 ****
--- 88,94 ----
   *   0 : SIGILL was *not* signalled
   *   1 : SIGILL was signalled
   */
+ #if !defined(__amigaos4__)
  #if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER)
  static int
  sigill_check(void (*func)())
***************
*** 127,132 ****
--- 135,141 ----
      return(jmpret);
  }
  #endif
+ #endif
  
  
  /* detect cpu flags  */
***************
*** 136,141 ****
--- 145,160 ----
  	/* enable native assembly optimizations by default */
  	unsigned int cpu_flags = XVID_CPU_ASM;
  
+ #if defined(__amigaos4__)
+ 	{
+ 		uint32_t vector_unit = VECTORTYPE_NONE;
+ 		IExec->GetCPUInfoTags(GCIT_VectorUnit, &vector_unit, TAG_END);
+ 		if (vector_unit == VECTORTYPE_ALTIVEC) {
+ 			cpu_flags |= XVID_CPU_ALTIVEC;
+ 		}
+ 	}
+ #else
+ 
  #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)
  	cpu_flags |= check_cpu_features();
  	if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger))
***************
*** 150,155 ****
--- 169,176 ----
  		cpu_flags |= XVID_CPU_ALTIVEC;
  #endif
  
+ #endif
+ 
  	return cpu_flags;
  }
  
***************
*** 677,682 ****
--- 698,711 ----
  	info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */
    }
  
+ #elif defined(__amigaos4__)
+ 
+   {
+     uint32_t num_threads = 1;
+     IExec->GetCPUInfoTags(GCIT_NumberOfCPUs, &num_threads, TAG_END);
+     info->num_threads = num_threads;
+   }
+ 
  #else
  
    info->num_threads = sysconf(_SC_NPROCESSORS_CONF);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.