diff options
Diffstat (limited to 'core/src/fxcodec')
32 files changed, 1076 insertions, 1076 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index ae9f22bc4a..c50faaa936 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,9 +17,9 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); @@ -27,7 +27,7 @@ public: struct CCodec_ImageDataCache { int m_Width, m_Height; int m_nCachedLines; - FX_BYTE m_Data; + uint8_t m_Data; }; class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { @@ -126,10 +126,10 @@ class CCodec_FlateModule : public ICodec_FlateModule public: virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE 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 FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, + 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); - virtual FX_BOOL Encode(const FX_BYTE* src_buf, FX_DWORD src_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); @@ -185,12 +185,12 @@ public: virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); - virtual FX_INT32 ReadHeader(void* pContext, int* width, int* height, + virtual int32_t ReadHeader(void* pContext, int* width, int* height, int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute); - virtual FX_INT32 LoadFrameInfo(void* pContext, int* frame_num); + virtual int32_t LoadFrameInfo(void* pContext, int* frame_num); - virtual FX_INT32 LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute); + virtual int32_t LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute); protected: FX_CHAR m_szLastError[256]; @@ -206,8 +206,8 @@ public: virtual void Finish(void* pContext); virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); - virtual FX_INT32 ReadHeader(void* pContext, FX_INT32* width, FX_INT32* height, FX_BOOL* tb_flag, FX_INT32* components, FX_INT32* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute); - virtual FX_INT32 LoadImage(void* pContext); + virtual int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute); + virtual int32_t LoadImage(void* pContext); protected: FX_CHAR m_szLastError[256]; @@ -225,10 +225,10 @@ 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, FX_INT32& nComponents, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE 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, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ); @@ -263,8 +263,8 @@ class CCodec_TiffModule : public ICodec_TiffModule { public: virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr); - virtual void GetFrames(FX_LPVOID ctx, FX_INT32& frames); - virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); + virtual void GetFrames(FX_LPVOID ctx, int32_t& frames); + virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBitmap); virtual void DestroyDecoder(FX_LPVOID ctx); }; @@ -273,14 +273,14 @@ class CPDF_Jbig2Interface : public CJBig2_Module public: virtual void *JBig2_Malloc(FX_DWORD dwSize) { - return FX_Alloc(FX_BYTE, dwSize); + return FX_Alloc(uint8_t, dwSize); } virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) { if (dwSize && num >= UINT_MAX / dwSize) { return NULL; } - return FX_Alloc(FX_BYTE, num * dwSize); + return FX_Alloc(uint8_t, num * dwSize); } virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) { @@ -291,11 +291,11 @@ public: if (size && num >= UINT_MAX / size) { return NULL; } - return FX_Alloc(FX_BYTE, num * size); + return FX_Alloc(uint8_t, num * size); } virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) { - return FX_Realloc(FX_BYTE, pMem, dwSize); + return FX_Realloc(uint8_t, pMem, dwSize); } virtual void JBig2_Free(FX_LPVOID pMem) { diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 711e2898a1..5676e46be0 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -123,7 +123,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) FX_Free(m_pDataCache); m_pDataCache = NULL; } - m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(FX_BYTE, sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight); + m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(uint8_t, sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight); if (m_pDataCache == NULL) { return; } @@ -131,7 +131,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 FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -240,7 +240,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -FX_BOOL CCodec_BasicModule::A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -368,7 +368,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYT wTag = m_readWord(data); data += 2; if (!pMap->Lookup(wTag, buf)) { - buf = FX_Alloc(FX_BYTE, 10); + buf = FX_Alloc(uint8_t, 10); if (buf == NULL) { return FALSE; } @@ -387,7 +387,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYT wTag = m_readWord(data); data += 2; if (!pMap->Lookup(wTag, buf)) { - buf = FX_Alloc(FX_BYTE, 10); + buf = FX_Alloc(uint8_t, 10); if (buf == NULL) { return FALSE; } @@ -452,7 +452,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_SignedByte: case FX_Undefined: dwSize = dwModuleNum; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -465,7 +465,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_UnsignedShort: case FX_SignedShort: dwSize = dwModuleNum << 1; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -484,7 +484,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_SignedLong: case FX_SignedFloat: dwSize = dwModuleNum << 2; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -502,7 +502,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_UnsignedRation: case FX_SignedRation: { dwSize = dwModuleNum << 3; - buf = FX_Alloc(FX_BYTE, dwSize); + buf = FX_Alloc(uint8_t, dwSize); if (buf == NULL) { return FALSE; } @@ -512,7 +512,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* FXSYS_memcpy32(buf, head, dwSize); } temp = buf; - val = FX_Alloc(FX_BYTE, dwSize / 2); + val = FX_Alloc(uint8_t, dwSize / 2); if (val == NULL) { FX_Free(buf); return FALSE; @@ -530,7 +530,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* break; case FX_DoubleFloat: dwSize = dwModuleNum << 3; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -606,7 +606,7 @@ public: protected: FX_BOOL CheckDestSize(); void GetNextOperator(); - void UpdateOperator(FX_BYTE used_bytes); + void UpdateOperator(uint8_t used_bytes); FX_LPBYTE m_pScanline; FX_LPCBYTE m_pSrcBuf; @@ -614,7 +614,7 @@ protected: FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; FX_BOOL m_bEOD; - FX_BYTE m_Operator; + uint8_t m_Operator; }; CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder() : m_pScanline(NULL) @@ -673,7 +673,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_DownScale = 1; m_Pitch = (width * nComps * bpc + 31) / 32 * 4; m_dwLineBytes = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); return CheckDestSize(); } FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() @@ -709,7 +709,7 @@ FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memcpy32(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); col_pos += copy_len; - UpdateOperator((FX_BYTE)copy_len); + UpdateOperator((uint8_t)copy_len); } else if (m_Operator > 128) { int fill = 0; if (m_SrcOffset - 1 < m_SrcSize - 1) { @@ -722,7 +722,7 @@ FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memset8(m_pScanline + col_pos, fill, duplicate_len); col_pos += duplicate_len; - UpdateOperator((FX_BYTE)duplicate_len); + UpdateOperator((uint8_t)duplicate_len); } else { m_bEOD = TRUE; break; @@ -739,7 +739,7 @@ void CCodec_RLScanlineDecoder::GetNextOperator() m_Operator = m_pSrcBuf[m_SrcOffset]; m_SrcOffset ++; } -void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) +void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { if (used_bytes == 0) { return; @@ -758,7 +758,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) } return; } - FX_BYTE count = 257 - m_Operator; + uint8_t count = 257 - m_Operator; FXSYS_assert((FX_DWORD)count >= used_bytes); if (used_bytes == count) { m_SrcOffset ++; diff --git a/core/src/fxcodec/codec/fx_codec_bmp.cpp b/core/src/fxcodec/codec/fx_codec_bmp.cpp index 4e974e2124..924eaa91a4 100644 --- a/core/src/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/src/fxcodec/codec/fx_codec_bmp.cpp @@ -33,7 +33,7 @@ static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg) FXSYS_strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1);
longjmp(bmp_ptr->jmpbuf, 1);
}
-static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, FX_INT32 row_num, FX_LPBYTE row_buf)
+static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf)
{
FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr;
CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr;
@@ -47,7 +47,7 @@ static FX_BOOL _bmp_get_data_position(bmp_decompress_struct_p bmp_ptr, FX_DWORD }
void* CCodec_BmpModule::Start(void* pModule)
{
- FXBMP_Context* p = (FXBMP_Context*)FX_Alloc(FX_BYTE, sizeof(FXBMP_Context));
+ FXBMP_Context* p = (FXBMP_Context*)FX_Alloc(uint8_t, sizeof(FXBMP_Context));
if (p == NULL) {
return NULL;
}
@@ -80,13 +80,13 @@ void CCodec_BmpModule::Finish(void* pContext) p->m_FreeFunc(p);
}
}
-FX_INT32 CCodec_BmpModule::ReadHeader(void* pContext, FX_INT32* width, FX_INT32* height, FX_BOOL* tb_flag, FX_INT32* components, FX_INT32* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute)
+int32_t CCodec_BmpModule::ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
if(setjmp(p->bmp_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _bmp_read_header(p->bmp_ptr);
+ int32_t ret = _bmp_read_header(p->bmp_ptr);
if (ret != 1) {
return ret;
}
@@ -104,7 +104,7 @@ FX_INT32 CCodec_BmpModule::ReadHeader(void* pContext, FX_INT32* width, FX_INT32* }
return 1;
}
-FX_INT32 CCodec_BmpModule::LoadImage(void* pContext)
+int32_t CCodec_BmpModule::LoadImage(void* pContext)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
if(setjmp(p->bmp_ptr->jmpbuf)) {
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index dc2ee2aacd..869751e05b 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -6,7 +6,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "codec_int.h" -const FX_BYTE OneLeadPos[256] = { +const uint8_t OneLeadPos[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -24,7 +24,7 @@ const FX_BYTE OneLeadPos[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -const FX_BYTE ZeroLeadPos[256] = { +const uint8_t ZeroLeadPos[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43,14 +43,14 @@ const FX_BYTE ZeroLeadPos[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, }; -int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) +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; if (start_pos % 8) { - FX_BYTE data = data_buf[start_pos / 8]; + uint8_t data = data_buf[start_pos / 8]; if (bit) { data &= 0xff >> (start_pos % 8); } else { @@ -61,7 +61,7 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } start_pos += 7; } - FX_BYTE skip = bit ? 0x00 : 0xff; + uint8_t skip = bit ? 0x00 : 0xff; int byte_pos = start_pos / 8; int max_byte = (max_pos + 7) / 8; while (byte_pos < max_byte) { @@ -79,12 +79,12 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } return pos; } -void _FaxG4FindB1B2(const FX_BYTE* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) +void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) { if (a0color) { a0color = 1; } - FX_BYTE first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); + uint8_t first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); b1 = _FindBit(ref_buf, columns, a0 + 1, !first_bit); if (b1 >= columns) { b1 = b2 = columns; @@ -136,7 +136,7 @@ void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) #define NEXTBIT src_buf[bitpos/8] & (1 << (7-bitpos%8)); bitpos ++; #define ADDBIT(code, bit) code = code << 1; if (bit) code ++; #define GETBIT(bitpos) src_buf[bitpos/8] & (1 << (7-bitpos%8)) -static const FX_BYTE FaxBlackRunIns[] = { +static const uint8_t FaxBlackRunIns[] = { 0, 2, 0x02, 3, 0, @@ -256,7 +256,7 @@ static const FX_BYTE FaxBlackRunIns[] = { 0x77, 1216 % 256, 1216 / 256, 0xff }; -static const FX_BYTE FaxWhiteRunIns[] = { +static const uint8_t FaxWhiteRunIns[] = { 0, 0, 0, @@ -375,12 +375,12 @@ static const FX_BYTE FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; while (1) { - FX_BYTE ins = ins_array[ins_off++]; + uint8_t ins = ins_array[ins_off++]; if (ins == 0xff) { return -1; } @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bi } } } -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -522,7 +522,7 @@ FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE a0color = !a0color; } } -FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { int startbit = bitpos; while (bitpos < bitsize) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -621,8 +621,8 @@ FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wid m_Pitch = (m_OrigWidth + 31) / 32 * 4; m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); m_pSrcBuf = src_buf; m_SrcSize = src_size; m_nComps = 1; @@ -698,7 +698,7 @@ extern "C" { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(FX_BYTE, pitch); + FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { @@ -711,7 +711,7 @@ extern "C" { *pbitpos = bitpos; } }; -static const FX_BYTE BlackRunTerminator[128] = { +static const uint8_t BlackRunTerminator[128] = { 0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4, 0x03, 5, 0x05, 6, 0x04, 6, 0x04, 7, 0x05, 7, 0x07, 7, 0x04, 8, 0x07, 8, 0x18, 9, 0x17, 10, 0x18, 10, 0x08, 10, 0x67, 11, 0x68, 11, 0x6c, 11, 0x37, 11, 0x28, 11, @@ -721,14 +721,14 @@ static const FX_BYTE BlackRunTerminator[128] = { 0x64, 12, 0x65, 12, 0x52, 12, 0x53, 12, 0x24, 12, 0x37, 12, 0x38, 12, 0x27, 12, 0x28, 12, 0x58, 12, 0x59, 12, 0x2b, 12, 0x2c, 12, 0x5a, 12, 0x66, 12, 0x67, 12, }; -static const FX_BYTE BlackRunMarkup[80] = { +static const uint8_t BlackRunMarkup[80] = { 0x0f, 10, 0xc8, 12, 0xc9, 12, 0x5b, 12, 0x33, 12, 0x34, 12, 0x35, 12, 0x6c, 13, 0x6d, 13, 0x4a, 13, 0x4b, 13, 0x4c, 13, 0x4d, 13, 0x72, 13, 0x73, 13, 0x74, 13, 0x75, 13, 0x76, 13, 0x77, 13, 0x52, 13, 0x53, 13, 0x54, 13, 0x55, 13, 0x5a, 13, 0x5b, 13, 0x64, 13, 0x65, 13, 0x08, 11, 0x0c, 11, 0x0d, 11, 0x12, 12, 0x13, 12, 0x14, 12, 0x15, 12, 0x16, 12, 0x17, 12, 0x1c, 12, 0x1d, 12, 0x1e, 12, 0x1f, 12, }; -static const FX_BYTE WhiteRunTerminator[128] = { +static const uint8_t WhiteRunTerminator[128] = { 0x35, 8, 0x07, 6, 0x07, 4, @@ -794,7 +794,7 @@ static const FX_BYTE WhiteRunTerminator[128] = { 0x33, 8, 0x34, 8, }; -static const FX_BYTE WhiteRunMarkup[80] = { +static const uint8_t WhiteRunMarkup[80] = { 0x1b, 5, 0x12, 5, 0x17, 6, @@ -935,9 +935,9 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, m_Cols = width; m_Rows = height; m_Pitch = pitch; - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); - m_pLineBuf = FX_Alloc2D(FX_BYTE, m_Pitch, 8); + m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); } CCodec_FaxEncoder::~CCodec_FaxEncoder() @@ -952,7 +952,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; - FX_BYTE last_byte = 0; + uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 7a19e8b855..9997a570d6 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -13,7 +13,7 @@ extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -79,22 +79,22 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const FX_BYTE* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(FX_LPBYTE 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; - const FX_BYTE* m_pInput; + const uint8_t* m_pInput; FX_BOOL m_Early; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); FX_DWORD m_CodeArray[5021]; FX_DWORD m_nCodes; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; void DecodeString(FX_DWORD code); int m_CodeLen; }; -void CLZWDecoder::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_Early == 4094) { return; @@ -119,15 +119,15 @@ void CLZWDecoder::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -137,7 +137,7 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* m_Early = bEarlyChange ? 1 : 0; m_nCodes = 0; FX_DWORD old_code = (FX_DWORD) - 1; - FX_BYTE last_char; + uint8_t last_char; while (1) { if (m_InPos + m_CodeLen > src_size * 8) { break; @@ -164,10 +164,10 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* return -5; } if (m_pOutput) { - m_pOutput[m_OutPos] = (FX_BYTE)code; + m_pOutput[m_OutPos] = (uint8_t)code; } m_OutPos ++; - last_char = (FX_BYTE)code; + last_char = (uint8_t)code; if (old_code != (FX_DWORD) - 1) { AddCode(old_code, last_char); } @@ -217,19 +217,19 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_size = (m_InPos + 7) / 8; return 0; } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, int predictor, int Colors, @@ -241,7 +241,7 @@ 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(FX_BYTE, row_size + 1, row_count); + FX_LPBYTE 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; @@ -262,7 +262,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, switch (predictor) { case 11: { pDestData[0] = 1; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } @@ -271,7 +271,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 12: { pDestData[0] = 2; - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -280,11 +280,11 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 13: { pDestData[0] = 3; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -293,15 +293,15 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 14: { pDestData[0] = 4; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pSrcData[byte - row_size - BytesPerPixel]; } @@ -328,16 +328,16 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE { int row_size = (nPixels * bpc * nColors + 7) / 8; int BytesPerPixel = (bpc * nColors + 7) / 8; - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; if (tag == 0) { FXSYS_memmove32(pDestData, pSrcData + 1, row_size); return; } for (int byte = 0; byte < row_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -345,7 +345,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -353,11 +353,11 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -365,15 +365,15 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && pLastLine) { upper_left = pLastLine[byte - BytesPerPixel]; } @@ -395,12 +395,12 @@ 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(FX_BYTE, row_size, row_count); + FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; FX_LPBYTE pSrcData = data_buf; FX_LPBYTE pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; byte_cnt++; if (tag == 0) { int move_size = row_size; @@ -414,10 +414,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, continue; } for (int byte = 0; byte < row_size && byte_cnt < (int)data_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -425,7 +425,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -433,11 +433,11 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -445,15 +445,15 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pDestData[byte - row_size - BytesPerPixel]; } @@ -478,7 +478,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { - FX_BYTE mask = 0x01; + uint8_t mask = 0x01; if (BitsPerComponent == 2) { mask = 0x03; } else if (BitsPerComponent == 4) { @@ -490,8 +490,8 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP int index = i / 8; int col_pre = (col == 0) ? (8 - BitsPerComponent) : (col - BitsPerComponent); int index_pre = (col == 0) ? (index - 1) : index; - FX_BYTE cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; - FX_BYTE left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; + uint8_t cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; + uint8_t left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; cur -= left; cur &= mask; cur <<= (8 - col - BitsPerComponent); @@ -507,7 +507,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP FX_WORD pixel = (dest_buf[i] << 8) | dest_buf[i + 1]; pixel -= (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } } @@ -553,7 +553,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon FX_WORD pixel = (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; pixel += (dest_buf[i] << 8) | dest_buf[i + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } else { for (int i = BytesPerPixel; i < row_size; i ++) { @@ -641,7 +641,7 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_bpc = bpc; m_bColorTransformed = FALSE; m_Pitch = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; if (predictor) { if (predictor >= 10) { @@ -659,9 +659,9 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_BitsPerComponent = BitsPerComponent; m_Columns = Columns; m_PredictPitch = (m_BitsPerComponent * m_Colors * m_Columns + 7) / 8; - m_pLastLine = FX_Alloc(FX_BYTE, m_PredictPitch); - m_pPredictRaw = FX_Alloc(FX_BYTE, m_PredictPitch + 1); - m_pPredictBuffer = FX_Alloc(FX_BYTE, m_PredictPitch); + m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch); + m_pPredictRaw = FX_Alloc(uint8_t, m_PredictPitch + 1); + m_pPredictBuffer = FX_Alloc(uint8_t, m_PredictPitch); } } } @@ -737,7 +737,7 @@ 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(FX_BYTE, guess_size + 1); + FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1); FX_LPBYTE cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); @@ -746,10 +746,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FPDFAPI_FlateInput(context, src_buf, src_size); if (useOldImpl) { while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); if (ret != Z_OK) break; - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (avail_buf_size != 0) break; @@ -758,7 +758,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig guess_size += alloc_step; if (guess_size < old_size || guess_size + 1 < guess_size) goto fail; - guess_buf = FX_Realloc(FX_BYTE, guess_buf, guess_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, guess_size + 1); if (!guess_buf) goto fail; guess_buf[guess_size] = '\0'; @@ -768,7 +768,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig dest_size = FPDFAPI_FlateGetTotalOut(context); offset = FPDFAPI_FlateGetTotalIn(context); if (guess_size / 2 > dest_size) { - guess_buf = FX_Realloc(FX_BYTE, guess_buf, dest_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, dest_size + 1); if (!guess_buf) goto fail; guess_size = dest_size; @@ -778,8 +778,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } else { CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs; while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (ret != Z_OK) { last_buf_size = buf_size - avail_buf_size; result_tmp_bufs.Add(cur_buf); @@ -793,7 +793,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig // |avail_buf_size| == 0 case. result_tmp_bufs.Add(cur_buf); - cur_buf = FX_Alloc(FX_BYTE, buf_size + 1); + cur_buf = FX_Alloc(uint8_t, buf_size + 1); cur_buf[buf_size] = '\0'; } dest_size = FPDFAPI_FlateGetTotalOut(context); @@ -801,9 +801,9 @@ 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(FX_BYTE, dest_size); + FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; - for (FX_INT32 i = 0; i < result_tmp_bufs.GetSize(); i++) { + for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { FX_LPBYTE tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { @@ -832,7 +832,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX pDecoder->Create(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, +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) { @@ -859,7 +859,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } { nonstd::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder); - dest_buf = FX_Alloc( FX_BYTE, dest_size + 1); + dest_buf = FX_Alloc( uint8_t, dest_size + 1); dest_buf[dest_size] = '\0'; decoder->Decode(dest_buf, dest_size, src_buf, offset, bEarlyChange); } @@ -879,7 +879,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } return ret ? offset : -1; } -FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, +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) { @@ -887,7 +887,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, return Encode(src_buf, src_size, dest_buf, dest_size); } FX_LPBYTE pSrcBuf = NULL; - pSrcBuf = FX_Alloc(FX_BYTE, src_size); + pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; if (predictor == 2) { @@ -905,7 +905,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); unsigned long temp_size = dest_size; FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); dest_size = (FX_DWORD)temp_size; diff --git a/core/src/fxcodec/codec/fx_codec_gif.cpp b/core/src/fxcodec/codec/fx_codec_gif.cpp index 1fc708db5c..218b58a946 100644 --- a/core/src/fxcodec/codec/fx_codec_gif.cpp +++ b/core/src/fxcodec/codec/fx_codec_gif.cpp @@ -33,7 +33,7 @@ static void _gif_error_data(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) FXSYS_strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1);
longjmp(gif_ptr->jmpbuf, 1);
}
-static FX_LPBYTE _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, FX_INT32 pal_size)
+static FX_LPBYTE _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, int32_t pal_size)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -47,17 +47,17 @@ static void _gif_record_current_position(gif_decompress_struct_p gif_ptr, FX_DWO CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr);
}
-static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, FX_INT32 row_num, FX_LPBYTE row_buf)
+static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf);
}
static FX_BOOL _gif_get_record_position(gif_decompress_struct_p gif_ptr, FX_DWORD cur_pos,
- FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace)
+ int32_t left, int32_t top, int32_t width, int32_t height,
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -66,7 +66,7 @@ static FX_BOOL _gif_get_record_position(gif_decompress_struct_p gif_ptr, FX_DWOR }
void* CCodec_GifModule::Start(void* pModule)
{
- FXGIF_Context* p = (FXGIF_Context*)FX_Alloc(FX_BYTE, sizeof(FXGIF_Context));
+ FXGIF_Context* p = (FXGIF_Context*)FX_Alloc(uint8_t, sizeof(FXGIF_Context));
if (p == NULL) {
return NULL;
}
@@ -98,14 +98,14 @@ void CCodec_GifModule::Finish(void* pContext) p->m_FreeFunc(p);
}
}
-FX_INT32 CCodec_GifModule::ReadHeader(void* pContext, int* width, int* height,
+int32_t CCodec_GifModule::ReadHeader(void* pContext, int* width, int* height,
int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
if(setjmp(p->gif_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _gif_read_header(p->gif_ptr);
+ int32_t ret = _gif_read_header(p->gif_ptr);
if (ret != 1) {
return ret;
}
@@ -118,26 +118,26 @@ FX_INT32 CCodec_GifModule::ReadHeader(void* pContext, int* width, int* height, *bg_index = p->gif_ptr->bc_index;
return 1;
}
-FX_INT32 CCodec_GifModule::LoadFrameInfo(void* pContext, int* frame_num)
+int32_t CCodec_GifModule::LoadFrameInfo(void* pContext, int* frame_num)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
if(setjmp(p->gif_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _gif_get_frame(p->gif_ptr);
+ int32_t ret = _gif_get_frame(p->gif_ptr);
if (ret != 1) {
return ret;
}
*frame_num = _gif_get_frame_num(p->gif_ptr);
return 1;
}
-FX_INT32 CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute)
+int32_t CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
if(setjmp(p->gif_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _gif_load_frame(p->gif_ptr, frame_num);
+ int32_t ret = _gif_load_frame(p->gif_ptr, frame_num);
if (ret == 1) {
if (pAttribute) {
pAttribute->m_nGifLeft = p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->left;
@@ -147,7 +147,7 @@ FX_INT32 CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttri FX_LPCBYTE buf = (FX_LPCBYTE)p->gif_ptr->cmt_data_ptr->GetBuffer(0);
FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength();
if (len > 21) {
- FX_BYTE size = *buf++;
+ uint8_t size = *buf++;
if (size) {
pAttribute->m_strAuthor = CFX_ByteString(buf, size);
} else {
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 26b4c1adfc..cde5d4c1bd 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, FX_BYTE ID[16] ) +FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -65,7 +65,7 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs, int nComponents, FX_BOOL bDst } return TRUE; } -FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) +int32_t GetCSComponents(cmsColorSpaceSignature cs) { FX_DWORD components; switch (cs) { @@ -87,8 +87,8 @@ FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) } return components; } -void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 nDstComponents, +void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t nDstComponents, int intent, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) { cmsHPROFILE srcProfile = NULL; @@ -157,7 +157,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr cmsCloseProfile(dstProfile); return pCmm; } -void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL, 0, 3, intent, dwSrcFormat); } @@ -175,7 +175,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV return; } CLcmsCmm* p = (CLcmsCmm*)pTransform; - FX_BYTE output[4]; + uint8_t output[4]; if (p->m_bLab) { CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); double* input = inputs; @@ -184,8 +184,8 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV } cmsDoTransform(p->m_hTransform, input, output, 1); } else { - CFX_FixedBufGrow<FX_BYTE, 16> inputs(nSrcComponents); - FX_BYTE* input = inputs; + CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents); + uint8_t* input = inputs; for (FX_DWORD i = 0; i < nSrcComponents; i ++) { if (pSrcValues[i] > 1.0f) { input[i] = 255; @@ -214,7 +214,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV break; } } -void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, FX_INT32 pixels) +void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, int32_t pixels) { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } @@ -284,7 +284,7 @@ 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(FX_BYTE, dwSize); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); @@ -406,7 +406,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteStringKey key; CFX_ByteString text; key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8); - FX_BYTE ID[16]; + uint8_t ID[16]; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_NONE: return NULL; @@ -526,12 +526,12 @@ CCodec_IccModule::~CCodec_IccModule() } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE 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, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent, +void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,11 +545,11 @@ 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, FX_INT32 pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } -const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { +const uint8_t g_CMYKSamples[81 * 81 * 3] = { 255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152, 123, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, 255, 253, 229, 226, 224, 203, 200, 199, 182, 173, 173, 158, 149, 148, 135, 125, 124, 113, 99, 99, 90, 70, 69, 63, 33, 29, 24, 255, 251, 204, 228, 223, 182, 201, 198, 163, 174, 172, 142, 150, 147, 122, 125, 123, 101, 99, 98, 80, 70, 68, 54, 32, 28, 16, @@ -1280,7 +1280,7 @@ const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { 53, 53, 66, 47, 44, 57, 40, 36, 48, 32, 27, 39, 22, 18, 30, 9, 4, 18, 0, 0, 3, 0, 0, 0, 0, 0, 0, 54, 53, 57, 48, 45, 49, 41, 37, 41, 33, 28, 32, 22, 19, 23, 11, 6, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, }; -void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, FX_BYTE& G, FX_BYTE& B) +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) { int fix_c = c << 8; int fix_m = m << 8; @@ -1357,11 +1357,11 @@ void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, } 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) { - FX_BYTE c1 = FXSYS_round(c * 255); - FX_BYTE m1 = FXSYS_round(m * 255); - FX_BYTE y1 = FXSYS_round(y * 255); - FX_BYTE k1 = FXSYS_round(k * 255); - FX_BYTE r, g, b; + uint8_t c1 = FXSYS_round(c * 255); + uint8_t m1 = FXSYS_round(m * 255); + uint8_t y1 = FXSYS_round(y * 255); + uint8_t k1 = FXSYS_round(k * 255); + uint8_t r, g, b; AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); R = 1.0f * r / 255; G = 1.0f * g / 255; diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 8fcd9f4711..622448d659 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -52,7 +52,7 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -129,7 +129,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead m_pJbig2Context->m_bFileReader = TRUE; m_pJbig2Context->m_dest_image = NULL; m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize(); - m_pJbig2Context->m_src_buf = FX_Alloc(FX_BYTE, m_pJbig2Context->m_src_size); + m_pJbig2Context->m_src_buf = FX_Alloc(uint8_t, m_pJbig2Context->m_src_size); int ret = 0; if(!file_ptr->ReadBlock((void*)m_pJbig2Context->m_src_buf, 0, m_pJbig2Context->m_src_size)) { goto failed; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 7d18cb599f..4d06a77067 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -12,7 +12,7 @@ #include "codec_int.h" extern "C" { - static void _JpegScanSOI(const FX_BYTE*& src_buf, FX_DWORD& src_size) + static void _JpegScanSOI(const uint8_t*& src_buf, FX_DWORD& src_size) { if (src_size == 0) { return; @@ -95,8 +95,8 @@ static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_pt *icc_length = 0; FX_LPBYTE icc_data_ptr = NULL; FX_DWORD icc_data_len = 0; - FX_BYTE count_icc_marker = 0; - FX_BYTE num_icc_marker = 0; + uint8_t count_icc_marker = 0; + uint8_t num_icc_marker = 0; jpeg_saved_marker_ptr marker_list[256] = {NULL}; for (jpeg_saved_marker_ptr cur_marker = cinfo->marker_list; cur_marker != NULL; @@ -126,7 +126,7 @@ static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_pt if(num_icc_marker == 0) { return TRUE; } - icc_data_ptr = FX_Alloc(FX_BYTE, icc_data_len); + icc_data_ptr = FX_Alloc(uint8_t, icc_data_len); if(icc_buf_ptr == NULL) { return FALSE; } @@ -150,15 +150,15 @@ 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(FX_BYTE, icc_data_length); + FX_LPBYTE 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] = (FX_BYTE)icc_segment_num; - for (FX_BYTE i = 0; i < (icc_segment_num - 1); i++) { + icc_data[13] = (uint8_t)icc_segment_num; + for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { icc_data[12] = i + 1; FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + i * icc_segment_size, icc_segment_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length); } - icc_data[12] = (FX_BYTE)icc_segment_num; + icc_data[12] = (uint8_t)icc_segment_num; FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size; FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, JPEG_OVERHEAD_LEN + icc_length - icc_size); @@ -206,11 +206,11 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST dest_buf = nullptr; } else { dest_buf_length = safe_buf_len.ValueOrDie(); - dest_buf = FX_TryAlloc(FX_BYTE, dest_buf_length); + dest_buf = FX_TryAlloc(uint8_t, dest_buf_length); const int MIN_TRY_BUF_LEN = 1024; while (!dest_buf && dest_buf_length > MIN_TRY_BUF_LEN) { dest_buf_length >>= 1; - dest_buf = FX_TryAlloc(FX_BYTE, dest_buf_length); + dest_buf = FX_TryAlloc(uint8_t, dest_buf_length); } } if (!dest_buf) { @@ -235,7 +235,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } FX_LPBYTE line_buf = NULL; if (nComponents > 1) { - line_buf = FX_Alloc2D(FX_BYTE, width, nComponents); + line_buf = FX_Alloc2D(uint8_t, width, nComponents); } jpeg_set_defaults(&cinfo); if(quality != 75) { @@ -269,7 +269,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST row = cinfo.next_scanline; jpeg_write_scanlines(&cinfo, row_pointer, 1); if (cinfo.next_scanline == row) { - dest_buf = FX_Realloc(FX_BYTE, dest_buf, dest_buf_length + JPEG_BLOCK_SIZE); + dest_buf = FX_Realloc(uint8_t, dest_buf, dest_buf_length + JPEG_BLOCK_SIZE); dest.next_output_byte = dest_buf + dest_buf_length - dest.free_in_buffer; dest_buf_length += JPEG_BLOCK_SIZE; dest.free_in_buffer += JPEG_BLOCK_SIZE; @@ -477,7 +477,7 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi return FALSE; } m_Pitch = (cinfo.image_width * cinfo.num_components + 3) / 4 * 4; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); m_nComps = cinfo.num_components; m_bpc = 8; m_bColorTransformed = FALSE; @@ -485,7 +485,7 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi return TRUE; } extern "C" { - FX_INT32 FX_GetDownsampleRatio(FX_INT32 originWidth, FX_INT32 originHeight, FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int32_t downsampleWidth, int32_t downsampleHeight) { int iratio_w = originWidth / downsampleWidth; int iratio_h = originHeight / downsampleHeight; @@ -637,7 +637,7 @@ void* CCodec_JpegModule::Start() if (m_pExtProvider) { return m_pExtProvider->Start(); } - FXJPEG_Context* p = (FXJPEG_Context*)FX_Alloc(FX_BYTE, sizeof(FXJPEG_Context)); + FXJPEG_Context* p = (FXJPEG_Context*)FX_Alloc(uint8_t, sizeof(FXJPEG_Context)); p->m_AllocFunc = jpeg_alloc_func; p->m_FreeFunc = jpeg_free_func; p->m_ErrMgr.error_exit = _error_fatal1; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 1a1616c0a1..01faf67a30 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -714,7 +714,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo return FALSE; } FXSYS_memset8(dest_buf, 0xff, image->y1 * pitch); - FX_BYTE** channel_bufs = FX_Alloc(FX_BYTE*, image->numcomps); + uint8_t** channel_bufs = FX_Alloc(uint8_t*, image->numcomps); FX_BOOL result = FALSE; int* adjust_comps = FX_Alloc(int, image->numcomps); for (i = 0; i < (int)image->numcomps; i ++) { @@ -742,7 +742,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo if (adjust_comps[channel] > 0) { *pPixel = 0; } else { - *pPixel = (FX_BYTE)(src << -adjust_comps[channel]); + *pPixel = (uint8_t)(src << -adjust_comps[channel]); } } } @@ -757,7 +757,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo src = image->comps[channel].data[row * wid + col]; src += image->comps[channel].sgnd ? 1 << (image->comps[channel].prec - 1) : 0; if (adjust_comps[channel] - 1 < 0) { - *pPixel = (FX_BYTE)((src >> adjust_comps[channel])); + *pPixel = (uint8_t)((src >> adjust_comps[channel])); } else { int tmpPixel = (src >> adjust_comps[channel]) + ((src >> (adjust_comps[channel] - 1)) % 2); if (tmpPixel > 255) { @@ -765,7 +765,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo } else if (tmpPixel < 0) { tmpPixel = 0; } - *pPixel = (FX_BYTE)tmpPixel; + *pPixel = (uint8_t)tmpPixel; } } } diff --git a/core/src/fxcodec/codec/fx_codec_png.cpp b/core/src/fxcodec/codec/fx_codec_png.cpp index ea5ffaf68a..8cb24ba2fa 100644 --- a/core/src/fxcodec/codec/fx_codec_png.cpp +++ b/core/src/fxcodec/codec/fx_codec_png.cpp @@ -191,7 +191,7 @@ static void _png_get_row_func(png_structp png_ptr, png_bytep new_row, png_uint_3 }
void* CCodec_PngModule::Start(void* pModule)
{
- FXPNG_Context* p = (FXPNG_Context*)FX_Alloc(FX_BYTE, sizeof(FXPNG_Context));
+ FXPNG_Context* p = (FXPNG_Context*)FX_Alloc(uint8_t, sizeof(FXPNG_Context));
if(p == NULL) {
return NULL;
}
diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp index 0a51a9d437..d6ef06311c 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.cpp +++ b/core/src/fxcodec/codec/fx_codec_progress.cpp @@ -21,7 +21,7 @@ void CFXCODEC_WeightTable::Calc(int dest_len, int dest_min, int dest_max, int sr }
m_ItemSize = (int)(sizeof(int) * 2 + sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + 1));
m_DestMin = dest_min;
- m_pWeightTables = FX_Alloc(FX_BYTE, (dest_max - dest_min) * m_ItemSize + 4);
+ m_pWeightTables = FX_Alloc(uint8_t, (dest_max - dest_min) * m_ItemSize + 4);
if(m_pWeightTables == NULL) {
return;
}
@@ -103,7 +103,7 @@ void CFXCODEC_HorzTable::Calc(int dest_len, int src_len, FX_BOOL bInterpol) double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
- m_pWeightTables = FX_Alloc(FX_BYTE, size);
+ m_pWeightTables = FX_Alloc(uint8_t, size);
if(m_pWeightTables == NULL) {
return;
}
@@ -160,7 +160,7 @@ void CFXCODEC_VertTable::Calc(int dest_len, int src_len) double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
- m_pWeightTables = FX_Alloc(FX_BYTE, size);
+ m_pWeightTables = FX_Alloc(uint8_t, size);
if(m_pWeightTables == NULL) {
return;
}
@@ -288,7 +288,7 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(ICodec_JpegModule* pJpegModu dwSize = FXCODEC_BLOCK_SIZE;
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) / FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(FX_BYTE, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -360,17 +360,17 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
if(line >= pCodec->m_clipBox.top && line < pCodec->m_clipBox.bottom) {
double scale_y = (double)pCodec->m_sizeY / (double)pCodec->m_clipBox.Height();
- FX_INT32 row = (FX_INT32)((line - pCodec->m_clipBox.top) * scale_y) + pCodec->m_startY;
+ int32_t row = (int32_t)((line - pCodec->m_clipBox.top) * scale_y) + pCodec->m_startY;
FX_LPBYTE src_scan = (FX_LPBYTE)pDIBitmap->GetScanline(row);
FX_LPBYTE des_scan = pCodec->m_pDecodeBuf;
src_buf = pCodec->m_pDecodeBuf;
- FX_INT32 src_Bpp = pDIBitmap->GetBPP() >> 3;
- FX_INT32 des_Bpp = (pCodec->m_SrcFormat & 0xff) >> 3;
- FX_INT32 src_left = pCodec->m_startX;
- FX_INT32 des_left = pCodec->m_clipBox.left;
+ int32_t src_Bpp = pDIBitmap->GetBPP() >> 3;
+ int32_t des_Bpp = (pCodec->m_SrcFormat & 0xff) >> 3;
+ int32_t src_left = pCodec->m_startX;
+ int32_t des_left = pCodec->m_clipBox.left;
src_scan += src_left * src_Bpp;
des_scan += des_left * des_Bpp;
- for (FX_INT32 src_col = 0; src_col < pCodec->m_sizeX; src_col++) {
+ for (int32_t src_col = 0; src_col < pCodec->m_sizeX; src_col++) {
PixelWeight* pPixelWeights = pCodec->m_WeightHorzOO.GetPixelWeight(src_col);
if(pPixelWeights->m_SrcStart != pPixelWeights->m_SrcEnd) {
continue;
@@ -387,7 +387,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
FX_DWORD des_g = 0;
des_g += pPixelWeights->m_Weights[0] * src_scan[src_col];
- des_scan[pPixelWeights->m_SrcStart] = (FX_BYTE)(des_g >> 16);
+ des_scan[pPixelWeights->m_SrcStart] = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -398,9 +398,9 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p);
FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
- *pDes++ = (FX_BYTE)((des_b) >> 16);
- *pDes++ = (FX_BYTE)((des_g) >> 16);
- *pDes = (FX_BYTE)((des_r) >> 16);
+ *pDes++ = (uint8_t)((des_b) >> 16);
+ *pDes++ = (uint8_t)((des_g) >> 16);
+ *pDes = (uint8_t)((des_r) >> 16);
}
break;
case FXDIB_Argb: {
@@ -410,9 +410,9 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p++);
FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
- *pDes++ = (FX_BYTE)((des_b) >> 16);
- *pDes++ = (FX_BYTE)((des_g) >> 16);
- *pDes++ = (FX_BYTE)((des_r) >> 16);
+ *pDes++ = (uint8_t)((des_b) >> 16);
+ *pDes++ = (uint8_t)((des_g) >> 16);
+ *pDes++ = (uint8_t)((des_r) >> 16);
*pDes = *p;
}
break;
@@ -423,16 +423,16 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
return TRUE;
}
-void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, FX_INT32 des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
{
FX_LPBYTE des_scan = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_line);
- FX_INT32 src_Bpp = (m_SrcFormat & 0xff) >> 3;
- FX_INT32 des_Bpp = pDeviceBitmap->GetBPP() >> 3;
- FX_INT32 src_left = m_clipBox.left;
- FX_INT32 des_left = m_startX;
+ int32_t src_Bpp = (m_SrcFormat & 0xff) >> 3;
+ int32_t des_Bpp = pDeviceBitmap->GetBPP() >> 3;
+ int32_t src_left = m_clipBox.left;
+ int32_t des_left = m_startX;
src_scan += src_left * src_Bpp;
des_scan += des_left * des_Bpp;
- for (FX_INT32 des_col = 0; des_col < m_sizeX; des_col++) {
+ for (int32_t des_col = 0; des_col < m_sizeX; des_col++) {
PixelWeight* pPixelWeights = m_WeightHorzOO.GetPixelWeight(des_col);
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_1bppMask:
@@ -447,7 +447,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi FX_DWORD des_g = 0;
des_g += pPixelWeights->m_Weights[0] * src_scan[pPixelWeights->m_SrcStart];
des_g += pPixelWeights->m_Weights[1] * src_scan[pPixelWeights->m_SrcEnd];
- *des_scan++ = (FX_BYTE)(des_g >> 16);
+ *des_scan++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -462,9 +462,9 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi des_b += pPixelWeights->m_Weights[1] * (*p++);
des_g += pPixelWeights->m_Weights[1] * (*p++);
des_r += pPixelWeights->m_Weights[1] * (*p);
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -481,10 +481,10 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi des_g += pPixelWeights->m_Weights[1] * (*p++);
des_r += pPixelWeights->m_Weights[1] * (*p++);
des_a += pPixelWeights->m_Weights[1] * (*p);
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
- *des_scan++ = (FX_BYTE)((des_a) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -532,7 +532,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, dwSize = FXCODEC_BLOCK_SIZE;
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) / FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(FX_BYTE, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -560,14 +560,14 @@ void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback(void* pModule, FX_DWORD remain_size = pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext);
cur_pos = pCodec->m_offSet - remain_size;
}
-FX_LPBYTE CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, FX_INT32 frame_num, FX_INT32 pal_size)
+FX_LPBYTE CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size)
{
- return FX_Alloc(FX_BYTE, pal_size);
+ return FX_Alloc(uint8_t, pal_size);
}
FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace)
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
pCodec->m_offSet = rcd_pos;
@@ -599,7 +599,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu pCodec->m_GifTransIndex = trans_index;
pCodec->m_GifFrameRect = img_rc;
pCodec->m_SrcPassNumber = interlace ? 4 : 1;
- FX_INT32 pal_index = pCodec->m_GifBgIndex;
+ int32_t pal_index = pCodec->m_GifBgIndex;
CFX_DIBitmap* pDevice = pCodec->m_pDeviceBitmap;
if (trans_index >= pal_num) {
trans_index = -1;
@@ -620,7 +620,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu FX_LPBYTE pScanline = (FX_LPBYTE)pDevice->GetScanline(row + startY) + startX * Bpp;
switch(pCodec->m_TransMethod) {
case 3: {
- FX_BYTE gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
+ uint8_t gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
FXSYS_memset8(pScanline, gray, sizeX);
break;
}
@@ -644,12 +644,12 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu }
return TRUE;
}
-void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
ASSERT(pDIBitmap != NULL);
- FX_INT32 img_width = pCodec->m_GifFrameRect.Width();
+ int32_t img_width = pCodec->m_GifFrameRect.Width();
if (!pDIBitmap->HasAlpha()) {
FX_LPBYTE byte_ptr = row_buf;
for (int i = 0; i < img_width; i++ ) {
@@ -659,14 +659,14 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, FX_INT32 byte_ptr++;
}
}
- FX_INT32 pal_index = pCodec->m_GifBgIndex;
+ int32_t pal_index = pCodec->m_GifBgIndex;
if (pCodec->m_GifTransIndex != -1 && pCodec->m_pDeviceBitmap->HasAlpha()) {
pal_index = pCodec->m_GifTransIndex;
}
FXSYS_memset8(pCodec->m_pDecodeBuf, pal_index, pCodec->m_SrcWidth);
FX_BOOL bLastPass = ((row_num % 2) == 1) ? TRUE : FALSE;
- FX_INT32 line = row_num + pCodec->m_GifFrameRect.top;
- FX_INT32 left = pCodec->m_GifFrameRect.left;
+ int32_t line = row_num + pCodec->m_GifFrameRect.top;
+ int32_t left = pCodec->m_GifFrameRect.left;
FXSYS_memcpy32(pCodec->m_pDecodeBuf + left, row_buf, img_width);
int src_top = pCodec->m_clipBox.top;
int src_bottom = pCodec->m_clipBox.bottom;
@@ -732,7 +732,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB int des_g = 0;
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)(des_g >> 16);
+ *scan_des++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -746,9 +746,9 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
scan_src2 += des_Bpp - 3;
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
scan_des += des_Bpp - 3;
}
break;
@@ -762,10 +762,10 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
des_a += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
- *scan_des++ = (FX_BYTE)((des_a) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -791,7 +791,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, dwSize = FXCODEC_BLOCK_SIZE;
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) / FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(FX_BYTE, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -823,7 +823,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(void* pModul }
return TRUE;
}
-void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
@@ -887,7 +887,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub int des_g = 0;
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)(des_g >> 16);
+ *scan_des++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -901,9 +901,9 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
scan_src2 += des_Bpp - 3;
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
scan_des += des_Bpp - 3;
}
break;
@@ -917,10 +917,10 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
des_a += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
- *scan_des++ = (FX_BYTE)((des_a) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -940,7 +940,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, FX_Free(m_pSrcBuf);
m_pSrcBuf = NULL;
}
- m_pSrcBuf = FX_Alloc(FX_BYTE, size);
+ m_pSrcBuf = FX_Alloc(uint8_t, size);
if(m_pSrcBuf == NULL) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -969,7 +969,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_offSet += size;
pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size);
FX_DWORD* pPalette = NULL;
- FX_INT32 readResult = pBmpModule->ReadHeader(m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
+ int32_t readResult = pBmpModule->ReadHeader(m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
&m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
@@ -1023,7 +1023,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, }
m_offSet += size;
pJpegModule->Input(m_pJpegContext, m_pSrcBuf, size);
- FX_INT32 readResult = pJpegModule->ReadHeader(m_pJpegContext, &m_SrcWidth, &m_SrcHeight, &m_SrcComponents, pAttribute);
+ int32_t readResult = pJpegModule->ReadHeader(m_pJpegContext, &m_SrcWidth, &m_SrcHeight, &m_SrcComponents, pAttribute);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if(!JpegReadMoreData(pJpegModule, error_status)) {
@@ -1079,7 +1079,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, }
if(m_pSrcBuf != NULL && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
- m_pSrcBuf = FX_Alloc(FX_BYTE, input_size);
+ m_pSrcBuf = FX_Alloc(uint8_t, input_size);
if(m_pSrcBuf == NULL) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -1129,7 +1129,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_offSet += size;
pGifModule->Input(m_pGifContext, m_pSrcBuf, size);
m_SrcComponents = 1;
- FX_INT32 readResult = pGifModule->ReadHeader(m_pGifContext, &m_SrcWidth, &m_SrcHeight,
+ int32_t readResult = pGifModule->ReadHeader(m_pGifContext, &m_SrcWidth, &m_SrcHeight,
&m_GifPltNumber, (void**)&m_pGifPalette, &m_GifBgIndex);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
@@ -1164,7 +1164,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_status = FXCODEC_STATUS_ERR_FORMAT;
return FALSE;
}
- FX_INT32 frames = 0;
+ int32_t frames = 0;
pTiffModule->GetFrames(m_pTiffContext, frames);
FX_DWORD bpc;
FX_BOOL ret = pTiffModule->LoadFrameInfo(m_pTiffContext, 0, (FX_DWORD&)m_SrcWidth, (FX_DWORD&)m_SrcHeight, (FX_DWORD&)m_SrcComponents, bpc, pAttribute);
@@ -1380,7 +1380,7 @@ void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format des_format, FXCodec_ void _RGB2BGR(FX_LPBYTE buffer, int width = 1)
{
if (buffer && width > 0) {
- FX_BYTE temp;
+ uint8_t temp;
int i = 0;
int j = 0;
for (; i < width; i++, j += 3) {
@@ -1416,7 +1416,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
des_g += pixel_weight * src_scan[j];
}
- *des_scan++ = (FX_BYTE)(des_g >> 16);
+ *des_scan++ = (uint8_t)(des_g >> 16);
}
break;
case 3: {
@@ -1424,11 +1424,11 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
+ *des_scan++ = (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
}
break;
case 4: {
@@ -1440,7 +1440,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
}
- *des_scan++ = (FX_BYTE)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
+ *des_scan++ = (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
}
break;
case 5: {
@@ -1448,14 +1448,14 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
- FX_BYTE src_b = 0, src_g = 0, src_r = 0;
+ uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
des_b += pixel_weight * src_b;
des_g += pixel_weight * src_g;
des_r += pixel_weight * src_r;
}
- *des_scan++ = (FX_BYTE)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
+ *des_scan++ = (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
}
break;
case 6:
@@ -1466,7 +1466,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
des_g += pixel_weight * src_scan[j];
}
- FXSYS_memset8(des_scan, (FX_BYTE)(des_g >> 16), 3);
+ FXSYS_memset8(des_scan, (uint8_t)(des_g >> 16), 3);
des_scan += des_Bpp;
}
break;
@@ -1475,13 +1475,13 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -1491,28 +1491,28 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
*des_scan++ = 0xFF;
} else {
int des_a = 0, des_r = 0, des_g = 0, des_b = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_a += pixel_weight * (FX_BYTE)(argb >> 24);
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_a += pixel_weight * (uint8_t)(argb >> 24);
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
- *des_scan++ = (FX_BYTE)((des_a) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_a) >> 16);
}
}
break;
@@ -1525,9 +1525,9 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -1536,16 +1536,16 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
- FX_BYTE src_b = 0, src_g = 0, src_r = 0;
+ uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
des_b += pixel_weight * src_b;
des_g += pixel_weight * src_g;
des_r += pixel_weight * src_r;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -1560,10 +1560,10 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in des_r += pixel_weight * (*src_pixel);
des_alpha += pixel_weight;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
- *des_scan++ = (FX_BYTE)((des_alpha * 255) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_alpha * 255) >> 16);
}
break;
default:
@@ -1609,7 +1609,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double int des_g = 0;
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)(des_g >> 16);
+ *scan_des++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -1623,9 +1623,9 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
scan_src2 += des_Bpp - 3;
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
scan_des += des_Bpp - 3;
}
break;
@@ -1639,10 +1639,10 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
des_a += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
- *scan_des++ = (FX_BYTE)((des_a) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -1674,7 +1674,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double }
}
}
-void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, FX_INT32 src_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
{
int src_top = m_clipBox.top;
int des_top = m_startY;
@@ -1693,7 +1693,7 @@ void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, FX_INT32 s }
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(FX_INT32& frames, IFX_Pause* pPause)
+FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames, IFX_Pause* pPause)
{
if(!(m_status == FXCODEC_STATUS_FRAME_READY || m_status == FXCODEC_STATUS_FRAME_TOBECONTINUE)) {
return FXCODEC_STATUS_ERROR;
@@ -1708,7 +1708,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(FX_INT32& frames, IFX_Pause* case FXCODEC_IMAGE_GIF: {
ICodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
while (TRUE) {
- FX_INT32 readResult = pGifModule->LoadFrameInfo(m_pGifContext, &m_FrameNumber);
+ int32_t readResult = pGifModule->LoadFrameInfo(m_pGifContext, &m_FrameNumber);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_READ;
if(!GifReadMoreData(pGifModule, error_status)) {
@@ -1738,7 +1738,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(FX_INT32& frames, IFX_Pause* }
FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
int start_x, int start_y, int size_x, int size_y,
- FX_INT32 frames, FX_BOOL bInterpol)
+ int32_t frames, FX_BOOL bInterpol)
{
if(m_status != FXCODEC_STATUS_DECODE_READY) {
return FXCODEC_STATUS_ERROR;
@@ -1755,8 +1755,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, return FXCODEC_STATUS_ERR_PARAMS;
}
FX_RECT device_rc = FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y);
- FX_INT32 out_range_x = device_rc.right - pDIBitmap->GetWidth();
- FX_INT32 out_range_y = device_rc.bottom - pDIBitmap->GetHeight();
+ int32_t out_range_x = device_rc.right - pDIBitmap->GetWidth();
+ int32_t out_range_y = device_rc.bottom - pDIBitmap->GetHeight();
device_rc.Intersect(FX_RECT(0, 0, pDIBitmap->GetWidth(), pDIBitmap->GetHeight()));
if(device_rc.IsEmpty()) {
return FXCODEC_STATUS_ERR_PARAMS;
@@ -1770,19 +1770,19 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, if(start_x < 0 || out_range_x > 0) {
FX_FLOAT scaleX = (FX_FLOAT)m_clipBox.Width() / (FX_FLOAT)size_x;
if(start_x < 0) {
- m_clipBox.left -= (FX_INT32)FXSYS_ceil((FX_FLOAT)start_x * scaleX);
+ m_clipBox.left -= (int32_t)FXSYS_ceil((FX_FLOAT)start_x * scaleX);
}
if(out_range_x > 0) {
- m_clipBox.right -= (FX_INT32)FXSYS_floor((FX_FLOAT)out_range_x * scaleX);
+ m_clipBox.right -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_x * scaleX);
}
}
if(start_y < 0 || out_range_y > 0) {
FX_FLOAT scaleY = (FX_FLOAT)m_clipBox.Height() / (FX_FLOAT)size_y;
if(start_y < 0) {
- m_clipBox.top -= (FX_INT32)FXSYS_ceil((FX_FLOAT)start_y * scaleY);
+ m_clipBox.top -= (int32_t)FXSYS_ceil((FX_FLOAT)start_y * scaleY);
}
if(out_range_y > 0) {
- m_clipBox.bottom -= (FX_INT32)FXSYS_floor((FX_FLOAT)out_range_y * scaleY);
+ m_clipBox.bottom -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_y * scaleY);
}
}
if(m_clipBox.IsEmpty()) {
@@ -1809,7 +1809,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, scanline_size);
+ m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -1878,7 +1878,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, scanline_size);
+ m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -1904,7 +1904,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, scanline_size);
+ m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -1941,7 +1941,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, m_ScanlineSize);
+ m_pDecodeBuf = FX_Alloc(uint8_t, m_ScanlineSize);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -2012,7 +2012,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) }
if(m_pSrcBuf != NULL && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
- m_pSrcBuf = FX_Alloc(FX_BYTE, input_size);
+ m_pSrcBuf = FX_Alloc(uint8_t, input_size);
if(m_pSrcBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -2043,7 +2043,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXCODEC_IMAGE_GIF: {
ICodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
while(TRUE) {
- FX_INT32 readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur);
+ int32_t readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur);
while(readRes == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if(!GifReadMoreData(pGifModule, error_status)) {
@@ -2070,7 +2070,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXCODEC_IMAGE_BMP: {
ICodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
while(TRUE) {
- FX_INT32 readRes = pBmpModule->LoadImage(m_pBmpContext);
+ int32_t readRes = pBmpModule->LoadImage(m_pBmpContext);
while(readRes == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if(!BmpReadMoreData(pBmpModule, error_status)) {
@@ -2165,14 +2165,14 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) switch(m_pDeviceBitmap->GetFormat()) {
case FXDIB_8bppRgb:
case FXDIB_8bppMask: {
- for (FX_INT32 row = 0; row < pClipBitmap->GetHeight(); row++) {
+ for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
- for (FX_INT32 col = 0; col < pClipBitmap->GetWidth(); col++) {
- FX_BYTE _a = 255 - src_line[3];
- FX_BYTE b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
+ for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
+ uint8_t _a = 255 - src_line[3];
+ uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
*des_line++ = FXRGB2GRAY(r, g, b);
src_line += 4;
}
@@ -2181,15 +2181,15 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_INT32 desBpp = (m_pDeviceBitmap->GetFormat() == FXDIB_Rgb) ? 3 : 4;
- for (FX_INT32 row = 0; row < pClipBitmap->GetHeight(); row++) {
+ int32_t desBpp = (m_pDeviceBitmap->GetFormat() == FXDIB_Rgb) ? 3 : 4;
+ for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
- for (FX_INT32 col = 0; col < pClipBitmap->GetWidth(); col++) {
- FX_BYTE _a = 255 - src_line[3];
- FX_BYTE b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
+ for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
+ uint8_t _a = 255 - src_line[3];
+ uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
*des_line++ = b;
*des_line++ = g;
*des_line++ = r;
diff --git a/core/src/fxcodec/codec/fx_codec_progress.h b/core/src/fxcodec/codec/fx_codec_progress.h index ea53c8f010..e5a4e53376 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.h +++ b/core/src/fxcodec/codec/fx_codec_progress.h @@ -108,28 +108,28 @@ public: {
return m_imagType;
}
- virtual FX_INT32 GetWidth()
+ virtual int32_t GetWidth()
{
return m_SrcWidth;
}
- virtual FX_INT32 GetHeight()
+ virtual int32_t GetHeight()
{
return m_SrcHeight;
}
- virtual FX_INT32 GetNumComponents()
+ virtual int32_t GetNumComponents()
{
return m_SrcComponents;
}
- virtual FX_INT32 GetBPC()
+ virtual int32_t GetBPC()
{
return m_SrcBPC;
}
virtual void SetClipBox(FX_RECT* clip);
- virtual FXCODEC_STATUS GetFrames(FX_INT32& frames, IFX_Pause* pPause);
+ virtual FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause);
virtual FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap,
int start_x, int start_y, int size_x, int size_y,
- FX_INT32 frames, FX_BOOL bInterpol);
+ int32_t frames, FX_BOOL bInterpol);
virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause);
@@ -137,27 +137,27 @@ protected: FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute = NULL);
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
- void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, FX_INT32 des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
- void Resample(CFX_DIBitmap* pDeviceBitmap, FX_INT32 src_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status);
static FX_BOOL PngReadHeaderFunc(void* pModule, int width, int height, int bpc, int pass, int* color_type, double* gamma);
static FX_BOOL PngAskScanlineBufFunc(void* pModule, int line, FX_LPBYTE& src_buf);
static void PngFillScanlineBufCompletedFunc(void* pModule, int pass, int line);
- void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, FX_INT32 des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, FXCODEC_STATUS& err_status);
static void GifRecordCurrentPositionCallback(void* pModule, FX_DWORD& cur_pos);
- static FX_LPBYTE GifAskLocalPaletteBufCallback(void* pModule, FX_INT32 frame_num, FX_INT32 pal_size);
+ static FX_LPBYTE GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size);
static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace);
- static void GifReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf);
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
+ static void GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status);
static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, FX_DWORD rcd_pos);
- static void BmpReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf);
+ static void BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
public:
IFX_FileRead* m_pFile;
@@ -197,7 +197,7 @@ public: int m_FrameCur;
int m_GifBgIndex;
FX_LPBYTE m_pGifPalette;
- FX_INT32 m_GifPltNumber;
+ int32_t m_GifPltNumber;
int m_GifTransIndex;
FX_RECT m_GifFrameRect;
FX_BOOL m_BmpIsTopBottom;
diff --git a/core/src/fxcodec/codec/fx_codec_tiff.cpp b/core/src/fxcodec/codec/fx_codec_tiff.cpp index fee2c783c5..8e9dd10f29 100644 --- a/core/src/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/src/fxcodec/codec/fx_codec_tiff.cpp @@ -20,8 +20,8 @@ public: ~CCodec_TiffContext();
FX_BOOL InitDecoder(IFX_FileRead* file_ptr);
- void GetFrames(FX_INT32& frames);
- FX_BOOL LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute);
+ void GetFrames(int32_t& frames);
+ FX_BOOL LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute);
FX_BOOL Decode(CFX_DIBitmap* pDIBitmap);
union {
@@ -33,15 +33,15 @@ public: TIFF* tif_ctx;
void* icc_ctx;
- FX_INT32 frame_num;
- FX_INT32 frame_cur;
+ int32_t frame_num;
+ int32_t frame_cur;
FX_BOOL isDecoder;
private:
FX_BOOL isSupport(CFX_DIBitmap* pDIBitmap);
- void SetPalette(CFX_DIBitmap* pDIBitmap, FX_UINT16 bps);
- FX_BOOL Decode1bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp);
- FX_BOOL Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp);
- FX_BOOL Decode24bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp);
+ void SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps);
+ FX_BOOL Decode1bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp);
+ FX_BOOL Decode8bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp);
+ FX_BOOL Decode24bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp);
};
CCodec_TiffContext::CCodec_TiffContext()
{
@@ -142,7 +142,7 @@ TIFF* _tiff_open(void* context, const char* mode) _tiff_read, _tiff_write, _tiff_seek, _tiff_close,
_tiff_get_size, _tiff_map, _tiff_unmap);
if(tif) {
- tif->tif_fd = (int)(FX_INTPTR)context;
+ tif->tif_fd = (int)(intptr_t)context;
}
return tif;
}
@@ -207,7 +207,7 @@ FX_BOOL CCodec_TiffContext::InitDecoder(IFX_FileRead* file_ptr) }
return TRUE;
}
-void CCodec_TiffContext::GetFrames(FX_INT32& frames)
+void CCodec_TiffContext::GetFrames(int32_t& frames)
{
frames = frame_num = TIFFNumberOfDirectories(tif_ctx);
}
@@ -215,7 +215,7 @@ void CCodec_TiffContext::GetFrames(FX_INT32& frames) T val = (T)0;\
TIFFGetField(tif_ctx,tag,&val);\
if (val) {\
- (key) = FX_Alloc(FX_BYTE,sizeof(T));\
+ (key) = FX_Alloc(uint8_t,sizeof(T));\
if ((key)) {\
T* ptr = (T*)(key);\
*ptr = val;\
@@ -226,7 +226,7 @@ void CCodec_TiffContext::GetFrames(FX_INT32& frames) FX_LPBYTE buf = NULL;\
TIFFGetField(tif_ctx,tag,&size, &buf);\
if (size && buf) {\
- (key) = FX_Alloc(FX_BYTE,size);\
+ (key) = FX_Alloc(uint8_t,size);\
if ((key)) {\
FXSYS_memcpy32((key),buf,size);\
pExif->m_TagVal.SetAt(tag,(key));}}}\
@@ -238,7 +238,7 @@ static FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif T val = (T)0;
TIFFGetField(tif_ctx, tag, &val);
if (val) {
- (key) = FX_Alloc(FX_BYTE, sizeof(T));
+ (key) = FX_Alloc(uint8_t, sizeof(T));
if ((key) == NULL) {
return FALSE;
}
@@ -255,8 +255,8 @@ static void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeE FX_LPBYTE key = NULL;
TIFFGetField(tif_ctx, tag, &buf);
if (buf) {
- FX_INT32 size = (FX_INT32)FXSYS_strlen(buf);
- (key) = FX_Alloc(FX_BYTE, size + 1);
+ int32_t size = (int32_t)FXSYS_strlen(buf);
+ (key) = FX_Alloc(uint8_t, size + 1);
if ((key) == NULL) {
return;
}
@@ -265,7 +265,7 @@ static void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeE pExif->m_TagVal.SetAt(tag, (key));
}
}
-FX_BOOL CCodec_TiffContext::LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
{
if (!TIFFSetDirectory(tif_ctx, (uint16)frame)) {
return FALSE;
@@ -296,12 +296,12 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DW if (Tiff_Exif_GetInfo<FX_FLOAT>(tif_ctx, TIFFTAG_XRESOLUTION, pExif)) {
FX_FLOAT fDpi = 0;
pExif->GetInfo(TIFFTAG_XRESOLUTION, &fDpi);
- pAttribute->m_nXDPI = (FX_INT32)(fDpi + 0.5f);
+ pAttribute->m_nXDPI = (int32_t)(fDpi + 0.5f);
}
if (Tiff_Exif_GetInfo<FX_FLOAT>(tif_ctx, TIFFTAG_YRESOLUTION, pExif)) {
FX_FLOAT fDpi = 0;
pExif->GetInfo(TIFFTAG_YRESOLUTION, &fDpi);
- pAttribute->m_nYDPI = (FX_INT32)(fDpi + 0.5f);
+ pAttribute->m_nYDPI = (int32_t)(fDpi + 0.5f);
}
Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_IMAGEDESCRIPTION, pExif);
Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_MAKE, pExif);
@@ -313,10 +313,10 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DW }
return TRUE;
}
-void _TiffBGRA2RGBA(FX_LPBYTE pBuf, FX_INT32 pixel, FX_INT32 spp)
+void _TiffBGRA2RGBA(FX_LPBYTE pBuf, int32_t pixel, int32_t spp)
{
- register FX_BYTE tmp;
- for (FX_INT32 n = 0; n < pixel; n++) {
+ register uint8_t tmp;
+ for (int32_t n = 0; n < pixel; n++) {
tmp = pBuf[0];
pBuf[0] = pBuf[2];
pBuf[2] = tmp;
@@ -328,7 +328,7 @@ FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) if (TIFFIsTiled(tif_ctx)) {
return FALSE;
}
- FX_UINT16 photometric;
+ uint16_t photometric;
if (!TIFFGetField(tif_ctx, TIFFTAG_PHOTOMETRIC, &photometric)) {
return FALSE;
}
@@ -347,7 +347,7 @@ FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) default:
return FALSE;
}
- FX_UINT16 planarconfig;
+ uint16_t planarconfig;
if (!TIFFGetFieldDefaulted(tif_ctx, TIFFTAG_PLANARCONFIG, &planarconfig)) {
return FALSE;
}
@@ -356,33 +356,33 @@ FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) }
return TRUE;
}
-void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, FX_UINT16 bps)
+void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps)
{
- FX_UINT16 *red_orig, *green_orig, *blue_orig;
+ uint16_t *red_orig, *green_orig, *blue_orig;
TIFFGetField(tif_ctx, TIFFTAG_COLORMAP, &red_orig, &green_orig, &blue_orig);
- for (FX_INT32 i = (1L << bps) - 1; i >= 0; i--) {
-#define CVT(x) ((FX_UINT16)((x)>>8))
+ for (int32_t i = (1L << bps) - 1; i >= 0; i--) {
+#define CVT(x) ((uint16_t)((x)>>8))
red_orig[i] = CVT(red_orig[i]);
green_orig[i] = CVT(green_orig[i]);
blue_orig[i] = CVT(blue_orig[i]);
#undef CVT
}
- FX_INT32 len = 1 << bps;
- for(FX_INT32 index = 0; index < len; index++) {
+ int32_t len = 1 << bps;
+ for(int32_t index = 0; index < len; index++) {
FX_DWORD r = red_orig[index] & 0xFF;
FX_DWORD g = green_orig[index] & 0xFF;
FX_DWORD b = blue_orig[index] & 0xFF;
- FX_DWORD color = (FX_UINT32)b | ((FX_UINT32)g << 8) | ((FX_UINT32)r << 16) | (((uint32)0xffL) << 24);
+ FX_DWORD color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | (((uint32)0xffL) << 24);
pDIBitmap->SetPaletteEntry(index, color);
}
}
-FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp)
+FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp)
{
if (pDIBitmap->GetBPP() != 1 || spp != 1 || bps != 1 || !isSupport(pDIBitmap)) {
return FALSE;
}
SetPalette(pDIBitmap, bps);
- FX_INT32 size = (FX_INT32)TIFFScanlineSize(tif_ctx);
+ int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
@@ -390,22 +390,22 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 heig }
FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
- for(FX_INT32 row = 0; row < height; row++) {
+ for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
- for(FX_INT32 j = 0; j < size; j++) {
+ for(int32_t j = 0; j < size; j++) {
bitMapbuffer[row * pitch + j] = buf[j];
}
}
_TIFFfree(buf);
return TRUE;
}
-FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp)
+FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp)
{
if (pDIBitmap->GetBPP() != 8 || spp != 1 || (bps != 4 && bps != 8) || !isSupport(pDIBitmap)) {
return FALSE;
}
SetPalette(pDIBitmap, bps);
- FX_INT32 size = (FX_INT32)TIFFScanlineSize(tif_ctx);
+ int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
@@ -413,9 +413,9 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 heig }
FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
- for(FX_INT32 row = 0; row < height; row++) {
+ for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
- for(FX_INT32 j = 0; j < size; j++) {
+ for(int32_t j = 0; j < size; j++) {
switch(bps) {
case 4:
bitMapbuffer[row * pitch + 2 * j + 0] = (buf[j] & 0xF0) >> 4;
@@ -430,12 +430,12 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 heig _TIFFfree(buf);
return TRUE;
}
-FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp)
+FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp)
{
if (pDIBitmap->GetBPP() != 24 || !isSupport(pDIBitmap)) {
return FALSE;
}
- FX_INT32 size = (FX_INT32)TIFFScanlineSize(tif_ctx);
+ int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
@@ -443,9 +443,9 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 hei }
FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
- for(FX_INT32 row = 0; row < height; row++) {
+ for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
- for(FX_INT32 j = 0; j < size - 2; j += 3) {
+ for(int32_t j = 0; j < size - 2; j += 3) {
bitMapbuffer[row * pitch + j + 0] = buf[j + 2];
bitMapbuffer[row * pitch + j + 1] = buf[j + 1];
bitMapbuffer[row * pitch + j + 2] = buf[j + 0];
@@ -477,7 +477,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) return TRUE;
}
}
- FX_UINT16 spp, bps;
+ uint16_t spp, bps;
TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp);
TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps);
FX_DWORD bpp = bps * spp;
@@ -499,12 +499,12 @@ FX_LPVOID CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) }
return pDecoder;
}
-void CCodec_TiffModule::GetFrames(FX_LPVOID ctx, FX_INT32& frames)
+void CCodec_TiffModule::GetFrames(FX_LPVOID ctx, int32_t& frames)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
pDecoder->GetFrames(frames);
}
-FX_BOOL CCodec_TiffModule::LoadFrameInfo(FX_LPVOID ctx, FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_TiffModule::LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute);
diff --git a/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h b/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h index 3ca425c712..d0f823d8c3 100644 --- a/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h +++ b/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h @@ -44,7 +44,7 @@ /*#define HAVE_SEARCH_H 1 */ /* The size of a `int', as computed by sizeof. */ -/* According typedef int FX_INT32; in the fx_system.h*/ +/* According typedef int int32_t; in the fx_system.h*/ #define SIZEOF_INT 4 /* Sunliang.Liu 20110325. We should config the correct long size for tif diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h index 9d5d29468f..ff0b9fcfeb 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h @@ -11,41 +11,41 @@ class CJBig2_BitStream : public CJBig2_Object { public: - CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength); + CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength); CJBig2_BitStream(CJBig2_BitStream &bs); ~CJBig2_BitStream(); - FX_INT32 readNBits(FX_DWORD nBits, FX_DWORD *dwResult); + int32_t readNBits(FX_DWORD nBits, FX_DWORD *dwResult); - FX_INT32 readNBits(FX_DWORD nBits, FX_INT32 *nResult); + int32_t readNBits(FX_DWORD nBits, int32_t *nResult); - FX_INT32 read1Bit(FX_DWORD *dwResult); + int32_t read1Bit(FX_DWORD *dwResult); - FX_INT32 read1Bit(FX_BOOL *bResult); + int32_t read1Bit(FX_BOOL *bResult); - FX_INT32 read1Byte(FX_BYTE *cResult); + int32_t read1Byte(uint8_t *cResult); - FX_INT32 readInteger(FX_DWORD *dwResult); + int32_t readInteger(FX_DWORD *dwResult); - FX_INT32 readShortInteger(FX_WORD *wResult); + int32_t readShortInteger(FX_WORD *wResult); void alignByte(); void align4Byte(); - FX_BYTE getAt(FX_DWORD dwOffset); + uint8_t getAt(FX_DWORD dwOffset); - FX_BYTE getCurByte(); + uint8_t getCurByte(); - FX_BYTE getNextByte(); + uint8_t getNextByte(); - FX_INT32 incByteIdx(); + int32_t incByteIdx(); - FX_BYTE getCurByte_arith(); + uint8_t getCurByte_arith(); - FX_BYTE getNextByte_arith(); + uint8_t getNextByte_arith(); FX_DWORD getOffset(); @@ -55,21 +55,21 @@ public: void setBitPos(FX_DWORD dwBitPos); - FX_BYTE *getBuf(); + uint8_t *getBuf(); FX_DWORD getLength() { return m_dwLength; } - FX_BYTE *getPointer(); + uint8_t *getPointer(); void offset(FX_DWORD dwOffset); FX_DWORD getByteLeft(); private: - FX_BYTE *m_pBuf; + uint8_t *m_pBuf; FX_DWORD m_dwLength; @@ -77,7 +77,7 @@ private: FX_DWORD m_dwBitIdx; }; -inline CJBig2_BitStream::CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength) +inline CJBig2_BitStream::CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength) { m_pBuf = pBuffer; m_dwLength = dwLength; @@ -98,7 +98,7 @@ inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream &bs) inline CJBig2_BitStream::~CJBig2_BitStream() { } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -123,7 +123,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t *nResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -149,7 +149,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) { if(m_dwByteIdx < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -165,7 +165,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_BOOL *bResult) { if(m_dwByteIdx < m_dwLength) { *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -180,7 +180,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) +inline int32_t CJBig2_BitStream::read1Byte(uint8_t *cResult) { if(m_dwByteIdx < m_dwLength) { *cResult = m_pBuf[m_dwByteIdx]; @@ -191,7 +191,7 @@ inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) } } -inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readInteger(FX_DWORD *dwResult) { if(m_dwByteIdx + 3 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 24) | (m_pBuf[m_dwByteIdx + 1] << 16) @@ -203,7 +203,7 @@ inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) +inline int32_t CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) { if(m_dwByteIdx + 1 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 8) | m_pBuf[m_dwByteIdx + 1]; @@ -228,7 +228,7 @@ inline void CJBig2_BitStream::align4Byte() } m_dwByteIdx = (m_dwByteIdx + 3) & -4; } -inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) +inline uint8_t CJBig2_BitStream::getAt(FX_DWORD dwOffset) { if(dwOffset < m_dwLength) { return m_pBuf[dwOffset]; @@ -236,7 +236,7 @@ inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) return 0; } } -inline FX_BYTE CJBig2_BitStream::getCurByte() +inline uint8_t CJBig2_BitStream::getCurByte() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -244,7 +244,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte() return 0; } } -inline FX_BYTE CJBig2_BitStream::getNextByte() +inline uint8_t CJBig2_BitStream::getNextByte() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -252,7 +252,7 @@ inline FX_BYTE CJBig2_BitStream::getNextByte() return 0; } } -inline FX_INT32 CJBig2_BitStream::incByteIdx() +inline int32_t CJBig2_BitStream::incByteIdx() { if(m_dwByteIdx < m_dwLength) { m_dwByteIdx ++; @@ -261,7 +261,7 @@ inline FX_INT32 CJBig2_BitStream::incByteIdx() return -1; } } -inline FX_BYTE CJBig2_BitStream::getCurByte_arith() +inline uint8_t CJBig2_BitStream::getCurByte_arith() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -269,7 +269,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte_arith() return 0xff; } } -inline FX_BYTE CJBig2_BitStream::getNextByte_arith() +inline uint8_t CJBig2_BitStream::getNextByte_arith() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -297,11 +297,11 @@ inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } -inline FX_BYTE *CJBig2_BitStream::getBuf() +inline uint8_t *CJBig2_BitStream::getBuf() { return m_pBuf; } -inline FX_BYTE *CJBig2_BitStream::getPointer() +inline uint8_t *CJBig2_BitStream::getPointer() { return m_pBuf + m_dwByteIdx; } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index bcd16e7e14..1c7592778d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -23,8 +23,8 @@ void OutputBitmap(CJBig2_Image* pImage) return; } } -CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { return new(pModule)CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, nStreamType, pSymbolDictCache, pPause); } @@ -34,8 +34,8 @@ void CJBig2_Context::DestroyContext(CJBig2_Context *pContext) delete pContext; } } -CJBig2_Context::CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { if(pGlobalData && (dwGlobalLength > 0)) { JBIG2_ALLOC(m_pGlobalContext, CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, @@ -96,12 +96,12 @@ CJBig2_Context::~CJBig2_Context() } m_pSegmentList = NULL; } -FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) +int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause) { - FX_BYTE cFlags; + uint8_t cFlags; FX_DWORD dwTemp; - const FX_BYTE fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; - FX_INT32 nRet; + const uint8_t fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; + int32_t nRet; if(m_pStream->getByteLeft() < 8) { m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; @@ -139,9 +139,9 @@ FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) failed: return nRet; } -FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; if(m_pStream->getByteLeft() > 0) { while(m_pStream->getByteLeft() >= JBIG2_MIN_SEGMENT_SIZE) { if(m_pSegment == NULL) { @@ -189,14 +189,14 @@ FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { return decode_SquentialOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { CJBig2_Segment *pSegment; - FX_INT32 nRet; + int32_t nRet; while(m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { JBIG2_ALLOC(pSegment, CJBig2_Segment()); nRet = parseSegmentHeader(pSegment); @@ -217,9 +217,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) m_nSegmentDecoded = 0; return decode_RandomOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; for(; m_nSegmentDecoded < m_pSegmentList->getLength(); m_nSegmentDecoded++) { nRet = parseSegmentData(m_pSegmentList->getAt(m_nSegmentDecoded), pPause); if((nRet == JBIG2_END_OF_PAGE) || (nRet == JBIG2_END_OF_FILE)) { @@ -235,9 +235,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = 0; + int32_t nRet = 0; if(m_pGlobalContext) { nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause); if(nRet != JBIG2_SUCCESS) { @@ -260,10 +260,10 @@ FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 he int ret = Continue(pPause); return ret; } -FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) +int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { m_ProcessiveStatus = FXCODEC_STATUS_DECODE_READY; - FX_INT32 nRet; + int32_t nRet; if(m_PauseStep <= 1) { switch(m_nStreamType) { case JBIG2_FILE_STREAM: @@ -311,9 +311,9 @@ FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) } return nRet; } -FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = JBIG2_ERROR_STREAM_TYPE; + int32_t nRet = JBIG2_ERROR_STREAM_TYPE; m_bFirstPage = FALSE; m_PauseStep = 0; if(m_pPage) { @@ -345,9 +345,9 @@ FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 hei } return nRet; } -FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bFirstPage = TRUE; m_PauseStep = 0; if(m_pGlobalContext) { @@ -359,9 +359,9 @@ FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) m_bBufSpecified = FALSE; return Continue(pPause); } -FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bBufSpecified = FALSE; m_bFirstPage = FALSE; m_PauseStep = 0; @@ -391,7 +391,7 @@ FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) { CJBig2_Segment *pSeg; - FX_INT32 i; + int32_t i; if(m_pGlobalContext) { pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); if(pSeg) { @@ -407,10 +407,10 @@ CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) return NULL; } CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, - FX_BYTE cType, FX_INT32 nIndex) + uint8_t cType, int32_t nIndex) { CJBig2_Segment *pSeg; - FX_INT32 i, count; + int32_t i, count; count = 0; for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -424,10 +424,10 @@ CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment } return NULL; } -FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) +int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) { - FX_BYTE cSSize, cPSize; - FX_BYTE cTemp; + uint8_t cSSize, cPSize; + uint8_t cTemp; FX_WORD wTemp; FX_DWORD dwTemp; if((m_pStream->readInteger(&pSegment->m_dwNumber) != 0) @@ -457,7 +457,7 @@ FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) if(pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = (FX_DWORD*)m_pModule->JBig2_Malloc2( sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); - for(FX_INT32 i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { + for(int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { switch(cSSize) { case 1: if(m_pStream->read1Byte(&cTemp) != 0) { @@ -504,15 +504,15 @@ failed: m_pModule->JBig2_Error("header too short."); return JBIG2_ERROR_TOO_SHORT; } -FX_INT32 CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { - FX_INT32 ret = ProcessiveParseSegmentData(pSegment, pPause); + int32_t ret = ProcessiveParseSegmentData(pSegment, pPause); while(m_ProcessiveStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE && m_pStream->getByteLeft() > 0) { ret = ProcessiveParseSegmentData(pSegment, pPause); } return ret; } -FX_INT32 CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { switch(pSegment->m_cFlags.s.type) { case 0: @@ -613,13 +613,13 @@ failed2: m_pModule->JBig2_Error("segment syntax error."); return JBIG2_ERROR_FETAL; } -FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_BYTE cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; + uint8_t cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B2 = NULL, *Table_B3 = NULL, *Table_B4 = NULL, *Table_B5 = NULL; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; FX_BOOL bUsed; CJBig2_Image ** SDINSYMS = NULL; @@ -627,7 +627,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP JBig2ArithCtx *gbContext = NULL, *grContext = NULL; CJBig2_ArithDecoder *pArithDecoder; JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); - FX_BYTE *key = pSegment->m_pData; + uint8_t *key = pSegment->m_pData; FX_BOOL cache_hit = false; if(m_pStream->readShortInteger(&wFlags) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); @@ -648,8 +648,8 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } else { dwTemp = 2; } - for(i = 0; i < (FX_INT32)dwTemp; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDAT[i]) != 0) { + for(i = 0; i < (int32_t)dwTemp; i++) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -658,7 +658,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } if((pSymbolDictDecoder->SDREFAGG == 1) && (pSymbolDictDecoder->SDRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDRAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -917,12 +917,12 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_Image **SBSYMS = NULL; JBig2HuffmanCode *SBSYMCODES = NULL; - FX_BYTE cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; + uint8_t cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B6 = NULL, *Table_B7 = NULL, @@ -976,7 +976,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) } if((pTRD->SBREFINE == 1) && (pTRD->SBRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pTRD->SBRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pTRD->SBRAT[i]) != 0) { m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1032,7 +1032,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) while((FX_DWORD)(1 << dwTemp) < pTRD->SBNUMSYMS) { dwTemp ++; } - pTRD->SBSYMCODELEN = (FX_BYTE)dwTemp; + pTRD->SBSYMCODELEN = (uint8_t)dwTemp; } if(pTRD->SBHUFF == 1) { if((cSBHUFFFS == 2) || (cSBHUFFRDW == 2) || (cSBHUFFRDH == 2) @@ -1326,11 +1326,11 @@ failed: FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_PDDProc *pPDD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); if((m_pStream->read1Byte(&cFlags) != 0) || (m_pStream->read1Byte(&pPDD->HDPW) != 0) @@ -1380,14 +1380,14 @@ failed: FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_PatternDict *pPatternDict; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_HTRDProc *pHRD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pHRD, CJBig2_HTRDProc()); if((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0) @@ -1474,8 +1474,8 @@ failed: FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; - FX_INT32 i, nRet; + uint8_t cFlags; + int32_t i, nRet; if(m_pGRD == NULL) { JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); if((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) @@ -1497,7 +1497,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* if(m_pGRD->MMR == 0) { if(m_pGRD->GBTEMPLATE == 0) { for(i = 0; i < 8; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1505,7 +1505,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* } } else { for(i = 0; i < 2; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1593,8 +1593,8 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) FX_DWORD dwTemp; JBig2RegionInfo ri; CJBig2_Segment *pSeg; - FX_INT32 i, nRet; - FX_BYTE cFlags; + int32_t i, nRet; + uint8_t cFlags; JBig2ArithCtx *grContext; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -1611,7 +1611,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) pGRRD->TPGRON = (cFlags >> 1) & 0x01; if(pGRRD->GRTEMPLATE == 0) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pGRRD->GRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pGRRD->GRAT[i]) != 0) { m_pModule->JBig2_Error("generic refinement region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1687,7 +1687,7 @@ FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment) m_pStream->alignByte(); return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) +int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) { if((m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0) || (m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0) @@ -1702,9 +1702,9 @@ JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p FX_DWORD SBNUMSYMS) { JBig2HuffmanCode *SBSYMCODES; - FX_INT32 runcodes[35], runcodes_len[35], runcode; - FX_INT32 i, j, nTemp, nVal, nBits; - FX_INT32 run; + int32_t runcodes[35], runcodes_len[35], runcode; + int32_t i, j, nTemp, nVal, nBits; + int32_t run; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2HuffmanCode), SBNUMSYMS); for (i = 0; i < 35; i ++) { if(pStream->readNBits(4, &runcodes_len[i]) != 0) { diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index f46530e005..b12853accf 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -14,7 +14,7 @@ #include "../../../include/fxcodec/fx_codec_def.h" #include "../../../include/fxcrt/fx_basic.h" #include <utility> -typedef std::pair<FX_BYTE*, CJBig2_SymbolDict*> CJBig2_CachePair; +typedef std::pair<uint8_t*, CJBig2_SymbolDict*> CJBig2_CachePair; typedef enum { JBIG2_OUT_OF_PAGE = 0, JBIG2_IN_PAGE, @@ -37,64 +37,64 @@ class CJBig2_Context : public CJBig2_Object { public: - static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); + static CJBig2_Context *CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); static void DestroyContext(CJBig2_Context *pContext); - FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t getNextPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); FXCODEC_STATUS GetProcessiveStatus() { return m_ProcessiveStatus; }; private: - CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); + CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); ~CJBig2_Context(); - FX_INT32 decodeFile(IFX_Pause* pPause); + int32_t decodeFile(IFX_Pause* pPause); - FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); + int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); + int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation(IFX_Pause* pPause); CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber); - CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, FX_BYTE cType, FX_INT32 nIndex); + CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, uint8_t cType, int32_t nIndex); - FX_INT32 parseSegmentHeader(CJBig2_Segment *pSegment); + int32_t parseSegmentHeader(CJBig2_Segment *pSegment); - FX_INT32 parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseTextRegion(CJBig2_Segment *pSegment); + int32_t parseTextRegion(CJBig2_Segment *pSegment); - FX_INT32 parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRefinementRegion(CJBig2_Segment *pSegment); + int32_t parseGenericRefinementRegion(CJBig2_Segment *pSegment); - FX_INT32 parseTable(CJBig2_Segment *pSegment); + int32_t parseTable(CJBig2_Segment *pSegment); - FX_INT32 parseRegionInfo(JBig2RegionInfo *pRI); + int32_t parseRegionInfo(JBig2RegionInfo *pRI); @@ -108,11 +108,11 @@ private: CJBig2_Context *m_pGlobalContext; - FX_INT32 m_nStreamType; + int32_t m_nStreamType; CJBig2_BitStream *m_pStream; - FX_INT32 m_nState; + int32_t m_nState; CJBig2_List<CJBig2_Segment> *m_pSegmentList; @@ -122,9 +122,9 @@ private: FX_BOOL m_bBufSpecified; - FX_INT32 m_nSegmentDecoded; + int32_t m_nSegmentDecoded; IFX_Pause* m_pPause; - FX_INT32 m_PauseStep; + int32_t m_PauseStep; FXCODEC_STATUS m_ProcessiveStatus; FX_BOOL m_bFirstPage; CJBig2_ArithDecoder *m_pArithDecoder; diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index ccf15d07ba..46c6e2b532 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -13,15 +13,15 @@ #include "JBig2_Object.h" #define JBIG2_OOB 1 typedef struct { - FX_INT32 width, + int32_t width, height; - FX_INT32 x, + int32_t x, y; - FX_BYTE flags; + uint8_t flags; } JBig2RegionInfo; typedef struct { - FX_INT32 codelen; - FX_INT32 code; + int32_t codelen; + 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); diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index a5928f9ea3..bad595e6b7 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -150,9 +150,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -217,9 +217,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -401,9 +401,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -468,9 +468,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -647,9 +647,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -714,9 +714,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -887,9 +887,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -945,9 +945,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -1428,13 +1428,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1446,19 +1446,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0010]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 4 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1468,7 +1468,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1506,7 +1506,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1637,13 +1637,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1655,19 +1655,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0008]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 1 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1677,7 +1677,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1709,7 +1709,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1872,23 +1872,23 @@ CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBi } CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2ArithCtx *grContext) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_BYTE CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + uint8_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; FX_DWORD nTmp; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; CJBig2_HuffmanDecoder *pHuffmanDecoder; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -2092,23 +2092,23 @@ failed: CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext, JBig2IntDecoderState *pIDS) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_INT32 CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + int32_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; - FX_INT32 nRet, nVal; - FX_INT32 bRetained; + int32_t nRet, nVal; + int32_t bRetained; CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *IARDX, *IARDY; CJBig2_ArithIaidDecoder *IAID; CJBig2_GRRDProc *pGRRD; @@ -2333,21 +2333,21 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod { CJBig2_Image **SDNEWSYMS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal; + int32_t nVal; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; CJBig2_Image **SBSYMS; CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH, *SBHUFFRDX, *SBHUFFRDY, *SBHUFFRSIZE; @@ -2374,7 +2374,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp ++; } - JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((FX_BYTE)nTmp)); + JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((uint8_t)nTmp)); SDNEWSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, sizeof(CJBig2_Image*)); FXSYS_memset32(SDNEWSYMS, 0 , SDNUMNEWSYMS * sizeof(CJBig2_Image*)); HCHEIGHT = 0; @@ -2458,7 +2458,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; pDecoder->SBSYMCODELEN = SBSYMCODELEN; SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); @@ -2671,22 +2671,22 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, CJBig2_Image **SDNEWSYMS; FX_DWORD *SDNEWSYMWIDTHS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS, *BHC; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; JBig2HuffmanCode *SBSYMCODES; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; FX_DWORD BMSIZE; FX_DWORD stride; CJBig2_Image **SBSYMS; @@ -2843,7 +2843,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(JBig2HuffmanCode)); for(I = 0; I < SBNUMSYMS; I++) { SBSYMCODES[I].codelen = SBSYMCODELEN; @@ -2931,7 +2931,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, NSYMSDECODED = NSYMSDECODED + 1; } if(SDREFAGG == 0) { - if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (FX_INT32*)&BMSIZE) != 0) { + if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) { m_pModule->JBig2_Error("symbol dictionary decoding procedure (huffman): too short."); goto failed; } @@ -3042,7 +3042,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; CJBig2_Image *HSKIP; FX_DWORD HBPP; FX_DWORD *GI; @@ -3057,8 +3057,8 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, for(ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - if((x + HPW <= 0) | (x >= (FX_INT32)HBW) - | (y + HPH <= 0) | (y >= (FX_INT32)HPH)) { + if((x + HPW <= 0) | (x >= (int32_t)HBW) + | (y + HPH <= 0) | (y >= (int32_t)HPH)) { HSKIP->setPixel(ng, mg, 1); } else { HSKIP->setPixel(ng, mg, 0); @@ -3074,7 +3074,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = HENABLESKIP; pGID->GSKIP = HSKIP; pGID->GSTEMPLATE = HTEMPLATE; @@ -3110,7 +3110,7 @@ failed: CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; FX_DWORD HBPP; FX_DWORD *GI; CJBig2_Image *HTREG; @@ -3125,7 +3125,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = 0; GI = pGID->decode_MMR(pStream, pPause); if(GI == NULL) { @@ -3168,7 +3168,7 @@ CJBig2_PatternDict *CJBig2_PDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDeco pGRD->GBTEMPLATE = HDTEMPLATE; pGRD->TPGDON = 0; pGRD->USESKIP = 0; - pGRD->GBAT[0] = -(FX_INT32)HDPW; + pGRD->GBAT[0] = -(int32_t)HDPW; pGRD->GBAT[1] = 0; if(pGRD->GBTEMPLATE == 0) { pGRD->GBAT[2] = -3; @@ -3237,7 +3237,7 @@ FX_DWORD *CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3318,7 +3318,7 @@ failed: FX_DWORD *CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3808,9 +3808,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(m_pLine == NULL) { m_pLine = pImage->m_pData; } @@ -3949,9 +3949,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -4087,9 +4087,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(!m_pLine) { m_pLine = pImage->m_pData; } @@ -4223,9 +4223,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1; - FX_BYTE *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h index 3f43c979a5..45e2940d3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h @@ -68,7 +68,7 @@ private: FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FXCODEC_STATUS decode_Arith_Template3_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FX_DWORD m_loopIndex; - FX_BYTE * m_pLine; + uint8_t * m_pLine; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProssiveStatus; CJBig2_Image** m_pImage; @@ -114,7 +114,7 @@ public: FX_BOOL MMR; FX_DWORD GBW; FX_DWORD GBH; - FX_BYTE GBTEMPLATE; + uint8_t GBTEMPLATE; FX_BOOL TPGDON; FX_BOOL USESKIP; CJBig2_Image * SKIP; @@ -140,8 +140,8 @@ public: FX_DWORD GRH; FX_BOOL GRTEMPLATE; CJBig2_Image *GRREFERENCE; - FX_INT32 GRREFERENCEDX; - FX_INT32 GRREFERENCEDY; + int32_t GRREFERENCEDX; + int32_t GRREFERENCEDY; FX_BOOL TPGRON; signed char GRAT[4]; }; @@ -175,7 +175,7 @@ public: FX_DWORD SBNUMSYMS; JBig2HuffmanCode *SBSYMCODES; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; CJBig2_Image **SBSYMS; FX_BOOL SBDEFPIXEL; @@ -214,7 +214,7 @@ public: *SDHUFFDW, *SDHUFFBMSIZE, *SDHUFFAGGINST; - FX_BYTE SDTEMPLATE; + uint8_t SDTEMPLATE; signed char SDAT[8]; FX_BOOL SDRTEMPLATE; signed char SDRAT[4]; @@ -230,7 +230,7 @@ public: FX_DWORD HBW, HBH; FX_BOOL HMMR; - FX_BYTE HTEMPLATE; + uint8_t HTEMPLATE; FX_DWORD HNUMPATS; CJBig2_Image **HPATS; FX_BOOL HDEFPIXEL; @@ -238,11 +238,11 @@ public: FX_BOOL HENABLESKIP; FX_DWORD HGW, HGH; - FX_INT32 HGX, + int32_t HGX, HGY; FX_WORD HRX, HRY; - FX_BYTE HPW, + uint8_t HPW, HPH; }; class CJBig2_PDDProc : public CJBig2_Object @@ -254,10 +254,10 @@ public: CJBig2_PatternDict *decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause); public: FX_BOOL HDMMR; - FX_BYTE HDPW, + uint8_t HDPW, HDPH; FX_DWORD GRAYMAX; - FX_BYTE HDTEMPLATE; + uint8_t HDTEMPLATE; }; class CJBig2_GSIDProc : public CJBig2_Object { @@ -269,10 +269,10 @@ public: public: FX_BOOL GSMMR; FX_BOOL GSUSESKIP; - FX_BYTE GSBPP; + uint8_t GSBPP; FX_DWORD GSW, GSH; - FX_BYTE GSTEMPLATE; + uint8_t GSTEMPLATE; CJBig2_Image *GSKIP; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index f2cea597c1..044ccf7410 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Image.cpp @@ -11,7 +11,7 @@ #include "../../../include/fxcrt/fx_safe_types.h" #include "JBig2_Image.h" -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) { m_nWidth = w; m_nHeight = h; @@ -22,13 +22,13 @@ CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) } m_nStride = ((w + 31) >> 5) << 2; if (m_nStride * m_nHeight > 0 && 104857600 / (int)m_nStride > m_nHeight) { - m_pData = (FX_BYTE *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); } else { m_pData = NULL; } m_bNeedFree = TRUE; } -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf) { m_nWidth = w; m_nHeight = h; @@ -43,7 +43,7 @@ CJBig2_Image::CJBig2_Image(CJBig2_Image &im) m_nHeight = im.m_nHeight; m_nStride = im.m_nStride; if (im.m_pData) { - m_pData = (FX_BYTE*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); JBIG2_memcpy(m_pData, im.m_pData, m_nStride * m_nHeight); } else { m_pData = NULL; @@ -56,12 +56,12 @@ CJBig2_Image::~CJBig2_Image() m_pModule->JBig2_Free(m_pData); } } -FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) +FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -73,12 +73,12 @@ FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) return ((m_pData[m] >> (7 - n)) & 1); } -FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, FX_BOOL v) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -94,7 +94,7 @@ FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) } return 1; } -void CJBig2_Image::copyLine(FX_INT32 hTo, FX_INT32 hFrom) +void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { if (!m_pData) { return; @@ -112,14 +112,14 @@ void CJBig2_Image::fill(FX_BOOL v) } JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return composeTo_opt2(pDst, x, y, op); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; @@ -129,10 +129,10 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig } return composeTo_opt2(pDst, x, y, op, pSrcRect); } -FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 w, h, dx, dy; - FX_INT32 i, j; + int32_t w, h, dx, dy; + int32_t i, j; w = m_nWidth; h = m_nHeight; dx = dy = 0; @@ -196,10 +196,10 @@ FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y return TRUE; } -FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 x0, x1, y0, y1, xx, yy; - FX_BYTE *pLineSrc, *pLineDst, *srcPtr, *destPtr; + int32_t x0, x1, y0, y1, xx, yy; + uint8_t *pLineSrc, *pLineDst, *srcPtr, *destPtr; FX_DWORD src0, src1, src, dest, s1, s2, m1, m2, m3; FX_BOOL oneByte; if (!m_pData) { @@ -247,7 +247,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest |= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -259,7 +259,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest &= ((0xff00 | *srcPtr) >> s1) | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -271,7 +271,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -283,7 +283,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= ((*srcPtr ^ 0xff) >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -295,7 +295,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest = (dest & ~m3) | ((*srcPtr >> s1) & m3); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -310,7 +310,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest |= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -322,7 +322,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest &= *srcPtr | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -334,7 +334,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -346,7 +346,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= (*srcPtr ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -358,7 +358,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest = (*srcPtr & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -376,7 +376,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest |= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -384,7 +384,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -395,7 +395,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -408,7 +408,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest &= (0xff00 | src1) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -416,7 +416,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -427,7 +427,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -440,7 +440,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -448,7 +448,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -459,7 +459,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -472,7 +472,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= (src1 ^ 0xff) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -480,7 +480,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -491,7 +491,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -504,7 +504,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest = (dest & (0xff << s2)) | (src1 >> s1); - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -512,7 +512,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -523,7 +523,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -544,7 +544,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -555,7 +555,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -573,7 +573,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -584,7 +584,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -602,7 +602,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -613,7 +613,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -631,7 +631,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -642,7 +642,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -660,7 +660,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -671,7 +671,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -682,24 +682,24 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return TRUE; } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op); } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op, pSrcRect); } -CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 i, j; + int32_t i, j; JBIG2_ALLOC(pImage, CJBig2_Image(w, h)); for(j = 0; j < h; j++) { for(i = 0; i < w; i++) { @@ -709,13 +709,13 @@ CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, F return pImage; } #define JBIG2_GETDWORD(buf) ((FX_DWORD)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) -CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 m, n, j; - FX_BYTE *pLineSrc, *pLineDst; + int32_t m, n, j; + uint8_t *pLineSrc, *pLineDst; FX_DWORD wTmp; - FX_BYTE *pSrc, *pSrcEnd, *pDst, *pDstEnd; + uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd; if (w == 0 || h == 0) { return NULL; } @@ -755,10 +755,10 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } else { wTmp = JBIG2_GETDWORD(pSrc) << n; } - pDst[0] = (FX_BYTE)(wTmp >> 24); - pDst[1] = (FX_BYTE)(wTmp >> 16); - pDst[2] = (FX_BYTE)(wTmp >> 8); - pDst[3] = (FX_BYTE)wTmp; + pDst[0] = (uint8_t)(wTmp >> 24); + pDst[1] = (uint8_t)(wTmp >> 16); + pDst[2] = (uint8_t)(wTmp >> 8); + pDst[3] = (uint8_t)wTmp; } pLineSrc += m_nStride; pLineDst += pImage->m_nStride; @@ -766,7 +766,7 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } return pImage; } -void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) +void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; @@ -780,7 +780,7 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) return; } //The guaranteed reallocated memory is to be < 4GB (unsigned int). - m_pData = (FX_BYTE*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); + m_pData = (uint8_t*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); //The result of dwHeight * dwStride doesn't overflow after the //checking of safeMemSize. //The same as the result of (dwH - dwHeight) * dwStride) because @@ -789,15 +789,15 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) JBIG2_memset(m_pData + dwHeight * dwStride, v ? 0xff : 0, (dwH - dwHeight) * dwStride); m_nHeight = h; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, + int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0; FX_DWORD s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; - FX_BYTE *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; + uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; if (!m_pData) { return FALSE; @@ -867,10 +867,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -896,10 +896,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -927,10 +927,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -963,10 +963,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -990,10 +990,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1018,10 +1018,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1051,10 +1051,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1078,10 +1078,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1105,10 +1105,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1140,10 +1140,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1166,10 +1166,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1194,10 +1194,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1206,12 +1206,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return 1; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { - FX_INT32 xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; + int32_t xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; FX_DWORD s1, d1, d2, shift, shift1, shift2, tmp, tmp1, tmp2, maskL, maskR, maskM; - FX_BYTE *lineSrc, *lineDst, *sp, *dp; - FX_INT32 sw, sh; + uint8_t *lineSrc, *lineDst, *sp, *dp; + int32_t sw, sh; if (!m_pData) { return FALSE; } @@ -1290,10 +1290,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1319,10 +1319,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1350,10 +1350,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1386,10 +1386,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1413,10 +1413,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1441,10 +1441,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1474,10 +1474,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1501,10 +1501,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1528,10 +1528,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1563,10 +1563,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1589,10 +1589,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1617,10 +1617,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; diff --git a/core/src/fxcodec/jbig2/JBig2_Image.h b/core/src/fxcodec/jbig2/JBig2_Image.h index 5d06695c7c..423bebcede 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.h +++ b/core/src/fxcodec/jbig2/JBig2_Image.h @@ -20,48 +20,48 @@ class CJBig2_Image : public CJBig2_Object { public: - CJBig2_Image(FX_INT32 w, FX_INT32 h); + CJBig2_Image(int32_t w, int32_t h); - CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf); + CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf); CJBig2_Image(CJBig2_Image &im); ~CJBig2_Image(); - FX_BOOL getPixel(FX_INT32 x, FX_INT32 y); + FX_BOOL getPixel(int32_t x, int32_t y); - FX_INT32 setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v); + int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); - void copyLine(FX_INT32 hTo, FX_INT32 hFrom); + void copyLine(int32_t hTo, int32_t hFrom); void fill(FX_BOOL v); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); - CJBig2_Image *subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); + CJBig2_Image *subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h); - CJBig2_Image *subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + CJBig2_Image *subImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(FX_INT32 h, FX_BOOL v); + void expand(int32_t h, FX_BOOL v); public: - FX_INT32 m_nWidth; + int32_t m_nWidth; - FX_INT32 m_nHeight; + int32_t m_nHeight; - FX_INT32 m_nStride; + int32_t m_nStride; - FX_BYTE *m_pData; + uint8_t *m_pData; FX_BOOL m_bNeedFree; }; diff --git a/core/src/fxcodec/jbig2/JBig2_List.h b/core/src/fxcodec/jbig2/JBig2_List.h index 9292724b1e..19f99dec3d 100644 --- a/core/src/fxcodec/jbig2/JBig2_List.h +++ b/core/src/fxcodec/jbig2/JBig2_List.h @@ -13,7 +13,7 @@ class CJBig2_List : public CJBig2_Object { public: - CJBig2_List(FX_INT32 nSize = 8) + CJBig2_List(int32_t nSize = 8) { m_nSize = nSize; m_pArray = (TYPE**)m_pModule->JBig2_Malloc2(sizeof(TYPE*), nSize); @@ -28,7 +28,7 @@ public: void clear() { - FX_INT32 i; + int32_t i; for(i = 0; i < m_nLength; i++) { delete m_pArray[i]; } @@ -45,12 +45,12 @@ public: } - FX_INT32 getLength() + int32_t getLength() { return m_nLength; } - TYPE *getAt(FX_INT32 nIndex) + TYPE *getAt(int32_t nIndex) { return m_pArray[nIndex]; } @@ -60,8 +60,8 @@ public: return m_pArray[m_nLength - 1]; } private: - FX_INT32 m_nSize; + int32_t m_nSize; TYPE **m_pArray; - FX_INT32 m_nLength; + int32_t m_nLength; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index 711cf4047b..aef31bb49f 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -22,7 +22,7 @@ public: virtual void JBig2_Free(FX_LPVOID pMem) = 0; - virtual void JBig2_Assert(FX_INT32 nExpression) {}; + virtual void JBig2_Assert(int32_t nExpression) {}; virtual void JBig2_Error(FX_LPCSTR format, ...) {}; diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 2bb267b085..4bb00b897b 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -36,9 +36,9 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t FX_LPCSTR filename, int line) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; @@ -53,9 +53,9 @@ void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t un void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; diff --git a/core/src/fxcodec/jbig2/JBig2_Page.h b/core/src/fxcodec/jbig2/JBig2_Page.h index d7399bd452..b07eba8a3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_Page.h +++ b/core/src/fxcodec/jbig2/JBig2_Page.h @@ -12,7 +12,7 @@ struct JBig2PageInfo : public CJBig2_Object { m_dwHeight; FX_DWORD m_dwResolutionX, m_dwResolutionY; - FX_BYTE m_cFlags; + uint8_t m_cFlags; FX_BOOL m_bIsStriped; FX_WORD m_wMaxStripeSize; }; diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index 33ee721a1b..fe44bc962d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -42,19 +42,19 @@ public: FX_DWORD m_dwNumber; union { struct { - FX_BYTE type : 6; - FX_BYTE page_association_size : 1; - FX_BYTE deferred_non_retain : 1; + uint8_t type : 6; + uint8_t page_association_size : 1; + uint8_t deferred_non_retain : 1; } s; - FX_BYTE c; + uint8_t c; } m_cFlags; - FX_INT32 m_nReferred_to_segment_count; + int32_t m_nReferred_to_segment_count; FX_DWORD * m_pReferred_to_segment_numbers; FX_DWORD m_dwPage_association; FX_DWORD m_dwData_length; FX_DWORD m_dwHeader_Length; - FX_BYTE *m_pData; + uint8_t *m_pData; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { diff --git a/core/src/fxcodec/lbmp/fx_bmp.cpp b/core/src/fxcodec/lbmp/fx_bmp.cpp index e868fdeaef..3a6e3816ff 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.cpp +++ b/core/src/fxcodec/lbmp/fx_bmp.cpp @@ -15,15 +15,15 @@ FX_WORD _GetWord_LSBFirst(FX_LPBYTE p) }
void _SetDWord_LSBFirst(FX_LPBYTE p, FX_DWORD v)
{
- p[0] = (FX_BYTE)v;
- p[1] = (FX_BYTE)(v >> 8);
- p[2] = (FX_BYTE)(v >> 16);
- p[3] = (FX_BYTE)(v >> 24);
+ p[0] = (uint8_t)v;
+ p[1] = (uint8_t)(v >> 8);
+ p[2] = (uint8_t)(v >> 16);
+ p[3] = (uint8_t)(v >> 24);
}
void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v)
{
- p[0] = (FX_BYTE)v;
- p[1] = (FX_BYTE)(v >> 8);
+ p[0] = (uint8_t)v;
+ p[1] = (uint8_t)(v >> 8);
}
void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg)
{
@@ -60,7 +60,7 @@ void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr) }
FX_Free(bmp_ptr);
}
-FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr)
{
if(bmp_ptr == NULL) {
return 0;
@@ -113,8 +113,8 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biBitCount);
bmp_ptr->compress_flag = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biCompression);
bmp_ptr->color_used = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biClrUsed);
- bmp_ptr->dpi_x = (FX_INT32)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
- bmp_ptr->dpi_y = (FX_INT32)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
+ bmp_ptr->dpi_x = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
+ bmp_ptr->dpi_y = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
if(bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = TRUE;
@@ -197,7 +197,7 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) FX_Free(bmp_ptr->out_row_buffer);
bmp_ptr->out_row_buffer = NULL;
}
- bmp_ptr->out_row_buffer = FX_Alloc(FX_BYTE, bmp_ptr->out_row_bytes);
+ bmp_ptr->out_row_buffer = FX_Alloc(uint8_t, bmp_ptr->out_row_bytes);
BMP_PTR_NOT_NULL(bmp_ptr->out_row_buffer, bmp_ptr);
FXSYS_memset32(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
_bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_PAL);
@@ -258,7 +258,7 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) }
bmp_ptr->pal_ptr = FX_Alloc(FX_DWORD, bmp_ptr->pal_num);
BMP_PTR_NOT_NULL(bmp_ptr->pal_ptr, bmp_ptr);
- FX_INT32 src_pal_index = 0;
+ int32_t src_pal_index = 0;
if(bmp_ptr->pal_type == BMP_PAL_OLD) {
while(src_pal_index < bmp_ptr->pal_num) {
bmp_ptr->pal_ptr[src_pal_index++] = BMP_PAL_ENCODE(0x00, src_pal_ptr[2], src_pal_ptr[1], src_pal_ptr[0]);
@@ -278,7 +278,7 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) }
return 1;
}
-FX_INT32 _bmp_decode_image(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr)
{
if(bmp_ptr->decode_status == BMP_D_STATUS_DATA_PRE) {
bmp_ptr->avail_in = 0;
@@ -304,7 +304,7 @@ FX_INT32 _bmp_decode_image(bmp_decompress_struct_p bmp_ptr) _bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
-FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr)
{
FX_LPBYTE row_buf = bmp_ptr->out_row_buffer;
FX_LPBYTE des_buf = NULL;
@@ -315,13 +315,13 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) _bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_DATA);
switch(bmp_ptr->bitCounts) {
case 1: {
- for (FX_INT32 col = 0; col < bmp_ptr->width; col++) {
+ for (int32_t col = 0; col < bmp_ptr->width; col++) {
*row_buf++ = des_buf[col >> 3] & (0x80 >> (col % 8)) ? 0x01 : 0x00;
}
}
break;
case 4: {
- for (FX_INT32 col = 0; col < bmp_ptr->width; col++) {
+ for (int32_t col = 0; col < bmp_ptr->width; col++) {
*row_buf++ = (col & 0x01) ?
(des_buf[col >> 1] & 0x0F) :
((des_buf[col >> 1] & 0xF0) >> 4);
@@ -331,10 +331,10 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) #ifdef BMP_SUPPORT_BITFIELD
case 16: {
FX_WORD* buf = (FX_WORD*)des_buf;
- FX_BYTE blue_bits = 0;
- FX_BYTE green_bits = 0;
- FX_BYTE red_bits = 0;
- for(FX_INT32 i = 0; i < 16; i++) {
+ uint8_t blue_bits = 0;
+ uint8_t green_bits = 0;
+ uint8_t red_bits = 0;
+ for(int32_t i = 0; i < 16; i++) {
if((bmp_ptr->mask_blue >> i) & 0x01) {
blue_bits++;
}
@@ -350,11 +350,11 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) blue_bits = 8 - blue_bits;
green_bits -= 8;
red_bits -= 8;
- for (FX_INT32 col = 0; col < bmp_ptr->width; col++) {
+ for (int32_t col = 0; col < bmp_ptr->width; col++) {
*buf = _GetWord_LSBFirst((FX_LPBYTE)buf);
- *row_buf++ = (FX_BYTE)((*buf & bmp_ptr->mask_blue) << blue_bits);
- *row_buf++ = (FX_BYTE)((*buf & bmp_ptr->mask_green) >> green_bits);
- *row_buf++ = (FX_BYTE)((*buf++ & bmp_ptr->mask_red) >> red_bits);
+ *row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_blue) << blue_bits);
+ *row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_green) >> green_bits);
+ *row_buf++ = (uint8_t)((*buf++ & bmp_ptr->mask_red) >> red_bits);
}
}
break;
@@ -373,7 +373,7 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) _bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_TAIL);
return 1;
}
-FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr)
{
FX_LPBYTE first_byte_ptr = NULL;
FX_LPBYTE second_byte_ptr = NULL;
@@ -419,8 +419,8 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->col_num += (FX_INT32)delta_ptr[0];
- FX_INT32 bmp_row_num_next = bmp_ptr->row_num + (FX_INT32)delta_ptr[1];
+ bmp_ptr->col_num += (int32_t)delta_ptr[0];
+ int32_t bmp_row_num_next = bmp_ptr->row_num + (int32_t)delta_ptr[1];
if(bmp_ptr->col_num >= bmp_ptr->out_row_bytes || bmp_row_num_next >= bmp_ptr->height) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt Or Not Supported");
return 0;
@@ -434,7 +434,7 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) }
break;
default: {
- if((FX_INT32)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
+ if((int32_t)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
@@ -444,7 +444,7 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) return 2;
}
FXSYS_memcpy32(bmp_ptr->out_row_buffer + bmp_ptr->col_num, second_byte_ptr, *first_byte_ptr);
- bmp_ptr->col_num += (FX_INT32)(*first_byte_ptr);
+ bmp_ptr->col_num += (int32_t)(*first_byte_ptr);
}
}
}
@@ -454,19 +454,19 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- if((FX_INT32)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
+ if((int32_t)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
FXSYS_memset8(bmp_ptr->out_row_buffer + bmp_ptr->col_num, *second_byte_ptr, *first_byte_ptr);
- bmp_ptr->col_num += (FX_INT32)(*first_byte_ptr);
+ bmp_ptr->col_num += (int32_t)(*first_byte_ptr);
}
}
}
_bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
-FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr)
{
FX_LPBYTE first_byte_ptr = NULL;
FX_LPBYTE second_byte_ptr = NULL;
@@ -512,8 +512,8 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->col_num += (FX_INT32)delta_ptr[0];
- FX_INT32 bmp_row_num_next = bmp_ptr->row_num + (FX_INT32)delta_ptr[1];
+ bmp_ptr->col_num += (int32_t)delta_ptr[0];
+ int32_t bmp_row_num_next = bmp_ptr->row_num + (int32_t)delta_ptr[1];
if(bmp_ptr->col_num >= bmp_ptr->out_row_bytes || bmp_row_num_next >= bmp_ptr->height) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt Or Not Supported");
return 0;
@@ -527,8 +527,8 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) }
break;
default: {
- FX_BYTE size = (FX_BYTE)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
- if((FX_INT32)*first_byte_ptr >= bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
+ uint8_t size = (uint8_t)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
+ if((int32_t)*first_byte_ptr >= bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
if(size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
@@ -539,7 +539,7 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- for (FX_BYTE i = 0; i < *first_byte_ptr; i++) {
+ for (uint8_t i = 0; i < *first_byte_ptr; i++) {
if(i & 0x01) {
*(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) = (*second_byte_ptr++ & 0x0F);
} else {
@@ -555,15 +555,15 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- if((FX_INT32)*first_byte_ptr > bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
- FX_BYTE size = (FX_BYTE)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
+ if((int32_t)*first_byte_ptr > bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
+ uint8_t size = (uint8_t)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
if(size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
*first_byte_ptr = bmp_ptr->out_row_bytes - bmp_ptr->col_num - 1;
}
- for (FX_BYTE i = 0; i < *first_byte_ptr; i++) {
+ for (uint8_t i = 0; i < *first_byte_ptr; i++) {
if(i & 0x01) {
*(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) = (*second_byte_ptr & 0x0F);
} else {
@@ -586,7 +586,7 @@ FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, bmp_ptr->skip_size += data_size;
return *des_buf_pp;
}
-void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, FX_INT32 status)
+void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status)
{
bmp_ptr->decode_status = status;
bmp_ptr->next_in += bmp_ptr->skip_size;
@@ -679,7 +679,7 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ size = bmp_ptr->src_pitch * bmp_ptr->src_row * bmp_ptr->info_header.biBitCount / 16;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
@@ -709,9 +709,9 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ dst_pos += 4;
bmp_ptr->file_header.bfOffBits = dst_pos;
}
- FX_BYTE blue_bits = 0;
- FX_BYTE green_bits = 0;
- FX_BYTE red_bits = 0;
+ uint8_t blue_bits = 0;
+ uint8_t green_bits = 0;
+ uint8_t red_bits = 0;
for(i = 0; i < bmp_ptr->info_header.biBitCount; i++) {
if((mask_blue >> i) & 0x01) {
blue_bits++;
@@ -729,11 +729,11 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ green_bits -= 8;
red_bits -= 8;
i = 0;
- for (FX_INT32 row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--, i = 0) {
+ for (int32_t row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--, i = 0) {
while (i < bmp_ptr->src_width * bmp_ptr->src_bpp / 8) {
- FX_BYTE b = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
- FX_BYTE g = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
- FX_BYTE r = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
+ uint8_t b = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
+ uint8_t g = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
+ uint8_t r = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
if (bmp_ptr->src_bpp == 32) {
i++;
}
@@ -766,20 +766,20 @@ static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, F size = dst_pitch * bmp_ptr->src_row;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
FXSYS_memset32(&dst_buf[dst_pos], 0, size);
- for (FX_INT32 row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--) {
+ for (int32_t row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--) {
FXSYS_memcpy32(&dst_buf[dst_pos], &bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch], bmp_ptr->src_pitch);
dst_pos += dst_pitch;
}
dst_size = dst_pos;
}
-static FX_BYTE _bmp_rle8_search(FX_LPCBYTE buf, FX_INT32 len)
+static uint8_t _bmp_rle8_search(FX_LPCBYTE buf, int32_t len)
{
- FX_BYTE num;
+ uint8_t num;
num = 1;
while (num < len) {
if (buf[num - 1] != buf[num] || num == 0xFF) {
@@ -792,21 +792,21 @@ static FX_BYTE _bmp_rle8_search(FX_LPCBYTE buf, FX_INT32 len) static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
- FX_BYTE rle[2] = {0};
+ uint8_t rle[2] = {0};
size = bmp_ptr->src_pitch * bmp_ptr->src_row * 2;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
FXSYS_memset32(&dst_buf[dst_pos], 0, size);
- for (FX_INT32 row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; ) {
+ for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; ) {
index = row_num * bmp_ptr->src_pitch;
rle[0] = _bmp_rle8_search(&bmp_ptr->src_buf[index + i], size - index - i);
rle[1] = bmp_ptr->src_buf[index + i];
- if (i + rle[0] >= (FX_INT32)bmp_ptr->src_pitch) {
- rle[0] = FX_BYTE(bmp_ptr->src_pitch - i);
+ if (i + rle[0] >= (int32_t)bmp_ptr->src_pitch) {
+ rle[0] = uint8_t(bmp_ptr->src_pitch - i);
if (rle[0]) {
dst_buf[dst_pos++] = rle[0];
dst_buf[dst_pos++] = rle[1];
@@ -825,9 +825,9 @@ static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-static FX_BYTE _bmp_rle4_search(FX_LPCBYTE buf, FX_INT32 len)
+static uint8_t _bmp_rle4_search(FX_LPCBYTE buf, int32_t len)
{
- FX_BYTE num;
+ uint8_t num;
num = 2;
while (num < len) {
if (buf[num - 2] != buf[num] || num == 0xFF) {
@@ -840,22 +840,22 @@ static FX_BYTE _bmp_rle4_search(FX_LPCBYTE buf, FX_INT32 len) static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
- FX_BYTE rle[2] = {0};
+ uint8_t rle[2] = {0};
size = bmp_ptr->src_pitch * bmp_ptr->src_row;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
FXSYS_memset32(&dst_buf[dst_pos], 0, size);
- for (FX_INT32 row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; rle[1] = 0) {
+ for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; rle[1] = 0) {
index = row_num * bmp_ptr->src_pitch;
rle[0] = _bmp_rle4_search(&bmp_ptr->src_buf[index + i], size - index - i);
rle[1] |= (bmp_ptr->src_buf[index + i] & 0x0f) << 4;
rle[1] |= bmp_ptr->src_buf[index + i + 1] & 0x0f;
- if (i + rle[0] >= (FX_INT32)bmp_ptr->src_pitch) {
- rle[0] = FX_BYTE(bmp_ptr->src_pitch - i);
+ if (i + rle[0] >= (int32_t)bmp_ptr->src_pitch) {
+ rle[0] = uint8_t(bmp_ptr->src_pitch - i);
if (rle[0]) {
dst_buf[dst_pos++] = rle[0];
dst_buf[dst_pos++] = rle[1];
@@ -882,7 +882,7 @@ FX_BOOL _bmp_encode_image( bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX pal_size = sizeof(FX_DWORD) * bmp_ptr->info_header.biClrUsed;
}
dst_size = head_size + sizeof(FX_DWORD) * bmp_ptr->pal_num;
- dst_buf = FX_TryAlloc(FX_BYTE, dst_size);
+ dst_buf = FX_TryAlloc(uint8_t, dst_size);
if (dst_buf == NULL) {
return FALSE;
}
diff --git a/core/src/fxcodec/lbmp/fx_bmp.h b/core/src/fxcodec/lbmp/fx_bmp.h index b7c3617182..553a1501db 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.h +++ b/core/src/fxcodec/lbmp/fx_bmp.h @@ -47,14 +47,14 @@ typedef struct tagBmpCoreHeader { } BmpCoreHeader, *BmpCoreHeaderPtr;
typedef struct tagBmpInfoHeader {
FX_DWORD biSize;
- FX_INT32 biWidth;
- FX_INT32 biHeight;
+ int32_t biWidth;
+ int32_t biHeight;
FX_WORD biPlanes;
FX_WORD biBitCount;
FX_DWORD biCompression;
FX_DWORD biSizeImage;
- FX_INT32 biXPelsPerMeter;
- FX_INT32 biYPelsPerMeter;
+ int32_t biXPelsPerMeter;
+ int32_t biYPelsPerMeter;
FX_DWORD biClrUsed;
FX_DWORD biClrImportant;
} BmpInfoHeader, *BmpInfoHeaderPtr;
@@ -71,26 +71,26 @@ struct tag_bmp_decompress_struct { BmpFileHeaderPtr bmp_header_ptr;
BmpInfoHeaderPtr bmp_infoheader_ptr;
- FX_INT32 width;
- FX_INT32 height;
+ int32_t width;
+ int32_t height;
FX_DWORD compress_flag;
- FX_INT32 components;
- FX_INT32 src_row_bytes;
- FX_INT32 out_row_bytes;
+ int32_t components;
+ int32_t src_row_bytes;
+ int32_t out_row_bytes;
FX_LPBYTE out_row_buffer;
FX_WORD bitCounts;
FX_DWORD color_used;
FX_BOOL imgTB_flag;
- FX_INT32 pal_num;
- FX_INT32 pal_type;
+ int32_t pal_num;
+ int32_t pal_type;
FX_DWORD* pal_ptr;
FX_DWORD data_size;
FX_DWORD img_data_offset;
FX_DWORD img_ifh_size;
- FX_INT32 row_num;
- FX_INT32 col_num;
- FX_INT32 dpi_x;
- FX_INT32 dpi_y;
+ int32_t row_num;
+ int32_t col_num;
+ int32_t dpi_x;
+ int32_t dpi_y;
#ifdef BMP_SUPPORT_BITFIELD
FX_DWORD mask_red;
FX_DWORD mask_green;
@@ -98,22 +98,22 @@ struct tag_bmp_decompress_struct { #endif
FX_BOOL (*_bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, FX_DWORD cur_pos);
- void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, FX_INT32 row_num, FX_LPBYTE row_buf);
+ void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf);
FX_LPBYTE next_in;
FX_DWORD avail_in;
FX_DWORD skip_size;
- FX_INT32 decode_status;
+ int32_t decode_status;
};
void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg);
bmp_decompress_struct_p _bmp_create_decompress();
void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr);
-FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_image(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr);
FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
-void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, FX_INT32 status);
+void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status);
void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* avial_buf_ptr);
#define BMP_PTR_NOT_NULL(ptr,bmp_ptr) if(ptr == NULL){ \
@@ -129,13 +129,13 @@ struct tag_bmp_compress_struct { FX_LPBYTE src_buf;
FX_DWORD src_pitch;
FX_DWORD src_row;
- FX_BYTE src_bpp;
+ uint8_t src_bpp;
FX_DWORD src_width;
FX_BOOL src_free;
FX_DWORD* pal_ptr;
FX_WORD pal_num;
#ifdef BMP_SUPPORT_BITFIELD
- FX_BYTE bit_type;
+ uint8_t bit_type;
#endif
};
bmp_compress_struct_p _bmp_create_compress();
diff --git a/core/src/fxcodec/lgif/fx_gif.cpp b/core/src/fxcodec/lgif/fx_gif.cpp index bc6109e88e..1eb4a75f1a 100644 --- a/core/src/fxcodec/lgif/fx_gif.cpp +++ b/core/src/fxcodec/lgif/fx_gif.cpp @@ -14,7 +14,7 @@ FX_DWORD CGifLZWDecoder::GetAvailInput() {
return avail_in;
}
-void CGifLZWDecoder::InitTable(FX_BYTE code_len)
+void CGifLZWDecoder::InitTable(uint8_t code_len)
{
code_size = code_len;
code_clear = 1 << code_size;
@@ -35,7 +35,7 @@ void CGifLZWDecoder::ClearTable() FXSYS_memset32(code_table, 0, sizeof(tag_Table)*GIF_MAX_LZW_CODE);
FXSYS_memset32(stack, 0, GIF_MAX_LZW_CODE);
for (FX_WORD i = 0; i < code_clear; i++) {
- code_table[i].suffix = (FX_BYTE)i;
+ code_table[i].suffix = (uint8_t)i;
}
}
void CGifLZWDecoder::DecodeString(FX_WORD code)
@@ -49,10 +49,10 @@ void CGifLZWDecoder::DecodeString(FX_WORD code) stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = code_table[code].suffix;
code = code_table[code].prefix;
}
- stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = (FX_BYTE)code;
- code_first = (FX_BYTE)code;
+ stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = (uint8_t)code;
+ code_first = (uint8_t)code;
}
-void CGifLZWDecoder::AddCode(FX_WORD prefix_code, FX_BYTE append_char)
+void CGifLZWDecoder::AddCode(FX_WORD prefix_code, uint8_t append_char)
{
if(code_next == GIF_MAX_LZW_CODE) {
return;
@@ -65,7 +65,7 @@ void CGifLZWDecoder::AddCode(FX_WORD prefix_code, FX_BYTE append_char) }
}
}
-FX_INT32 CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
+int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
{
if(des_size == 0) {
return 3;
@@ -118,7 +118,7 @@ FX_INT32 CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size) return 0;
} else {
DecodeString(code);
- FX_BYTE append_char = stack[GIF_MAX_LZW_CODE - stack_size];
+ uint8_t append_char = stack[GIF_MAX_LZW_CODE - stack_size];
AddCode(code_old, append_char);
}
}
@@ -150,11 +150,11 @@ static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD siz FX_DWORD len_org = dst_len;
while (dst_buf && dst_len < size) {
dst_len <<= 1;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_len);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len);
}
if (dst_buf == NULL) {
dst_len = size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_len);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len);
if (dst_buf == NULL) {
return FALSE;
}
@@ -164,17 +164,17 @@ static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD siz }
return TRUE;
}
-static inline void _gif_cut_index(FX_BYTE& val, FX_DWORD index, FX_BYTE index_bit, FX_BYTE index_bit_use, FX_BYTE bit_use)
+static inline void _gif_cut_index(uint8_t& val, FX_DWORD index, uint8_t index_bit, uint8_t index_bit_use, uint8_t bit_use)
{
FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use;
val |= ((index & cut) >> index_bit_use) << bit_use;
}
-static inline FX_BYTE _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE bit_cut, FX_BYTE& bit_offset, FX_DWORD& bit_num)
+static inline uint8_t _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)
{
if (bit_cut != 8) {
FX_WORD index = 0;
index |= ((1 << bit_cut) - 1) << (7 - bit_offset);
- FX_BYTE ret = ((index & buf[offset]) >> (7 - bit_offset));
+ uint8_t ret = ((index & buf[offset]) >> (7 - bit_offset));
bit_offset += bit_cut;
if (bit_offset >= 8) {
if (bit_offset > 8) {
@@ -206,7 +206,7 @@ void CGifLZWEncoder::ClearTable() code_table[i].suffix = 0;
}
}
-void CGifLZWEncoder::Start( FX_BYTE code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)
+void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)
{
code_size = code_len + 1;
src_bit_cut = code_size;
@@ -238,7 +238,7 @@ void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& }
void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
- FX_BYTE index_bit_use;
+ uint8_t index_bit_use;
index_bit_use = 0;
if (index_buf_len == GIF_DATA_BLOCK) {
WriteBlock(dst_buf, dst_len, offset);
@@ -289,7 +289,7 @@ void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& }
FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
- FX_BYTE suffix;
+ uint8_t suffix;
if (setjmp(jmp)) {
return FALSE;
}
@@ -313,7 +313,7 @@ FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& src_bit_num = 0;
return TRUE;
}
-FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE& bit_offset )
+FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset )
{
for (FX_WORD i = table_cur; i < index_num; i++) {
if (code_table[i].prefix == code_table[index_num].prefix &&
@@ -336,7 +336,7 @@ void CGifLZWEncoder::Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& off }
gif_decompress_struct_p _gif_create_decompress()
{
- gif_decompress_struct_p gif_ptr = (gif_decompress_struct*)FX_Alloc(FX_BYTE, sizeof(gif_decompress_struct));
+ gif_decompress_struct_p gif_ptr = (gif_decompress_struct*)FX_Alloc(uint8_t, sizeof(gif_decompress_struct));
if(gif_ptr == NULL) {
return NULL;
}
@@ -365,8 +365,8 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) delete gif_ptr->img_decoder_ptr;
}
if(gif_ptr->img_ptr_arr_ptr != NULL) {
- FX_INT32 size_img_arr = gif_ptr->img_ptr_arr_ptr->GetSize();
- for (FX_INT32 i = 0; i < size_img_arr; i++) {
+ int32_t size_img_arr = gif_ptr->img_ptr_arr_ptr->GetSize();
+ for (int32_t i = 0; i < size_img_arr; i++) {
GifImage* p = gif_ptr->img_ptr_arr_ptr->GetAt(i);
if(p->image_info_ptr != NULL) {
FX_Free(p->image_info_ptr);
@@ -402,8 +402,8 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) #endif
#ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
if(gif_ptr->pt_ptr_arr_ptr != NULL) {
- FX_INT32 size_pt_arr = gif_ptr->pt_ptr_arr_ptr->GetSize();
- for (FX_INT32 i = 0; i < size_pt_arr; i++) {
+ int32_t size_pt_arr = gif_ptr->pt_ptr_arr_ptr->GetSize();
+ for (int32_t i = 0; i < size_pt_arr; i++) {
GifPlainText* p = gif_ptr->pt_ptr_arr_ptr->GetAt(i);
if(p->gce_ptr != NULL) {
FX_Free(p->gce_ptr);
@@ -423,13 +423,13 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) }
gif_compress_struct_p _gif_create_compress()
{
- gif_compress_struct_p gif_ptr = (gif_compress_struct*)FX_Alloc(FX_BYTE, sizeof(gif_compress_struct));
+ gif_compress_struct_p gif_ptr = (gif_compress_struct*)FX_Alloc(uint8_t, sizeof(gif_compress_struct));
if (gif_ptr == NULL) {
return NULL;
}
FXSYS_memset32(gif_ptr, 0, sizeof(gif_compress_struct));
gif_ptr->img_encoder_ptr = new CGifLZWEncoder;
- gif_ptr->header_ptr = (GifHeader*)FX_Alloc(FX_BYTE, sizeof(GifHeader));
+ gif_ptr->header_ptr = (GifHeader*)FX_Alloc(uint8_t, sizeof(GifHeader));
if (gif_ptr->header_ptr == NULL) {
delete(gif_ptr->img_encoder_ptr);
FX_Free(gif_ptr);
@@ -437,7 +437,7 @@ gif_compress_struct_p _gif_create_compress() }
FXSYS_memcpy32(gif_ptr->header_ptr->signature, GIF_SIGNATURE, 3);
FXSYS_memcpy32(gif_ptr->header_ptr->version, "89a", 3);
- gif_ptr->lsd_ptr = (GifLSD*)FX_Alloc(FX_BYTE, sizeof(GifLSD));
+ gif_ptr->lsd_ptr = (GifLSD*)FX_Alloc(uint8_t, sizeof(GifLSD));
if (gif_ptr->lsd_ptr == NULL) {
FX_Free(gif_ptr->header_ptr);
delete(gif_ptr->img_encoder_ptr);
@@ -445,7 +445,7 @@ gif_compress_struct_p _gif_create_compress() return NULL;
}
FXSYS_memset32(gif_ptr->lsd_ptr, 0, sizeof(GifLSD));
- gif_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(FX_BYTE, sizeof(GifImageInfo));
+ gif_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
if (gif_ptr->image_info_ptr == NULL) {
FX_Free(gif_ptr->lsd_ptr);
FX_Free(gif_ptr->header_ptr);
@@ -459,7 +459,7 @@ gif_compress_struct_p _gif_create_compress() FXSYS_memcpy32(gif_ptr->app_authentication, "2.0", 3);
#endif
#ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
- gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(FX_BYTE, sizeof(GifGCE));
+ gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(uint8_t, sizeof(GifGCE));
if (gif_ptr->gce_ptr == NULL) {
FX_Free(gif_ptr->image_info_ptr);
FX_Free(gif_ptr->lsd_ptr);
@@ -470,7 +470,7 @@ gif_compress_struct_p _gif_create_compress() }
#endif
#ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
- gif_ptr->pte_ptr = (GifPTE*)FX_Alloc(FX_BYTE, sizeof(GifPTE));
+ gif_ptr->pte_ptr = (GifPTE*)FX_Alloc(uint8_t, sizeof(GifPTE));
if (gif_ptr->pte_ptr == NULL) {
FX_Free(gif_ptr->gce_ptr);
FX_Free(gif_ptr->image_info_ptr);
@@ -539,7 +539,7 @@ void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) }
}
void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) {}
-FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr)
+int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr == NULL) {
return 0;
@@ -565,7 +565,7 @@ FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr) if(((GifGF*)&gif_lsd_ptr->global_flag)->global_pal) {
gif_ptr->global_pal_num = 2 << ((GifGF*)&gif_lsd_ptr->global_flag)->pal_bits;
ASSERT(sizeof(GifPalette) == 3);
- FX_INT32 global_pal_size = gif_ptr->global_pal_num * 3;
+ int32_t global_pal_size = gif_ptr->global_pal_num * 3;
FX_LPBYTE global_pal_ptr = NULL;
if (_gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -577,7 +577,7 @@ FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr) FX_Free(gif_ptr->global_pal_ptr);
}
gif_ptr->global_pal_ptr = NULL;
- gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(FX_BYTE, global_pal_size);
+ gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(uint8_t, global_pal_size);
GIF_PTR_NOT_NULL(gif_ptr->global_pal_ptr, gif_ptr);
FXSYS_memcpy32(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
}
@@ -587,12 +587,12 @@ FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr) gif_ptr->pixel_aspect = gif_lsd_ptr->pixel_aspect;
return 1;
}
-FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr)
+int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr == NULL) {
return 0;
}
- FX_INT32 ret = 1;
+ int32_t ret = 1;
while (TRUE) {
switch(gif_ptr->decode_status) {
case GIF_D_STATUS_TAIL:
@@ -649,7 +649,7 @@ FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr) continue;
#endif
default: {
- FX_INT32 status = GIF_D_STATUS_EXT_UNE;
+ int32_t status = GIF_D_STATUS_EXT_UNE;
#ifndef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
if(*ext_ptr == GIF_BLOCK_PTE) {
status = GIF_D_STATUS_EXT_PTE;
@@ -709,7 +709,7 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr }
#endif
}
-FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr)
+int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
{
FX_LPBYTE data_size_ptr = NULL;
FX_LPBYTE data_ptr = NULL;
@@ -728,7 +728,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) return 2;
}
while(*data_size_ptr != GIF_BLOCK_TERMINAL) {
- FX_BYTE data_size = *data_size_ptr;
+ uint8_t data_size = *data_size_ptr;
if(_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -743,7 +743,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) FX_Free(gif_ptr->app_data);
gif_ptr->app_data = NULL;
}
- gif_ptr->app_data = FX_Alloc(FX_BYTE, gif_ptr->app_data_size);
+ gif_ptr->app_data = FX_Alloc(uint8_t, gif_ptr->app_data_size);
GIF_PTR_NOT_NULL(gif_ptr->app_data, gif_ptr);
FXSYS_memcpy32(gif_ptr->app_data, FX_LPCBYTE(gif_ae_data_str), gif_ptr->app_data_size);
}
@@ -757,7 +757,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
gif_ptr->cmt_data_ptr->Empty();
while(*data_size_ptr != GIF_BLOCK_TERMINAL) {
- FX_BYTE data_size = *data_size_ptr;
+ uint8_t data_size = *data_size_ptr;
if(_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -779,7 +779,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) GIF_PTR_NOT_NULL(gif_pt_ptr, gif_ptr);
FXSYS_memset32(gif_pt_ptr, 0, sizeof(GifPlainText));
_gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr);
- gif_pt_ptr->pte_ptr = (GifPTE*)FX_Alloc(FX_BYTE, sizeof(GifPTE));
+ gif_pt_ptr->pte_ptr = (GifPTE*)FX_Alloc(uint8_t, sizeof(GifPTE));
GIF_PTR_NOT_NULL(gif_pt_ptr->pte_ptr, gif_ptr);
gif_pt_ptr->string_ptr = new CFX_ByteString;
GIF_PTR_NOT_NULL(gif_pt_ptr->string_ptr, gif_ptr);
@@ -809,7 +809,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) return 2;
}
while(*data_size_ptr != GIF_BLOCK_TERMINAL) {
- FX_BYTE data_size = *data_size_ptr;
+ uint8_t data_size = *data_size_ptr;
if(_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -841,7 +841,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) return 2;
}
if(gif_ptr->gce_ptr == NULL) {
- gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(FX_BYTE, sizeof(GifGCE));
+ gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(uint8_t, sizeof(GifGCE));
GIF_PTR_NOT_NULL(gif_ptr->gce_ptr, gif_ptr);
}
gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;
@@ -877,7 +877,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
return 1;
}
-FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
+int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr->width == 0 || gif_ptr->height == 0) {
_gif_error(gif_ptr, "No Image Header Info");
@@ -889,10 +889,10 @@ FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr) if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_img_info_ptr, 9) == NULL) {
return 2;
}
- GifImage* gif_image_ptr = (GifImage*)FX_Alloc(FX_BYTE, sizeof(GifImage));
+ GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));
GIF_PTR_NOT_NULL(gif_image_ptr, gif_ptr);
FXSYS_memset32(gif_image_ptr, 0, sizeof(GifImage));
- gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(FX_BYTE, sizeof(GifImageInfo));
+ gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
GIF_PTR_NOT_NULL(gif_image_ptr->image_info_ptr, gif_ptr);
gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->left);
gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->top);
@@ -914,7 +914,7 @@ FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr) GifLF* gif_img_info_lf_ptr = (GifLF*)&gif_img_info_ptr->local_flag;
if(gif_img_info_lf_ptr->local_pal) {
ASSERT(sizeof(GifPalette) == 3);
- FX_INT32 loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
+ int32_t loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
FX_LPBYTE loc_pal_ptr = NULL;
if(_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -955,7 +955,7 @@ FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr) _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
return 1;
}
-FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num)
+int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num)
{
if(gif_ptr == NULL ||
frame_num < 0 ||
@@ -973,10 +973,10 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) FX_Free(gif_image_ptr->image_row_buf);
gif_image_ptr->image_row_buf = NULL;
}
- gif_image_ptr->image_row_buf = FX_Alloc(FX_BYTE, gif_img_row_bytes);
+ gif_image_ptr->image_row_buf = FX_Alloc(uint8_t, gif_img_row_bytes);
GIF_PTR_NOT_NULL(gif_image_ptr->image_row_buf, gif_ptr);
GifGCE* gif_img_gce_ptr = gif_image_ptr->image_gce_ptr;
- FX_INT32 loc_pal_num = ((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->local_pal ?
+ int32_t loc_pal_num = ((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->local_pal ?
(2 << ((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->pal_bits) : 0;
gif_ptr->avail_in = 0;
if(gif_img_gce_ptr == NULL) {
@@ -1002,11 +1002,11 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) gif_image_ptr->image_info_ptr->width,
gif_image_ptr->image_info_ptr->height,
loc_pal_num, gif_image_ptr->local_pal_ptr,
- (FX_INT32)gif_image_ptr->image_gce_ptr->delay_time,
+ (int32_t)gif_image_ptr->image_gce_ptr->delay_time,
(FX_BOOL)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->user_input,
((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->transparency ?
- (FX_INT32)gif_image_ptr->image_gce_ptr->trans_index : -1,
- (FX_INT32)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->disposal_method,
+ (int32_t)gif_image_ptr->image_gce_ptr->trans_index : -1,
+ (int32_t)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->disposal_method,
(FX_BOOL)((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->interlace
);
if(!bRes) {
@@ -1041,7 +1041,7 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
gif_ptr->img_row_offset += gif_ptr->img_row_avail_size;
gif_ptr->img_row_avail_size = gif_img_row_bytes - gif_ptr->img_row_offset;
- FX_INT32 ret = img_decoder_ptr->Decode(gif_image_ptr->image_row_buf + gif_ptr->img_row_offset, gif_ptr->img_row_avail_size);
+ int32_t ret = img_decoder_ptr->Decode(gif_image_ptr->image_row_buf + gif_ptr->img_row_offset, gif_ptr->img_row_avail_size);
if(ret == 0) {
FX_Free(gif_image_ptr->image_row_buf);
gif_image_ptr->image_row_buf = NULL;
@@ -1079,7 +1079,7 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) if(((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->interlace) {
gif_ptr->_gif_get_row_fn(gif_ptr, gif_image_ptr->image_row_num, gif_image_ptr->image_row_buf);
gif_image_ptr->image_row_num += s_gif_interlace_step[gif_ptr->img_pass_num];
- if(gif_image_ptr->image_row_num >= (FX_INT32)gif_image_ptr->image_info_ptr->height) {
+ if(gif_image_ptr->image_row_num >= (int32_t)gif_image_ptr->image_info_ptr->height) {
gif_ptr->img_pass_num++;
gif_image_ptr->image_row_num = s_gif_interlace_step[gif_ptr->img_pass_num] / 2;
}
@@ -1104,7 +1104,7 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) _gif_error(gif_ptr, "Decode Image Data Error");
return 0;
}
-void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, FX_INT32 status)
+void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status)
{
gif_ptr->decode_status = status;
gif_ptr->next_in += gif_ptr->skip_size;
@@ -1137,7 +1137,7 @@ FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_ }
return gif_ptr->avail_in;
}
-FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr)
+int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr)
{
return gif_ptr->img_ptr_arr_ptr->GetSize();
}
@@ -1147,7 +1147,7 @@ static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_ return TRUE;
}
dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF);
- dst_buf = FX_TryAlloc(FX_BYTE, dst_len);
+ dst_buf = FX_TryAlloc(uint8_t, dst_len);
if (dst_buf == NULL) {
return FALSE;
}
@@ -1188,7 +1188,7 @@ void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height) } else {
j = 3;
}
- temp = FX_Alloc(FX_BYTE, pitch);
+ temp = FX_Alloc(uint8_t, pitch);
if (temp == NULL) {
return;
}
@@ -1213,7 +1213,7 @@ static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYT src_offset += GIF_DATA_BLOCK;
src_len -= GIF_DATA_BLOCK;
}
- dst_buf[dst_offset++] = (FX_BYTE)src_len;
+ dst_buf[dst_offset++] = (uint8_t)src_len;
FXSYS_memcpy32(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
dst_offset += src_len;
}
@@ -1260,7 +1260,7 @@ static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_bu if (lf.interlace) {
interlace_buf(gif_ptr->src_buf, gif_ptr->src_pitch, gif_ptr->image_info_ptr->height);
}
- FX_BYTE code_bit = lf.pal_bits;
+ uint8_t code_bit = lf.pal_bits;
if (lf.local_pal == 0) {
GifGF& gf = (GifGF&)gif_ptr->lsd_ptr->global_flag;
code_bit = gf.pal_bits;
diff --git a/core/src/fxcodec/lgif/fx_gif.h b/core/src/fxcodec/lgif/fx_gif.h index 09c63e20f6..10aaf5f98f 100644 --- a/core/src/fxcodec/lgif/fx_gif.h +++ b/core/src/fxcodec/lgif/fx_gif.h @@ -10,7 +10,7 @@ extern FX_WORD _GetWord_LSBFirst(FX_LPBYTE p);
extern void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v);
-extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_INT32 src_bpc, FX_INT32 dst_bpc,
+extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, int32_t src_bpc, int32_t dst_bpc,
FX_LPBYTE& dst_buf, FX_DWORD& dst_len);
#define GIF_SUPPORT_COMMENT_EXTENSION
#define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
@@ -39,17 +39,17 @@ extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_INT32 src_bpc, #define GIF_D_STATUS_IMG_DATA 0x0A
#pragma pack(1)
typedef struct tagGifGF {
- FX_BYTE pal_bits : 3;
- FX_BYTE sort_flag : 1;
- FX_BYTE color_resolution : 3;
- FX_BYTE global_pal : 1;
+ uint8_t pal_bits : 3;
+ uint8_t sort_flag : 1;
+ uint8_t color_resolution : 3;
+ uint8_t global_pal : 1;
} GifGF;
typedef struct tagGifLF {
- FX_BYTE pal_bits : 3;
- FX_BYTE reserved : 2;
- FX_BYTE sort_flag : 1;
- FX_BYTE interlace : 1;
- FX_BYTE local_pal : 1;
+ uint8_t pal_bits : 3;
+ uint8_t reserved : 2;
+ uint8_t sort_flag : 1;
+ uint8_t interlace : 1;
+ uint8_t local_pal : 1;
} GifLF;
typedef struct tagGifHeader {
char signature[3];
@@ -58,9 +58,9 @@ typedef struct tagGifHeader { typedef struct tagGifLSD {
FX_WORD width;
FX_WORD height;
- FX_BYTE global_flag;
- FX_BYTE bc_index;
- FX_BYTE pixel_aspect;
+ uint8_t global_flag;
+ uint8_t bc_index;
+ uint8_t pixel_aspect;
} GifLSD;
typedef struct tagGifImageInfo {
FX_WORD left;
@@ -68,50 +68,50 @@ typedef struct tagGifImageInfo { FX_WORD width;
FX_WORD height;
- FX_BYTE local_flag;
+ uint8_t local_flag;
} GifImageInfo;
typedef struct tagGifCEF {
- FX_BYTE transparency : 1;
- FX_BYTE user_input : 1;
- FX_BYTE disposal_method : 3;
- FX_BYTE reserved : 3;
+ uint8_t transparency : 1;
+ uint8_t user_input : 1;
+ uint8_t disposal_method : 3;
+ uint8_t reserved : 3;
} GifCEF;
typedef struct tagGifGCE {
- FX_BYTE block_size;
- FX_BYTE gce_flag;
+ uint8_t block_size;
+ uint8_t gce_flag;
FX_WORD delay_time;
- FX_BYTE trans_index;
+ uint8_t trans_index;
} GifGCE;
typedef struct tagGifPTE {
- FX_BYTE block_size;
+ uint8_t block_size;
FX_WORD grid_left;
FX_WORD grid_top;
FX_WORD grid_width;
FX_WORD grid_height;
- FX_BYTE char_width;
- FX_BYTE char_height;
+ uint8_t char_width;
+ uint8_t char_height;
- FX_BYTE fc_index;
- FX_BYTE bc_index;
+ uint8_t fc_index;
+ uint8_t bc_index;
} GifPTE;
typedef struct tagGifAE {
- FX_BYTE block_size;
- FX_BYTE app_identify[8];
- FX_BYTE app_authentication[3];
+ uint8_t block_size;
+ uint8_t app_identify[8];
+ uint8_t app_authentication[3];
} GifAE;
typedef struct tagGifPalette {
- FX_BYTE r, g, b;
+ uint8_t r, g, b;
} GifPalette;
#pragma pack()
typedef struct tagGifImage {
GifGCE* image_gce_ptr;
GifPalette* local_pal_ptr;
GifImageInfo* image_info_ptr;
- FX_BYTE image_code_size;
+ uint8_t image_code_size;
FX_DWORD image_data_pos;
FX_LPBYTE image_row_buf;
- FX_INT32 image_row_num;
+ int32_t image_row_num;
} GifImage;
typedef struct tagGifPlainText {
GifGCE* gce_ptr;
@@ -123,30 +123,30 @@ class CGifLZWDecoder public:
struct tag_Table {
FX_WORD prefix;
- FX_BYTE suffix;
+ uint8_t suffix;
};
CGifLZWDecoder(FX_LPSTR error_ptr = NULL)
{
err_msg_ptr = error_ptr;
}
- void InitTable(FX_BYTE code_len);
+ void InitTable(uint8_t code_len);
- FX_INT32 Decode(FX_LPBYTE des_buf, FX_DWORD& des_size);
+ int32_t Decode(FX_LPBYTE des_buf, FX_DWORD& des_size);
void Input(FX_LPBYTE src_buf, FX_DWORD src_size);
FX_DWORD GetAvailInput();
private:
void ClearTable();
- void AddCode(FX_WORD prefix_code, FX_BYTE append_char);
+ void AddCode(FX_WORD prefix_code, uint8_t append_char);
void DecodeString(FX_WORD code);
- FX_BYTE code_size;
- FX_BYTE code_size_cur;
+ uint8_t code_size;
+ uint8_t code_size_cur;
FX_WORD code_clear;
FX_WORD code_end;
FX_WORD code_next;
- FX_BYTE code_first;
- FX_BYTE stack[GIF_MAX_LZW_CODE];
+ uint8_t code_first;
+ uint8_t stack[GIF_MAX_LZW_CODE];
FX_WORD stack_size;
tag_Table code_table[GIF_MAX_LZW_CODE];
FX_WORD code_old;
@@ -154,7 +154,7 @@ private: FX_LPBYTE next_in;
FX_DWORD avail_in;
- FX_BYTE bits_left;
+ uint8_t bits_left;
FX_DWORD code_store;
FX_LPSTR err_msg_ptr;
@@ -164,38 +164,38 @@ class CGifLZWEncoder public:
struct tag_Table {
FX_WORD prefix;
- FX_BYTE suffix;
+ uint8_t suffix;
};
CGifLZWEncoder();
~CGifLZWEncoder();
- void Start(FX_BYTE code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset);
+ void Start(uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset);
FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
void Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
private:
void ClearTable();
- FX_BOOL LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE& bit_offset);
+ FX_BOOL LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset);
void EncodeString(FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
void WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
jmp_buf jmp;
FX_DWORD src_offset;
- FX_BYTE src_bit_offset;
- FX_BYTE src_bit_cut;
+ uint8_t src_bit_offset;
+ uint8_t src_bit_cut;
FX_DWORD src_bit_num;
- FX_BYTE code_size;
+ uint8_t code_size;
FX_WORD code_clear;
FX_WORD code_end;
FX_WORD index_num;
- FX_BYTE bit_offset;
- FX_BYTE index_bit_cur;
- FX_BYTE index_buf[GIF_DATA_BLOCK];
- FX_BYTE index_buf_len;
+ uint8_t bit_offset;
+ uint8_t index_bit_cur;
+ uint8_t index_buf[GIF_DATA_BLOCK];
+ uint8_t index_buf_len;
tag_Table code_table[GIF_MAX_LZW_CODE];
FX_WORD table_cur;
};
typedef struct tag_gif_decompress_struct gif_decompress_struct;
typedef gif_decompress_struct *gif_decompress_struct_p;
typedef gif_decompress_struct_p *gif_decompress_struct_pp;
-static FX_INT32 s_gif_interlace_step[4] = {8, 8, 4, 2};
+static int32_t s_gif_interlace_step[4] = {8, 8, 4, 2};
struct tag_gif_decompress_struct {
jmp_buf jmpbuf;
FX_LPSTR err_ptr;
@@ -204,32 +204,32 @@ struct tag_gif_decompress_struct { int width;
int height;
GifPalette* global_pal_ptr;
- FX_INT32 global_pal_num;
- FX_BYTE global_sort_flag;
- FX_BYTE global_color_resolution;
+ int32_t global_pal_num;
+ uint8_t global_sort_flag;
+ uint8_t global_color_resolution;
- FX_BYTE bc_index;
- FX_BYTE pixel_aspect;
+ uint8_t bc_index;
+ uint8_t pixel_aspect;
CGifLZWDecoder* img_decoder_ptr;
FX_DWORD img_row_offset;
FX_DWORD img_row_avail_size;
- FX_BYTE img_pass_num;
+ uint8_t img_pass_num;
CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr;
- FX_LPBYTE (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, FX_INT32 pal_size);
+ FX_LPBYTE (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size);
FX_LPBYTE next_in;
FX_DWORD avail_in;
- FX_INT32 decode_status;
+ int32_t decode_status;
FX_DWORD skip_size;
void (*_gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD* cur_pos_ptr);
- void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, FX_INT32 row_num, FX_LPBYTE row_buf);
+ void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf);
FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD cur_pos,
- FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace);
+ int32_t left, int32_t top, int32_t width, int32_t height,
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
- FX_BYTE app_identify[8];
- FX_BYTE app_authentication[3];
+ uint8_t app_identify[8];
+ uint8_t app_authentication[3];
FX_DWORD app_data_size;
FX_LPBYTE app_data;
#endif
@@ -262,8 +262,8 @@ struct tag_gif_compress_struct { GifImageInfo* image_info_ptr;
CGifLZWEncoder* img_encoder_ptr;
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
- FX_BYTE app_identify[8];
- FX_BYTE app_authentication[3];
+ uint8_t app_identify[8];
+ uint8_t app_authentication[3];
FX_DWORD app_data_size;
FX_LPBYTE app_data;
#endif
@@ -289,15 +289,15 @@ gif_decompress_struct_p _gif_create_decompress(); void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr);
gif_compress_struct_p _gif_create_compress();
void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr);
-FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr);
+int32_t _gif_read_header(gif_decompress_struct_p gif_ptr);
+int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr);
+int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr);
+int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr);
+int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr);
void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr);
-FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num);
+int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num);
FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
-void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, FX_INT32 status);
+void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status);
void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr);
void interlace_buf(FX_LPCBYTE buf, FX_DWORD width, FX_DWORD height);
|