Fawkes API  Fawkes Development Version
jpeg.h
1 
2 /***************************************************************************
3  * jpeg.h - JPEG Reader
4  *
5  * Generated: Sun Jun 04 23:18:06 2006 (watching Terminator 2)
6  * Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_UTILS_READERS_JPEG_H_
25 #define __FIREVISION_UTILS_READERS_JPEG_H_
26 
27 #include <fvutils/readers/reader.h>
28 
29 #include <cstdio>
30 extern "C" {
31 #include <jpeglib.h>
32 }
33 
34 namespace firevision {
35 #if 0 /* just to make Emacs auto-indent happy */
36 }
37 #endif
38 
39 class JpegReader : public Reader {
40 
41  public:
42  JpegReader(const char *filename);
43  virtual ~JpegReader();
44 
45  virtual void set_buffer(unsigned char *yuv422planar_buffer);
46  virtual colorspace_t colorspace();
47  virtual unsigned int pixel_width();
48  virtual unsigned int pixel_height();
49  virtual void read();
50 
51  private:
52  bool opened;
53 
54  unsigned char *buffer;
55  unsigned char *row_buffer;
56 
57  FILE *infile;
58  int row_stride;
59  struct jpeg_decompress_struct cinfo;
60  struct jpeg_error_mgr jerr;
61 };
62 
63 } // end namespace firevision
64 
65 #endif
virtual ~JpegReader()
Destructor.
Definition: jpeg.cpp:73
JPEG file reader.
Definition: jpeg.h:39
virtual unsigned int pixel_width()
Get width of read image in pixels.
Definition: jpeg.cpp:96
Image reader interface.
Definition: reader.h:34
JpegReader(const char *filename)
Constructor.
Definition: jpeg.cpp:46
virtual unsigned int pixel_height()
Get height of read image in pixels.
Definition: jpeg.cpp:107
virtual colorspace_t colorspace()
Get colorspace from the just read image.
Definition: jpeg.cpp:89
virtual void set_buffer(unsigned char *yuv422planar_buffer)
Set buffer that the read image should be written to.
Definition: jpeg.cpp:82
virtual void read()
Read data from file.
Definition: jpeg.cpp:118