summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/codec/fx_codec_fax.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcodec/codec/fx_codec_fax.cpp')
-rw-r--r--core/src/fxcodec/codec/fx_codec_fax.cpp48
1 files changed, 24 insertions, 24 deletions
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);