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_INCLUDE_FXCODEC_FX_CODEC_H_ | 7 #ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |
8 #define CORE_INCLUDE_FXCODEC_FX_CODEC_H_ | 8 #define CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |
9 | 9 |
10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 ICodec_Jbig2Module* m_pJbig2Module; | 78 ICodec_Jbig2Module* m_pJbig2Module; |
79 ICodec_IccModule* m_pIccModule; | 79 ICodec_IccModule* m_pIccModule; |
80 ICodec_FlateModule* m_pFlateModule; | 80 ICodec_FlateModule* m_pFlateModule; |
81 | 81 |
82 }; | 82 }; |
83 class ICodec_BasicModule | 83 class ICodec_BasicModule |
84 { | 84 { |
85 public: | 85 public: |
86 | 86 |
87 virtual ~ICodec_BasicModule() {} | 87 virtual ~ICodec_BasicModule() {} |
88 virtual FX_BOOL» RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_siz
e, FX_LPBYTE& dest_buf, | 88 virtual FX_BOOL» RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_siz
e, uint8_t*& dest_buf, |
89 FX_DWORD& dest_size) = 0; | 89 FX_DWORD& dest_size) = 0; |
90 virtual FX_BOOL» A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_
LPBYTE& dest_buf, | 90 virtual FX_BOOL» A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uin
t8_t*& dest_buf, |
91 FX_DWORD& dest_size) = 0; | 91 FX_DWORD& dest_size) = 0; |
92 virtual ICodec_ScanlineDecoder*» CreateRunLengthDecoder(FX_LPCBYTE src_bu
f, FX_DWORD src_size, int width, int height, | 92 virtual ICodec_ScanlineDecoder*» CreateRunLengthDecoder(const uint8_t* sr
c_buf, FX_DWORD src_size, int width, int height, |
93 int nComps, int bpc) = 0; | 93 int nComps, int bpc) = 0; |
94 }; | 94 }; |
95 class ICodec_ScanlineDecoder | 95 class ICodec_ScanlineDecoder |
96 { | 96 { |
97 public: | 97 public: |
98 | 98 |
99 virtual ~ICodec_ScanlineDecoder() {} | 99 virtual ~ICodec_ScanlineDecoder() {} |
100 | 100 |
101 virtual FX_DWORD GetSrcOffset() = 0; | 101 virtual FX_DWORD GetSrcOffset() = 0; |
102 | 102 |
103 virtual void DownScale(int dest_width, int dest_height) = 0; | 103 virtual void DownScale(int dest_width, int dest_height) = 0; |
104 | 104 |
105 virtual FX_LPBYTE» GetScanline(int line) = 0; | 105 virtual uint8_t*» GetScanline(int line) = 0; |
106 | 106 |
107 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; | 107 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; |
108 | 108 |
109 virtual int GetWidth() = 0; | 109 virtual int GetWidth() = 0; |
110 | 110 |
111 virtual int GetHeight() = 0; | 111 virtual int GetHeight() = 0; |
112 | 112 |
113 virtual int CountComps() = 0; | 113 virtual int CountComps() = 0; |
114 | 114 |
115 virtual int GetBPC() = 0; | 115 virtual int GetBPC() = 0; |
116 | 116 |
117 virtual FX_BOOL IsColorTransformed() = 0; | 117 virtual FX_BOOL IsColorTransformed() = 0; |
118 | 118 |
119 virtual void ClearImageData() = 0; | 119 virtual void ClearImageData() = 0; |
120 }; | 120 }; |
121 class ICodec_FlateModule | 121 class ICodec_FlateModule |
122 { | 122 { |
123 public: | 123 public: |
124 | 124 |
125 virtual ~ICodec_FlateModule() {} | 125 virtual ~ICodec_FlateModule() {} |
126 virtual ICodec_ScanlineDecoder*» CreateDecoder(FX_LPCBYTE src_buf, FX_DWO
RD src_size, int width, int height, | 126 virtual ICodec_ScanlineDecoder*» CreateDecoder(const uint8_t* src_buf, FX
_DWORD src_size, int width, int height, |
127 int nComps, int bpc, int predictor, int Colors, int BitsPerComponent
, int Columns) = 0; | 127 int nComps, int bpc, int predictor, int Colors, int BitsPerComponent
, int Columns) = 0; |
128 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, F
X_DWORD src_size, FX_BOOL bEarlyChange, | 128 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, F
X_DWORD src_size, FX_BOOL bEarlyChange, |
129 int predictor, int Colors, int BitsPerC
omponent, int Columns, | 129 int predictor, int Colors, int BitsPerC
omponent, int Columns, |
130 FX_DWORD estimated_size, FX_LPBYTE& des
t_buf, FX_DWORD& dest_size) = 0; | 130 FX_DWORD estimated_size, uint8_t*& dest
_buf, FX_DWORD& dest_size) = 0; |
131 virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size
, | 131 virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size
, |
132 int predictor, int Colors, int BitsPerComponent,
int Columns, | 132 int predictor, int Colors, int BitsPerComponent,
int Columns, |
133 FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; | 133 uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; |
134 virtual FX_BOOL» » Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX
_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; | 134 virtual FX_BOOL» » Encode(const uint8_t* src_buf, FX_DWORD src_size
, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; |
135 }; | 135 }; |
136 class ICodec_FaxModule | 136 class ICodec_FaxModule |
137 { | 137 { |
138 public: | 138 public: |
139 | 139 |
140 virtual ~ICodec_FaxModule() {} | 140 virtual ~ICodec_FaxModule() {} |
141 | 141 |
142 virtual ICodec_ScanlineDecoder*» CreateDecoder(FX_LPCBYTE src_buf, FX_DWO
RD src_size, int width, int height, | 142 virtual ICodec_ScanlineDecoder*» CreateDecoder(const uint8_t* src_buf, FX
_DWORD src_size, int width, int height, |
143 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1
, int Columns, int Rows) = 0; | 143 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1
, int Columns, int Rows) = 0; |
144 | 144 |
145 | 145 |
146 virtual FX_BOOL» » Encode(FX_LPCBYTE src_buf, int width, int height
, int pitch, | 146 virtual FX_BOOL» » Encode(const uint8_t* src_buf, int width, int he
ight, int pitch, |
147 FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; | 147 uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; |
148 }; | 148 }; |
149 class ICodec_JpegModule | 149 class ICodec_JpegModule |
150 { | 150 { |
151 public: | 151 public: |
152 | 152 |
153 virtual ~ICodec_JpegModule() {} | 153 virtual ~ICodec_JpegModule() {} |
154 | 154 |
155 virtual void SetPovider(IFX_JpegProvider* pJP) = 0; | 155 virtual void SetPovider(IFX_JpegProvider* pJP) = 0; |
156 | 156 |
157 virtual ICodec_ScanlineDecoder*» CreateDecoder(FX_LPCBYTE src_buf, FX_DWO
RD src_size, | 157 virtual ICodec_ScanlineDecoder*» CreateDecoder(const uint8_t* src_buf, FX
_DWORD src_size, |
158 int width, int height, int nComps, FX_BOOL ColorTransform) = 0; | 158 int width, int height, int nComps, FX_BOOL ColorTransform) = 0; |
159 | 159 |
160 virtual FX_BOOL» » LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size,
int& width, int& height, | 160 virtual FX_BOOL» » LoadInfo(const uint8_t* src_buf, FX_DWORD src_si
ze, int& width, int& height, |
161 int& num_components, int& bits_per_components,
FX_BOOL& color_transform, | 161 int& num_components, int& bits_per_components,
FX_BOOL& color_transform, |
162 FX_LPBYTE* icc_buf_ptr = NULL, FX_DWORD* icc_le
ngth = NULL) = 0; | 162 uint8_t** icc_buf_ptr = NULL, FX_DWORD* icc_len
gth = NULL) = 0; |
163 | 163 |
164 virtual FX_BOOL» » Encode(const class CFX_DIBSource* pSource, FX_LP
BYTE& dest_buf, FX_STRSIZE& dest_size, int quality = 75, | 164 virtual FX_BOOL» » Encode(const class CFX_DIBSource* pSource, uint8
_t*& dest_buf, FX_STRSIZE& dest_size, int quality = 75, |
165 FX_LPCBYTE icc_buf = NULL, FX_DWORD icc_length =
0) = 0; | 165 const uint8_t* icc_buf = NULL, FX_DWORD icc_lengt
h = 0) = 0; |
166 | 166 |
167 virtual void* Start() = 0; | 167 virtual void* Start() = 0; |
168 | 168 |
169 virtual void Finish(void* pContext) = 0; | 169 virtual void Finish(void* pContext) = 0; |
170 | 170 |
171 virtual void» » Input(void* pContext, FX_LPCBYTE src_buf, FX_DWO
RD src_size) = 0; | 171 virtual void» » Input(void* pContext, const uint8_t* src_buf, FX
_DWORD src_size) = 0; |
172 | 172 |
173 virtual int ReadHeader(void* pContext, int* width, int* heig
ht, int* nComps) = 0; | 173 virtual int ReadHeader(void* pContext, int* width, int* heig
ht, int* nComps) = 0; |
174 | 174 |
175 | 175 |
176 virtual int StartScanline(void* pContext, int down_scale) =
0; | 176 virtual int StartScanline(void* pContext, int down_scale) =
0; |
177 | 177 |
178 | 178 |
179 virtual FX_BOOL» » ReadScanline(void* pContext, FX_LPBYTE dest_buf)
= 0; | 179 virtual FX_BOOL» » ReadScanline(void* pContext, uint8_t* dest_buf)
= 0; |
180 | 180 |
181 | 181 |
182 virtual FX_DWORD» GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr =
NULL) = 0; | 182 virtual FX_DWORD» GetAvailInput(void* pContext, uint8_t** avail_buf_ptr =
NULL) = 0; |
183 }; | 183 }; |
184 class ICodec_JpxModule | 184 class ICodec_JpxModule |
185 { | 185 { |
186 public: | 186 public: |
187 | 187 |
188 virtual ~ICodec_JpxModule() {} | 188 virtual ~ICodec_JpxModule() {} |
189 | 189 |
190 virtual FX_LPVOID » CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_
BOOL useColorSpace = FALSE) = 0; | 190 virtual void* » CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size,
FX_BOOL useColorSpace = FALSE) = 0; |
191 | 191 |
192 virtual void» » GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_
DWORD& height, | 192 virtual void» » GetImageInfo(void* ctx, FX_DWORD& width, FX_DWOR
D& height, |
193 FX_DWORD& codestream_nComps, FX_DWORD& outp
ut_nComps) = 0; | 193 FX_DWORD& codestream_nComps, FX_DWORD& outp
ut_nComps) = 0; |
194 | 194 |
195 virtual FX_BOOL» » Decode(FX_LPVOID ctx, FX_LPBYTE dest_data, int p
itch, | 195 virtual FX_BOOL» » Decode(void* ctx, uint8_t* dest_data, int pitch, |
196 FX_BOOL bTranslateColor, FX_LPBYTE offsets) = 0; | 196 FX_BOOL bTranslateColor, uint8_t* offsets) = 0; |
197 | 197 |
198 virtual void» » DestroyDecoder(FX_LPVOID ctx) = 0; | 198 virtual void» » DestroyDecoder(void* ctx) = 0; |
199 }; | 199 }; |
200 class ICodec_Jbig2Module | 200 class ICodec_Jbig2Module |
201 { | 201 { |
202 public: | 202 public: |
203 | 203 |
204 virtual ~ICodec_Jbig2Module() {} | 204 virtual ~ICodec_Jbig2Module() {} |
205 | 205 |
206 virtual FX_BOOL» » Decode(FX_DWORD width, FX_DWORD height, FX_LPCBY
TE src_buf, FX_DWORD src_size, | 206 virtual FX_BOOL» » Decode(FX_DWORD width, FX_DWORD height, const ui
nt8_t* src_buf, FX_DWORD src_size, |
207 FX_LPCBYTE global_data, FX_DWORD global_size, FX_
LPBYTE dest_buf, FX_DWORD dest_pitch) = 0; | 207 const uint8_t* global_data, FX_DWORD global_size,
uint8_t* dest_buf, FX_DWORD dest_pitch) = 0; |
208 | 208 |
209 virtual FX_BOOL Decode(IFX_FileRead* file_ptr, FX_DWORD& width,
FX_DWORD& height, | 209 virtual FX_BOOL Decode(IFX_FileRead* file_ptr, FX_DWORD& width,
FX_DWORD& height, |
210 FX_DWORD& pitch, FX_LPBYTE& dest_buf) = 0; | 210 FX_DWORD& pitch, uint8_t*& dest_buf) = 0; |
211 virtual void* CreateJbig2Context() = 0; | 211 virtual void* CreateJbig2Context() = 0; |
212 | 212 |
213 virtual FXCODEC_STATUS» » StartDecode(void* pJbig2Context, FX_DWOR
D width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, | 213 virtual FXCODEC_STATUS» » StartDecode(void* pJbig2Context, FX_DWOR
D width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, |
214 FX_LPCBYTE global_data, FX_DWORD glo
bal_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) = 0; | 214 const uint8_t* global_data, FX_DWORD
global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) = 0; |
215 | 215 |
216 virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_Fil
eRead* file_ptr, | 216 virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_Fil
eRead* file_ptr, |
217 FX_DWORD& width, FX_DWORD& height, F
X_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause) = 0; | 217 FX_DWORD& width, FX_DWORD& height, F
X_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause) = 0; |
218 virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, IFX_
Pause* pPause) = 0; | 218 virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, IFX_
Pause* pPause) = 0; |
219 virtual void DestroyJbig2Context(void* pJbig2
Content) = 0; | 219 virtual void DestroyJbig2Context(void* pJbig2
Content) = 0; |
220 }; | 220 }; |
221 class ICodec_Jbig2Encoder | 221 class ICodec_Jbig2Encoder |
222 { | 222 { |
223 public: | 223 public: |
224 | 224 |
225 virtual ~ICodec_Jbig2Encoder() {} | 225 virtual ~ICodec_Jbig2Encoder() {} |
226 }; | 226 }; |
227 class ICodec_IccModule | 227 class ICodec_IccModule |
(...skipping 11 matching lines...) Expand all Loading... |
239 IccCS_Gray, | 239 IccCS_Gray, |
240 IccCS_Rgb, | 240 IccCS_Rgb, |
241 IccCS_Cmyk, | 241 IccCS_Cmyk, |
242 IccCS_Cmy | 242 IccCS_Cmy |
243 } IccCS; | 243 } IccCS; |
244 typedef struct _IccParam { | 244 typedef struct _IccParam { |
245 FX_DWORD Version; | 245 FX_DWORD Version; |
246 IccCS ColorSpace; | 246 IccCS ColorSpace; |
247 FX_DWORD dwProfileType; | 247 FX_DWORD dwProfileType; |
248 FX_DWORD dwFormat; | 248 FX_DWORD dwFormat; |
249 FX_LPBYTE» pProfileData; | 249 uint8_t*» pProfileData; |
250 FX_DWORD dwProfileSize; | 250 FX_DWORD dwProfileSize; |
251 double Gamma; | 251 double Gamma; |
252 } IccParam; | 252 } IccParam; |
253 | 253 |
254 virtual ~ICodec_IccModule() {} | 254 virtual ~ICodec_IccModule() {} |
255 | 255 |
256 virtual IccCS» » » GetProfileCS(FX_LPCBYTE pProfileData, un
signed int dwProfileSize) = 0; | 256 virtual IccCS» » » GetProfileCS(const uint8_t* pProfileData
, unsigned int dwProfileSize) = 0; |
257 | 257 |
258 virtual IccCS GetProfileCS(IFX_FileRead* pFile) = 0; | 258 virtual IccCS GetProfileCS(IFX_FileRead* pFile) = 0; |
259 | 259 |
260 virtual FX_LPVOID» CreateTransform(ICodec_IccModule::IccParam* pInputParam, | 260 virtual void*» CreateTransform(ICodec_IccModule::IccParam* pInputParam, |
261 ICodec_IccModule::IccParam* pOutputParam
, | 261 ICodec_IccModule::IccParam* pOutputParam
, |
262 ICodec_IccModule::IccParam* pProofParam
= NULL, | 262 ICodec_IccModule::IccParam* pProofParam
= NULL, |
263 FX_DWORD dwIntent = Icc_INTENT_PERCEPTUA
L, | 263 FX_DWORD dwIntent = Icc_INTENT_PERCEPTUA
L, |
264 FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, | 264 FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, |
265 FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLU
TE_COLORIMETRIC, | 265 FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLU
TE_COLORIMETRIC, |
266 FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOF
ING | 266 FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOF
ING |
267 ) = 0; | 267 ) = 0; |
268 | 268 |
269 | 269 |
270 virtual FX_LPVOID» CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD d
wProfileSize, int32_t& nComponents, int32_t intent = 0, | 270 virtual void*» CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWO
RD dwProfileSize, int32_t& nComponents, int32_t intent = 0, |
271 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; | 271 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; |
272 | 272 |
273 virtual FX_LPVOID» CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWOR
D dwSrcProfileSize, int32_t& nSrcComponents, | 273 virtual void*» CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_
DWORD dwSrcProfileSize, int32_t& nSrcComponents, |
274 FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t inten
t = 0, | 274 const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t i
ntent = 0, |
275 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, | 275 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, |
276 FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT | 276 FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT |
277 ) = 0; | 277 ) = 0; |
278 | 278 |
279 virtual void» » » DestroyTransform(FX_LPVOID pTransform) =
0; | 279 virtual void» » » DestroyTransform(void* pTransform) = 0; |
280 | 280 |
281 virtual void» » » Translate(FX_LPVOID pTransform, FX_FLOAT
* pSrcValues, FX_FLOAT* pDestValues) = 0; | 281 virtual void» » » Translate(void* pTransform, FX_FLOAT* pS
rcValues, FX_FLOAT* pDestValues) = 0; |
282 | 282 |
283 virtual void» » » TranslateScanline(FX_LPVOID pTransform,
FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels) = 0; | 283 virtual void» » » TranslateScanline(void* pTransform, uint
8_t* pDest, const uint8_t* pSrc, int pixels) = 0; |
284 virtual void SetComponents(FX_DWORD nComponents) = 0; | 284 virtual void SetComponents(FX_DWORD nComponents) = 0; |
285 }; | 285 }; |
286 void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT&
R, FX_FLOAT& G, FX_FLOAT& B); | 286 void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT&
R, FX_FLOAT& G, FX_FLOAT& B); |
287 void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R,
uint8_t& G, uint8_t& B); | 287 void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R,
uint8_t& G, uint8_t& B); |
288 FX_BOOL MD5ComputeID(FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16]); | 288 FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]); |
289 | 289 |
290 #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ | 290 #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |
OLD | NEW |