Constantin Kaplinsky | 39e31a1 | 2007-12-13 19:16:33 +0000 | [diff] [blame] | 1 | #ifndef __IRIXCLJPEGCOMPRESSOR_H__ |
| 2 | #define __IRIXCLJPEGCOMPRESSOR_H__ |
| 3 | |
| 4 | #include <sys/types.h> |
Constantin Kaplinsky | 51e6652 | 2007-12-19 06:25:06 +0000 | [diff] [blame^] | 5 | #include <dmedia/cl.h> |
Constantin Kaplinsky | 39e31a1 | 2007-12-13 19:16:33 +0000 | [diff] [blame] | 6 | |
| 7 | #include <rdr/types.h> |
| 8 | #include <rfb/PixelFormat.h> |
| 9 | |
| 10 | #include <rfb/JpegCompressor.h> |
| 11 | |
| 12 | namespace 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 Kaplinsky | 51e6652 | 2007-12-19 06:25:06 +0000 | [diff] [blame^] | 26 | bool isValid() const { return m_clHandleValid; } |
Constantin Kaplinsky | 39e31a1 | 2007-12-13 19:16:33 +0000 | [diff] [blame] | 27 | |
| 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 Kaplinsky | 51e6652 | 2007-12-19 06:25:06 +0000 | [diff] [blame^] | 43 | CLhandle m_clHandle; |
| 44 | bool m_clHandleValid; |
| 45 | |
| 46 | int m_srcBufferSize; |
| 47 | int m_dstBufferSize; |
| 48 | |
| 49 | rdr::U32 *m_sourceData; |
Constantin Kaplinsky | 39e31a1 | 2007-12-13 19:16:33 +0000 | [diff] [blame] | 50 | char *m_compressedData; |
Constantin Kaplinsky | 51e6652 | 2007-12-19 06:25:06 +0000 | [diff] [blame^] | 51 | |
Constantin Kaplinsky | 39e31a1 | 2007-12-13 19:16:33 +0000 | [diff] [blame] | 52 | size_t m_compressedLength; |
| 53 | }; |
| 54 | |
| 55 | } |
| 56 | |
| 57 | #endif // __IRIXCLJPEGCOMPRESSOR_H__ |
| 58 | |