rpms/openjpeg/F-8 openjpeg-20070717svn-codec-libtiff.patch, NONE, 1.1 openjpeg-20070717svn-mqc-optimize.patch, NONE, 1.1 openjpeg-20070719svn-mqc-more-optimize.patch, NONE, 1.1 openjpeg-20070719svn-t1-t1_dec_sigpass_step-optimize.patch, NONE, 1.1 openjpeg-20070719svn-t1-x86_64-flags-branchless.patch, NONE, 1.1 openjpeg-20070821svn-t1-flags-stride.patch, NONE, 1.1 openjpeg-20070821svn-t1-remove-macro.patch, NONE, 1.1 openjpeg-20070821svn-t1-updateflags-x86_64.patch, NONE, 1.1 openjpeg-svn468-mj2-noscroll.patch, NONE, 1.1 openjpeg-svn470-t1-flags-mmx.patch, NONE, 1.1 openjpeg-svn480-cmake.patch, NONE, 1.1 openjpeg-svn480-use-stdbool.patch, NONE, 1.1 openjpeg.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Callum Lerwick (seg) fedora-extras-commits at redhat.com
Sat Nov 17 06:11:48 UTC 2007


Author: seg

Update of /cvs/extras/rpms/openjpeg/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24958

Modified Files:
	.cvsignore sources 
Added Files:
	openjpeg-20070717svn-codec-libtiff.patch 
	openjpeg-20070717svn-mqc-optimize.patch 
	openjpeg-20070719svn-mqc-more-optimize.patch 
	openjpeg-20070719svn-t1-t1_dec_sigpass_step-optimize.patch 
	openjpeg-20070719svn-t1-x86_64-flags-branchless.patch 
	openjpeg-20070821svn-t1-flags-stride.patch 
	openjpeg-20070821svn-t1-remove-macro.patch 
	openjpeg-20070821svn-t1-updateflags-x86_64.patch 
	openjpeg-svn468-mj2-noscroll.patch 
	openjpeg-svn470-t1-flags-mmx.patch openjpeg-svn480-cmake.patch 
	openjpeg-svn480-use-stdbool.patch openjpeg.spec 
Log Message:
Initial import.


openjpeg-20070717svn-codec-libtiff.patch:

--- NEW FILE openjpeg-20070717svn-codec-libtiff.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/codec/convert.c OpenJPEG.patched/codec/convert.c
--- OpenJPEG.orig/codec/convert.c	2007-07-17 11:19:41.000000000 -0500
+++ OpenJPEG.patched/codec/convert.c	2007-07-17 19:40:02.000000000 -0500
@@ -33,7 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "openjpeg.h"
-#include "../libs/libtiff/tiffio.h"
+#include "tiffio.h"
 #include "convert.h"
 
 /*

openjpeg-20070717svn-mqc-optimize.patch:

--- NEW FILE openjpeg-20070717svn-mqc-optimize.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/mqc.c OpenJPEG.patched/libopenjpeg/mqc.c
--- OpenJPEG.orig/libopenjpeg/mqc.c	2007-07-17 20:07:22.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/mqc.c	2007-07-17 20:07:44.000000000 -0500
@@ -507,20 +507,20 @@
 
 int mqc_decode(opj_mqc_t *mqc) {
 	int d;
-	mqc->a -= (*mqc->curctx)->qeval;
-	if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
+	unsigned int qeval = (*mqc->curctx)->qeval;
+	mqc->a -= qeval;
+	qeval <<= 16;
+	if (mqc->c < qeval) {
 		d = mqc_lpsexchange(mqc);
-		mqc_renormd(mqc);
 	} else {
-		mqc->c -= (*mqc->curctx)->qeval << 16;
+		mqc->c -= qeval;
 		if ((mqc->a & 0x8000) == 0) {
 			d = mqc_mpsexchange(mqc);
-			mqc_renormd(mqc);
 		} else {
-			d = (*mqc->curctx)->mps;
+			return (*mqc->curctx)->mps;
 		}
 	}
-
+	mqc_renormd(mqc);
 	return d;
 }
 

openjpeg-20070719svn-mqc-more-optimize.patch:

--- NEW FILE openjpeg-20070719svn-mqc-more-optimize.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/mqc.c OpenJPEG.patched/libopenjpeg/mqc.c
--- OpenJPEG.orig/libopenjpeg/mqc.c	2007-08-06 16:16:00.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/mqc.c	2007-08-06 19:07:28.000000000 -0500
@@ -68,13 +68,13 @@
 @param mqc MQC handle
 @return 
 */
-static int mqc_mpsexchange(opj_mqc_t *mqc);
+//static int mqc_mpsexchange(opj_mqc_t *mqc);
 /**
 FIXME: documentation ???
 @param mqc MQC handle
 @return 
 */
