#ifndef INPUTIMAGE_H #define INPUTIMAGE_H #include #include #include 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& 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 m_data; }; #endif // INPUTIMAGE_H