core/vil1/file_formats/vil1_jpeg_decompressor.h

Go to the documentation of this file.
00001 // This is core/vil1/file_formats/vil1_jpeg_decompressor.h
00002 #ifndef vil1_jpeg_decompressor_h_
00003 #define vil1_jpeg_decompressor_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author fsm
00010 
00011 #include <vil1/vil1_jpeglib.h>
00012 class vil1_stream;
00013 
00014 class vil1_jpeg_decompressor
00015 {
00016  public:
00017   struct jpeg_error_mgr         jerr;
00018   struct jpeg_decompress_struct jobj;
00019   vil1_stream *stream;
00020 
00021   vil1_jpeg_decompressor(vil1_stream *s);
00022 
00023   // NB. does not delete the stream.
00024   ~vil1_jpeg_decompressor();
00025 
00026   // Do *not* delete the return value. Leave it alone.
00027   // The return value is zero on failure.
00028   // It should cost nothing to read the same scanline twice in succession.
00029   JSAMPLE const *read_scanline(unsigned line);
00030 
00031  private:
00032   bool ready; // true if decompression has started but not finished.
00033   bool valid; // true if last scanline read was successful.
00034 
00035   // It's not worth the effort using JPEG to allocate the buffer using the
00036   // jobj.mem->alloc_sarray method, because it would have to be reallocated
00037   // after each call to jpeg_finish_decompress(). The symptom of not doing
00038   // so is a nasty heap corruption which only shows up later in unrelated
00039   // code.
00040   JSAMPLE *biffer;   // pointer to scanline buffer.
00041 };
00042 
00043 #endif // vil1_jpeg_decompressor_h_

Generated on Sat Nov 22 05:08:28 2008 for core/vil1 by  doxygen 1.5.1