-static int mqc_lpsexchange(opj_mqc_t *mqc);
+//static int mqc_lpsexchange(opj_mqc_t *mqc);
 /**
 Input a byte
 @param mqc MQC handle
@@ -271,33 +271,22 @@
 	}
 }
 
+/*
 static int mqc_mpsexchange(opj_mqc_t *mqc) {
-	int d;
-	if (mqc->a < (*mqc->curctx)->qeval) {
-		d = 1 - (*mqc->curctx)->mps;
-		*mqc->curctx = (*mqc->curctx)->nlps;
-	} else {
-		d = (*mqc->curctx)->mps;
-		*mqc->curctx = (*mqc->curctx)->nmps;
-	}
-	
-	return d;
+	int d = (*mqc->curctx)->mps;
+	int tmp = (mqc->a < (*mqc->curctx)->qeval);
+	*mqc->curctx = tmp ? (*mqc->curctx)->nlps : (*mqc->curctx)->nmps;
+	return tmp ^ d;
 }
 
 static int mqc_lpsexchange(opj_mqc_t *mqc) {
-	int d;
-	if (mqc->a < (*mqc->curctx)->qeval) {
-		mqc->a = (*mqc->curctx)->qeval;
-		d = (*mqc->curctx)->mps;
-		*mqc->curctx = (*mqc->curctx)->nmps;
-	} else {
-		mqc->a = (*mqc->curctx)->qeval;
-		d = 1 - (*mqc->curctx)->mps;
-		*mqc->curctx = (*mqc->curctx)->nlps;
-	}
-	
-	return d;
+	int d = (*mqc->curctx)->mps;
+	int tmp = !(mqc->a < (*mqc->curctx)->qeval);
+	mqc->a = (*mqc->curctx)->qeval;
+	*mqc->curctx = tmp ? (*mqc->curctx)->nlps : (*mqc->curctx)->nmps;
+	return tmp ^ d;
 }
+*/
 
 static void mqc_bytein(opj_mqc_t *mqc) {
 	if (mqc->bp != mqc->end) {
@@ -506,22 +495,27 @@
 }
 
 int mqc_decode(opj_mqc_t *mqc) {
-	int d;
 	unsigned int qeval = (*mqc->curctx)->qeval;
 	mqc->a -= qeval;
+	bool tmp = (mqc->a < qeval);
 	qeval <<= 16;
-	if (mqc->c < qeval) {
-		d = mqc_lpsexchange(mqc);
-	} else {
+	if (mqc->c >= qeval) {
 		mqc->c -= qeval;
-		if ((mqc->a & 0x8000) == 0) {
-			d = mqc_mpsexchange(mqc);
-		} else {
+		if (mqc->a & 0x8000) {
 			return (*mqc->curctx)->mps;
 		}
+	}else{
+		tmp = !tmp;
+		mqc->a = (*mqc->curctx)->qeval;
 	}
+
+	opj_mqc_state_t* nmps = (*mqc->curctx)->nmps;
+	opj_mqc_state_t* nlps = (*mqc->curctx)->nlps;
+	int mps = (*mqc->curctx)->mps ^ tmp;
+	*mqc->curctx = tmp ? nlps : nmps;
+
 	mqc_renormd(mqc);
-	return d;
+	return mps;
 }
 
 void mqc_resetstates(opj_mqc_t *mqc) {

openjpeg-20070719svn-t1-t1_dec_sigpass_step-optimize.patch:

--- NEW FILE openjpeg-20070719svn-t1-t1_dec_sigpass_step-optimize.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
--- OpenJPEG.orig/libopenjpeg/t1.c	2007-08-09 19:26:57.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.c	2007-08-09 19:44:25.000000000 -0500
@@ -40,7 +40,7 @@
 /*@{*/
 
 static INLINE char t1_getctxno_zc(int f, int orient);
-static char t1_getctxno_sc(int f);
+static INLINE char t1_getctxno_sc(int f);
 static INLINE int t1_getctxno_mag(int f);
 static char t1_getspb(int f);
 static short t1_getnmsedec_sig(int x, int bitpos);
@@ -334,6 +334,7 @@
 	
 	flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
 	if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
+		*flagsp |= T1_VISIT;
 		if (type == T1_TYPE_RAW) {
 			if (raw_decode(raw)) {
 				v = raw_decode(raw);	/* ESSAI */
@@ -349,7 +350,6 @@
 				t1_updateflags(flagsp, v, t1->flags_stride);
 			}
 		}
-		*flagsp |= T1_VISIT;
 	}
 }				/* VSC and  BYPASS by Antonin */
 

openjpeg-20070719svn-t1-x86_64-flags-branchless.patch:

--- NEW FILE openjpeg-20070719svn-t1-x86_64-flags-branchless.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
--- OpenJPEG.orig/libopenjpeg/t1.c	2007-08-06 14:07:59.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.c	2007-08-06 15:54:31.000000000 -0500
@@ -669,6 +669,17 @@
 	for (k = 0; k < t1->h; k += 4) {
 		for (i = 0; i < t1->w; ++i) {
 			if (k + 3 < t1->h) {
+#ifdef __amd64__
+				int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*t1->flags_stride]);
+				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
+					tmp &= ~((int64)(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S)<<48);
+				}
+				tmp &= (int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)
+				    | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<16)
+				    | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<32)
+				    | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<48);
+				agg = !tmp;
+#else
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
 					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
 					    ||  t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
@@ -681,6 +692,7 @@
 					     || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
 					     || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				}
+#endif
 			} else {
 				agg = 0;
 			}

openjpeg-20070821svn-t1-flags-stride.patch:

