X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmJpeg.cxx;h=76dfaa0724eb506f16304bd654cd162e0c9fd4d1;hb=76bb7282f2aee8ff167483c0ccf3397769b21326;hp=3d11de65781c9b6cf9218726d320e50da6f18f3b;hpb=37fd1bd483d69af97351da7ccbd9ed7912fbaa75;p=gdcm.git diff --git a/src/gdcmJpeg.cxx b/src/gdcmJpeg.cxx index 3d11de65..76dfaa07 100644 --- a/src/gdcmJpeg.cxx +++ b/src/gdcmJpeg.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmJpeg.cxx,v $ Language: C++ - Date: $Date: 2005/02/11 20:04:08 $ - Version: $Revision: 1.48 $ + Date: $Date: 2006/01/27 10:01:34 $ + Version: $Revision: 1.55 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -39,6 +39,11 @@ #include #include + +#if defined(__BORLANDC__) + #include // for memset +#endif + #include "jdatasrc.cxx" #include "jdatadst.cxx" @@ -56,7 +61,7 @@ namespace gdcm * @return 1 on success, 0 on error */ -bool gdcm_write_JPEG_file (std::ofstream *fp, void *im_buf, +bool gdcm_write_JPEG_file (std::ostream *fp, void *im_buf, int image_width, int image_height, int quality) { @@ -107,7 +112,9 @@ bool gdcm_write_JPEG_file (std::ofstream *fp, void *im_buf, // exit(1); // // } - jpeg_stdio_dest(&cinfo, fp); + assert( 0 ); + (void)fp; + //jpeg_stdio_dest(&cinfo, fp, 0, 0, image_width, image_height, quality); /* Step 3: set parameters for compression */ @@ -205,13 +212,13 @@ METHODDEF(void) my_error_exit (j_common_ptr cinfo) { // (*cinfo->err->format_message) (cinfo, buffer); // // // Custom display message, we could be more fancy and throw an exception: -// gdcmErrorMacro( buffer ); +// gdcmStaticErrorMacro( buffer ); //} } //----------------------------------------------------------------------------- - /** +/** * \brief routine for JPEG decompression * @param fp pointer to an already open file descriptor * 8 significant bits per pixel @@ -271,7 +278,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta return 0; } // Now we can initialize the JPEG decompression object. - if( statesuspension == 0 ) + if ( statesuspension == 0 ) { jpeg_create_decompress(&cinfo); jpeg_stdio_src(&cinfo, fp, this, 1); @@ -282,9 +289,9 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta } // Step 3: read file parameters with jpeg_read_header() - if( statesuspension < 2 ) + if ( statesuspension < 2 ) { - if( jpeg_read_header(&cinfo, TRUE) == JPEG_SUSPENDED ) + if ( jpeg_read_header(&cinfo, TRUE) == JPEG_SUSPENDED ) { // Suspension in jpeg_read_header statesuspension = 2; @@ -292,7 +299,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta // Step 4: set parameters for decompression // prevent the library from performing any color space conversion - if( cinfo.process == JPROC_LOSSLESS ) + if ( cinfo.process == JPROC_LOSSLESS ) { cinfo.jpeg_color_space = JCS_UNKNOWN; cinfo.out_color_space = JCS_UNKNOWN; @@ -300,9 +307,9 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta } // Step 5: Start decompressor - if(statesuspension < 3 ) + if (statesuspension < 3 ) { - if( jpeg_start_decompress(&cinfo) == FALSE ) + if ( jpeg_start_decompress(&cinfo) == FALSE ) { // Suspension: jpeg_start_decompress statesuspension = 3; @@ -330,7 +337,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta while (cinfo.output_scanline < cinfo.output_height) { - if( jpeg_read_scanlines(&cinfo, buffer, 1) == 0 ) + if ( jpeg_read_scanlines(&cinfo, buffer, 1) == 0 ) { // Suspension in jpeg_read_scanlines statesuspension = 3; @@ -349,7 +356,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta } // Step 7: Finish decompression - if( jpeg_finish_decompress(&cinfo) == FALSE ) + if ( jpeg_finish_decompress(&cinfo) == FALSE ) { // Suspension: jpeg_finish_decompress statesuspension = 4;