diff --git a/gdcm-2.0.18-charls.patch b/gdcm-2.0.18-charls.patch index 61de90e..d67f1a5 100644 --- a/gdcm-2.0.18-charls.patch +++ b/gdcm-2.0.18-charls.patch @@ -1,6 +1,6 @@ diff -up gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx.charls gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx --- gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx.charls 2011-06-29 01:08:45.000000000 -0600 -+++ gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx 2011-11-02 08:59:23.582956059 -0600 ++++ gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx 2011-11-02 09:15:59.630494712 -0600 @@ -17,8 +17,7 @@ #include @@ -23,7 +23,7 @@ diff -up gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx.charls gdcm-2.0.18/Example if (JpegLsReadHeader(buffer, totalLen, &metadata) != OK) { std::cerr << "Cant parse jpegls" << std::endl; -@@ -156,7 +159,11 @@ int main(int argc, char *argv[]) +@@ -156,15 +159,24 @@ int main(int argc, char *argv[]) const char *pbyteCompressed = &vbuffer[0]; unsigned int cbyteCompressed = vbuffer.size(); // updated legnth @@ -35,3 +35,16 @@ diff -up gdcm-2.0.18/Examples/Cxx/FixJAIBugJPEGLS.cxx.charls gdcm-2.0.18/Example JpegLsReadHeader(pbyteCompressed, cbyteCompressed, ¶ms); std::vector rgbyteOut; + //rgbyteOut.resize( image.GetBufferLength() ); + rgbyteOut.resize(params.height *params.width * ((params.bitspersample + 7) / 8) * params.components); + ++#ifdef GDCM_USE_SYSTEM_CHARLS ++ JLS_ERROR result = ++ JpegLsDecode(&rgbyteOut[0], rgbyteOut.size(), pbyteCompressed, cbyteCompressed, ¶ms ); ++#else + JLS_ERROR result = + JpegLsDecode(&rgbyteOut[0], rgbyteOut.size(), pbyteCompressed, cbyteCompressed ); ++#endif + if (result != OK) + { + std::cerr << "Could not patch JAI-JPEGLS" << std::endl;