1
0

inputImage.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef INPUTIMAGE_H
  2. #define INPUTIMAGE_H
  3. #include <string>
  4. #include <vector>
  5. #include <jpeglib.h>
  6. class inputImage
  7. {
  8. public:
  9. inputImage();
  10. void setImageData(const std::string& data);
  11. unsigned int width() const;
  12. unsigned int height() const;
  13. unsigned int strideX() const;
  14. unsigned int strideY() const;
  15. const std::vector<char>& data() const;
  16. private:
  17. struct source_mgr
  18. {
  19. struct jpeg_source_mgr pub;
  20. const JOCTET *data;
  21. size_t len;
  22. };
  23. typedef source_mgr* source_mgr_ptr;
  24. private:
  25. static void init_source(j_decompress_ptr pCinfo);
  26. static boolean fill_input_buffer(j_decompress_ptr pCinfo);
  27. static void skip_input_data(j_decompress_ptr pCinfo, long numBytes);
  28. static void term_source(j_decompress_ptr pCinfo);
  29. void setSourceMgr(j_decompress_ptr pCinfo, const char* pData, size_t len) const;
  30. void decompressImage(const char* pData, size_t len);
  31. private:
  32. unsigned int m_width;
  33. unsigned int m_height;
  34. unsigned int m_strideX;
  35. unsigned int m_strideY;
  36. std::vector<char> m_data;
  37. };
  38. #endif // INPUTIMAGE_H