summaryrefslogtreecommitdiff
path: root/core/src/fxcodec
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcodec')
-rw-r--r--core/src/fxcodec/codec/codec_int.h86
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp24
-rw-r--r--core/src/fxcodec/codec/fx_codec_fax.cpp60
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp78
-rw-r--r--core/src/fxcodec/codec/fx_codec_icc.cpp44
-rw-r--r--core/src/fxcodec/codec/fx_codec_jbig.cpp18
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp46
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpx_opj.cpp16
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Define.h2
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Module.h10
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Object.cpp8
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Object.h8
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Segment.h2
13 files changed, 203 insertions, 199 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h
index d39a1fd18a..eb356aa531 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -17,11 +17,11 @@
class CCodec_BasicModule : public ICodec_BasicModule
{
public:
- virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf,
+ virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf,
FX_DWORD& dest_size);
- virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf,
+ virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf,
FX_DWORD& dest_size);
- virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc);
};
struct CCodec_ImageDataCache {
@@ -44,7 +44,7 @@ public:
virtual void DownScale(int dest_width, int dest_height);
- FX_LPBYTE GetScanline(int line);
+ uint8_t* GetScanline(int line);
FX_BOOL SkipToScanline(int line, IFX_Pause* pPause);
@@ -100,39 +100,39 @@ protected:
FX_BOOL m_bColorTransformed;
- FX_LPBYTE ReadNextLine();
+ uint8_t* ReadNextLine();
virtual FX_BOOL v_Rewind() = 0;
- virtual FX_LPBYTE v_GetNextLine() = 0;
+ virtual uint8_t* v_GetNextLine() = 0;
virtual void v_DownScale(int dest_width, int dest_height) = 0;
int m_NextLine;
- FX_LPBYTE m_pLastScanline;
+ uint8_t* m_pLastScanline;
CCodec_ImageDataCache* m_pDataCache;
};
class CCodec_FaxModule : public ICodec_FaxModule
{
public:
- virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows);
- FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
+ FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size);
};
class CCodec_FlateModule : public ICodec_FlateModule
{
public:
- virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns);
virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange,
int predictor, int Colors, int BitsPerComponent, int Columns,
- FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
+ FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size,
int predictor, int Colors, int BitsPerComponent, int Columns,
- FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
- virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
+ uint8_t*& dest_buf, FX_DWORD& dest_size);
+ virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
};
class CCodec_JpegModule : public ICodec_JpegModule
{
@@ -142,28 +142,28 @@ public:
{
m_pExtProvider = pJP;
}
- ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size,
+ ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size,
int width, int height, int nComps, FX_BOOL ColorTransform);
- FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height,
+ FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height,
int& num_components, int& bits_per_components, FX_BOOL& color_transform,
- FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length);
- FX_BOOL Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length);
+ uint8_t** icc_buf_ptr, FX_DWORD* icc_length);
+ FX_BOOL Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length);
virtual void* Start();
virtual void Finish(void* pContext);
- virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size);
+ virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size);
virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps);
virtual FX_BOOL StartScanline(void* pContext, int down_scale);
- virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf);
- virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr);
+ virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf);
+ virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr);
protected:
IFX_JpegProvider* m_pExtProvider;
};
class CCodec_IccModule : public ICodec_IccModule
{
public:
- virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, unsigned int dwProfileSize);
+ virtual IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize);
virtual IccCS GetProfileCS(IFX_FileRead* pFile);
- virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInputParam,
+ virtual void* CreateTransform(ICodec_IccModule::IccParam* pInputParam,
ICodec_IccModule::IccParam* pOutputParam,
ICodec_IccModule::IccParam* pProofParam = NULL,
FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL,
@@ -171,16 +171,16 @@ public:
FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC,
FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING
);
- virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0,
+ virtual void* CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0,
FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT);
- virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents,
- FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0,
+ virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents,
+ const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0,
FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT,
FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT
);
- virtual void DestroyTransform(FX_LPVOID pTransform);
- virtual void Translate(FX_LPVOID pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues);
- virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels);
+ virtual void DestroyTransform(void* pTransform);
+ virtual void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues);
+ virtual void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels);
virtual void SetComponents(FX_DWORD nComponents) {m_nComponents = nComponents;}
virtual ~CCodec_IccModule();
protected:
@@ -193,16 +193,16 @@ protected:
Icc_CLASS_PROOF,
Icc_CLASS_MAX
} Icc_CLASS;
- FX_LPVOID CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey);
+ void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey);
};
class CCodec_JpxModule : public ICodec_JpxModule
{
public:
CCodec_JpxModule();
- void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE);
- void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height,
+ void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE);
+ void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height,
FX_DWORD& codestream_nComps, FX_DWORD& output_nComps);
- FX_BOOL Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets);
+ FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets);
void DestroyDecoder(void* ctx);
};
class CPDF_Jbig2Interface : public CJBig2_Module
@@ -230,11 +230,11 @@ public:
}
return FX_Alloc(uint8_t, num * size);
}
- virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize)
+ virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize)
{
return FX_Realloc(uint8_t, pMem, dwSize);
}
- virtual void JBig2_Free(FX_LPVOID pMem)
+ virtual void JBig2_Free(void* pMem)
{
FX_Free(pMem);
}
@@ -247,11 +247,11 @@ public:
IFX_FileRead* m_file_ptr;
FX_DWORD m_width;
FX_DWORD m_height;
- FX_LPBYTE m_src_buf;
+ uint8_t* m_src_buf;
FX_DWORD m_src_size;
- FX_LPCBYTE m_global_data;
+ const uint8_t* m_global_data;
FX_DWORD m_global_size;
- FX_LPBYTE m_dest_buf;
+ uint8_t* m_dest_buf;
FX_DWORD m_dest_pitch;
FX_BOOL m_bFileReader;
IFX_Pause* m_pPause;
@@ -263,16 +263,16 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module
public:
CCodec_Jbig2Module() {};
~CCodec_Jbig2Module();
- FX_BOOL Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size,
- FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch);
+ FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size,
+ const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch);
FX_BOOL Decode(IFX_FileRead* file_ptr,
- FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf);
+ FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf);
void* CreateJbig2Context();
- FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size,
- FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause);
+ FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size,
+ const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause);
FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr,
- FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause);
+ FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause);
FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause);
void DestroyJbig2Context(void* pJbig2Context);
CPDF_Jbig2Interface m_Module;
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp
index ee3ef8ce9d..1068126d5d 100644
--- a/core/src/fxcodec/codec/fx_codec.cpp
+++ b/core/src/fxcodec/codec/fx_codec.cpp
@@ -47,7 +47,7 @@ CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder()
FX_Free(m_pDataCache);
}
}
-FX_LPBYTE CCodec_ScanlineDecoder::GetScanline(int line)
+uint8_t* CCodec_ScanlineDecoder::GetScanline(int line)
{
if (m_pDataCache && line < m_pDataCache->m_nCachedLines) {
return &m_pDataCache->m_Data + line * m_Pitch;
@@ -91,9 +91,9 @@ FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause)
}
return FALSE;
}
-FX_LPBYTE CCodec_ScanlineDecoder::ReadNextLine()
+uint8_t* CCodec_ScanlineDecoder::ReadNextLine()
{
- FX_LPBYTE pLine = v_GetNextLine();
+ uint8_t* pLine = v_GetNextLine();
if (pLine == NULL) {
return NULL;
}
@@ -127,7 +127,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height)
m_pDataCache->m_Width = m_OutputWidth;
m_pDataCache->m_nCachedLines = 0;
}
-FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf,
+FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf,
FX_DWORD& dest_size)
{
return FALSE;
@@ -236,7 +236,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr)
}
return is_negative ? -ret : ret;
}
-FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf,
+FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf,
FX_DWORD& dest_size)
{
return FALSE;
@@ -254,10 +254,10 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder
public:
CCodec_RLScanlineDecoder();
virtual ~CCodec_RLScanlineDecoder();
- FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc);
+ FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc);
virtual void v_DownScale(int dest_width, int dest_height) {}
virtual FX_BOOL v_Rewind();
- virtual FX_LPBYTE v_GetNextLine();
+ virtual uint8_t* v_GetNextLine();
virtual FX_DWORD GetSrcOffset()
{
return m_SrcOffset;
@@ -267,8 +267,8 @@ protected:
void GetNextOperator();
void UpdateOperator(uint8_t used_bytes);
- FX_LPBYTE m_pScanline;
- FX_LPCBYTE m_pSrcBuf;
+ uint8_t* m_pScanline;
+ const uint8_t* m_pSrcBuf;
FX_DWORD m_SrcSize;
FX_DWORD m_dwLineBytes;
FX_DWORD m_SrcOffset;
@@ -320,7 +320,7 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize()
}
return TRUE;
}
-FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc)
+FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc)
{
m_pSrcBuf = src_buf;
m_SrcSize = src_size;
@@ -343,7 +343,7 @@ FX_BOOL CCodec_RLScanlineDecoder::v_Rewind()
m_Operator = 0;
return TRUE;
}
-FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine()
+uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine()
{
if (m_SrcOffset == 0) {
GetNextOperator();
@@ -427,7 +427,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes)
count -= used_bytes;
m_Operator = 257 - count;
}
-ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc)
{
CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder;
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp
index 869751e05b..40502362d5 100644
--- a/core/src/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/src/fxcodec/codec/fx_codec_fax.cpp
@@ -48,7 +48,7 @@ int _FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit)
if (start_pos >= max_pos) {
return max_pos;
}
- FX_LPCBYTE leading_pos = bit ? OneLeadPos : ZeroLeadPos;
+ const uint8_t* leading_pos = bit ? OneLeadPos : ZeroLeadPos;
if (start_pos % 8) {
uint8_t data = data_buf[start_pos / 8];
if (bit) {
@@ -100,7 +100,7 @@ void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color
}
b2 = _FindBit(ref_buf, columns, b1 + 1, first_bit);
}
-void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos)
+void _FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos)
{
if (startpos < 0) {
startpos = 0;
@@ -375,7 +375,7 @@ static const uint8_t FaxWhiteRunIns[] = {
0x1f, 2560 % 256, 2560 / 256,
0xff,
};
-int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize)
+int _FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, int bitsize)
{
FX_DWORD code = 0;
int ins_off = 0;
@@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bi
}
}
}
-FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns)
+FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns)
{
int a0 = -1, a0color = 1;
while (1) {
@@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos)
}
return FALSE;
}
-FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns)
+FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns)
{
int color = TRUE;
int startpos = 0;
@@ -577,17 +577,18 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder
public:
CCodec_FaxDecoder();
virtual ~CCodec_FaxDecoder();
- FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows);
virtual void v_DownScale(int dest_width, int dest_height) {}
virtual FX_BOOL v_Rewind();
- virtual FX_LPBYTE v_GetNextLine();
+ virtual uint8_t* v_GetNextLine();
virtual FX_DWORD GetSrcOffset();
int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack;
int bitpos;
- FX_LPCBYTE m_pSrcBuf;
+ const uint8_t* m_pSrcBuf;
FX_DWORD m_SrcSize;
- FX_LPBYTE m_pScanlineBuf, m_pRefBuf;
+ uint8_t* m_pScanlineBuf;
+ uint8_t* m_pRefBuf;
};
CCodec_FaxDecoder::CCodec_FaxDecoder()
{
@@ -603,7 +604,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder()
FX_Free(m_pRefBuf);
}
}
-FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows)
{
m_Encoding = K;
@@ -636,7 +637,7 @@ FX_BOOL CCodec_FaxDecoder::v_Rewind()
bitpos = 0;
return TRUE;
}
-FX_LPBYTE CCodec_FaxDecoder::v_GetNextLine()
+uint8_t* CCodec_FaxDecoder::v_GetNextLine()
{
int bitsize = m_SrcSize * 8;
_FaxSkipEOL(m_pSrcBuf, bitsize, bitpos);
@@ -693,16 +694,16 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset()
return ret;
}
extern "C" {
- void _FaxG4Decode(void*, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch)
+ void _FaxG4Decode(void*, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch)
{
if (pitch == 0) {
pitch = (width + 7) / 8;
}
- FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch);
+ uint8_t* ref_buf = FX_Alloc(uint8_t, pitch);
FXSYS_memset8(ref_buf, 0xff, pitch);
int bitpos = *pbitpos;
for (int iRow = 0; iRow < height; iRow ++) {
- FX_LPBYTE line_buf = dest_buf + iRow * pitch;
+ uint8_t* line_buf = dest_buf + iRow * pitch;
FXSYS_memset8(line_buf, 0xff, pitch);
_FaxG4GetRow(src_buf, src_size << 3, bitpos, line_buf, ref_buf, width);
FXSYS_memcpy32(ref_buf, line_buf, pitch);
@@ -836,7 +837,7 @@ static const uint8_t WhiteRunMarkup[80] = {
0x1e, 12,
0x1f, 12,
};
-static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bitlen)
+static void _AddBitStream(uint8_t* dest_buf, int& dest_bitpos, int data, int bitlen)
{
for (int i = bitlen - 1; i >= 0; i --) {
if (data & (1 << i)) {
@@ -845,7 +846,7 @@ static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bi
dest_bitpos ++;
}
}
-static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite)
+static void _FaxEncodeRun(uint8_t* dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite)
{
while (run >= 2560) {
_AddBitStream(dest_buf, dest_bitpos, 0x1f, 12);
@@ -853,16 +854,16 @@ static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL
}
if (run >= 64) {
int markup = run - run % 64;
- FX_LPCBYTE p = bWhite ? WhiteRunMarkup : BlackRunMarkup;
+ const uint8_t* p = bWhite ? WhiteRunMarkup : BlackRunMarkup;
p += (markup / 64 - 1) * 2;
_AddBitStream(dest_buf, dest_bitpos, *p, p[1]);
}
run %= 64;
- FX_LPCBYTE p = bWhite ? WhiteRunTerminator : BlackRunTerminator;
+ const uint8_t* p = bWhite ? WhiteRunTerminator : BlackRunTerminator;
p += run * 2;
_AddBitStream(dest_buf, dest_bitpos, *p, p[1]);
}
-static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE src_buf, FX_LPCBYTE ref_buf, int cols)
+static void _FaxEncode2DLine(uint8_t* dest_buf, int& dest_bitpos, const uint8_t* src_buf, const uint8_t* ref_buf, int cols)
{
int a0 = -1, a0color = 1;
while (1) {
@@ -920,16 +921,17 @@ static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE sr
class CCodec_FaxEncoder
{
public:
- CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch);
+ CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch);
~CCodec_FaxEncoder();
- void Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
- void Encode2DLine(FX_LPCBYTE scan_line);
+ void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size);
+ void Encode2DLine(const uint8_t* scan_line);
CFX_BinaryBuf m_DestBuf;
- FX_LPBYTE m_pRefLine, m_pLineBuf;
+ uint8_t* m_pRefLine;
+ uint8_t* m_pLineBuf;
int m_Cols, m_Rows, m_Pitch;
- FX_LPCBYTE m_pSrcBuf;
+ const uint8_t* m_pSrcBuf;
};
-CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch)
+CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch)
{
m_pSrcBuf = src_buf;
m_Cols = width;
@@ -949,12 +951,12 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder()
FX_Free(m_pLineBuf);
}
}
-void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size)
{
int dest_bitpos = 0;
uint8_t last_byte = 0;
for (int i = 0; i < m_Rows; i ++) {
- FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch;
+ const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch;
FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8);
m_pLineBuf[0] = last_byte;
_FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols);
@@ -970,13 +972,13 @@ void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
dest_size = m_DestBuf.GetSize();
m_DestBuf.DetachBuffer();
}
-FX_BOOL CCodec_FaxModule::Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
CCodec_FaxEncoder encoder(src_buf, width, height, pitch);
encoder.Encode(dest_buf, dest_size);
return TRUE;
}
-ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows)
{
CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder;
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index 9997a570d6..2e6cf4e8db 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -79,11 +79,11 @@ extern "C"
class CLZWDecoder
{
public:
- FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange);
+ FX_BOOL Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange);
private:
FX_DWORD m_InPos;
FX_DWORD m_OutPos;
- FX_LPBYTE m_pOutput;
+ uint8_t* m_pOutput;
const uint8_t* m_pInput;
FX_BOOL m_Early;
void AddCode(FX_DWORD prefix_code, uint8_t append_char);
@@ -127,7 +127,7 @@ void CLZWDecoder::DecodeString(FX_DWORD code)
}
m_DecodeStack[m_StackLen++] = (uint8_t)code;
}
-int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange)
+int CLZWDecoder::Decode(uint8_t* dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange)
{
m_CodeLen = 9;
m_InPos = 0;
@@ -231,7 +231,7 @@ static uint8_t PaethPredictor(int a, int b, int c)
}
return (uint8_t)c;
}
-static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size,
+static FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size,
int predictor, int Colors,
int BitsPerComponent, int Columns)
{
@@ -241,10 +241,10 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size,
return FALSE;
const int row_count = (data_size + row_size - 1) / row_size;
const int last_row_size = data_size % row_size;
- FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count);
+ uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count);
int byte_cnt = 0;
- FX_LPBYTE pSrcData = data_buf;
- FX_LPBYTE pDestData = dest_buf;
+ uint8_t* pSrcData = data_buf;
+ uint8_t* pDestData = dest_buf;
for (int row = 0; row < row_count; row++) {
if (predictor == 10) {
pDestData[0] = 0;
@@ -323,7 +323,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size,
data_size = (row_size + 1) * row_count - (last_row_size > 0 ? (row_size - last_row_size) : 0);
return TRUE;
}
-static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE pLastLine,
+static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const uint8_t* pLastLine,
int bpc, int nColors, int nPixels)
{
int row_size = (nPixels * bpc * nColors + 7) / 8;
@@ -386,7 +386,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE
}
}
}
-static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
+static FX_BOOL PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size,
int Colors, int BitsPerComponent, int Columns)
{
const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8;
@@ -395,10 +395,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
return FALSE;
const int row_count = (data_size + row_size) / (row_size + 1);
const int last_row_size = data_size % (row_size + 1);
- FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count);
+ uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size, row_count);
int byte_cnt = 0;
- FX_LPBYTE pSrcData = data_buf;
- FX_LPBYTE pDestData = dest_buf;
+ uint8_t* pSrcData = data_buf;
+ uint8_t* pDestData = dest_buf;
for (int row = 0; row < row_count; row ++) {
uint8_t tag = pSrcData[0];
byte_cnt++;
@@ -474,7 +474,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
data_size = row_size * row_count - (last_row_size > 0 ? (row_size + 1 - last_row_size) : 0);
return TRUE;
}
-static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns)
+static void TIFF_PredictorEncodeLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns)
{
int BytesPerPixel = BitsPerComponent * Colors / 8;
if (BitsPerComponent < 8) {
@@ -511,7 +511,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP
}
}
}
-static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size,
+static FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size,
int Colors, int BitsPerComponent, int Columns)
{
int row_size = (Colors * BitsPerComponent * Columns + 7) / 8;
@@ -520,7 +520,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size,
const int row_count = (data_size + row_size - 1) / row_size;
const int last_row_size = data_size % row_size;
for (int row = 0; row < row_count; row++) {
- FX_LPBYTE scan_line = data_buf + row * row_size;
+ uint8_t* scan_line = data_buf + row * row_size;
if ((row + 1) * row_size > (int)data_size) {
row_size = last_row_size;
}
@@ -528,7 +528,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size,
}
return TRUE;
}
-static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns)
+static void TIFF_PredictLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns)
{
if (BitsPerComponent == 1) {
int row_bits = FX_MIN(BitsPerComponent * Colors * Columns, row_size * 8);
@@ -561,7 +561,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon
}
}
}
-static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
+static FX_BOOL TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size,
int Colors, int BitsPerComponent, int Columns)
{
int row_size = (Colors * BitsPerComponent * Columns + 7) / 8;
@@ -570,7 +570,7 @@ static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
const int row_count = (data_size + row_size - 1) / row_size;
const int last_row_size = data_size % row_size;
for (int row = 0; row < row_count; row ++) {
- FX_LPBYTE scan_line = data_buf + row * row_size;
+ uint8_t* scan_line = data_buf + row * row_size;
if ((row + 1) * row_size > (int)data_size) {
row_size = last_row_size;
}
@@ -583,7 +583,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder
public:
CCodec_FlateScanlineDecoder();
~CCodec_FlateScanlineDecoder();
- void Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc,
+ void Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc,
int predictor, int Colors, int BitsPerComponent, int Columns);
virtual void Destroy()
{
@@ -591,15 +591,15 @@ public:
}
virtual void v_DownScale(int dest_width, int dest_height) {}
virtual FX_BOOL v_Rewind();
- virtual FX_LPBYTE v_GetNextLine();
+ virtual uint8_t* v_GetNextLine();
virtual FX_DWORD GetSrcOffset();
void* m_pFlate;
- FX_LPCBYTE m_SrcBuf;
+ const uint8_t* m_SrcBuf;
FX_DWORD m_SrcSize;
- FX_LPBYTE m_pScanline;
- FX_LPBYTE m_pLastLine;
- FX_LPBYTE m_pPredictBuffer;
- FX_LPBYTE m_pPredictRaw;
+ uint8_t* m_pScanline;
+ uint8_t* m_pLastLine;
+ uint8_t* m_pPredictBuffer;
+ uint8_t* m_pPredictRaw;
int m_Predictor;
int m_Colors, m_BitsPerComponent, m_Columns, m_PredictPitch, m_LeftOver;
};
@@ -630,7 +630,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder()
FPDFAPI_FlateEnd(m_pFlate);
}
}
-void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns)
{
m_SrcBuf = src_buf;
@@ -678,7 +678,7 @@ FX_BOOL CCodec_FlateScanlineDecoder::v_Rewind()
m_LeftOver = 0;
return TRUE;
}
-FX_LPBYTE CCodec_FlateScanlineDecoder::v_GetNextLine()
+uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine()
{
if (m_Predictor) {
if (m_Pitch == m_PredictPitch) {
@@ -722,8 +722,8 @@ FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset()
{
return FPDFAPI_FlateGetTotalIn(m_pFlate);
}
-static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig_size,
- FX_LPBYTE& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset)
+static void FlateUncompress(const uint8_t* src_buf, FX_DWORD src_size, FX_DWORD orig_size,
+ uint8_t*& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset)
{
const FX_BOOL useOldImpl = src_size < 10240;
FX_DWORD guess_size = orig_size ? orig_size : src_size * 2;
@@ -737,8 +737,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig
FX_DWORD last_buf_size = buf_size;
void* context = nullptr;
- FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1);
- FX_LPBYTE cur_buf = guess_buf;
+ uint8_t* guess_buf = FX_Alloc(uint8_t, guess_size + 1);
+ uint8_t* cur_buf = guess_buf;
guess_buf[guess_size] = '\0';
context = FPDFAPI_FlateInit(my_alloc_func, my_free_func);
if (!context)
@@ -776,7 +776,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig
}
dest_buf = guess_buf;
} else {
- CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs;
+ CFX_ArrayTemplate<uint8_t*> result_tmp_bufs;
while (1) {
int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size);
int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context);
@@ -801,10 +801,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig
if (result_tmp_bufs.GetSize() == 1) {
dest_buf = result_tmp_bufs[0];
} else {
- FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size);
+ uint8_t* result_buf = FX_Alloc(uint8_t, dest_size);
FX_DWORD result_pos = 0;
for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) {
- FX_LPBYTE tmp_buf = result_tmp_bufs[i];
+ uint8_t* tmp_buf = result_tmp_bufs[i];
FX_DWORD tmp_buf_size = buf_size;
if (i == result_tmp_bufs.GetSize() - 1) {
tmp_buf_size = last_buf_size;
@@ -825,7 +825,7 @@ fail:
dest_size = 0;
return;
}
-ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns)
{
CCodec_FlateScanlineDecoder* pDecoder = new CCodec_FlateScanlineDecoder;
@@ -834,7 +834,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX
}
FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange,
int predictor, int Colors, int BitsPerComponent, int Columns,
- FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+ FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
dest_buf = NULL;
FX_DWORD offset = 0;
@@ -881,12 +881,12 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_b
}
FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size,
int predictor, int Colors, int BitsPerComponent, int Columns,
- FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+ uint8_t*& dest_buf, FX_DWORD& dest_size)
{
if (predictor != 2 && predictor < 10) {
return Encode(src_buf, src_size, dest_buf, dest_size);
}
- FX_LPBYTE pSrcBuf = NULL;
+ uint8_t* pSrcBuf = NULL;
pSrcBuf = FX_Alloc(uint8_t, src_size);
FXSYS_memcpy32(pSrcBuf, src_buf, src_size);
FX_BOOL ret = TRUE;
@@ -902,7 +902,7 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size,
FX_Free(pSrcBuf);
return ret;
}
-FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
dest_size = src_size + src_size / 1000 + 12;
dest_buf = FX_Alloc( uint8_t, dest_size);
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp
index cde5d4c1bd..6fe92ff240 100644
--- a/core/src/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/src/fxcodec/codec/fx_codec_icc.cpp
@@ -13,7 +13,7 @@ const FX_DWORD N_COMPONENT_RGB = 3;
const FX_DWORD N_COMPONENT_CMYK = 4;
const FX_DWORD N_COMPONENT_DEFAULT = 3;
-FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] )
+FX_BOOL MD5ComputeID( const void* buf, FX_DWORD dwSize, uint8_t ID[16] )
{
return cmsMD5computeIDExt(buf, dwSize, ID);
}
@@ -218,7 +218,7 @@ void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigne
{
cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels);
}
-FX_LPVOID CreateProfile_Gray(double gamma)
+void* CreateProfile_Gray(double gamma)
{
cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY();
if (!cmsWhitePointFromTemp(D50, 6504)) {
@@ -228,11 +228,11 @@ FX_LPVOID CreateProfile_Gray(double gamma)
if (curve == NULL) {
return NULL;
}
- FX_LPVOID profile = cmsCreateGrayProfile(D50, curve);
+ void* profile = cmsCreateGrayProfile(D50, curve);
cmsFreeToneCurve(curve);
return profile;
}
-ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile)
+ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile)
{
if (pProfile == NULL) {
return ICodec_IccModule::IccCS_Unknown;
@@ -264,7 +264,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile)
return ICodec_IccModule::IccCS_Unknown;
}
}
-ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize)
+ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(const uint8_t* pProfileData, FX_DWORD dwProfileSize)
{
ICodec_IccModule::IccCS cs;
cmsHPROFILE hProfile = cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize);
@@ -284,13 +284,13 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile)
}
ICodec_IccModule::IccCS cs;
FX_DWORD dwSize = (FX_DWORD)pFile->GetSize();
- FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize);
+ uint8_t* pBuf = FX_Alloc(uint8_t, dwSize);
pFile->ReadBlock(pBuf, 0, dwSize);
cs = GetProfileCS(pBuf, dwSize);
FX_Free(pBuf);
return cs;
}
-FX_DWORD TransferProfileType(FX_LPVOID pProfile, FX_DWORD dwFormat)
+FX_DWORD TransferProfileType(void* pProfile, FX_DWORD dwFormat)
{
cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile);
switch (cs) {
@@ -341,7 +341,7 @@ class CFX_IccProfileCache
public:
CFX_IccProfileCache();
~CFX_IccProfileCache();
- FX_LPVOID m_pProfile;
+ void* m_pProfile;
FX_DWORD m_dwRate;
protected:
void Purge();
@@ -365,7 +365,7 @@ class CFX_IccTransformCache
public:
CFX_IccTransformCache(CLcmsCmm* pCmm = NULL);
~CFX_IccTransformCache();
- FX_LPVOID m_pIccTransform;
+ void* m_pIccTransform;
FX_DWORD m_dwRate;
CLcmsCmm* m_pCmm;
protected:
@@ -400,7 +400,7 @@ CFX_ByteStringKey& CFX_ByteStringKey::operator << (FX_DWORD i)
AppendBlock(&i, sizeof(FX_DWORD));
return *this;
}
-FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey)
+void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey)
{
CFX_IccProfileCache* pCache = NULL;
CFX_ByteStringKey key;
@@ -431,7 +431,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam,
CFX_ByteString ProfileKey(key.GetBuffer(), key.GetSize());
ASSERT(pTransformKey);
pTransformKey->AppendBlock(ProfileKey.GetBuffer(0), ProfileKey.GetLength());
- if (!m_MapProfile.Lookup(ProfileKey, (FX_LPVOID&)pCache)) {
+ if (!m_MapProfile.Lookup(ProfileKey, (void*&)pCache)) {
pCache = new CFX_IccProfileCache;
switch (pIccParam->dwProfileType) {
case Icc_PARAMTYPE_BUFFER:
@@ -458,7 +458,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam,
}
return pCache->m_pProfile;
}
-FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam,
+void* CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam,
ICodec_IccModule::IccParam* pOutputParam,
ICodec_IccModule::IccParam* pProofParam,
FX_DWORD dwIntent, FX_DWORD dwFlag, FX_DWORD dwPrfIntent, FX_DWORD dwPrfFlag)
@@ -466,11 +466,11 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa
CLcmsCmm* pCmm = NULL;
ASSERT(pInputParam && pOutputParam);
CFX_ByteStringKey key;
- FX_LPVOID pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key);
+ void* pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key);
if (pInputProfile == NULL) {
return NULL;
}
- FX_LPVOID pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key);
+ void* pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key);
if (pOutputProfile == NULL) {
return NULL;
}
@@ -479,14 +479,14 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa
if (dwInputProfileType == 0 || dwOutputProfileType == 0) {
return NULL;
}
- FX_LPVOID pProofProfile = NULL;
+ void* pProofProfile = NULL;
if (pProofParam) {
pProofProfile = CreateProfile(pProofParam, Icc_CLASS_PROOF, &key);
}
key << dwInputProfileType << dwOutputProfileType << dwIntent << dwFlag << (pProofProfile != NULL) << dwPrfIntent << dwPrfFlag;
CFX_ByteStringC TransformKey(key.GetBuffer(), key.GetSize());
CFX_IccTransformCache* pTransformCache;
- if (!m_MapTranform.Lookup(TransformKey, (FX_LPVOID&)pTransformCache)) {
+ if (!m_MapTranform.Lookup(TransformKey, (void*&)pTransformCache)) {
pCmm = FX_Alloc(CLcmsCmm, 1);
pCmm->m_nSrcComponents = T_CHANNELS(dwInputProfileType);
pCmm->m_nDstComponents = T_CHANNELS(dwOutputProfileType);
@@ -512,7 +512,7 @@ CCodec_IccModule::~CCodec_IccModule()
CFX_ByteString key;
CFX_IccProfileCache* pProfileCache;
while (pos) {
- m_MapProfile.GetNextAssoc(pos, key, (FX_LPVOID&)pProfileCache);
+ m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache);
if (pProfileCache) {
delete pProfileCache;
}
@@ -520,18 +520,18 @@ CCodec_IccModule::~CCodec_IccModule()
pos = m_MapTranform.GetStartPosition();
CFX_IccTransformCache* pTransformCache;
while (pos) {
- m_MapTranform.GetNextAssoc(pos, key, (FX_LPVOID&)pTransformCache);
+ m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache);
if (pTransformCache) {
delete pTransformCache;
}
}
}
-void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat)
+void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat)
{
return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat);
}
-void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents,
- FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent,
+void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents,
+ const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent,
FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat)
{
return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents,
@@ -545,7 +545,7 @@ void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA
{
IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues);
}
-void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels)
+void CCodec_IccModule::TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int32_t pixels)
{
IccLib_TranslateImage(pTransform, pDest, pSrc, pixels);
}
diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp
index 622448d659..b908915227 100644
--- a/core/src/fxcodec/codec/fx_codec_jbig.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp
@@ -25,12 +25,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content)
}
pJbig2Content = NULL;
}
-FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size,
- FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch)
+FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size,
+ const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch)
{
FXSYS_memset32(dest_buf, 0, height * dest_pitch);
CJBig2_Context* pContext = CJBig2_Context::CreateContext(&m_Module,
- (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache);
+ (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache);
if (pContext == NULL) {
return FALSE;
}
@@ -47,12 +47,12 @@ FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE s
return TRUE;
}
FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr,
- FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf)
+ FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf)
{
CJBig2_Context* pContext = NULL;
CJBig2_Image* dest_image = NULL;
FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize();
- FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size);
+ uint8_t* src_buf = FX_Alloc(uint8_t, src_size);
int ret = 0;
if(!file_ptr->ReadBlock(src_buf, 0, src_size)) {
goto failed;
@@ -80,8 +80,8 @@ failed:
}
return FALSE;
}
-FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size,
- FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause)
+FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size,
+ const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause)
{
if(!pJbig2Context) {
return FXCODEC_STATUS_ERR_PARAMS;
@@ -99,7 +99,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid
m_pJbig2Context->m_bFileReader = FALSE;
FXSYS_memset32(dest_buf, 0, height * dest_pitch);
m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(&m_Module,
- (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause);
+ (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause);
if(!m_pJbig2Context->m_pContext) {
return FXCODEC_STATUS_ERROR;
}
@@ -120,7 +120,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid
return m_pJbig2Context->m_pContext->GetProcessiveStatus();
}
FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr,
- FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause)
+ FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause)
{
if(!pJbig2Context) {
return FXCODEC_STATUS_ERR_PARAMS;
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index 111cbcf245..4017be56b3 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -77,7 +77,7 @@ extern "C" {
#define JPEG_MARKER_AUTHORTIME (JPEG_APP0 + 3)
#define JPEG_MARKER_MAXSIZE 0xFFFF
#define JPEG_OVERHEAD_LEN 14
-static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr, FX_DWORD icc_length)
+static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, FX_DWORD icc_length)
{
if(icc_buf_ptr == NULL || icc_length == 0) {
return FALSE;
@@ -88,7 +88,7 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr
return FALSE;
}
FX_DWORD icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length);
- FX_LPBYTE icc_data = FX_Alloc(uint8_t, icc_data_length);
+ uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length);
FXSYS_memcpy32(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", 12);
icc_data[13] = (uint8_t)icc_segment_num;
for (uint8_t i = 0; i < (icc_segment_num - 1); i++) {
@@ -113,7 +113,7 @@ extern "C" {
}
};
#define JPEG_BLOCK_SIZE 1048576
-static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length)
+static void _JpegEncode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length)
{
struct jpeg_error_mgr jerr;
jerr.error_exit = _error_do_nothing;
@@ -171,7 +171,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST
} else {
cinfo.in_color_space = JCS_CMYK;
}
- FX_LPBYTE line_buf = NULL;
+ uint8_t* line_buf = NULL;
if (nComponents > 1) {
line_buf = FX_Alloc2D(uint8_t, width, nComponents);
}
@@ -184,9 +184,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST
JSAMPROW row_pointer[1];
JDIMENSION row;
while (cinfo.next_scanline < cinfo.image_height) {
- FX_LPCBYTE src_scan = pSource->GetScanline(cinfo.next_scanline);
+ const uint8_t* src_scan = pSource->GetScanline(cinfo.next_scanline);
if (nComponents > 1) {
- FX_LPBYTE dest_scan = line_buf;
+ uint8_t* dest_scan = line_buf;
if (nComponents == 3) {
for (int i = 0; i < width; i ++) {
dest_scan[0] = src_scan[2];
@@ -202,7 +202,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST
}
row_pointer[0] = line_buf;
} else {
- row_pointer[0] = (FX_LPBYTE)src_scan;
+ row_pointer[0] = (uint8_t*)src_scan;
}
row = cinfo.next_scanline;
jpeg_write_scanlines(&cinfo, row_pointer, 1);
@@ -220,9 +220,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST
}
dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
}
-static FX_BOOL _JpegLoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height,
+static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height,
int& num_components, int& bits_per_components, FX_BOOL& color_transform,
- FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length)
+ uint8_t** icc_buf_ptr, FX_DWORD* icc_length)
{
_JpegScanSOI(src_buf, src_size);
struct jpeg_decompress_struct cinfo;
@@ -280,7 +280,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder
public:
CCodec_JpegDecoder();
~CCodec_JpegDecoder();
- FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps,
+ FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps,
FX_BOOL ColorTransform, IFX_JpegProvider* pJP);
virtual void Destroy()
{
@@ -288,15 +288,15 @@ public:
}
virtual void v_DownScale(int dest_width, int dest_height);
virtual FX_BOOL v_Rewind();
- virtual FX_LPBYTE v_GetNextLine();
+ virtual uint8_t* v_GetNextLine();
virtual FX_DWORD GetSrcOffset();
jmp_buf m_JmpBuf;
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
struct jpeg_source_mgr src;
- FX_LPCBYTE m_SrcBuf;
+ const uint8_t* m_SrcBuf;
FX_DWORD m_SrcSize;
- FX_LPBYTE m_pScanlineBuf;
+ uint8_t* m_pScanlineBuf;
FX_BOOL InitDecode();
FX_BOOL m_bInited, m_bStarted, m_bJpegTransform;
protected:
@@ -366,7 +366,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode()
m_nDefaultScaleDenom = cinfo.scale_denom;
return TRUE;
}
-FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP)
{
if (pJP) {
@@ -389,8 +389,8 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi
src.resync_to_restart = _src_resync;
m_bJpegTransform = ColorTransform;
if(src_size > 1 && FXSYS_memcmp32(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) {
- ((FX_LPBYTE)src_buf)[src_size - 2] = 0xFF;
- ((FX_LPBYTE)src_buf)[src_size - 1] = 0xD9;
+ ((uint8_t*)src_buf)[src_size - 2] = 0xFF;
+ ((uint8_t*)src_buf)[src_size - 1] = 0xD9;
}
m_OutputWidth = m_OrigWidth = width;
m_OutputHeight = m_OrigHeight = height;
@@ -470,7 +470,7 @@ FX_BOOL CCodec_JpegDecoder::v_Rewind()
m_bStarted = TRUE;
return TRUE;
}
-FX_LPBYTE CCodec_JpegDecoder::v_GetNextLine()
+uint8_t* CCodec_JpegDecoder::v_GetNextLine()
{
if (m_pExtProvider) {
return m_pExtProvider->GetNextLine(m_pExtContext);
@@ -488,7 +488,7 @@ FX_DWORD CCodec_JpegDecoder::GetSrcOffset()
}
return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer);
}
-ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size,
+ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size,
int width, int height, int nComps, FX_BOOL ColorTransform)
{
if (src_buf == NULL || src_size == 0) {
@@ -501,9 +501,9 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_
}
return pDecoder;
}
-FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height,
+FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height,
int& num_components, int& bits_per_components, FX_BOOL& color_transform,
- FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length)
+ uint8_t** icc_buf_ptr, FX_DWORD* icc_length)
{
if (m_pExtProvider) {
return m_pExtProvider->LoadInfo(src_buf, src_size, width, height,
@@ -512,7 +512,7 @@ FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int&
}
return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length);
}
-FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length)
+FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length)
{
if (m_pExtProvider) {
return m_pExtProvider->Encode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length);
@@ -662,7 +662,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf)
int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1);
return nlines == 1;
}
-FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr)
+FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr)
{
if (m_pExtProvider) {
return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr);
@@ -670,7 +670,7 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_p
if(avail_buf_ptr != NULL) {
*avail_buf_ptr = NULL;
if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) {
- *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte;
+ *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte;
}
}
return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
index 01faf67a30..312ce78759 100644
--- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -589,8 +589,8 @@ public:
~CJPX_Decoder();
FX_BOOL Init(const unsigned char* src_data, int src_size);
void GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps);
- FX_BOOL Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets);
- FX_LPCBYTE m_SrcData;
+ FX_BOOL Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets);
+ const uint8_t* m_SrcData;
int m_SrcSize;
opj_image_t *image;
opj_codec_t* l_codec;
@@ -702,10 +702,12 @@ void CJPX_Decoder::GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestre
height = (FX_DWORD)image->y1;
output_nComps = codestream_nComps = (FX_DWORD)image->numcomps;
}
-FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets)
+FX_BOOL CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets)
{
int i, wid, hei, row, col, channel, src;
- FX_LPBYTE pChannel, pScanline, pPixel;
+ uint8_t* pChannel;
+ uint8_t* pScanline;
+ uint8_t* pPixel;
if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) {
return FALSE;
@@ -784,7 +786,7 @@ void initialize_sign_lut();
CCodec_JpxModule::CCodec_JpxModule()
{
}
-void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX_BOOL useColorSpace)
+void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size , FX_BOOL useColorSpace)
{
CJPX_Decoder* pDecoder = new CJPX_Decoder;
pDecoder->m_useColorSpace = useColorSpace;
@@ -794,13 +796,13 @@ void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX
}
return pDecoder;
}
-void CCodec_JpxModule::GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height,
+void CCodec_JpxModule::GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height,
FX_DWORD& codestream_nComps, FX_DWORD& output_nComps)
{
CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx;
pDecoder->GetInfo(width, height, codestream_nComps, output_nComps);
}
-FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets)
+FX_BOOL CCodec_JpxModule::Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets)
{
CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx;
return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets);
diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h
index 46c6e2b532..cc1e3904bd 100644
--- a/core/src/fxcodec/jbig2/JBig2_Define.h
+++ b/core/src/fxcodec/jbig2/JBig2_Define.h
@@ -24,7 +24,7 @@ typedef struct {
int32_t code;
} JBig2HuffmanCode;
extern "C" {
- void _FaxG4Decode(void *pModule, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch = 0);
+ void _FaxG4Decode(void *pModule, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch = 0);
};
#define JBIG2_MAX_REFERRED_SEGMENT_COUNT 64
#define JBIG2_MAX_EXPORT_SYSMBOLS 65535
diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h
index aef31bb49f..5a96f4395e 100644
--- a/core/src/fxcodec/jbig2/JBig2_Module.h
+++ b/core/src/fxcodec/jbig2/JBig2_Module.h
@@ -18,16 +18,16 @@ public:
virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) = 0;
- virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) = 0;
+ virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) = 0;
- virtual void JBig2_Free(FX_LPVOID pMem) = 0;
+ virtual void JBig2_Free(void* pMem) = 0;
virtual void JBig2_Assert(int32_t nExpression) {};
- virtual void JBig2_Error(FX_LPCSTR format, ...) {};
+ virtual void JBig2_Error(const FX_CHAR* format, ...) {};
- virtual void JBig2_Warn(FX_LPCSTR format, ...) {};
+ virtual void JBig2_Warn(const FX_CHAR* format, ...) {};
- virtual void JBig2_Log(FX_LPCSTR format, ...) {};
+ virtual void JBig2_Log(const FX_CHAR* format, ...) {};
};
#endif
diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp
index 4bb00b897b..1429a91644 100644
--- a/core/src/fxcodec/jbig2/JBig2_Object.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp
@@ -6,14 +6,14 @@
#include "JBig2_Object.h"
#include "JBig2_Module.h"
-void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line)
+void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line)
{
CJBig2_Object *p;
p = (CJBig2_Object *)pModule->JBig2_Malloc((FX_DWORD)size);
p->m_pModule = pModule;
return p;
}
-void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line)
+void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line)
{
pModule->JBig2_Free(p);
}
@@ -33,7 +33,7 @@ void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule)
pModule->JBig2_Free(p);
}
void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size,
- FX_LPCSTR filename, int line)
+ const FX_CHAR* filename, int line)
{
void *p;
uint8_t *pCur, *pEnd;
@@ -46,7 +46,7 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t
return p;
}
void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size,
- FX_LPCSTR filename, int line)
+ const FX_CHAR* filename, int line)
{
pModule->JBig2_Free(p);
}
diff --git a/core/src/fxcodec/jbig2/JBig2_Object.h b/core/src/fxcodec/jbig2/JBig2_Object.h
index 23eecbf171..150a8e7e99 100644
--- a/core/src/fxcodec/jbig2/JBig2_Object.h
+++ b/core/src/fxcodec/jbig2/JBig2_Object.h
@@ -13,9 +13,9 @@ class CJBig2_Object
{
public:
- void *operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line);
+ void *operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line);
- void operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line);
+ void operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line);
void *operator new(size_t size, CJBig2_Module *pModule);
@@ -24,10 +24,10 @@ public:
void operator delete(void *p, CJBig2_Module *pModule);
void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size,
- FX_LPCSTR filename, int line);
+ const FX_CHAR* filename, int line);
void operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size,
- FX_LPCSTR filename, int line);
+ const FX_CHAR* filename, int line);
void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size);
diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h
index fe44bc962d..b61e8e5075 100644
--- a/core/src/fxcodec/jbig2/JBig2_Segment.h
+++ b/core/src/fxcodec/jbig2/JBig2_Segment.h
@@ -62,7 +62,7 @@ public:
CJBig2_PatternDict *pd;
CJBig2_Image *im;
CJBig2_HuffmanTable *ht;
- FX_LPVOID vd;
+ void* vd;
} m_Result;
};
#endif