aboutsummaryrefslogtreecommitdiff
path: root/graphics/openjpeg/files
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2009-03-21 12:04:30 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2009-03-21 12:04:30 +0000
commit06f759a55e4c34e6dbf61bc7b6e26e84a41da88e (patch)
treedc1a3a85a3b45741b7e400c13e73f6611eea1a27 /graphics/openjpeg/files
parent3391e7cb9700412dbca28ea43e8c92b09e56eb55 (diff)
downloadports-06f759a55e4c34e6dbf61bc7b6e26e84a41da88e.tar.gz
ports-06f759a55e4c34e6dbf61bc7b6e26e84a41da88e.zip
Notes
Diffstat (limited to 'graphics/openjpeg/files')
-rw-r--r--graphics/openjpeg/files/patch-Makefile11
-rw-r--r--graphics/openjpeg/files/patch-jpwl-Makefile35
-rw-r--r--graphics/openjpeg/files/patch-jpwl.c149
-rw-r--r--graphics/openjpeg/files/patch-jpwl.h11
-rw-r--r--graphics/openjpeg/files/patch-jpwl_Makefile27
-rw-r--r--graphics/openjpeg/files/patch-jpwl_lib.c29
-rw-r--r--graphics/openjpeg/files/patch-opj_malloc.h18
7 files changed, 248 insertions, 32 deletions
diff --git a/graphics/openjpeg/files/patch-Makefile b/graphics/openjpeg/files/patch-Makefile
index b7aafb366c36..8b64092bddb6 100644
--- a/graphics/openjpeg/files/patch-Makefile
+++ b/graphics/openjpeg/files/patch-Makefile
@@ -1,5 +1,5 @@
---- Makefile.orig 2007-06-04 09:27:25.000000000 -0400
-+++ Makefile 2007-07-18 06:51:33.000000000 -0400
+--- Makefile.orig 2007-12-21 11:39:41.000000000 +0100
++++ Makefile 2009-03-21 11:51:26.000000000 +0100
@@ -8,17 +8,16 @@
INCLUDE = -Ilibopenjpeg
@@ -16,12 +16,12 @@
# Converts cr/lf to just lf
DOS2UNIX = dos2unix
--COMPILERFLAGS = -O3 -fPIC
-+COMPILERFLAGS := $(CFLAGS) -fPIC
+-COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
++COMPILERFLAGS := $(CFLAGS) -Wall -std=c99 -fPIC
LIBRARIES = -lstdc++
MODULES = $(SRCS:.c=.o)
-@@ -33,7 +32,12 @@
+@@ -33,7 +32,13 @@
default: all
@@ -29,6 +29,7 @@
+all: OpenJPEG subdirs
+
+subdirs:
++ set -e; \
+ for dir in $(SUBDIRS); do \
+ $(MAKE) -C $$dir; \
+ done
diff --git a/graphics/openjpeg/files/patch-jpwl-Makefile b/graphics/openjpeg/files/patch-jpwl-Makefile
new file mode 100644
index 000000000000..e4c1230dcab4
--- /dev/null
+++ b/graphics/openjpeg/files/patch-jpwl-Makefile
@@ -0,0 +1,35 @@
+--- jpwl/Makefile.orig 2007-11-05 14:05:07.000000000 +0100
++++ jpwl/Makefile 2009-03-21 11:54:55.000000000 +0100
+@@ -9,10 +9,7 @@
+ INCLUDE = -Ilibopenjpeg_JPWL
+
+ # General configuration variables:
+-CC = gcc
+-AR = ar
+
+-PREFIX = /usr
+ INSTALL_LIBDIR = $(PREFIX)/lib
+ INSTALL_INCLUDE = $(PREFIX)/include
+
+@@ -23,7 +20,7 @@
+ LIBRARIES = -lstdc++
+
+ MODULES = $(SRCS:.c=.o)
+-CFLAGS = $(COMPILERFLAGS) $(INCLUDE) -DUSE_JPWL
++CFLAGS += $(COMPILERFLAGS) $(INCLUDE) -DUSE_JPWL
+
+ TARGET = openjpeg_JPWL
+ STATICLIB = lib$(TARGET).a
+@@ -60,10 +57,10 @@
+ $(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
+
+ JPWL_j2k_to_image: ../codec/j2k_to_image.c
+- gcc $(CFLAGS) ../codec/convert.c ../codec/j2k_to_image.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -ltiff
++ gcc $(CFLAGS) ../codec/convert.c ../codec/j2k_to_image.c ../codec/index.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -L . -L$(LOCALBASE)/lib -lopenjpeg_JPWL -lm -ltiff
+
+ JPWL_image_to_j2k: ../codec/image_to_j2k.c
+- gcc $(CFLAGS) ../codec/convert.c ../codec/image_to_j2k.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -ltiff
++ gcc $(CFLAGS) ../codec/convert.c ../codec/image_to_j2k.c ../codec/index.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -L . -L$(LOCALBASE)/lib -lopenjpeg_JPWL -lm -ltiff
+
+ install: OpenJPEG
+ install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
diff --git a/graphics/openjpeg/files/patch-jpwl.c b/graphics/openjpeg/files/patch-jpwl.c
new file mode 100644
index 000000000000..d316c3c8de50
--- /dev/null
+++ b/graphics/openjpeg/files/patch-jpwl.c
@@ -0,0 +1,149 @@
+--- jpwl/jpwl.c.orig 2007-11-29 15:38:26.000000000 +0100
++++ jpwl/jpwl.c 2009-03-21 12:36:53.000000000 +0100
+@@ -122,19 +122,19 @@
+ switch (jwmarker[mm].id) {
+
+ case J2K_MS_EPB:
+- free(jwmarker[mm].epbmark);
++ opj_aligned_free(jwmarker[mm].u.epbmark);
+ break;
+
+ case J2K_MS_EPC:
+- free(jwmarker[mm].epcmark);
++ opj_aligned_free(jwmarker[mm].u.epcmark);
+ break;
+
+ case J2K_MS_ESD:
+- free(jwmarker[mm].esdmark);
++ opj_aligned_free(jwmarker[mm].u.esdmark);
+ break;
+
+ case J2K_MS_RED:
+- free(jwmarker[mm].redmark);
++ opj_aligned_free(jwmarker[mm].u.redmark);
+ break;
+
+ default:
+@@ -213,7 +213,7 @@
+ /* Add this marker to the 'insertanda' list */
+ if (epc_mark) {
+ jwmarker[jwmarker_num].id = J2K_MS_EPC; /* its type */
+- jwmarker[jwmarker_num].epcmark = epc_mark; /* the EPC */
++ jwmarker[jwmarker_num].u.epcmark = epc_mark; /* the EPC */
+ jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
+ jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.1; /* not so first */
+ jwmarker[jwmarker_num].len = epc_mark->Lepc; /* its length */
+@@ -258,7 +258,7 @@
+ /* Add this marker to the 'insertanda' list */
+ if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
+ jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */
+- jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */
++ jwmarker[jwmarker_num].u.esdmark = esd_mark; /* the EPB */
+ jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* we choose to place it after SIZ */
+ jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
+ jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */
+@@ -352,7 +352,7 @@
+ /* Add this marker to the 'insertanda' list */
+ if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
+ jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */
+- jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */
++ jwmarker[jwmarker_num].u.esdmark = esd_mark; /* the EPB */
+ /****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */
+ jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
+ jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
+@@ -430,7 +430,7 @@
+ /* Add this marker to the 'insertanda' list */
+ if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
+ jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */
+- jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */
++ jwmarker[jwmarker_num].u.epbmark = epb_mark; /* the EPB */
+ jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
+ jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
+ jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
+@@ -528,7 +528,7 @@
+ /* Add this marker to the 'insertanda' list */
+ if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
+ jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */
+- jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */
++ jwmarker[jwmarker_num].u.epbmark = epb_mark; /* the EPB */
+ /****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */
+ jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
+ jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
+@@ -758,15 +758,15 @@
+ switch (jwmarker[mm].id) {
+
+ case J2K_MS_EPB:
+- jpwl_epb_write(j2k, jwmarker[mm].epbmark, jpwl_buf);
++ jpwl_epb_write(j2k, jwmarker[mm].u.epbmark, jpwl_buf);
+ break;
+
+ case J2K_MS_EPC:
+- jpwl_epc_write(j2k, jwmarker[mm].epcmark, jpwl_buf);
++ jpwl_epc_write(j2k, jwmarker[mm].u.epcmark, jpwl_buf);
+ break;
+
+ case J2K_MS_ESD:
+- jpwl_esd_write(j2k, jwmarker[mm].esdmark, jpwl_buf);
++ jpwl_esd_write(j2k, jwmarker[mm].u.esdmark, jpwl_buf);
+ break;
+
+ case J2K_MS_RED:
+@@ -812,11 +812,11 @@
+ unsigned short int mycrc = 0x0000;
+
+ /* fix and fill the DL field */
+- jwmarker[mm].epcmark->DL = new_size;
+- orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].epcmark->DL >> 24);
+- orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].epcmark->DL >> 16);
+- orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].epcmark->DL >> 8);
+- orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].epcmark->DL >> 0);
++ jwmarker[mm].u.epcmark->DL = new_size;
++ orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 24);
++ orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 16);
++ orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 8);
++ orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].u.epcmark->DL >> 0);
+
+ /* compute the CRC field (excluding itself) */
+ for (pp = 0; pp < 4; pp++)
+@@ -825,9 +825,9 @@
+ jpwl_updateCRC16(&mycrc, orig_buf[epc_pos + pp]);
+
+ /* fix and fill the CRC */
+- jwmarker[mm].epcmark->Pcrc = mycrc;
+- orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].epcmark->Pcrc >> 8);
+- orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].epcmark->Pcrc >> 0);
++ jwmarker[mm].u.epcmark->Pcrc = mycrc;
++ orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].u.epcmark->Pcrc >> 8);
++ orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].u.epcmark->Pcrc >> 0);
+
+ }
+ }
+@@ -842,7 +842,7 @@
+ /* remember that they are now in a new position (dpos) */
+ int esd_pos = (int) jwmarker[mm].dpos;
+
+- jpwl_esd_fill(j2k, jwmarker[mm].esdmark, &orig_buf[esd_pos]);
++ jpwl_esd_fill(j2k, jwmarker[mm].u.esdmark, &orig_buf[esd_pos]);
+
+ }
+
+@@ -867,16 +867,16 @@
+ accum_len = 0;
+ for (nn = mm; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) &&
+ (jwmarker[nn].pos == jwmarker[mm].pos); nn++)
+- accum_len += jwmarker[nn].epbmark->Lepb + 2;
++ accum_len += jwmarker[nn].u.epbmark->Lepb + 2;
+
+ /* fill the current (first) EPB with post-data starting from the computed position */
+- jpwl_epb_fill(j2k, jwmarker[mm].epbmark, &orig_buf[(int) jwmarker[mm].dpos],
++ jpwl_epb_fill(j2k, jwmarker[mm].u.epbmark, &orig_buf[(int) jwmarker[mm].dpos],
+ &orig_buf[(int) jwmarker[mm].dpos + accum_len]);
+
+ /* fill the remaining EPBs in the header with post-data starting from the last position */
+ for (nn = mm + 1; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) &&
+ (jwmarker[nn].pos == jwmarker[mm].pos); nn++)
+- jpwl_epb_fill(j2k, jwmarker[nn].epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL);
++ jpwl_epb_fill(j2k, jwmarker[nn].u.epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL);
+
+ /* skip all the processed EPBs */
+ mm = nn - 1;
diff --git a/graphics/openjpeg/files/patch-jpwl.h b/graphics/openjpeg/files/patch-jpwl.h
new file mode 100644
index 000000000000..2c9b44df5fcd
--- /dev/null
+++ b/graphics/openjpeg/files/patch-jpwl.h
@@ -0,0 +1,11 @@
+--- jpwl/jpwl.h.orig 2007-11-05 14:05:07.000000000 +0100
++++ jpwl/jpwl.h 2009-03-21 12:21:21.000000000 +0100
+@@ -188,7 +188,7 @@
+ jpwl_esd_ms_t *esdmark;
+ /** pointer to RED marker */
+ jpwl_red_ms_t *redmark;
+- };
++ } u;
+ /** position where the marker should go, in the pre-JPWL codestream */
+ unsigned long int pos;
+ /** same as before, only written as a double, so we can sort it better */
diff --git a/graphics/openjpeg/files/patch-jpwl_Makefile b/graphics/openjpeg/files/patch-jpwl_Makefile
deleted file mode 100644
index 979d2c6890af..000000000000
--- a/graphics/openjpeg/files/patch-jpwl_Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
---- jpwl/Makefile.orig 2007-02-23 13:24:49.000000000 -0500
-+++ jpwl/Makefile 2007-07-18 07:13:51.000000000 -0400
-@@ -1,10 +1,7 @@
- # Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k
-
- # General configuration variables:
--CC = gcc
--AR = ar
--
--CFLAGS = -O3 -DUSE_JPWL # -g -p -pg -DUSE_JPWL
-+CFLAGS += -DUSE_JPWL # -g -p -pg -DUSE_JPWL
-
- OPJ_SRCS = ../libopenjpeg/bio.c ../libopenjpeg/cio.c ../libopenjpeg/dwt.c ../libopenjpeg/event.c ../libopenjpeg/image.c ../libopenjpeg/j2k.c ../libopenjpeg/j2k_lib.c ../libopenjpeg/jp2.c ../libopenjpeg/jpt.c ../libopenjpeg/mct.c ../libopenjpeg/mqc.c ../libopenjpeg/openjpeg.c ../libopenjpeg/pi.c ../libopenjpeg/raw.c ../libopenjpeg/t1.c ../libopenjpeg/t2.c ../libopenjpeg/tcd.c ../libopenjpeg/tgt.c
- JPWL_SRCS = crc.c jpwl.c jpwl_lib.c rs.c
-@@ -23,10 +20,10 @@
- $(AR) r $@ $(MODULES)
-
- JPWL_j2k_to_image: ../codec/j2k_to_image.c $(STATICLIB)
-- gcc $(CFLAGS) ../codec/convert.c ../codec/j2k_to_image.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -lstdc++
-+ $(CC) $(CFLAGS) ../codec/convert.c ../codec/j2k_to_image.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -ltiff -L$(LOCALBASE)/lib -L . -lopenjpeg_JPWL -lm -lstdc++
-
- JPWL_image_to_j2k: ../codec/image_to_j2k.c $(STATICLIB)
-- gcc $(CFLAGS) ../codec/convert.c ../codec/image_to_j2k.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -lstdc++
-+ $(CC) $(CFLAGS) ../codec/convert.c ../codec/image_to_j2k.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -ltiff -L$(LOCALBASE)/lib -L . -lopenjpeg_JPWL -lm -lstdc++
-
- clean:
- rm -f JPWL_j2k_to_image JPWL_image_to_j2k *.o *.a
diff --git a/graphics/openjpeg/files/patch-jpwl_lib.c b/graphics/openjpeg/files/patch-jpwl_lib.c
new file mode 100644
index 000000000000..0292d8079770
--- /dev/null
+++ b/graphics/openjpeg/files/patch-jpwl_lib.c
@@ -0,0 +1,29 @@
+--- jpwl/jpwl_lib.c.orig 2007-11-29 15:38:26.000000000 +0100
++++ jpwl/jpwl_lib.c 2009-03-21 12:39:09.000000000 +0100
+@@ -166,7 +166,7 @@
+ /* Add this marker to the 'insertanda' list */
+ if (*jwmarker_num < JPWL_MAX_NO_MARKERS) {
+ jwmarker[*jwmarker_num].id = J2K_MS_EPB; /* its type */
+- jwmarker[*jwmarker_num].epbmark = epb_mark; /* the EPB */
++ jwmarker[*jwmarker_num].u.epbmark = epb_mark; /* the EPB */
+ jwmarker[*jwmarker_num].pos = (int) place_pos; /* after SOT */
+ jwmarker[*jwmarker_num].dpos = place_pos + 0.0000001 * (double)(*idx); /* not very first! */
+ jwmarker[*jwmarker_num].len = epb_mark->Lepb; /* its length */
+@@ -335,7 +335,7 @@
+ jpwl_epc_ms_t *epc = NULL;
+
+ /* Alloc space */
+- if (!(epc = (jpwl_epc_ms_t *) malloc((size_t) 1 * sizeof (jpwl_epc_ms_t)))) {
++ if (!(epc = (jpwl_epc_ms_t *) opj_aligned_malloc((size_t) 1 * sizeof (jpwl_epc_ms_t)))) {
+ opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for EPC MS\n");
+ return NULL;
+ };
+@@ -1196,7 +1196,7 @@
+ jpwl_esd_ms_t *esd = NULL;
+
+ /* Alloc space */
+- if (!(esd = (jpwl_esd_ms_t *) malloc((size_t) 1 * sizeof (jpwl_esd_ms_t)))) {
++ if (!(esd = (jpwl_esd_ms_t *) opj_aligned_malloc((size_t) 1 * sizeof (jpwl_esd_ms_t)))) {
+ opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for ESD MS\n");
+ return NULL;
+ };
diff --git a/graphics/openjpeg/files/patch-opj_malloc.h b/graphics/openjpeg/files/patch-opj_malloc.h
new file mode 100644
index 000000000000..6fc47351b7a4
--- /dev/null
+++ b/graphics/openjpeg/files/patch-opj_malloc.h
@@ -0,0 +1,18 @@
+--- libopenjpeg/opj_malloc.h.orig 2007-12-21 11:19:01.000000000 +0100
++++ libopenjpeg/opj_malloc.h 2009-03-21 12:02:37.000000000 +0100
+@@ -76,8 +76,15 @@
+ #if defined(__sun)
+ #define HAVE_MEMALIGN
+ #elif defined(__GNUC__)
++ #if defined(__FreeBSD__)
++ #include <stdlib.h>
++ #include <osreldate.h>
++ #if __FreeBSD_versioni >= 700000
++ #endif
++ #else
+ #define HAVE_MEMALIGN
+ #include <malloc.h>
++ #endif
+ /* Linux x86_64 and OSX always align allocations to 16 bytes */
+ #elif !defined(__amd64__) && !defined(__APPLE__)
+ /* FIXME: Yes, this is a big assumption */