Dan Sinclair | 0bb1333 | 2017-03-30 16:12:02 -0400 | [diff] [blame^] | 1 | // Copyright 2017 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
| 7 | #ifndef CORE_FXCODEC_CODEC_CJPX_DECODER_H_ |
| 8 | #define CORE_FXCODEC_CODEC_CJPX_DECODER_H_ |
| 9 | |
| 10 | #include <vector> |
| 11 | |
| 12 | #include "third_party/libopenjpeg20/openjpeg.h" |
| 13 | |
| 14 | class CPDF_ColorSpace; |
| 15 | |
| 16 | class CJPX_Decoder { |
| 17 | public: |
| 18 | explicit CJPX_Decoder(CPDF_ColorSpace* cs); |
| 19 | ~CJPX_Decoder(); |
| 20 | |
| 21 | bool Init(const unsigned char* src_data, uint32_t src_size); |
| 22 | void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components); |
| 23 | bool Decode(uint8_t* dest_buf, |
| 24 | int pitch, |
| 25 | const std::vector<uint8_t>& offsets); |
| 26 | |
| 27 | private: |
| 28 | const uint8_t* m_SrcData; |
| 29 | uint32_t m_SrcSize; |
| 30 | opj_image_t* image; |
| 31 | opj_codec_t* l_codec; |
| 32 | opj_stream_t* l_stream; |
| 33 | const CPDF_ColorSpace* const m_ColorSpace; |
| 34 | }; |
| 35 | |
| 36 | #endif // CORE_FXCODEC_CODEC_CJPX_DECODER_H_ |