--- NEW FILE openjpeg-20070821svn-t1-flags-stride.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
--- OpenJPEG.orig/libopenjpeg/t1.c	2007-08-23 05:48:09.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.c	2007-08-23 05:50:29.000000000 -0500
@@ -312,7 +312,7 @@
 			} else {
 				mqc_encode(mqc, v ^ t1_getspb(flag));
 			}
-			t1_updateflags(flagsp, v, t1->flags_stride);
+			t1_updateflags(flagsp, v, (t1->h+2));
 		}
 		*flagsp |= T1_VISIT;
 	}
@@ -339,7 +339,7 @@
 			if (raw_decode(raw)) {
 				v = raw_decode(raw);	/* ESSAI */
 				*datap = v ? -oneplushalf : oneplushalf;
-				t1_updateflags(flagsp, v, t1->flags_stride);
+				t1_updateflags(flagsp, v, (t1->h+2));
 			}
 		} else {
 			mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
@@ -347,7 +347,7 @@
 				mqc_setcurctx(mqc, t1_getctxno_sc(flag));
 				v = mqc_decode(mqc) ^ t1_getspb(flag);
 				*datap = v ? -oneplushalf : oneplushalf;
-				t1_updateflags(flagsp, v, t1->flags_stride);
+				t1_updateflags(flagsp, v, (t1->h+2));
 			}
 		}
 	}
@@ -370,7 +370,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_enc_sigpass_step(
 						t1,
-						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
+						&t1->flags[(j+1) + (i+1)*(t1->h+2)],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						bpno,
@@ -400,7 +400,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_dec_sigpass_step(
 						t1,
-						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
+						&t1->flags[(j+1) + (i+1)*(t1->h+2)],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						oneplushalf,
@@ -483,7 +483,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_enc_refpass_step(
 						t1,
-						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
+						&t1->flags[(j+1) + (i+1)*(t1->h+2)],
 						&t1->data[(j * t1->w) + i],
 						bpno,
 						one,
@@ -512,7 +512,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_dec_refpass_step(
 						t1,
-						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
+						&t1->flags[(j+1) + (i+1)*(t1->h+2)],
 						&t1->data[(j * t1->w) + i],
 						poshalf,
 						neghalf,
@@ -552,7 +552,7 @@
 			mqc_setcurctx(mqc, t1_getctxno_sc(flag));
 			v = *datap < 0 ? 1 : 0;
 			mqc_encode(mqc, v ^ t1_getspb(flag));
-			t1_updateflags(flagsp, v, t1->flags_stride);
+			t1_updateflags(flagsp, v, (t1->h+2));
 		}
 	}
 	*flagsp &= ~T1_VISIT;
@@ -582,7 +582,7 @@
 			mqc_setcurctx(mqc, t1_getctxno_sc(flag));
 			v = mqc_decode(mqc) ^ t1_getspb(flag);
 			*datap = v ? -oneplushalf : oneplushalf;
-			t1_updateflags(flagsp, v, t1->flags_stride);
+			t1_updateflags(flagsp, v, (t1->h+2));
 		}
 	}
 	*flagsp &= ~T1_VISIT;
@@ -605,16 +605,16 @@
 		for (i = 0; i < t1->w; ++i) {
 			if (k + 3 < t1->h) {
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
-					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    ||  t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    ||  t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    || (t1->flags[(k+4) + (i+1)*t1->flags_stride] 
+					agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    || (t1->flags[(k+4) + (i+1)*(t1->h+2)] 
 					   & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				} else {
-					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+4) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				}
 			} else {
 				agg = 0;
@@ -639,7 +639,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_enc_clnpass_step(
 						t1,
-						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
+						&t1->flags[(j+1) + (i+1)*(t1->h+2)],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						bpno,
@@ -670,7 +670,7 @@
 		for (i = 0; i < t1->w; ++i) {
 			if (k + 3 < t1->h) {
 #ifdef __amd64__
-				int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*t1->flags_stride]);
+				int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*(t1->h+2)]);
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
 					tmp &= ~((int64)(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S)<<48);
 				}
