summaryrefslogtreecommitdiff
path: root/core/fxcodec/lgif
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/lgif')
-rw-r--r--core/fxcodec/lgif/fx_gif.cpp26
-rw-r--r--core/fxcodec/lgif/fx_gif.h52
2 files changed, 39 insertions, 39 deletions
diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp
index af447dc84b..b20b4dfdec 100644
--- a/core/fxcodec/lgif/fx_gif.cpp
+++ b/core/fxcodec/lgif/fx_gif.cpp
@@ -30,14 +30,14 @@ void CGifLZWDecoder::InitTable(uint8_t code_len) {
void CGifLZWDecoder::ClearTable() {
code_size_cur = code_size + 1;
code_next = code_end + 1;
- code_old = (FX_WORD)-1;
+ code_old = (uint16_t)-1;
FXSYS_memset(code_table, 0, sizeof(tag_Table) * GIF_MAX_LZW_CODE);
FXSYS_memset(stack, 0, GIF_MAX_LZW_CODE);
- for (FX_WORD i = 0; i < code_clear; i++) {
+ for (uint16_t i = 0; i < code_clear; i++) {
code_table[i].suffix = (uint8_t)i;
}
}
-void CGifLZWDecoder::DecodeString(FX_WORD code) {
+void CGifLZWDecoder::DecodeString(uint16_t code) {
stack_size = 0;
while (TRUE) {
ASSERT(code <= code_next);
@@ -50,7 +50,7 @@ void CGifLZWDecoder::DecodeString(FX_WORD code) {
stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = (uint8_t)code;
code_first = (uint8_t)code;
}
-void CGifLZWDecoder::AddCode(FX_WORD prefix_code, uint8_t append_char) {
+void CGifLZWDecoder::AddCode(uint16_t prefix_code, uint8_t append_char) {
if (code_next == GIF_MAX_LZW_CODE) {
return;
}
@@ -70,7 +70,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) {
if (stack_size != 0) {
if (des_size < stack_size) {
FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size);
- stack_size -= (FX_WORD)des_size;
+ stack_size -= (uint16_t)des_size;
return 3;
}
FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size);
@@ -78,7 +78,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) {
i += stack_size;
stack_size = 0;
}
- FX_WORD code = 0;
+ uint16_t code = 0;
while (i <= des_size && (avail_in > 0 || bits_left >= code_size_cur)) {
if (code_size_cur > 12) {
if (err_msg_ptr) {
@@ -93,7 +93,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) {
bits_left += 8;
}
while (bits_left >= code_size_cur) {
- code = (FX_WORD)code_store & ((1 << code_size_cur) - 1);
+ code = (uint16_t)code_store & ((1 << code_size_cur) - 1);
code_store >>= code_size_cur;
bits_left -= code_size_cur;
if (code == code_clear) {
@@ -103,7 +103,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) {
des_size = i;
return 1;
} else {
- if (code_old != (FX_WORD)-1) {
+ if (code_old != (uint16_t)-1) {
if (code_next < GIF_MAX_LZW_CODE) {
if (code == code_next) {
AddCode(code_old, code_first);
@@ -127,7 +127,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) {
if (i + stack_size > des_size) {
FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size],
des_size - i);
- stack_size -= (FX_WORD)(des_size - i);
+ stack_size -= (uint16_t)(des_size - i);
return 3;
}
FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size],
@@ -179,7 +179,7 @@ static inline uint8_t gif_cut_buf(const uint8_t* buf,
uint8_t& bit_offset,
FX_DWORD& bit_num) {
if (bit_cut != 8) {
- FX_WORD index = 0;
+ uint16_t index = 0;
index |= ((1 << bit_cut) - 1) << (7 - bit_offset);
uint8_t ret = ((index & buf[offset]) >> (7 - bit_offset));
bit_offset += bit_cut;
@@ -204,7 +204,7 @@ void CGifLZWEncoder::ClearTable() {
index_bit_cur = code_size + 1;
index_num = code_end + 1;
table_cur = code_end + 1;
- for (FX_WORD i = 0; i < GIF_MAX_LZW_CODE; i++) {
+ for (uint16_t i = 0; i < GIF_MAX_LZW_CODE; i++) {
code_table[i].prefix = 0;
code_table[i].suffix = 0;
}
@@ -335,7 +335,7 @@ FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf,
FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf,
FX_DWORD& offset,
uint8_t& bit_offset) {
- for (FX_WORD i = table_cur; i < index_num; i++) {
+ for (uint16_t i = table_cur; i < index_num; i++) {
if (code_table[i].prefix == code_table[index_num].prefix &&
code_table[i].suffix == code_table[index_num].suffix) {
code_table[index_num].prefix = i;
@@ -1041,7 +1041,7 @@ static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr,
dst_buf[gif_ptr->cur_offset++] = gif_ptr->lsd_ptr->bc_index;
dst_buf[gif_ptr->cur_offset++] = gif_ptr->lsd_ptr->pixel_aspect;
if (gif_ptr->global_pal) {
- FX_WORD size = sizeof(GifPalette) * gif_ptr->gpal_num;
+ uint16_t size = sizeof(GifPalette) * gif_ptr->gpal_num;
if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + size)) {
return FALSE;
}
diff --git a/core/fxcodec/lgif/fx_gif.h b/core/fxcodec/lgif/fx_gif.h
index c44fb7a7cb..ad65d199b6 100644
--- a/core/fxcodec/lgif/fx_gif.h
+++ b/core/fxcodec/lgif/fx_gif.h
@@ -52,17 +52,17 @@ typedef struct tagGifHeader {
char version[3];
} GifHeader;
typedef struct tagGifLSD {
- FX_WORD width;
- FX_WORD height;
+ uint16_t width;
+ uint16_t height;
uint8_t global_flag;
uint8_t bc_index;
uint8_t pixel_aspect;
} GifLSD;
typedef struct tagGifImageInfo {
- FX_WORD left;
- FX_WORD top;
- FX_WORD width;
- FX_WORD height;
+ uint16_t left;
+ uint16_t top;
+ uint16_t width;
+ uint16_t height;
uint8_t local_flag;
} GifImageInfo;
@@ -75,15 +75,15 @@ typedef struct tagGifCEF {
typedef struct tagGifGCE {
uint8_t block_size;
uint8_t gce_flag;
- FX_WORD delay_time;
+ uint16_t delay_time;
uint8_t trans_index;
} GifGCE;
typedef struct tagGifPTE {
uint8_t block_size;
- FX_WORD grid_left;
- FX_WORD grid_top;
- FX_WORD grid_width;
- FX_WORD grid_height;
+ uint16_t grid_left;
+ uint16_t grid_top;
+ uint16_t grid_width;
+ uint16_t grid_height;
uint8_t char_width;
uint8_t char_height;
@@ -115,7 +115,7 @@ typedef struct tagGifPlainText {
class CGifLZWDecoder {
public:
struct tag_Table {
- FX_WORD prefix;
+ uint16_t prefix;
uint8_t suffix;
};
CGifLZWDecoder(FX_CHAR* error_ptr = NULL) { err_msg_ptr = error_ptr; }
@@ -128,18 +128,18 @@ class CGifLZWDecoder {
private:
void ClearTable();
- void AddCode(FX_WORD prefix_code, uint8_t append_char);
- void DecodeString(FX_WORD code);
+ void AddCode(uint16_t prefix_code, uint8_t append_char);
+ void DecodeString(uint16_t code);
uint8_t code_size;
uint8_t code_size_cur;
- FX_WORD code_clear;
- FX_WORD code_end;
- FX_WORD code_next;
+ uint16_t code_clear;
+ uint16_t code_end;
+ uint16_t code_next;
uint8_t code_first;
uint8_t stack[GIF_MAX_LZW_CODE];
- FX_WORD stack_size;
+ uint16_t stack_size;
tag_Table code_table[GIF_MAX_LZW_CODE];
- FX_WORD code_old;
+ uint16_t code_old;
uint8_t* next_in;
FX_DWORD avail_in;
@@ -152,7 +152,7 @@ class CGifLZWDecoder {
class CGifLZWEncoder {
public:
struct tag_Table {
- FX_WORD prefix;
+ uint16_t prefix;
uint8_t suffix;
};
CGifLZWEncoder();
@@ -184,15 +184,15 @@ class CGifLZWEncoder {
uint8_t src_bit_cut;
FX_DWORD src_bit_num;
uint8_t code_size;
- FX_WORD code_clear;
- FX_WORD code_end;
- FX_WORD index_num;
+ uint16_t code_clear;
+ uint16_t code_end;
+ uint16_t index_num;
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;
+ uint16_t table_cur;
};
typedef struct tag_gif_decompress_struct gif_decompress_struct;
typedef gif_decompress_struct* gif_decompress_struct_p;
@@ -251,9 +251,9 @@ struct tag_gif_compress_struct {
GifHeader* header_ptr;
GifLSD* lsd_ptr;
GifPalette* global_pal;
- FX_WORD gpal_num;
+ uint16_t gpal_num;
GifPalette* local_pal;
- FX_WORD lpal_num;
+ uint16_t lpal_num;
GifImageInfo* image_info_ptr;
CGifLZWEncoder* img_encoder_ptr;