Fawkes API  Fawkes Development Version
jpeg_compressor_libjpeg.h
1 
2 /***************************************************************************
3  * jpeg_compressor.h - JPEG image compressor interface
4  *
5  * Created: Fri Aug 11 18:53:19 2006 (on train to Cologne)
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_COMPRESSION_JPEG_COMPRESSOR_LIBJPEG_H_
25 #define _FIREVISION_UTILS_COMPRESSION_JPEG_COMPRESSOR_LIBJPEG_H_
26 
27 #ifndef _FIREVISION_UTILS_COMPRESSION_JPEG_COMPRESSOR_H_
28 # error Do not include jpeg_compressor_libjpeg.h directly, use jpeg_compressor.h
29 #endif
30 
31 #include <fvutils/compression/imagecompressor.h>
32 
33 namespace firevision {
34 
36 {
37 public:
39  unsigned int quality = 80,
42 
43  virtual void set_image_dimensions(unsigned int width, unsigned int height);
44  virtual void set_image_buffer(colorspace_t cspace, unsigned char *buffer);
45  virtual void set_destination_buffer(unsigned char *buf, unsigned int buf_size);
46  virtual size_t compressed_size();
47  virtual void set_filename(const char *filename);
50  virtual void compress();
51  virtual size_t recommended_compressed_buffer_size();
52  virtual bool supports_vflip();
53  virtual void set_vflip(bool enable);
54 
55 private:
56  unsigned char *jpeg_buffer;
57  unsigned int jpeg_buffer_size;
58  unsigned char *buffer;
59 
60  unsigned int quality;
61  bool vflip;
62 
63  unsigned int width;
64  unsigned int height;
65 
66  unsigned int jpeg_bytes;
67 
68  const char *filename;
69 
71  CompressionDestination compdest;
72 };
73 
74 } // end namespace firevision
75 
76 #endif
firevision::JpegImageCompressor::JpegColorspace
JpegColorspace
JPEG color space.
Definition: jpeg_compressor.h:35
firevision::JpegImageCompressor::JPEG_CS_RGB
@ JPEG_CS_RGB
RGB.
Definition: jpeg_compressor.h:36
firevision::JpegImageCompressorLibJpeg::JpegImageCompressorLibJpeg
JpegImageCompressorLibJpeg(unsigned int quality=80, JpegImageCompressor::JpegColorspace jcs=JpegImageCompressor::JPEG_CS_RGB)
Constructor.
Definition: jpeg_compressor_libjpeg.cpp:198
firevision::JpegImageCompressorLibJpeg::set_destination_buffer
virtual void set_destination_buffer(unsigned char *buf, unsigned int buf_size)
Set destination buffer (if compressing to memory).
Definition: jpeg_compressor_libjpeg.cpp:368
firevision::JpegImageCompressorLibJpeg::~JpegImageCompressorLibJpeg
virtual ~JpegImageCompressorLibJpeg()
Destructor.
Definition: jpeg_compressor_libjpeg.cpp:206
firevision::JpegImageCompressorLibJpeg::compressed_size
virtual size_t compressed_size()
Get compressed size.
Definition: jpeg_compressor_libjpeg.cpp:375
firevision::JpegImageCompressorLibJpeg::set_vflip
virtual void set_vflip(bool enable)
Enable or disable vflipping.
Definition: jpeg_compressor_libjpeg.cpp:217
firevision::ImageCompressor
Image compressor interface.
Definition: imagecompressor.h:33
firevision::JpegImageCompressorLibJpeg::recommended_compressed_buffer_size
virtual size_t recommended_compressed_buffer_size()
Get the recommended size for the compressed buffer.
Definition: jpeg_compressor_libjpeg.cpp:381
firevision::JpegImageCompressorLibJpeg::set_filename
virtual void set_filename(const char *filename)
Set file name.
Definition: jpeg_compressor_libjpeg.cpp:387
firevision::JpegImageCompressorLibJpeg::supports_vflip
virtual bool supports_vflip()
Check if image compressor can do vflip during compress.
Definition: jpeg_compressor_libjpeg.cpp:211
firevision::JpegImageCompressorLibJpeg::set_image_buffer
virtual void set_image_buffer(colorspace_t cspace, unsigned char *buffer)
Set image buffer to compress.
Definition: jpeg_compressor_libjpeg.cpp:347
firevision::JpegImageCompressorLibJpeg::supports_compression_destination
virtual bool supports_compression_destination(ImageCompressor::CompressionDestination cd)
Check if compressor supports desired compression destination.
Definition: jpeg_compressor_libjpeg.cpp:361
firevision::JpegImageCompressorLibJpeg::set_compression_destination
virtual void set_compression_destination(ImageCompressor::CompressionDestination cd)
Set compression destination.
Definition: jpeg_compressor_libjpeg.cpp:355
firevision::JpegImageCompressorLibJpeg::compress
virtual void compress()
Compress image.
Definition: jpeg_compressor_libjpeg.cpp:223
firevision::ImageCompressor::CompressionDestination
CompressionDestination
Where to put the compressed image.
Definition: imagecompressor.h:36
firevision::JpegImageCompressorLibJpeg::set_image_dimensions
virtual void set_image_dimensions(unsigned int width, unsigned int height)
Set dimensions of image to compress.
Definition: jpeg_compressor_libjpeg.cpp:340
firevision::JpegImageCompressorLibJpeg
Jpeg image compressor.
Definition: jpeg_compressor_libjpeg.h:36