@@ -681,16 +681,16 @@
 				agg = !tmp;
 #else
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
-					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    ||  t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    ||  t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    || (t1->flags[(k+4) + (i+1)*t1->flags_stride] 
+					agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    || (t1->flags[(k+4) + (i+1)*(t1->h+2)] 
 					   & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				} else {
-					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+4) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				}
 #endif
 			} else {
@@ -711,7 +711,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_dec_clnpass_step(
 						t1,
-						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
+						&t1->flags[(j+1) + (i+1)*(t1->h+2)],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						oneplushalf,
@@ -779,8 +779,7 @@
 	}
 	memset(t1->data,0,datasize * sizeof(int));
 
-	t1->flags_stride=h+2;
-	flagssize=t1->flags_stride * (w+2);
+	flagssize=(h+2) * (w+2);
 
 	if(flagssize > t1->flagssize){
 		opj_aligned_free(t1->flags);
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.h OpenJPEG.patched/libopenjpeg/t1.h
--- OpenJPEG.orig/libopenjpeg/t1.h	2007-08-23 05:48:09.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.h	2007-08-23 05:48:37.000000000 -0500
@@ -105,7 +105,6 @@
 	int h;
 	int datasize;
 	int flagssize;
-	int flags_stride;
 } opj_t1_t;
 
 /** @name Exported functions */

openjpeg-20070821svn-t1-remove-macro.patch:

--- NEW FILE openjpeg-20070821svn-t1-remove-macro.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
--- OpenJPEG.orig/libopenjpeg/t1.c	2007-08-23 05:43:10.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.c	2007-08-23 05:46:31.000000000 -0500
@@ -259,27 +259,24 @@
 }
 
 static void t1_updateflags(flag_t *flagsp, int s, int stride) {
-	flag_t *np = flagsp - stride;
-	flag_t *sp = flagsp + stride;
-
 	static const flag_t mod[] = {
-		T1_SIG_S, T1_SIG_S|T1_SGN_S,
 		T1_SIG_E, T1_SIG_E|T1_SGN_E,
-		T1_SIG_W, T1_SIG_W|T1_SGN_W,
-		T1_SIG_N, T1_SIG_N|T1_SGN_N
+		T1_SIG_S, T1_SIG_S|T1_SGN_S,
+		T1_SIG_N, T1_SIG_N|T1_SGN_N,
+		T1_SIG_W, T1_SIG_W|T1_SGN_W
 	};
 
-	np[-1] |= T1_SIG_SE;
-	np[0]  |= mod[s];
-	np[1]  |= T1_SIG_SW;
+	flagsp[-1 - stride] |= T1_SIG_SE;
+	flagsp[ 0 - stride] |= mod[s];
+	flagsp[ 1 - stride] |= T1_SIG_NE;
 
 	flagsp[-1] |= mod[s+2];
-	flagsp[0]  |= T1_SIG;
-	flagsp[1]  |= mod[s+4];
+	flagsp[ 0] |= T1_SIG;
+	flagsp[ 1] |= mod[s+4];
 
-	sp[-1] |= T1_SIG_NE;
-	sp[0]  |= mod[s+6];
-	sp[1]  |= T1_SIG_NW;
+	flagsp[-1 + stride] |= T1_SIG_SW;
+	flagsp[ 0 + stride] |= mod[s+6];
+	flagsp[ 1 + stride] |= T1_SIG_NW;
 }
 
 static void t1_enc_sigpass_step(
@@ -373,7 +370,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_enc_sigpass_step(
 						t1,
-						&t1->flags[((j+1) * t1->flags_stride) + i + 1],
+						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						bpno,
@@ -403,7 +400,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_dec_sigpass_step(
 						t1,
-						&t1->flags[((j+1) * t1->flags_stride) + i + 1],
+						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						oneplushalf,
@@ -486,7 +483,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_enc_refpass_step(
 						t1,
-						&t1->flags[((j+1) * t1->flags_stride) + i + 1],
+						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
 						&t1->data[(j * t1->w) + i],
 						bpno,
 						one,
@@ -515,7 +512,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_dec_refpass_step(
 						t1,
-						&t1->flags[((j+1) * t1->flags_stride) + i + 1],
+						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
 						&t1->data[(j * t1->w) + i],
 						poshalf,
 						neghalf,
@@ -608,16 +605,16 @@
 		for (i = 0; i < t1->w; ++i) {
 			if (k + 3 < t1->h) {
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
-					agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| (MACRO_t1_flags(1 + k + 3,1 + i) 
-						& (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW |	T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    || (t1->flags[(k+4) + (i+1)*t1->flags_stride] 
+					   & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				} else {
-					agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 3,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				}
 			} else {
 				agg = 0;
@@ -642,7 +639,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_enc_clnpass_step(
 						t1,
-						&t1->flags[((j+1) * t1->flags_stride) + i + 1],
+						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						bpno,
@@ -673,16 +670,16 @@
 		for (i = 0; i < t1->w; ++i) {
 			if (k + 3 < t1->h) {
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
-					agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| (MACRO_t1_flags(1 + k + 3,1 + i) 
-						& (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW |	T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    ||  t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					    || (t1->flags[(k+4) + (i+1)*t1->flags_stride] 
+					   & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				} else {
-					agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-						|| MACRO_t1_flags(1 + k + 3,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg = !(t1->flags[(k+1) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+2) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+3) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
+					     || t1->flags[(k+4) + (i+1)*t1->flags_stride] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
 				}
 			} else {
 				agg = 0;
@@ -702,7 +699,7 @@
 				vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
 				t1_dec_clnpass_step(
 						t1,
-						&t1->flags[((j+1) * t1->flags_stride) + i + 1],
+						&t1->flags[(j+1) + (i+1)*t1->flags_stride],
 						&t1->data[(j * t1->w) + i],
 						orient,
 						oneplushalf,
@@ -770,8 +767,8 @@
 	}
 	memset(t1->data,0,datasize * sizeof(int));
 
-	t1->flags_stride=w+2;
-	flagssize=t1->flags_stride * (h+2);
+	t1->flags_stride=h+2;
+	flagssize=t1->flags_stride * (w+2);
 
 	if(flagssize > t1->flagssize){
 		opj_aligned_free(t1->flags);
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.h OpenJPEG.patched/libopenjpeg/t1.h
--- OpenJPEG.orig/libopenjpeg/t1.h	2007-05-22 08:14:13.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.h	2007-08-23 05:44:00.000000000 -0500
@@ -108,8 +108,6 @@
 	int flags_stride;
 } opj_t1_t;
 
-#define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
-
 /** @name Exported functions */
 /*@{*/
 /* ----------------------------------------------------------------------- */

openjpeg-20070821svn-t1-updateflags-x86_64.patch:

--- NEW FILE openjpeg-20070821svn-t1-updateflags-x86_64.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
--- OpenJPEG.orig/libopenjpeg/t1.c	2007-08-23 05:53:17.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/t1.c	2007-08-23 05:56:33.000000000 -0500
@@ -45,7 +45,11 @@
 static char t1_getspb(int f);
 static short t1_getnmsedec_sig(int x, int bitpos);
 static short t1_getnmsedec_ref(int x, int bitpos);
+#ifdef __amd64__
+static INLINE void t1_updateflags(flag_t *flagsp, int s, int stride);
+#else
 static void t1_updateflags(flag_t *flagsp, int s, int stride);
+#endif
 /**
 Encode significant pass
 */
@@ -258,6 +262,38 @@
     return lut_nmsedec_ref0[x & ((1 << T1_NMSEDEC_BITS) - 1)];
 }
 
+#ifdef __amd64__
+
+/* On 64 bit platforms we can set three flags at a time. (SWAR) */
+/* FIXME: Assumes little endian? */
+
+#define VEC(x,y,z) (int64)(x)|((int64)(y)<<16)|((int64)(z)<<32)
+
+static void t1_updateflags(flag_t *flagsp, int s, int stride) {
+	static const int64 mod[] = {
+		VEC(T1_SIG_SE,         T1_SIG_E,          T1_SIG_NE),
+		VEC(T1_SIG_SE,         T1_SIG_E|T1_SGN_E, T1_SIG_NE),
+		VEC(T1_SIG_S,          T1_SIG,            T1_SIG_N),
+		VEC(T1_SIG_S|T1_SGN_S, T1_SIG,            T1_SIG_N|T1_SGN_N),
+		VEC(T1_SIG_SW,         T1_SIG_W,          T1_SIG_NW),
+		VEC(T1_SIG_SW,         T1_SIG_W|T1_SGN_W, T1_SIG_NW)
+	};
+
+	int64 tmp1 = *(int64*)((void*)&flagsp[-1 - stride]);
+	int64 tmp2 = *(int64*)((void*)&flagsp[-1         ]);
+	int64 tmp3 = *(int64*)((void*)&flagsp[-1 + stride]);
+
+	tmp1 |= mod[s];
+	tmp2 |= mod[s+2];
+	tmp3 |= mod[s+4];
+
+	*(int64*)((void*)&flagsp[-1 - stride]) = tmp1;
+	*(int64*)((void*)&flagsp[-1         ]) = tmp2;
+	*(int64*)((void*)&flagsp[-1 + stride]) = tmp3;
+}
+
+#else
+
 static void t1_updateflags(flag_t *flagsp, int s, int stride) {
 	static const flag_t mod[] = {
 		T1_SIG_E, T1_SIG_E|T1_SGN_E,
@@ -279,6 +315,8 @@
 	flagsp[ 1 + stride] |= T1_SIG_NW;
 }
 
+#endif
+
 static void t1_enc_sigpass_step(
 		opj_t1_t *t1,
 		flag_t *flagsp,
@@ -670,6 +708,8 @@
 		for (i = 0; i < t1->w; ++i) {
 			if (k + 3 < t1->h) {
 #ifdef __amd64__
+				/* 64 bit SWAR */
+				/* FIXME: Assumes little endian? */
 				int64 tmp = *((int64*)&t1->flags[(k+1) + (i+1)*(t1->h+2)]);
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
 					tmp &= ~((int64)(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S)<<48);
@@ -780,6 +820,11 @@
 	memset(t1->data,0,datasize * sizeof(int));
 
 	flagssize=(h+2) * (w+2);
+#ifdef __amd64__
+	/* 64 bit SIMD/SWAR in t1_updateflags requires one short of headroom
+	   because three shorts = 48 bits. */
+	++flagssize;
+#endif
 
 	if(flagssize > t1->flagssize){
 		opj_aligned_free(t1->flags);

openjpeg-svn468-mj2-noscroll.patch:

--- NEW FILE openjpeg-svn468-mj2-noscroll.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.patched/mj2/frames_to_mj2.c OpenJPEG.foo/mj2/frames_to_mj2.c
--- OpenJPEG.patched/mj2/frames_to_mj2.c	2007-10-18 07:26:11.000000000 -0500
+++ OpenJPEG.foo/mj2/frames_to_mj2.c	2007-11-03 22:48:45.000000000 -0500
@@ -758,7 +758,7 @@
 				fwrite(buf, 1, len+8, mj2file);				
 				offset += len+8;				
 				elapsed_time = opj_clock()-init_time;
-				fprintf(stderr, "Frame number %d/%d encoded in %.2f mseconds\n", sampleno + 1, numframes, elapsed_time*1000);
+				fprintf(stderr, "Frame number %d/%d encoded in %.2f mseconds \r", sampleno + 1, numframes, elapsed_time*1000);
 				total_time += elapsed_time;
 
       }
@@ -787,7 +787,7 @@
   fwrite(buf,cio_tell(cio),1,mj2file);
   free(buf);
 
-	fprintf(stdout,"Total encoding time: %.2f s for %d frames (%.1f fps)\n", total_time, numframes, (float)numframes/total_time);
+	fprintf(stdout,"\nTotal encoding time: %.2f s for %d frames (%.1f fps)\n", total_time, numframes, (float)numframes/total_time);
   
   // Ending program 
   
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.patched/mj2/mj2_to_frames.c OpenJPEG.foo/mj2/mj2_to_frames.c
--- OpenJPEG.patched/mj2/mj2_to_frames.c	2007-10-18 07:26:11.000000000 -0500
+++ OpenJPEG.foo/mj2/mj2_to_frames.c	2007-11-03 22:48:45.000000000 -0500
@@ -204,7 +204,7 @@
 		/* free image data structure */
 		opj_image_destroy(img);
 		elapsed_time = opj_clock()-init_time;
-		fprintf(stderr, "Frame number %d/%d decoded in %.2f mseconds\n", snum + 1, numframes, elapsed_time*1000);
+		fprintf(stderr, "Frame number %d/%d decoded in %.2f mseconds \r", snum + 1, numframes, elapsed_time*1000);
 		total_time += elapsed_time;
 
   }
@@ -218,7 +218,7 @@
 	}
 	free(dinfo);
 	
-	fprintf(stdout, "%d frame(s) correctly decompressed\n", snum);
+	fprintf(stdout, "\n%d frame(s) correctly decompressed\n", snum);
 	fprintf(stdout,"Total decoding time: %.2f seconds (%.1f fps)\n", total_time, (float)numframes/total_time);
 		
   return 0;

openjpeg-svn470-t1-flags-mmx.patch:

--- NEW FILE openjpeg-svn470-t1-flags-mmx.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/t1.c OpenJPEG.patched/libopenjpeg/t1.c
--- OpenJPEG.orig/libopenjpeg/t1.c	2007-11-13 13:52:05.000000000 -0600
+++ OpenJPEG.patched/libopenjpeg/t1.c	2007-11-14 01:09:40.000000000 -0600
@@ -33,6 +33,17 @@
 #include "opj_includes.h"
 #include "t1_luts.h"
 
+/* Don't use MMX on amd64 */
+/* Note that merely including mmintrin.h, even if we don't use it, changes the code gcc */
+/* outputs on amd64, and it is measurably slower. A bug in gcc? */
+#ifdef __amd64__
+#undef __MMX__
+#endif
+
+#ifdef __MMX__
+#include <mmintrin.h>
+#endif
+
 /** @defgroup T1 T1 - Implementation of the tier-1 coding */
 /*@{*/
 
@@ -45,7 +56,7 @@
 static char t1_getspb(int f);
 static short t1_getnmsedec_sig(int x, int bitpos);
 static short t1_getnmsedec_ref(int x, int bitpos);
-#ifdef __amd64__
+#if defined(__amd64__) || defined(__MMX__)
 static INLINE void t1_updateflags(flag_t *flagsp, int s, int stride);
 #else
 static void t1_updateflags(flag_t *flagsp, int s, int stride);
@@ -293,6 +304,32 @@
 }
 
 #else
+#ifdef __MMX__
+
+static void t1_updateflags(flag_t *flagsp, int s, int stride) {
+	static const __v4hi mod[] = {
+		{T1_SIG_SE,         T1_SIG_E,          T1_SIG_NE,         0},
+		{T1_SIG_SE,         T1_SIG_E|T1_SGN_E, T1_SIG_NE,         0},
+		{T1_SIG_S,          T1_SIG,            T1_SIG_N,          0},
+		{T1_SIG_S|T1_SGN_S, T1_SIG,            T1_SIG_N|T1_SGN_N, 0},
+		{T1_SIG_SW,         T1_SIG_W,          T1_SIG_NW,         0},
+		{T1_SIG_SW,         T1_SIG_W|T1_SGN_W, T1_SIG_NW,         0}
+	};
+
+	__m64 tmp1 = *(__m64*)((void*)&flagsp[-1 - stride]);
+	__m64 tmp2 = *(__m64*)((void*)&flagsp[-1         ]);
+	__m64 tmp3 = *(__m64*)((void*)&flagsp[-1 + stride]);
+
+	tmp1 = _mm_or_si64(tmp1, mod[s]);
+	tmp2 = _mm_or_si64(tmp2, mod[s+2]);
+	tmp3 = _mm_or_si64(tmp3, mod[s+4]);
+
+	*(__m64*)((void*)&flagsp[-1 - stride]) = tmp1;
+	*(__m64*)((void*)&flagsp[-1         ]) = tmp2;
+	*(__m64*)((void*)&flagsp[-1 + stride]) = tmp3;
+}
+
+#else
 
 static void t1_updateflags(flag_t *flagsp, int s, int stride) {
 	static const flag_t mod[] = {
@@ -316,6 +353,7 @@
 }
 
 #endif
+#endif
 
 static void t1_enc_sigpass_step(
 		opj_t1_t *t1,
@@ -720,18 +758,14 @@
 				    | ((int64)(T1_SIG | T1_VISIT | T1_SIG_OTH)<<48);
 				agg = !tmp;
 #else
+				int* flagsp = (int*)&t1->flags[(k+1) + (i+1)*(t1->h+2)];
+				agg = flagsp[1];
 				if (cblksty & J2K_CCP_CBLKSTY_VSC) {
-					agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    ||  t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    ||  t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					    || (t1->flags[(k+4) + (i+1)*(t1->h+2)] 
-					   & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
-				} else {
-					agg = !(t1->flags[(k+1) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+2) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+3) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
-					     || t1->flags[(k+4) + (i+1)*(t1->h+2)] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
+					agg &= ~((T1_SIG_S|T1_SIG_SE|T1_SIG_SW|T1_SGN_S)<<16);
 				}
+				agg |= flagsp[0];
+				agg &= (T1_SIG|T1_VISIT|T1_SIG_OTH)|(T1_SIG|T1_VISIT|T1_SIG_OTH)<<16;
+				agg = !agg;
 #endif
 			} else {
 				agg = 0;
@@ -820,7 +854,7 @@
 	memset(t1->data,0,datasize * sizeof(int));
 
 	flagssize=(h+2) * (w+2);
-#ifdef __amd64__
+#if defined(__amd64__) || defined(__MMX__)
 	/* 64 bit SIMD/SWAR in t1_updateflags requires one short of headroom
 	   because three shorts = 48 bits. */
 	++flagssize;
@@ -886,6 +920,9 @@
 		int correction = 3;
 		type = ((bpno < (cblk->numbps - 4)) && (passtype < 2) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
 		
+#if !defined(__amd64__) && defined(__MMX__)
+	_mm_empty();
+#endif
 		switch (passtype) {
 			case 0:
 				t1_enc_sigpass(t1, bpno, orient, &nmsedec, type, cblksty);
@@ -900,6 +937,9 @@
 					mqc_segmark_enc(mqc);
 				break;
 		}
+#if !defined(__amd64__) && defined(__MMX__)
+	_mm_empty();
+#endif
 		
 		/* fixed_quality */
 		cumwmsedec += t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps);
@@ -1004,6 +1044,9 @@
 	mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
 	mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
 	
+#if !defined(__amd64__) && defined(__MMX__)
+	_mm_empty();
+#endif
 	for (segno = 0; segno < cblk->numsegs; ++segno) {
 		opj_tcd_seg_t *seg = &cblk->segs[segno];
 		
@@ -1044,6 +1087,9 @@
 			}
 		}
 	}
+#if !defined(__amd64__) && defined(__MMX__)
+	_mm_empty();
+#endif
 }
 
 /* ----------------------------------------------------------------------- */

openjpeg-svn480-cmake.patch:

--- NEW FILE openjpeg-svn480-cmake.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/CMakeLists.txt OpenJPEG.patched/CMakeLists.txt
--- OpenJPEG.orig/CMakeLists.txt	2007-09-25 09:54:49.000000000 -0500
+++ OpenJPEG.patched/CMakeLists.txt	2007-09-26 00:34:22.000000000 -0500
@@ -24,6 +24,7 @@
 
 #-----------------------------------------------------------------------------
 # OPENJPEG version number, useful for packaging and doxygen doc:
+SET(OPENJPEG_SOVERSION 2)
 SET(OPENJPEG_VERSION_MAJOR 1)
 SET(OPENJPEG_VERSION_MINOR 2)
 SET(OPENJPEG_VERSION_BUILD 0)
@@ -33,8 +34,8 @@
 # This setting of SOVERSION assumes that any API change
 # will increment either the minor or major version number of openjpeg
 SET(OPENJPEG_LIBRARY_PROPERTIES
-  VERSION   "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
-  SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}"
+  VERSION   "${OPENJPEG_SOVERSION}.${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
+  SOVERSION ${OPENJPEG_SOVERSION}
 )
 
 
@@ -116,6 +117,10 @@
   $ENV{JPEG2000_CONFORMANCE_DATA_ROOT}
 )
 
+IF(NOT CMAKE_INSTALL_LIBDIR)
+SET(CMAKE_INSTALL_LIBDIR lib)
+ENDIF(NOT CMAKE_INSTALL_LIBDIR)
+
 #-----------------------------------------------------------------------------
 # Compiler specific flags:
 IF(CMAKE_COMPILER_IS_GNUCC)
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/CMakeLists.txt OpenJPEG.patched/libopenjpeg/CMakeLists.txt
--- OpenJPEG.orig/libopenjpeg/CMakeLists.txt	2007-09-25 09:54:49.000000000 -0500
+++ OpenJPEG.patched/libopenjpeg/CMakeLists.txt	2007-09-26 00:31:12.000000000 -0500
@@ -37,7 +37,7 @@
 
 # Install library
 INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}
-	DESTINATION lib)
+	DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
 # Install includes files
 INSTALL(FILES openjpeg.h

openjpeg-svn480-use-stdbool.patch:

--- NEW FILE openjpeg-svn480-use-stdbool.patch ---
diff -urN -x '*.orig' -x '*.rej' -x '*~' -x '.*' OpenJPEG.orig/libopenjpeg/openjpeg.h OpenJPEG.patched/libopenjpeg/openjpeg.h
--- OpenJPEG.orig/libopenjpeg/openjpeg.h	2007-11-14 05:34:48.000000000 -0600
+++ OpenJPEG.patched/libopenjpeg/openjpeg.h	2007-11-16 20:41:53.000000000 -0600
@@ -61,7 +61,7 @@
 #endif /* !OPJ_STATIC || !WIN32 */
 
 #ifndef __cplusplus
-#if defined(HAVE_STDBOOL_H)
+#if 1
 /*
 The C language implementation does correctly provide the standard header
 file "stdbool.h".


--- NEW FILE openjpeg.spec ---
%define rev 480
%define snapshot 20071114svn%{rev}

Name:    openjpeg
Version: 1.2
Release: 3.%{snapshot}%{?dist}
Summary: OpenJPEG command line tools

Group:     Applications/Multimedia
License:   BSD
URL:       http://www.openjpeg.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: cmake
BuildRequires: libtiff-devel

# This is an SVN snapshot.
# svn export -r 480 http://www.openjpeg.org/svn/trunk
# tar -cjvf openjpeg-20071114svn480.tar.bz2 trunk
Source0: openjpeg-%{snapshot}.tar.bz2

Patch1: openjpeg-20070717svn-codec-libtiff.patch
Patch4: openjpeg-svn480-cmake.patch
Patch5: openjpeg-svn480-use-stdbool.patch
Patch44: openjpeg-svn468-mj2-noscroll.patch
Patch21: openjpeg-20070717svn-mqc-optimize.patch
Patch22: openjpeg-20070821svn-t1-remove-macro.patch
Patch23: openjpeg-20070719svn-t1-x86_64-flags-branchless.patch
Patch24: openjpeg-20070719svn-t1-t1_dec_sigpass_step-optimize.patch
Patch25: openjpeg-20070821svn-t1-flags-stride.patch
Patch26: openjpeg-20070821svn-t1-updateflags-x86_64.patch
Patch27: openjpeg-svn470-t1-flags-mmx.patch
Patch28: openjpeg-20070719svn-mqc-more-optimize.patch

%description
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been
developed in order to promote the use of JPEG 2000, the new still-image
compression standard from the Joint Photographic Experts Group (JPEG).

%package libs
Summary: JPEG 2000 codec library
Group:   System Environment/Libraries

%description libs
The openjpeg-libs package contains runtime libraries for applications that use
OpenJPEG.

%package  devel
Summary:  Development files for openjpeg
Group:    Development/Libraries
Requires: openjpeg-libs = %{version}-%{release}

%description devel
The openjpeg-devel package contains libraries and header files for
developing applications that use OpenJPEG.

%prep
%setup -q -n trunk
# Windows stuff, delete it, it slows down patch making
rm -rf jp3d
# Make sure we use system libraries
rm -rf libs
%patch1 -p1
%patch4 -p1
%patch5 -p1
%patch44 -p1
%patch22 -p1
%patch23 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch24 -p1
%patch21 -p1
%patch28 -p1

%build
mkdir build
pushd build
CFLAGS="%{optflags} -O3"
%cmake .. -DBUILD_EXAMPLES:BOOL=ON
make VERBOSE=1 %{?_smp_mflags}
popd

%install
rm -rf %{buildroot}
pushd build
make install DESTDIR="%{buildroot}"
popd

%clean
rm -rf %{buildroot}

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc ChangeLog license.txt
%{_bindir}/extract_j2k_from_mj2
%{_bindir}/frames_to_mj2
%{_bindir}/image_to_j2k
%{_bindir}/j2k_to_image
%{_bindir}/mj2_to_frames
%{_bindir}/wrap_j2k_in_mj2

%files libs
%defattr(-,root,root,-)
%{_libdir}/libopenjpeg.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/openjpeg/
%{_libdir}/libopenjpeg.so

%changelog
* Thu Aug 09 2007 Callum Lerwick <seg at haxxed.com> 1.2-3.20071114svn480
- Build using cmake.
- New snapshot.

* Thu Aug 09 2007 Callum Lerwick <seg at haxxed.com> 1.2-2.20070808svn
- Put binaries in main package, move libraries to -libs subpackage.

* Sun Jun 10 2007 Callum Lerwick <seg at haxxed.com> 1.2-1
- Build the mj2 tools as well.
- New upstream version, ABI has broken, upstream has bumped soname.

* Fri Mar 30 2007 Callum Lerwick <seg at haxxed.com> 1.1.1-3
- Build and package the command line tools.

* Fri Mar 16 2007 Callum Lerwick <seg at haxxed.com> 1.1.1-2
- Link with libm, fixes building on ppc. i386 and x86_64 are magical.

* Fri Feb 23 2007 Callum Lerwick <seg at haxxed.com> 1.1.1-1
- New upstream version, which has the SL patches merged.

* Sat Feb 17 2007 Callum Lerwick <seg at haxxed.com> 1.1-2
- Move header to a subdirectory.
- Fix makefile patch to preserve timestamps during install.

* Sun Feb 04 2007 Callum Lerwick <seg at haxxed.com> 1.1-1
- Initial packaging.


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/openjpeg/F-8/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	17 Nov 2007 04:23:24 -0000	1.1
+++ .cvsignore	17 Nov 2007 06:11:15 -0000	1.2
@@ -0,0 +1 @@
+openjpeg-20071114svn480.tar.bz2


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/openjpeg/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	17 Nov 2007 04:23:24 -0000	1.1
+++ sources	17 Nov 2007 06:11:15 -0000	1.2
@@ -0,0 +1 @@
+87506cc9e3ba2372b3217fdb4f8bf65d  openjpeg-20071114svn480.tar.bz2




More information about the fedora-extras-commits mailing list