]> Creatis software - gdcm.git/blobdiff - src/gdcmJpeg.cxx
remove useless comments
[gdcm.git] / src / gdcmJpeg.cxx
index 5a2fb98418b7eb04edc04fd06822f494d013187c..3d11de65781c9b6cf9218726d320e50da6f18f3b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJpeg.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/04 23:30:21 $
-  Version:   $Revision: 1.41 $
+  Date:      $Date: 2005/02/11 20:04:08 $
+  Version:   $Revision: 1.48 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -170,11 +170,7 @@ bool gdcm_write_JPEG_file (std::ofstream *fp, void *im_buf,
 
   /* And we're done! */
 
-  return true; //???
-}
-
-extern "C" {
-  typedef void(*void_jpeg_common_struct)(jpeg_common_struct*);
+  return true;
 }
 
 //-----------------------------------------------------------------------------
@@ -188,6 +184,7 @@ typedef struct my_error_mgr* my_error_ptr;
 /*
  * Here's the routine that will replace the standard error_exit method:
  */
+extern "C" {
 METHODDEF(void) my_error_exit (j_common_ptr cinfo) {
    /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
    my_error_ptr myerr = (my_error_ptr) cinfo->err;
@@ -200,6 +197,18 @@ METHODDEF(void) my_error_exit (j_common_ptr cinfo) {
    longjmp(myerr->setjmp_buffer, 1);
 }
 
+//METHODDEF(void) my_output_message (j_common_ptr cinfo)
+//{
+//   char buffer[JMSG_LENGTH_MAX];
+// 
+//   /* Create the message */
+//   (*cinfo->err->format_message) (cinfo, buffer);
+//
+//   // Custom display message, we could be more fancy and throw an exception:
+//   gdcmErrorMacro( buffer );
+//}
+
+}
 //-----------------------------------------------------------------------------
  
  /**
@@ -246,8 +255,11 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta
   // We set up the normal JPEG error routines, then override error_exit.
   
   cinfo.err = jpeg_std_error(&jerr.pub);
-  jerr.pub.error_exit = reinterpret_cast<void_jpeg_common_struct>(my_error_exit);
-  
+  // for any jpeg error call my_error_exit
+  jerr.pub.error_exit = my_error_exit;
+  // for any output message call my_output_message
+  //jerr.pub.output_message = my_output_message;
+
   // Establish the setjmp return context for my_error_exit to use.
   if (setjmp(jerr.setjmp_buffer))
   {
@@ -277,7 +289,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta
       // Suspension in jpeg_read_header
       statesuspension = 2; 
       }
-   
       // Step 4: set parameters for decompression
       // prevent the library from performing any color space conversion
       if( cinfo.process == JPROC_LOSSLESS )
@@ -325,7 +337,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta
         return true;
         }
 // The ijg has no notion of big endian, therefore always swap the jpeg stream
-#if defined(GDCM_WORDS_BIGENDIAN) && (CMAKE_BITS_IN_JSAMPLE != 8)
+#if (defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)) && (CMAKE_BITS_IN_JSAMPLE != 8)
       uint16_t *buffer16 = (uint16_t*)*buffer;
       uint16_t *pimage16 = (uint16_t*)pImage;
       for(unsigned int i=0;i<rowsize/2;i++)