This directory contains a subset of the Independent JPEG Group's (IJG) libjpeg
version 6b.  We only include enough of distribution to build libjpeg.  We do
not include the standard executables that come with libjpeg (cjpeg, djpeg,
etc.). Furthermore, the standard libjpeg build process is replaced with a CMake
build process.

We'd like to thank the IJG for distributing a public JPEG IO library.

We'd like to also thank the dcmtk crew for releasing their toolkit under such a
nice license that allow us to patch ijg properly to handle all sort of jpeg
compression found in the DICOM implementation. The copyright can be found in
COPYRIGHT.dcmtk.

Modifications
-------------

1.
jconfig.h is usually generated by the build process. For this distribution, we
ship a version of jconfig.h.in to be used across several platforms. It's
purpose is also to allow generation of both 8bits, 12bits and 16bits lib.



2.
jmorecfg.h was modified so that we can modify it automatically at build time to
either generate a 8bits jpeg lib, 12bits jpeg library or 16bits jpeg library:

Index: jmorecfg.h
===================================================================
RCS file: /cvs/public/gdcm/src/jpeg/libijg8/jmorecfg.h,v
retrieving revision 1.4
diff -u -3 -p -r1.4 jmorecfg.h
--- jmorecfg.h  31 Oct 2003 14:59:50 -0000      1.4
+++ jmorecfg.h  7 Oct 2004 02:30:40 -0000
@@ -19,7 +19,8 @@
  * We do not support run-time selection of data precision, sorry.
  */

-#define BITS_IN_JSAMPLE  8     /* use 8 or 12 */
+//#define BITS_IN_JSAMPLE  8   /* use 8 or 12 */
+#define BITS_IN_JSAMPLE @GDCM_BITS_IN_JSAMPLE@

 /*
  * Maximum number of components (color channels) allowed in JPEG image.




3.
To further allow us to have to different copy of the 8, 12 and 16 bits jpeg
library we had to mangle the name. Fur this purpose two new file were added to
the library: gdcm_mangle_8bits.h, gdcm_mangle_12bits.h and
gdcm_mangle_16bits.h.
Those file were generated using:

        nm libgdcmijpeg8.a | grep " [R|T] " | colrm 1 11 | sort


4.
In order to read lossless images, we had to apply the ls-patch to jpeg-6b. So I started from scratch:

tar xvfz /tmp/jpegsrc.v6b.tar.gz                        (1)
patch < /tmp/ljpeg-6b.patch                             (2)
patch -p0 < arithmetic-without-arith-option-full.patch  (3)
patch -p0 < warnings10-14.patch                         (4)
patch -p0 < previous-gdcm.patch                         (5)
-----------------------------------------------------------
= The subdir src/jpeg/libijg

(now I also need to apply the redhat patch for cplusplus lib)

(1) http://www.ijg.org/files/jpegsrc.v6b.tar.gz
(2) http://www.oceana.com/ftp/ljpeg/ljpeg-patch.v6b.tar.gz
(3), (4) and (5) http://www.creatis.insa-lyon.fr/~malaterre/jpeg/

(3) Was made with a carefull inspection of dcmtk code (see convert.sh at the same spot as the patch)
(4) Is basically just compilation of the lib with -W -Wall -Werror
(5) This contains some configuration copy/paste from VTK, and the 'well known' 12 bits Philips MRI DICOM patch



NOTE for later:
(should we disable getenv just as dcmtk ? there is a ijg flag for that NO_ENV or something similar
