| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 7 #ifndef CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
| 8 #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 8 #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
| 9 | 9 |
| 10 #include <limits.h> | 10 #include <limits.h> |
| 11 #include <list> | 11 #include <list> |
| 12 #include <map> | 12 #include <map> |
| 13 | 13 |
| 14 #include "core/include/fxcodec/fx_codec.h" | 14 #include "core/include/fxcodec/fx_codec.h" |
| 15 #include "core/src/fxcodec/jbig2/JBig2_Context.h" | 15 #include "core/src/fxcodec/jbig2/JBig2_Context.h" |
| 16 #include "third_party/base/nonstd_unique_ptr.h" | 16 #include "third_party/base/nonstd_unique_ptr.h" |
| 17 #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. | 17 #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. |
| 18 | 18 |
| 19 class CFX_IccProfileCache; | 19 class CFX_IccProfileCache; |
| 20 class CFX_IccTransformCache; | 20 class CFX_IccTransformCache; |
| 21 | 21 |
| 22 class CCodec_BasicModule : public ICodec_BasicModule { | 22 class CCodec_BasicModule : public ICodec_BasicModule { |
| 23 public: | 23 public: |
| 24 // ICodec_BasicModule: | 24 // ICodec_BasicModule: |
| 25 FX_BOOL RunLengthEncode(const uint8_t* src_buf, |
| 26 FX_DWORD src_size, |
| 27 uint8_t*& dest_buf, |
| 28 FX_DWORD& dest_size) override; |
| 29 FX_BOOL A85Encode(const uint8_t* src_buf, |
| 30 FX_DWORD src_size, |
| 31 uint8_t*& dest_buf, |
| 32 FX_DWORD& dest_size) override; |
| 25 ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, | 33 ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, |
| 26 FX_DWORD src_size, | 34 FX_DWORD src_size, |
| 27 int width, | 35 int width, |
| 28 int height, | 36 int height, |
| 29 int nComps, | 37 int nComps, |
| 30 int bpc) override; | 38 int bpc) override; |
| 31 }; | 39 }; |
| 32 | 40 |
| 33 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { | 41 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { |
| 34 public: | 42 public: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 106 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
| 99 FX_DWORD src_size, | 107 FX_DWORD src_size, |
| 100 int width, | 108 int width, |
| 101 int height, | 109 int height, |
| 102 int K, | 110 int K, |
| 103 FX_BOOL EndOfLine, | 111 FX_BOOL EndOfLine, |
| 104 FX_BOOL EncodedByteAlign, | 112 FX_BOOL EncodedByteAlign, |
| 105 FX_BOOL BlackIs1, | 113 FX_BOOL BlackIs1, |
| 106 int Columns, | 114 int Columns, |
| 107 int Rows) override; | 115 int Rows) override; |
| 116 FX_BOOL Encode(const uint8_t* src_buf, |
| 117 int width, |
| 118 int height, |
| 119 int pitch, |
| 120 uint8_t*& dest_buf, |
| 121 FX_DWORD& dest_size) override; |
| 108 }; | 122 }; |
| 109 | 123 |
| 110 class CCodec_FlateModule : public ICodec_FlateModule { | 124 class CCodec_FlateModule : public ICodec_FlateModule { |
| 111 public: | 125 public: |
| 112 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 126 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
| 113 FX_DWORD src_size, | 127 FX_DWORD src_size, |
| 114 int width, | 128 int width, |
| 115 int height, | 129 int height, |
| 116 int nComps, | 130 int nComps, |
| 117 int bpc, | 131 int bpc, |
| 118 int predictor, | 132 int predictor, |
| 119 int Colors, | 133 int Colors, |
| 120 int BitsPerComponent, | 134 int BitsPerComponent, |
| 121 int Columns); | 135 int Columns); |
| 122 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, | 136 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, |
| 123 const uint8_t* src_buf, | 137 const uint8_t* src_buf, |
| 124 FX_DWORD src_size, | 138 FX_DWORD src_size, |
| 125 FX_BOOL bEarlyChange, | 139 FX_BOOL bEarlyChange, |
| 126 int predictor, | 140 int predictor, |
| 127 int Colors, | 141 int Colors, |
| 128 int BitsPerComponent, | 142 int BitsPerComponent, |
| 129 int Columns, | 143 int Columns, |
| 130 FX_DWORD estimated_size, | 144 FX_DWORD estimated_size, |
| 131 uint8_t*& dest_buf, | 145 uint8_t*& dest_buf, |
| 132 FX_DWORD& dest_size); | 146 FX_DWORD& dest_size); |
| 133 virtual bool Encode(const uint8_t* src_buf, | 147 virtual FX_BOOL Encode(const uint8_t* src_buf, |
| 134 FX_DWORD src_size, | |
| 135 uint8_t** dest_buf, | |
| 136 FX_DWORD* dest_size); | |
| 137 virtual bool PngEncode(const uint8_t* src_buf, | |
| 138 FX_DWORD src_size, | 148 FX_DWORD src_size, |
| 139 uint8_t** dest_buf, | 149 int predictor, |
| 140 FX_DWORD* dest_size); | 150 int Colors, |
| 151 int BitsPerComponent, |
| 152 int Columns, |
| 153 uint8_t*& dest_buf, |
| 154 FX_DWORD& dest_size); |
| 155 virtual FX_BOOL Encode(const uint8_t* src_buf, |
| 156 FX_DWORD src_size, |
| 157 uint8_t*& dest_buf, |
| 158 FX_DWORD& dest_size); |
| 141 }; | 159 }; |
| 142 | 160 |
| 143 class CCodec_JpegModule : public ICodec_JpegModule { | 161 class CCodec_JpegModule : public ICodec_JpegModule { |
| 144 public: | 162 public: |
| 145 CCodec_JpegModule() {} | 163 CCodec_JpegModule() {} |
| 146 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 164 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
| 147 FX_DWORD src_size, | 165 FX_DWORD src_size, |
| 148 int width, | 166 int width, |
| 149 int height, | 167 int height, |
| 150 int nComps, | 168 int nComps, |
| 151 FX_BOOL ColorTransform) override; | 169 FX_BOOL ColorTransform) override; |
| 152 bool LoadInfo(const uint8_t* src_buf, | 170 FX_BOOL LoadInfo(const uint8_t* src_buf, |
| 153 FX_DWORD src_size, | 171 FX_DWORD src_size, |
| 154 int* width, | 172 int& width, |
| 155 int* height, | 173 int& height, |
| 156 int* num_components, | 174 int& num_components, |
| 157 int* bits_per_components, | 175 int& bits_per_components, |
| 158 bool* color_transform) override; | 176 FX_BOOL& color_transform, |
| 177 uint8_t** icc_buf_ptr, |
| 178 FX_DWORD* icc_length) override; |
| 179 FX_BOOL Encode(const CFX_DIBSource* pSource, |
| 180 uint8_t*& dest_buf, |
| 181 FX_STRSIZE& dest_size, |
| 182 int quality, |
| 183 const uint8_t* icc_buf, |
| 184 FX_DWORD icc_length) override; |
| 159 void* Start() override; | 185 void* Start() override; |
| 160 void Finish(void* pContext) override; | 186 void Finish(void* pContext) override; |
| 161 void Input(void* pContext, | 187 void Input(void* pContext, |
| 162 const uint8_t* src_buf, | 188 const uint8_t* src_buf, |
| 163 FX_DWORD src_size) override; | 189 FX_DWORD src_size) override; |
| 164 int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; | 190 int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; |
| 165 int StartScanline(void* pContext, int down_scale) override; | 191 int StartScanline(void* pContext, int down_scale) override; |
| 166 FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; | 192 FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; |
| 167 FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; | 193 FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; |
| 168 }; | 194 }; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, | 321 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, |
| 296 OPJ_SIZE_T nb_bytes, | 322 OPJ_SIZE_T nb_bytes, |
| 297 void* p_user_data); | 323 void* p_user_data); |
| 298 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, | 324 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, |
| 299 OPJ_SIZE_T nb_bytes, | 325 OPJ_SIZE_T nb_bytes, |
| 300 void* p_user_data); | 326 void* p_user_data); |
| 301 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 327 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
| 302 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 328 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
| 303 | 329 |
| 304 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 330 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
| OLD | NEW |