]> Creatis software - gdcm.git/blobdiff - src/gdcmJPEGFragment.cxx
Fix mistypings
[gdcm.git] / src / gdcmJPEGFragment.cxx
index e3569967180264d0184d685be5bddf91c9556228..3a50c996bbceac1474a271afba6cc4c04b95a17d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJPEGFragment.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/31 04:00:04 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2008/01/02 10:48:52 $
+  Version:   $Revision: 1.20 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmJPEGFragment.h"
 #include "gdcmDebug.h"
 
-namespace gdcm
+namespace GDCM_NAME_SPACE
 {
-
+//-------------------------------------------------------------------------
 // For JPEG 2000, body in file gdcmJpeg2000.cxx
 // Not yet made
-bool gdcm_read_JPEG2000_file (std::ifstream* fp, void* image_buffer);
+bool gdcm_read_JPEG2000_file (std::ifstream *fp, void *image_buffer);
 
 // For JPEG-LS, body in file gdcmJpegLS.cxx
 // Not yet made
-bool gdcm_read_JPEGLS_file (std::ifstream* fp, void* image_buffer);
+bool gdcm_read_JPEGLS_file (std::ifstream *fp, void *image_buffer);
 
+//-------------------------------------------------------------------------
+// Constructor / Destructor
 /**
  * \brief Default constructor.
  */
@@ -42,19 +44,8 @@ JPEGFragment::JPEGFragment()
 
 }
 
-/**
- * \brief        Print self.
- * @param os     Stream to print to.
- * @param indent Indentation string to be prepended during printing.
- */
-void JPEGFragment::Print( std::ostream &os, std::string indent )
-{
-   os << indent
-      << "JPEG fragment: offset : " <<  Offset
-      << "   length : " <<  Length
-      << std::endl;
-}
-
+//-----------------------------------------------------------------------------
+// Public
 /**
  * \brief Decompress 8bits JPEG Fragment
  * @param fp ifstream to write to
@@ -64,7 +55,7 @@ void JPEGFragment::Print( std::ostream &os, std::string indent )
  */
 void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp,
                                                 uint8_t *buffer, int nBits, 
-                                                int & statesuspension)
+                                                int &statesuspension)
 {
    // First thing need to reset file to proper position:
    fp->seekg( Offset, std::ios::beg);
@@ -76,12 +67,14 @@ void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp,
    }
    else if ( nBits <= 12 )
    {
-      // JPEG Lossy : call to IJG 6b - 8 bits
+       assert( nBits >= 8 );
+      // JPEG Lossy : call to IJG 6b - 12 bits
       ReadJPEGFile12 ( fp, buffer, statesuspension);
    }
    else if ( nBits <= 16 )
    {
-      // JPEG Lossy : call to IJG 6b - 8 bits
+       assert( nBits >= 12 );
+      // JPEG Lossy : call to IJG 6b - 16 bits
       ReadJPEGFile16 ( fp, buffer, statesuspension);
       //gdcmAssertMacro( IsJPEGLossless );
    }
@@ -95,5 +88,29 @@ void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp,
    }
 }
 
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+/**
+ * \brief        Print self.
+ * @param os     Stream to print to.
+ * @param indent Indentation string to be prepended during printing.
+ */
+void JPEGFragment::Print( std::ostream &os, std::string const &indent )
+{
+   os << indent
+      << "JPEG fragment: offset : " <<  std::dec << Offset 
+      << " 0x(" << std::hex << Offset << ") "
+      << std::dec << "   length : " <<  Length
+      << " 0x(" << std::hex << Length << ") "      
+      << std::endl;
+}
+
+//-----------------------------------------------------------------------------
 } // end namespace gdcm