]> Creatis software - gdcm.git/blobdiff - src/gdcmJpeg.cxx
COMP: Fix comp on gcc295
[gdcm.git] / src / gdcmJpeg.cxx
index 6023ea721aa8c57bb5d5cca88fc6e8337eea5ee7..86403c62c8fd471a1921b02030c05531ee97746a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJpeg.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/14 22:16:33 $
-  Version:   $Revision: 1.25 $
+  Date:      $Date: 2004/10/22 03:05:42 $
+  Version:   $Revision: 1.28 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -85,10 +85,12 @@ of the uncompressed pixel data from which the compressed data is derived
  */
 
 #include <setjmp.h>
+#include <fstream>
+#include "jdatasrc.cxx"
+#include "jdatadst.cxx"
 
 namespace gdcm 
 {
-
 /******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
 
 /* This half of the example shows how to feed data into the JPEG compressor.
@@ -136,7 +138,7 @@ namespace gdcm
  * @return 1 on success, 0 on error
  */
  
-bool gdcm_write_JPEG_file (FILE* fp, void*  im_buf, 
+bool gdcm_write_JPEG_file (std::ofstream* fp, void*  im_buf, 
                            int image_width, int image_height, int quality)
 {
 
@@ -362,7 +364,7 @@ METHODDEF(void) my_error_exit (j_common_ptr cinfo) {
  * @return 1 on success, 0 on error
  */
  
-bool gdcm_read_JPEG_file ( FILE* fp, void* image_buffer )
+bool gdcm_read_JPEG_file ( std::ifstream* fp, void* image_buffer )
 {
    char* pimage;
 
@@ -503,7 +505,7 @@ bool gdcm_read_JPEG_file ( FILE* fp, void* image_buffer )
     */ 
 
    /* JSAMPLEs per row in output buffer */
-   row_stride = cinfo.output_width * cinfo.output_components;
+   row_stride = cinfo.output_width * cinfo.output_components*2;
   
 #ifdef GDCM_JPG_DEBUG
   printf ("cinfo.output_width %d cinfo.output_components %d  row_stride %d\n",
@@ -538,13 +540,12 @@ bool gdcm_read_JPEG_file ( FILE* fp, void* image_buffer )
        * more than one scanline at a time if that's more convenient.
        */
 
+     //printf( "scanlines: %d\n",cinfo.output_scanline);
       (void) jpeg_read_scanlines(&cinfo, buffer, 1);
       memcpy( pimage, *buffer,rowsize); 
       pimage+=rowsize;
    }
 
-printf( "Image size read: %d\n\n\n\n", (cinfo.output_scanline) * rowsize);
   /* Step 7: Finish decompression */
 #ifdef GDCM_JPG_DEBUG
    printf("Entree Step 7\n");