diff -Naur mjpegtools.orig/Portfile mjpegtools/Portfile
--- mjpegtools.orig/Portfile	2005-05-26 14:48:20.000000000 +0900
+++ mjpegtools/Portfile	2006-03-16 03:48:23.000000000 +0900
@@ -3,6 +3,7 @@
 PortSystem 1.0
 name		mjpegtools
 version		1.6.2	
+revision	1
 categories	multimedia
 maintainers 	filippo.natali@gmail.com	
 platforms	darwin
@@ -15,17 +16,30 @@
 
 checksums	md5 01c0120b0182de67f182ef99ad855daa
 
+depends_build	port:libtool
 depends_lib	lib:libpng:libpng lib:libjpeg:jpeg
 
-configure.args  --mandir=${prefix}/share/man   --disable-glibtest --disable-gtktest --disable-sdltest
+patch.pre_args	-p1
+
+configure.args  --mandir=${prefix}/share/man --disable-glibtest --disable-gtktest --disable-sdltest
 
 configure.env   CPPFLAGS="-L${prefix}/lib -I${prefix}/include" \
-                CFLAGS="-L${prefix}/lib" CC=gcc-3.3 CXX=g++-3.3
+                CFLAGS="-L${prefix}/lib" CC=gcc CXX=g++
+
+build.args	LIBTOOL=${prefix}/bin/glibtool ASFLAGS="-f macho"
 
 platform darwin 8 {
 	patchfiles mjpegtools.patch
 }
 
+platform i386 {
+	 configure.args-append	--disable-simd-accel
+}
+
+platform powerpc {
+	 configure.args-append	--enable-simd-accel
+}
+
 variant gtk {
 	configure.args-delete	--disable-glibtest --disable-gtktest
 	depends_lib-append	lib:libgtk.1:gtk1
diff -Naur mjpegtools.orig/files/mjpegtools.patch mjpegtools/files/mjpegtools.patch
--- mjpegtools.orig/files/mjpegtools.patch	2005-05-26 14:48:21.000000000 +0900
+++ mjpegtools/files/mjpegtools.patch	2006-03-16 03:34:41.000000000 +0900
@@ -1,5 +1,23 @@
---- lavtools/Makefile.in	2004-02-03 17:58:30.000000000 -0500
-+++ lavtools/Makefile.in	2005-05-04 23:50:31.000000000 -0400
+diff -ru mjpegtools-1.6.2.orig/configure mjpegtools-1.6.2/configure
+--- mjpegtools-1.6.2.orig/configure	2004-02-03 17:58:37.000000000 -0500
++++ mjpegtools-1.6.2/configure	2006-03-03 00:13:24.000000000 -0500
+@@ -25867,7 +25867,12 @@
+   i586) ARCHFLAGS="-mcpu=i586 -march=$arch"
+   have_cmov=false
+   ;;
+-  *) ARCHFLAGS="-mcpu=i686 -march=$arch"
++  *) case $host in
++  	 *-*-darwin*) ARCHFLAGS=" "
++  	 ;;
++  	 *) ARCHFLAGS="-mcpu=i686 -march=$arch"
++  	 ;;
++  	 esac
+   have_cmov=true
+   ;;
+   esac
+diff -ru mjpegtools-1.6.2.orig/lavtools/Makefile.in mjpegtools-1.6.2/lavtools/Makefile.in
+--- mjpegtools-1.6.2.orig/lavtools/Makefile.in	2004-02-03 17:58:30.000000000 -0500
++++ mjpegtools-1.6.2/lavtools/Makefile.in	2006-03-02 23:44:30.000000000 -0500
 @@ -236,7 +236,6 @@
  
  LAV_ALL_LIB_OPTS = \
@@ -8,8 +26,9 @@
  	-export-dynamic 
  
  
