-#include "gdcmFile.h"
-
-/*
-DICOM provides a mechanism for supporting the use of JPEG Image Compression
-through the Encapsulated Format (see PS 3.3 of the DICOM Standard).
-Annex A defines a number of Transfer Syntaxes which reference
-the JPEG Standard and provide a number of lossless (bit preserving)
-and lossy compression schemes.
-In order to facilitate interoperability of implementations conforming
-to the DICOM Standard which elect to use one or more
-of the Transfer Syntaxes for JPEG Image Compression, the following policy is specified:
-
- Any implementation which conforms to the DICOM Standard and has elected
- to support any one of the Transfer Syntaxes for lossless JPEG Image Compression,
- shall support the following lossless compression:
- The subset (first-order horizontal prediction [Selection Value 1) of JPEG Process 14
- (DPCM, non-hierarchical with Huffman coding) (see Annex F of the DICOM Standard).
-
- Any implementation which conforms to the DICOM Standard and has elected
- to support any one of the Transfer Syntaxes for 8-bit lossy JPEG Image Compression,
- shall support the JPEG Baseline Compression (coding Process 1).
-
- Any implementation which conforms to the DICOM Standard and has elected
- to support any one of the Transfer Syntaxes for 12-bit lossy JPEG Image Compression,
- shall support the JPEG Compression Process 4.
-
-Note: The DICOM conformance statement shall differentiate between implementations
-that can simply receive JPEG encoded images and those that can receive and process
-JPEG encoded images (see PS 3.2 of the DICOM Standard).
-
-The use of the DICOM Encapsulated Format to support JPEG Compressed Pixel Data
-implies that the Data Elements which are related to the Native Format Pixel Data encoding
-(e.g. Bits Allocated, Bits Stored, High Bit, Pixel Representation, Rows, Columns, etc.)
-shall contain values which are consistent with the characteristics
-of the uncompressed pixel data from which the compressed Data Stream was derived.
-The Pixel Data characteristics included in the JPEG Interchange Format
-shall be used to decode the compressed data stream.
-
-Run Length Encoding Compression
-
-DICOM provides a mechanism for supporting the use of Run Length Encoding (RLE)
-Compression which is a byte oriented lossless compression scheme through
-the encapsulated Format (see PS 3.3 of this Standard).
-Annex G of the DICOM Standard defines RLE Compression and its Transfer Syntax.
-
-Note: The RLE Compression algorithm described in Annex G
-of the DICOM Standard is the compression used in
-the TIFF 6.0 specification known as the "PackBits" scheme.
-
-The use of the DICOM Encapsulated Format to support RLE Compressed Pixel Data
-implies that the Data Elements which are related to the Native Format Pixel Data encoding (
-e.g. Bits Allocated, Bits Stored, High Bit, Pixel Representation, Rows, Columns, etc.)
-shall contain values which are consistent with the characteristics
-of the uncompressed pixel data from which the compressed data is derived
-*/
-
-/*
- * <setjmp.h> is used for the optional error recovery mechanism shown in
- * the second part of the example.
- */
-
-/*
- * Include file for users of JPEG library.
- * You will need to have included system headers that define at least
- * the typedefs FILE and size_t before you can include jpeglib.h.
- * (stdio.h is sufficient on ANSI-conforming systems.)
- * You may also wish to include "jerror.h".
- */
+#include "gdcmFileHelper.h"
+#include "gdcmJPEGFragment.h"
+#include "gdcmDebug.h"
+
+#if defined(__sgi) && !defined(__GNUC__)
+// Try to get rid of the warning:
+//cc-3505 CC: WARNING File = /usr/include/internal/setjmp_core.h, Line = 74
+// setjmp not marked as unknown_control_flow because it is not declared as a
+// function
+//
+// #pragma unknown_control_flow (setjmp)
+# if (_COMPILER_VERSION >= 730)
+# pragma set woff 3505
+# endif
+#endif
+#ifdef _MSC_VER
+// Let us get rid of this funny warning on /W4:
+// warning C4611: interaction between '_setjmp' and C++ object
+// destruction is non-portable
+#pragma warning( disable : 4611 )
+#endif