| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef INPUTIMAGE_H
- #define INPUTIMAGE_H
- #include <string>
- #include <vector>
- #include <jpeglib.h>
- class inputImage
- {
- public:
- inputImage();
- void setImageData(const std::string& data);
- unsigned int width() const;
- unsigned int height() const;
- unsigned int strideX() const;
- unsigned int strideY() const;
- const std::vector<char>& data() const;
- private:
- struct source_mgr
- {
- struct jpeg_source_mgr pub;
- const JOCTET *data;
- size_t len;
- };
- typedef source_mgr* source_mgr_ptr;
- private:
- static void init_source(j_decompress_ptr pCinfo);
- static boolean fill_input_buffer(j_decompress_ptr pCinfo);
- static void skip_input_data(j_decompress_ptr pCinfo, long numBytes);
- static void term_source(j_decompress_ptr pCinfo);
- void setSourceMgr(j_decompress_ptr pCinfo, const char* pData, size_t len) const;
- void decompressImage(const char* pData, size_t len);
- private:
- unsigned int m_width;
- unsigned int m_height;
- unsigned int m_strideX;
- unsigned int m_strideY;
- std::vector<char> m_data;
- };
- #endif // INPUTIMAGE_H
|