---- lavtools/lavpipe.c	2002-09-23 15:46:43.000000000 -0400
-+++ lavtools/lavpipe.c	2005-05-04 23:50:56.000000000 -0400
+diff -ru mjpegtools-1.6.2.orig/lavtools/lavpipe.c mjpegtools-1.6.2/lavtools/lavpipe.c
+--- mjpegtools-1.6.2.orig/lavtools/lavpipe.c	2002-09-23 15:46:43.000000000 -0400
++++ mjpegtools-1.6.2/lavtools/lavpipe.c	2006-03-02 23:44:30.000000000 -0500
 @@ -581,7 +581,7 @@
        }
        mjpeg_info( "closing input %d (source %d)", i, current_index);
@@ -19,8 +38,280 @@
      }
    }
  }
---- yuvdenoise/Makefile.in	2004-02-03 17:58:33.000000000 -0500
-+++ yuvdenoise/Makefile.in	2005-05-05 00:23:36.000000000 -0400
+diff -ru mjpegtools-1.6.2.orig/mpeg2enc/picture.cc mjpegtools-1.6.2/mpeg2enc/picture.cc
+--- mjpegtools-1.6.2.orig/mpeg2enc/picture.cc	2003-10-25 13:36:32.000000000 -0400
++++ mjpegtools-1.6.2/mpeg2enc/picture.cc	2006-03-02 23:44:30.000000000 -0500
+@@ -83,9 +83,9 @@
+     }
+ 
+ 
+-	curref = new (uint8_t *)[5];
+-	curorg = new (uint8_t *)[5];
+-	pred   = new (uint8_t *)[5];
++	curref = new uint8_t *[5];
++	curorg = new uint8_t *[5];
++	pred   = new uint8_t *[5];
+ 
+ 	for( i = 0 ; i<3; i++)
+ 	{
+diff -ru mjpegtools-1.6.2.orig/mpeg2enc/ratectl.cc mjpegtools-1.6.2/mpeg2enc/ratectl.cc
+--- mjpegtools-1.6.2.orig/mpeg2enc/ratectl.cc	2004-01-19 12:35:53.000000000 -0500
++++ mjpegtools-1.6.2/mpeg2enc/ratectl.cc	2006-03-02 23:44:30.000000000 -0500
+@@ -62,7 +62,9 @@
+ 
+ /* private prototypes */
+ 
+-
++static const double K_AVG_WINDOW_I = 4.0;
++static const double K_AVG_WINDOW_P = 10.0;
++static const double  K_AVG_WINDOW_B = 20.0;
+ 
+ static double scale_quantf( int q_scale_type, double quant )
+ {
+diff -ru mjpegtools-1.6.2.orig/mpeg2enc/ratectl.hh mjpegtools-1.6.2/mpeg2enc/ratectl.hh
+--- mjpegtools-1.6.2.orig/mpeg2enc/ratectl.hh	2004-01-13 14:53:25.000000000 -0500
++++ mjpegtools-1.6.2/mpeg2enc/ratectl.hh	2006-03-02 23:44:30.000000000 -0500
+@@ -144,9 +144,6 @@
+ 	double avg_KI;
+ 	double avg_KB;
+ 	double avg_KP;
+-	static const double K_AVG_WINDOW_I = 4.0;
+-	static const double K_AVG_WINDOW_P = 10.0;
+-	static const double  K_AVG_WINDOW_B = 20.0;
+ 
+ 	double bits_per_mb;
+ 	bool fast_tune;
+diff -ru mjpegtools-1.6.2.orig/strip_fPIC.sh mjpegtools-1.6.2/strip_fPIC.sh
+--- mjpegtools-1.6.2.orig/strip_fPIC.sh	2003-12-20 12:33:38.000000000 -0500
++++ mjpegtools-1.6.2/strip_fPIC.sh	2006-03-03 00:04:26.000000000 -0500
+@@ -8,6 +8,9 @@
+         -?PIC)
+             # Ignore -fPIC and -DPIC options
+             ;;
++        -fno-common)
++        	# Ignore -fno-common option
++        	;;
+         *)
+             command="$command $1"
+             ;;
+Only in mjpegtools-1.6.2/utils: .DS_Store
+Only in mjpegtools-1.6.2/utils/mmxsse: .DS_Store
+diff -ru mjpegtools-1.6.2.orig/utils/mmxsse/mblock_bsad_mmx.s mjpegtools-1.6.2/utils/mmxsse/mblock_bsad_mmx.s
+--- mjpegtools-1.6.2.orig/utils/mmxsse/mblock_bsad_mmx.s	2003-11-03 13:51:32.000000000 -0500
++++ mjpegtools-1.6.2/utils/mmxsse/mblock_bsad_mmx.s	2006-03-03 00:13:40.000000000 -0500
+@@ -57,7 +57,7 @@
+ %define pbc [esp+24]
+ 
+ SECTION .text
+-global	bsad_mmx:function
++global	bsad_mmx
+ 
+ align 32
+ bsad_mmx:
+diff -ru mjpegtools-1.6.2.orig/utils/mmxsse/mblock_bsumsq_mmx.s mjpegtools-1.6.2/utils/mmxsse/mblock_bsumsq_mmx.s
+--- mjpegtools-1.6.2.orig/utils/mmxsse/mblock_bsumsq_mmx.s	2003-11-03 13:51:32.000000000 -0500
++++ mjpegtools-1.6.2/utils/mmxsse/mblock_bsumsq_mmx.s	2006-03-03 00:13:50.000000000 -0500
+@@ -58,7 +58,7 @@
+ %define pbc [esp+24]
+ 
+ SECTION .text
+-global	bsumsq_mmx:function
++global	bsumsq_mmx
+ 
+ align 32
+ bsumsq_mmx:
+diff -ru mjpegtools-1.6.2.orig/utils/mmxsse/mblock_sad_mmx.s mjpegtools-1.6.2/utils/mmxsse/mblock_sad_mmx.s
+--- mjpegtools-1.6.2.orig/utils/mmxsse/mblock_sad_mmx.s	2003-11-03 13:51:32.000000000 -0500
++++ mjpegtools-1.6.2/utils/mmxsse/mblock_sad_mmx.s	2006-03-03 00:18:34.000000000 -0500
+@@ -27,7 +27,7 @@
+ 
+ SECTION .text
+ 
+-global	sad_00_mmx:function
++global	sad_00_mmx
+ 
+ ; int sad_mmx(unsigned char *blk1,unsigned char *blk2,int lx,int h, int distlim);
+ ; N.b. distlim is *ignored* as testing for it is more expensive than the
+@@ -164,7 +164,7 @@
+ ;
+ 
+ 
+-global	sad_01_mmx:function
++global	sad_01_mmx
+ 
+ ; int sad_01_mmx(unsigned char *p1,unsigned char *p2,int lx,int h);
+ 
+@@ -402,7 +402,7 @@
+ ;
+ 
+ 
+-global	sad_10_mmx:function
++global	sad_10_mmx
+ 
+ ; int sad_10_mmx(unsigned char *p1,unsigned char *p2,int lx,int h);
+ 
+@@ -637,7 +637,7 @@
+ ;
+ 
+ 
+-global	sad_11_mmx:function
++global	sad_11_mmx
+ 
+ ; int sad_11_mmx(unsigned char *p1,unsigned char *p2,int lx,int h);
+ 
+@@ -883,7 +883,7 @@
+ 	ret			; we now return you to your regular programming
+ 
+ 
+-global	sad_sub22_mmx:function
++global	sad_sub22_mmx
+ 
+ ; int sad_sub22_mmx(unsigned char *blk1,unsigned char *blk2,int lx,int h);
+ 
+@@ -986,7 +986,7 @@
+ 
+ 
+ 
+-global	sad_sub44_mmx:function
++global	sad_sub44_mmx
+ 
+ ; int sad_sub44_mmx(unsigned char *blk1,unsigned char *blk2,int qlx,int qh);
+ 
+diff -ru mjpegtools-1.6.2.orig/utils/mmxsse/mblock_sad_mmxe.s mjpegtools-1.6.2/utils/mmxsse/mblock_sad_mmxe.s
+--- mjpegtools-1.6.2.orig/utils/mmxsse/mblock_sad_mmxe.s	2003-11-03 13:51:32.000000000 -0500
++++ mjpegtools-1.6.2/utils/mmxsse/mblock_sad_mmxe.s	2006-03-03 00:19:06.000000000 -0500
+@@ -30,7 +30,7 @@
+ 
+ SECTION .text
+ 
+-global	sad_00_mmxe:function
++global	sad_00_mmxe
+ 
+ ; int sad_00(char *blk1,char *blk2,int lx,int h,int distlim);
+ ; distlim unused - costs more to check than the savings of
+@@ -106,7 +106,7 @@
+ 
+ 				
+ 
+-global	sad_00_Ammxe:function			
++global	sad_00_Ammxe			
+ 		;; This is a special version that only does aligned accesses...
+ 		;; Wonder if it'll make it faster on a P-III
+ 		;; ANSWER:		 NO its slower hence no longer used.
+@@ -193,7 +193,7 @@
+ 	ret	
+ 
+ 
+-global	sad_01_mmxe:function
++global	sad_01_mmxe
+ 
+ ; int sad_01(char *blk1,char *blk2,int lx,int h);
+ 
+@@ -271,7 +271,7 @@
+ 	ret			; we now return you to your regular programming
+ 
+ 
+-global	sad_10_mmxe:function
++global	sad_10_mmxe
+ 
+ ; int sad_10(char *blk1,char *blk2,int lx,int h);
+ 
+@@ -356,7 +356,7 @@
+ 	ret			; we now return you to your regular programming
+ 
+ 
+-global	sad_11_mmxe:function
++global	sad_11_mmxe
+ 
+ ; int sad_11(char *blk1,char *blk2,int lx,int h);
+ 
+@@ -452,7 +452,7 @@
+ 	emms			; clear mmx registers
+ 	ret			; we now return you to your regular programming
+ 
+-global	sad_sub22_mmxe:function
++global	sad_sub22_mmxe
+ 
+ ; int sad_sub22_mmxe(unsigned char *blk1,unsigned char *blk2,int flx,int fh);
+ 
+@@ -520,7 +520,7 @@
+ 
+ 
+ 
+-global	sad_sub44_mmxe:function
++global	sad_sub44_mmxe
+ 
+ ; int sad_sub44_mmxe(unsigned char *blk1,unsigned char *blk2,int qlx,int qh);
+ 
+@@ -617,7 +617,7 @@
+ 
+ 
+ ;;; CURRENTLY not used but used in testing as reference for tweaks...
+-global	mblockq_sad_REF:function
++global	mblockq_sad_REF
+ 
+ ; void mblockq_sad_REF(char *blk1,char *blk2,int lx,int h,int *weightvec);
+ ; eax = p1
+@@ -757,7 +757,7 @@
+ 
+ 
+ 
+-global	mblock_nearest4_sads_mmxe:function
++global	mblock_nearest4_sads_mmxe
+ 
+ ; void mblock_nearest4_sads_mmxe(char *blk1,char *blk2,int lx,int h,int *weightvec);
+ 
+@@ -905,7 +905,7 @@
+ 	emms
+ 	ret
+ 
+-global	mblock_sub22_nearest4_sads_mmxe:function
++global	mblock_sub22_nearest4_sads_mmxe
+ 
+ ; void mblock_sub22_nearest4_sads_mmxe(unsigned char *blk1,unsigned char *blk2,int flx,int fh, int* resvec);
+ 
+diff -ru mjpegtools-1.6.2.orig/utils/mmxsse/mblock_sumsq_mmx.s mjpegtools-1.6.2/utils/mmxsse/mblock_sumsq_mmx.s
+--- mjpegtools-1.6.2.orig/utils/mmxsse/mblock_sumsq_mmx.s	2003-11-03 13:51:32.000000000 -0500
++++ mjpegtools-1.6.2/utils/mmxsse/mblock_sumsq_mmx.s	2006-03-03 00:19:23.000000000 -0500
+@@ -26,7 +26,7 @@
+ ; h:         height of block (usually 8 or 16)
+ ; mmX version
+ 
+-global	sumsq_mmx:function
++global	sumsq_mmx
+ ; int sumsq_mmx(unsigned char *blk1, unsigned char *blk2,
+ ;                 int lx, int hx, int hy, int h)
+ 
+@@ -439,7 +439,7 @@
+ ; h:         height of block (usually 4, or 8)
+ ; mmX version
+ 
+-global	sumsq_sub22_mmx:function
++global	sumsq_sub22_mmx
+ ; int sumsq_sub22_mmx(unsigned char *blk1, unsigned char *blk2,
+ ;                 int lx, int h)
+ 
+@@ -508,7 +508,7 @@
+ ; h:         height of block (usually 4, or 8)
+ ; mmX version
+ 		
+-global	bsumsq_sub22_mmx:function
++global	bsumsq_sub22_mmx
+ ; int bsumsq_sub22_mmx(unsigned char *blk1f, unsigned char*blk1b,
+ ;				   unsigned char *blk2,
+ ;                 int lx, int h)
+@@ -581,7 +581,7 @@
+ 		jmp       d2exit
+ 
+ 
+-global	variance_mmx:function
++global	variance_mmx
+ 		
+ ;;;  variance of a (size*size) block, multiplied by 256
+ ;;; p:  address of top left pel of block
+diff -ru mjpegtools-1.6.2.orig/yuvdenoise/Makefile.in mjpegtools-1.6.2/yuvdenoise/Makefile.in
+--- mjpegtools-1.6.2.orig/yuvdenoise/Makefile.in	2004-02-03 17:58:33.000000000 -0500
++++ mjpegtools-1.6.2/yuvdenoise/Makefile.in	2006-03-02 23:44:30.000000000 -0500
 @@ -207,7 +207,7 @@
  # (Ronald) do we have to do this?
  AM_CFLAGS = -funroll-all-loops -finline-functions \
