[med-svn] [gdcm] 01/06: d/control, d/p/10, d/p/11: compile against openjpeg-2.1

Gert Wollny gert-guest at moszumanska.debian.org
Mon May 30 14:33:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

gert-guest pushed a commit to branch master
in repository gdcm.

commit b1ccf85fef9a0c67b045d3fbdfa306dd4c7d8648
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Fri May 27 07:34:42 2016 +0000

    d/control, d/p/10, d/p/11:  compile against openjpeg-2.1
    
    Add two patches provided by upstream to make compilation possible
    against openjpeg-2.1 and set dependency accordingly.
---
 debian/control                                   |   6 +-
 debian/patches/10_gdcm_openjpeg2_git4f793f.patch | 128 +++++++++++++++++++++++
 debian/patches/11_gdcm_openjpeg2_git0511b1.patch |  30 ++++++
 debian/patches/series                            |   3 +-
 4 files changed, 163 insertions(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index 7562e7d..0d8b01d 100644
--- a/debian/control
+++ b/debian/control
@@ -19,8 +19,8 @@ Build-Depends: cmake (>= 2.8.9),
 	       swig3.0,
 	       javahelper,
 	       libvtk6-dev,
-	       libcharls-dev, 
-	       libopenjpeg-dev,
+	       libcharls-dev,
+	       libopenjp2-7-dev,
 	       libvtk6-java,
 	       libxml2-dev,
 	       libjson-c-dev,
@@ -39,7 +39,7 @@ Build-Depends-Indep: vtk6-doc,
 	       doxygen-latex,
 	       ghostscript, 
                graphviz
-Build-Conflicts: libopenjp2-7-dev
+Build-Conflicts: libopenjpeg-dev
 Standards-Version: 3.9.8
 X-Python-Version: 2.7
 Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/gdcm.git
diff --git a/debian/patches/10_gdcm_openjpeg2_git4f793f.patch b/debian/patches/10_gdcm_openjpeg2_git4f793f.patch
new file mode 100644
index 0000000..ce87d4d
--- /dev/null
+++ b/debian/patches/10_gdcm_openjpeg2_git4f793f.patch
@@ -0,0 +1,128 @@
+commit 4f793f6005c794de633d01e42e00d37f80340fac
+Author: Mathieu Malaterre <mathieu.malaterre at gmail.com>
+Date:   Thu May 26 08:58:26 2016 +0200
+
+    Minimal changes to make GDCM compiles against OPJ 2.1.0
+
+diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+index 63de2c6..d6f3192 100644
+--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
++++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+@@ -78,6 +78,10 @@ void info_callback(const char *msg, void *) {
+ #define RAW_DFMT 15
+ #define TGA_DFMT 16
+ #define PNG_DFMT 17
++#define CODEC_JP2 OPJ_CODEC_JP2
++#define CODEC_J2K OPJ_CODEC_J2K
++#define CLRSPC_GRAY OPJ_CLRSPC_GRAY
++#define CLRSPC_SRGB OPJ_CLRSPC_SRGB
+ #endif // OPENJPEG_MAJOR_VERSION == 1
+ 
+ #if OPENJPEG_MAJOR_VERSION == 2
+@@ -190,7 +194,7 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create_memory_stream (myfile* p_mem,OPJ_UI
+   {
+     return 00;
+   }
+-  opj_stream_set_user_data(l_stream,p_mem);
++  opj_stream_set_user_data(l_stream,p_mem,NULL);
+   opj_stream_set_read_function(l_stream,(opj_stream_read_fn) opj_read_from_memory);
+   opj_stream_set_write_function(l_stream, (opj_stream_write_fn) opj_write_from_memory);
+   opj_stream_set_skip_function(l_stream, (opj_stream_skip_fn) opj_skip_from_memory);
+@@ -534,13 +538,18 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
+   s[1] = 0;
+   opj_set_error_handler(dinfo, gdcm_error_callback, s);
+ 
++#ifdef OPJ_J2K_STREAM_CHUNK_SIZE
++  cio = opj_stream_create_memory_stream(fsrc,OPJ_J2K_STREAM_CHUNK_SIZE, true);
++#else
+   cio = opj_stream_create_memory_stream(fsrc,J2K_STREAM_CHUNK_SIZE, true);
++#endif
+ 
+   /* setup the decoder decoding parameters using user parameters */
+   opj_setup_decoder(dinfo, &parameters);
+   bool bResult;
+   OPJ_INT32 l_tile_x0,l_tile_y0;
+   OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y;
++#if 0
+   bResult = opj_read_header(
+     dinfo,
+     &image,
+@@ -551,17 +560,25 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
+     &l_nb_tiles_x,
+     &l_nb_tiles_y,
+     cio);
++#else
++  bResult = opj_read_header(
++    cio,
++    dinfo,
++    &image);
++#endif
+   assert( bResult );
+ 
+ #if OPENJPEG_MAJOR_VERSION == 1
+ #else
++#if 0
+   // needs to be before call to opj_decode...
+   reversible = opj_get_reversible(dinfo, &parameters );
+   assert( reversible == 0 || reversible == 1 );
+ #endif
++#endif
+ 
+-  image = opj_decode(dinfo, cio);
+-  //assert( image );
++  bResult = opj_decode(dinfo, cio,image);
++  assert( bResult );
+   bResult = bResult && (image != 00);
+   bResult = bResult && opj_end_decompress(dinfo,cio);
+   if (!image || !check_comp_valid(image) )
+@@ -1050,7 +1067,7 @@ bool JPEG2000Codec::CodeFrameIntoBuffer(char * outdata, size_t outlen, size_t &
+ 
+   /* open a byte stream for writing */
+   /* allocate memory for all tiles */
+-  cio = opj_stream_create_memory_stream(fsrc,J2K_STREAM_CHUNK_SIZE,false);
++  cio = opj_stream_create_memory_stream(fsrc,OPJ_J2K_STREAM_CHUNK_SIZE,false);
+   if (! cio)
+     {
+     return false;
+@@ -1277,13 +1294,14 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
+   // the hack is not used when reading meta-info of a j2k stream:
+   opj_set_error_handler(dinfo, gdcm_error_callback, NULL);
+ 
+-  cio = opj_stream_create_memory_stream(fsrc,J2K_STREAM_CHUNK_SIZE, true);
++  cio = opj_stream_create_memory_stream(fsrc,OPJ_J2K_STREAM_CHUNK_SIZE, true);
+ 
+   /* setup the decoder decoding parameters using user parameters */
+   opj_setup_decoder(dinfo, &parameters);
+   bool bResult;
+   OPJ_INT32 l_tile_x0,l_tile_y0;
+   OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y;
++#if 0
+   bResult = opj_read_header(
+     dinfo,
+     &image,
+@@ -1294,6 +1312,12 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
+     &l_nb_tiles_x,
+     &l_nb_tiles_y,
+     cio);
++#else
++  bResult = opj_read_header(
++    cio,
++    dinfo,
++    &image);
++#endif
+   //image = opj_decode(dinfo, cio);
+   //bResult = bResult && (image != 00);
+   //bResult = bResult && opj_end_decompress(dinfo,cio);
+@@ -1331,10 +1355,12 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
+     return false;
+     }
+ #else
++#if 0
+   reversible = opj_get_reversible(dinfo, &parameters );
+   assert( reversible == 0 || reversible == 1 );
+   // FIXME
+   assert( mct == 0 || mct == 1 );
++#endif
+ #endif // OPENJPEG_MAJOR_VERSION == 1
+   LossyFlag = !reversible;
+ 
diff --git a/debian/patches/11_gdcm_openjpeg2_git0511b1.patch b/debian/patches/11_gdcm_openjpeg2_git0511b1.patch
new file mode 100644
index 0000000..a4c81d3
--- /dev/null
+++ b/debian/patches/11_gdcm_openjpeg2_git0511b1.patch
@@ -0,0 +1,30 @@
+commit 0511b1d6d356a1c5d1f4e22cd5bb862ef233a332
+Author: Mathieu Malaterre <mathieu.malaterre at gmail.com>
+Date:   Thu May 26 12:02:34 2016 +0200
+
+    This is a legitimate init
+    
+    DICOM standard allow storing lossless J2K within the broad JPEG 2000 TS
+
+diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+index d6f3192..3025621 100644
+--- a/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
++++ b/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
+@@ -574,6 +574,8 @@ std::pair<char *, size_t> JPEG2000Codec::DecodeByStreamsCommon(char *dummy_buffe
+   // needs to be before call to opj_decode...
+   reversible = opj_get_reversible(dinfo, &parameters );
+   assert( reversible == 0 || reversible == 1 );
++#else
++  reversible = 0;
+ #endif
+ #endif
+ 
+@@ -1360,6 +1362,8 @@ bool JPEG2000Codec::GetHeaderInfo(const char * dummy_buffer, size_t buf_size, Tr
+   assert( reversible == 0 || reversible == 1 );
+   // FIXME
+   assert( mct == 0 || mct == 1 );
++#else
++  reversible = 0;
+ #endif
+ #endif // OPENJPEG_MAJOR_VERSION == 1
+   LossyFlag = !reversible;
diff --git a/debian/patches/series b/debian/patches/series
index bff6a08..3da7a19 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,4 +6,5 @@
 07_don_t_link_vtkjava_modules.patch
 08_supportvtk6.3.patch
 09_set_java_15.patch
-
+10_gdcm_openjpeg2_git4f793f.patch
+11_gdcm_openjpeg2_git0511b1.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gdcm.git



More information about the debian-med-commit mailing list