blob: 39ebd4a759aa1f2645d86af4f7b994654a988280 [file] [log] [blame]
Constantin Kaplinsky39e31a12007-12-13 19:16:33 +00001#ifndef __IRIXCLJPEGCOMPRESSOR_H__
2#define __IRIXCLJPEGCOMPRESSOR_H__
3
4#include <sys/types.h>
Constantin Kaplinsky51e66522007-12-19 06:25:06 +00005#include <dmedia/cl.h>
Constantin Kaplinsky39e31a12007-12-13 19:16:33 +00006
7#include <rdr/types.h>
8#include <rfb/PixelFormat.h>
9
10#include <rfb/JpegCompressor.h>
11
12namespace rfb {
13
14 //
15 // A C++ class for performing JPEG compression.
16 // This implementation uses IRIX Compression Library (CL).
17 //
18
19 class IrixCLJpegCompressor : public JpegCompressor
20 {
21 public:
22 IrixCLJpegCompressor();
23 virtual ~IrixCLJpegCompressor();
24
25 // Check if the object has been created successfully.
Constantin Kaplinsky51e66522007-12-19 06:25:06 +000026 bool isValid() const { return m_clHandleValid; }
Constantin Kaplinsky39e31a12007-12-13 19:16:33 +000027
28 // Set JPEG quality level (0..100).
29 virtual void setQuality(int level);
30
31 // Actually compress the image.
32 virtual void compress(const rdr::U32 *buf, const PixelFormat *fmt,
33 int w, int h, int stride);
34
35 // Access results of the compression.
36 virtual size_t getDataLength() { return m_compressedLength; }
37 virtual const char *getDataPtr() { return m_compressedData; }
38
39 protected:
40 static const int DEFAULT_QUALITY;
41 int m_quality;
42
Constantin Kaplinsky51e66522007-12-19 06:25:06 +000043 CLhandle m_clHandle;
44 bool m_clHandleValid;
45
46 int m_srcBufferSize;
47 int m_dstBufferSize;
48
49 rdr::U32 *m_sourceData;
Constantin Kaplinsky39e31a12007-12-13 19:16:33 +000050 char *m_compressedData;
Constantin Kaplinsky51e66522007-12-19 06:25:06 +000051
Constantin Kaplinsky39e31a12007-12-13 19:16:33 +000052 size_t m_compressedLength;
53 };
54
55}
56
57#endif // __IRIXCLJPEGCOMPRESSOR_H__
58