X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmJPEGFragment.cxx;h=8c82b1d88f5d1c072e94b9b533a5c64247f6b67c;hb=173aecc6a03f633d2a5a3f2dbb73a464c01335c0;hp=65b9e3934194c56ba32ba301bef8559ba4f53116;hpb=0e0403151bbff57175d2b974ee2d14b8195f9234;p=gdcm.git diff --git a/src/gdcmJPEGFragment.cxx b/src/gdcmJPEGFragment.cxx index 65b9e393..8c82b1d8 100644 --- a/src/gdcmJPEGFragment.cxx +++ b/src/gdcmJPEGFragment.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmJPEGFragment.cxx,v $ Language: C++ - Date: $Date: 2005/01/31 03:22:25 $ - Version: $Revision: 1.10 $ + Date: $Date: 2005/02/04 16:51:36 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,15 +21,17 @@ namespace gdcm { - +//------------------------------------------------------------------------- // 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. */ @@ -38,25 +40,12 @@ JPEGFragment::JPEGFragment() Offset = 0; Length = 0; -// StateSuspension = 0; -// void *SampBuffer; pImage = 0; } -/** - * \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 @@ -66,34 +55,25 @@ 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); if ( nBits == 8 ) { - // JPEG Lossy : call to IJG 6b - if ( ! this->gdcm_read_JPEG_file8( fp, buffer, statesuspension) ) - { - //return false; - } + // JPEG Lossy : call to IJG 6b - 8 bits + ReadJPEGFile8( fp, buffer, statesuspension); } else if ( nBits <= 12 ) { - // Reading Fragment pixels - if ( ! this->gdcm_read_JPEG_file12 ( fp, buffer, statesuspension) ) - { - //return false; - } + // JPEG Lossy : call to IJG 6b - 12 bits + ReadJPEGFile12 ( fp, buffer, statesuspension); } else if ( nBits <= 16 ) { - // Reading Fragment pixels - if ( ! this->gdcm_read_JPEG_file16 ( fp, buffer, statesuspension) ) - { - //return false; - } + // JPEG Lossy : call to IJG 6b - 16 bits + ReadJPEGFile16 ( fp, buffer, statesuspension); //gdcmAssertMacro( IsJPEGLossless ); } else @@ -103,10 +83,30 @@ void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp, // other JPEG lossy not supported gdcmErrorMacro( "Unknown jpeg lossy compression "); - //return false; } +} + +//----------------------------------------------------------------------------- +// 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 indent ) +{ + os << indent + << "JPEG fragment: offset : " << Offset + << " length : " << Length + << std::endl; } +//----------------------------------------------------------------------------- } // end namespace gdcm