move PackBits packing code to packbits.c

new functions :
- PackBits_pack_init()
- PackBits_pack_add()
- PackBits_pack_flush()
This commit is contained in:
Thomas Bernard
2020-01-01 23:17:41 +01:00
parent e656139f93
commit 0dcee6acc3
5 changed files with 188 additions and 120 deletions

View File

@@ -38,4 +38,36 @@
*/
int PackBits_unpack_from_file(FILE * f, byte * dest, unsigned int count);
/**
* Data used by the PackBits packer
*/
typedef struct {
FILE * f;
int output_count;
byte list_size;
byte repetition_mode;
byte list[129];
} T_PackBits_data;
/**
* init before packing
*
* @param data storage for packbits data
* @param f FILE output or NULL (for no output)
*/
void PackBits_pack_init(T_PackBits_data * data, FILE * f);
/**
* Add a byte to the packbits stream
* @return -1 for error, 0 if OK
*/
int PackBits_pack_add(T_PackBits_data * data, byte b);
/**
* Flush the packed data to the file
*
* @return -1 for error, or the size of the packed stream so far
*/
int PackBits_pack_flush(T_PackBits_data * data);
#endif