void OpenJPEGImage::closeImage()
{
#ifdef DEBUG
  Timer timer;
  timer.start();
#endif

  if( _codec && _stream ) opj_end_decompress( _codec, _stream );
  if( _codec ){
    opj_destroy_codec( _codec );
    _codec = NULL;
  }
  if( _stream ){
    opj_stream_destroy( _stream );
    _stream = NULL;
  }
  if( _image ){
    opj_image_destroy( _image );
    _image = NULL;
  }

#ifdef DEBUG
  logfile << "OpenJPEG :: closeImage() :: " << timer.getTime() << " microseconds" << endl;
#endif
}
void OpenJPEGImage::closeImage()
{
#ifdef DEBUG
  Timer timer;
  timer.start();
#endif

  if( _codec && _stream ) opj_end_decompress( _codec, _stream );
  if( _codec ){
    opj_destroy_codec( _codec );
    _codec = NULL;
  }
  if( _stream ){
    opj_stream_destroy( _stream );
    _stream = NULL;
  }
  if( _image ){
    opj_image_destroy( _image );
    _image = NULL;
  }

#ifdef DEBUG
  logfile << "OpenJPEG :: closeImage() :: " << timer.getTime() << " microseconds" << endl;
#endif
}