| 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; |  | 
| 33   ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, | 25   ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, | 
| 34                                                  FX_DWORD src_size, | 26                                                  FX_DWORD src_size, | 
| 35                                                  int width, | 27                                                  int width, | 
| 36                                                  int height, | 28                                                  int height, | 
| 37                                                  int nComps, | 29                                                  int nComps, | 
| 38                                                  int bpc) override; | 30                                                  int bpc) override; | 
| 39 }; | 31 }; | 
| 40 | 32 | 
| 41 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { | 33 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { | 
| 42  public: | 34  public: | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 106   ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 98   ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 
| 107                                         FX_DWORD src_size, | 99                                         FX_DWORD src_size, | 
| 108                                         int width, | 100                                         int width, | 
| 109                                         int height, | 101                                         int height, | 
| 110                                         int K, | 102                                         int K, | 
| 111                                         FX_BOOL EndOfLine, | 103                                         FX_BOOL EndOfLine, | 
| 112                                         FX_BOOL EncodedByteAlign, | 104                                         FX_BOOL EncodedByteAlign, | 
| 113                                         FX_BOOL BlackIs1, | 105                                         FX_BOOL BlackIs1, | 
| 114                                         int Columns, | 106                                         int Columns, | 
| 115                                         int Rows) override; | 107                                         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; |  | 
| 122 }; | 108 }; | 
| 123 | 109 | 
| 124 class CCodec_FlateModule : public ICodec_FlateModule { | 110 class CCodec_FlateModule : public ICodec_FlateModule { | 
| 125  public: | 111  public: | 
| 126   virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 112   virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 
| 127                                                 FX_DWORD src_size, | 113                                                 FX_DWORD src_size, | 
| 128                                                 int width, | 114                                                 int width, | 
| 129                                                 int height, | 115                                                 int height, | 
| 130                                                 int nComps, | 116                                                 int nComps, | 
| 131                                                 int bpc, | 117                                                 int bpc, | 
| 132                                                 int predictor, | 118                                                 int predictor, | 
| 133                                                 int Colors, | 119                                                 int Colors, | 
| 134                                                 int BitsPerComponent, | 120                                                 int BitsPerComponent, | 
| 135                                                 int Columns); | 121                                                 int Columns); | 
| 136   virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, | 122   virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, | 
| 137                                     const uint8_t* src_buf, | 123                                     const uint8_t* src_buf, | 
| 138                                     FX_DWORD src_size, | 124                                     FX_DWORD src_size, | 
| 139                                     FX_BOOL bEarlyChange, | 125                                     FX_BOOL bEarlyChange, | 
| 140                                     int predictor, | 126                                     int predictor, | 
| 141                                     int Colors, | 127                                     int Colors, | 
| 142                                     int BitsPerComponent, | 128                                     int BitsPerComponent, | 
| 143                                     int Columns, | 129                                     int Columns, | 
| 144                                     FX_DWORD estimated_size, | 130                                     FX_DWORD estimated_size, | 
| 145                                     uint8_t*& dest_buf, | 131                                     uint8_t*& dest_buf, | 
| 146                                     FX_DWORD& dest_size); | 132                                     FX_DWORD& dest_size); | 
| 147   virtual FX_BOOL Encode(const uint8_t* src_buf, | 133   virtual 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, | 
| 148                          FX_DWORD src_size, | 138                          FX_DWORD src_size, | 
| 149                          int predictor, | 139                          uint8_t** dest_buf, | 
| 150                          int Colors, | 140                          FX_DWORD* dest_size); | 
| 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); |  | 
| 159 }; | 141 }; | 
| 160 | 142 | 
| 161 class CCodec_JpegModule : public ICodec_JpegModule { | 143 class CCodec_JpegModule : public ICodec_JpegModule { | 
| 162  public: | 144  public: | 
| 163   CCodec_JpegModule() {} | 145   CCodec_JpegModule() {} | 
| 164   ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 146   ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 
| 165                                         FX_DWORD src_size, | 147                                         FX_DWORD src_size, | 
| 166                                         int width, | 148                                         int width, | 
| 167                                         int height, | 149                                         int height, | 
| 168                                         int nComps, | 150                                         int nComps, | 
| 169                                         FX_BOOL ColorTransform) override; | 151                                         FX_BOOL ColorTransform) override; | 
| 170   FX_BOOL LoadInfo(const uint8_t* src_buf, | 152   bool LoadInfo(const uint8_t* src_buf, | 
| 171                    FX_DWORD src_size, | 153                 FX_DWORD src_size, | 
| 172                    int& width, | 154                 int* width, | 
| 173                    int& height, | 155                 int* height, | 
| 174                    int& num_components, | 156                 int* num_components, | 
| 175                    int& bits_per_components, | 157                 int* bits_per_components, | 
| 176                    FX_BOOL& color_transform, | 158                 bool* color_transform) override; | 
| 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; |  | 
| 185   void* Start() override; | 159   void* Start() override; | 
| 186   void Finish(void* pContext) override; | 160   void Finish(void* pContext) override; | 
| 187   void Input(void* pContext, | 161   void Input(void* pContext, | 
| 188              const uint8_t* src_buf, | 162              const uint8_t* src_buf, | 
| 189              FX_DWORD src_size) override; | 163              FX_DWORD src_size) override; | 
| 190   int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; | 164   int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; | 
| 191   int StartScanline(void* pContext, int down_scale) override; | 165   int StartScanline(void* pContext, int down_scale) override; | 
| 192   FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; | 166   FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; | 
| 193   FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; | 167   FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; | 
| 194 }; | 168 }; | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 321 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, | 295 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, | 
| 322                                 OPJ_SIZE_T nb_bytes, | 296                                 OPJ_SIZE_T nb_bytes, | 
| 323                                 void* p_user_data); | 297                                 void* p_user_data); | 
| 324 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, | 298 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, | 
| 325                                  OPJ_SIZE_T nb_bytes, | 299                                  OPJ_SIZE_T nb_bytes, | 
| 326                                  void* p_user_data); | 300                                  void* p_user_data); | 
| 327 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 301 OPJ_OFF_T opj_skip_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); | 302 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 
| 329 | 303 | 
| 330 #endif  // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 304 #endif  // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 
| OLD | NEW | 
|---|