Subversion Repositories ipe_artfile_utils

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
/**
2
 * LZW Encoder for Imagination Pilots Entertainment 32-bit games (IPE32)
3
 * - Where's Waldo? Exploring Geography
4
 * - Eraser Turnabout by Imagination Pilots
5
 * - Virtual K'Nex by Imagination Pilots
6
 * ART file packer and unpacker by Daniel Marschall, ViaThinkSoft (C) 2018
7
 * Revision: 2018-02-15
8
 **/
9
 
10
#ifndef __inc__ipe32_lzw_encoder
11
#define __inc__ipe32_lzw_encoder
12
 
13
#include <stdio.h>
14
#include <stdlib.h>
15
#include <stdint.h>
16
#include <stdbool.h>
17
 
18
typedef struct tagIpe32LZWEncoder {
19
        int *code_value;                      /* This is the code value array */
20
        unsigned int *prefix_code;            /* This array holds the prefix codes */
21
        unsigned char *append_character;      /* This array holds the appended chars */
22
 
23
        int num_bits;                         /* Starting with 9 bit codes */
24
        uint32_t bytes_in,bytes_out;          /* Used to monitor compression ratio */
25
        int max_code;                         /* old MAX_CODE */
26
        uint32_t checkpoint;                  /* For compression ratio monitoring */
27
 
28
        int output_bit_count;
29
        uint32_t output_bit_buffer;
30
} Ipe32LZWEncoder;
31
 
32
// Returns: Bytes written, or -1 if compression failed
33
int ipe32lzw_encode(Ipe32LZWEncoder *encoder, unsigned char* compressedData, const size_t compressedBufLen, unsigned char* uncompressedData, const size_t uncompressedSize);
34
 
35
Ipe32LZWEncoder* new_ipe32lzw_encoder(void);
36
void ipe32lzw_init_encoder(Ipe32LZWEncoder *encoder);
37
void ipe32lzw_free_encoder(Ipe32LZWEncoder *encoder);
38
 
39
#endif // #ifndef __inc__ipe32_lzw_encoder