@@ -30,3 +321,37 @@
  
  
  bin_PROGRAMS = yuvdenoise
+diff -ru mjpegtools-1.6.2.orig/yuvdenoise/denoise.c mjpegtools-1.6.2/yuvdenoise/denoise.c
+--- mjpegtools-1.6.2.orig/yuvdenoise/denoise.c	2003-12-21 02:57:25.000000000 -0500
++++ mjpegtools-1.6.2/yuvdenoise/denoise.c	2006-03-02 23:44:30.000000000 -0500
+@@ -12,6 +12,8 @@
+ #include "stdio.h"
+ #include "denoise.h"
+ 
++extern uint8_t luma_contrast_vector[256];
++
+ extern struct DNSR_GLOBAL denoiser;
+ extern struct DNSR_VECTOR vector;
+ extern struct DNSR_VECTOR varray44[8];
+diff -ru mjpegtools-1.6.2.orig/yuvdenoise/global.h mjpegtools-1.6.2/yuvdenoise/global.h
+--- mjpegtools-1.6.2.orig/yuvdenoise/global.h	2003-10-02 13:33:31.000000000 -0400
++++ mjpegtools-1.6.2/yuvdenoise/global.h	2006-03-02 23:44:30.000000000 -0500
+@@ -104,6 +104,4 @@
+   uint32_t SAD;
+ };
+ 
+-uint8_t luma_contrast_vector[256];
+-
+ #endif
+diff -ru mjpegtools-1.6.2.orig/yuvdenoise/main.c mjpegtools-1.6.2/yuvdenoise/main.c
+--- mjpegtools-1.6.2.orig/yuvdenoise/main.c	2004-01-01 14:18:48.000000000 -0500
++++ mjpegtools-1.6.2/yuvdenoise/main.c	2006-03-02 23:44:30.000000000 -0500
+@@ -27,6 +27,8 @@
+ #include "denoise.h"
+ #include "deinterlace.h"
+ 
++uint8_t luma_contrast_vector[256];
++
+ void allc_buffers(void);
+ void free_buffers(void);
+ void display_greeting(void);
