+
+ pImage = 0;
+
+}
+
+//-----------------------------------------------------------------------------
+// Public
+/**
+ * \brief Decompress 8bits JPEG Fragment
+ * @param fp ifstream to write to
+ * @param buffer output (data decompress)
+ * @param nBits 8/12 or 16 bits jpeg
+ * @param statesuspension state suspension
+ */
+void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp,
+ uint8_t *buffer, int nBits,
+ int &statesuspension)
+{
+ // First thing need to reset file to proper position:
+ fp->seekg( Offset, std::ios::beg);
+
+ if ( nBits == 8 )
+ {
+ // JPEG Lossy : call to IJG 6b - 8 bits
+ ReadJPEGFile8( fp, buffer, statesuspension);
+ }
+ else if ( nBits <= 12 )
+ {
+ assert( nBits >= 8 );
+ // JPEG Lossy : call to IJG 6b - 12 bits
+ ReadJPEGFile12 ( fp, buffer, statesuspension);
+ }
+ else if ( nBits <= 16 )
+ {
+ assert( nBits >= 12 );
+ // JPEG Lossy : call to IJG 6b - 16 bits
+ ReadJPEGFile16 ( fp, buffer, statesuspension);
+ //gdcmAssertMacro( IsJPEGLossless );
+ }
+ else
+ {
+ // FIXME : only the bits number is checked,
+ // NOT the compression method
+
+ // other JPEG lossy not supported
+ gdcmErrorMacro( "Unknown jpeg lossy compression ");
+ }