skuska
This commit is contained in:
parent
ca84283fa2
commit
38f65ca4e9
@ -1,25 +1,18 @@
|
|||||||
|
#ifndef COMPRESSOR_H
|
||||||
|
#define COMPRESSOR_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef COMPRESSOR_H
|
|
||||||
#define COMPRESSOR_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int compress_1(const char* input_file_name, const char* output_file_name);
|
int compress_1(const char* input_file_name, const char* output_file_name);
|
||||||
|
|
||||||
int decompress_1(const char* input_file_name, const char* output_file_name);
|
int decompress_1(const char* input_file_name, const char* output_file_name);
|
||||||
|
|
||||||
int compress_2(const char* input_file_name, const char* output_file_name);
|
int compress_2(const char* input_file_name, const char* output_file_name);
|
||||||
|
|
||||||
int decompress_2(const char* input_file_name, const char* output_file_name);
|
int decompress_2(const char* input_file_name, const char* output_file_name);
|
||||||
|
|
||||||
unsigned char* read_file(const char* file_name, size_t* size);
|
unsigned char* read_file(const char* file_name, size_t* size);
|
||||||
|
|
||||||
int write_file(const char* file_name, const unsigned char* buffer, size_t size);
|
int write_file(const char* file_name, const unsigned char* buffer, size_t size);
|
||||||
|
|
||||||
|
|
||||||
typedef struct HuffmanNode {
|
typedef struct HuffmanNode {
|
||||||
unsigned char symbol;
|
unsigned char symbol;
|
||||||
size_t frequency;
|
size_t frequency;
|
||||||
@ -28,11 +21,9 @@ typedef struct HuffmanNode {
|
|||||||
} HuffmanNode;
|
} HuffmanNode;
|
||||||
|
|
||||||
HuffmanNode* build_huffman_tree(const unsigned char* data, size_t size);
|
HuffmanNode* build_huffman_tree(const unsigned char* data, size_t size);
|
||||||
|
|
||||||
void generate_huffman_codes(HuffmanNode* root, char** codes, char* buffer, int depth);
|
void generate_huffman_codes(HuffmanNode* root, char** codes, char* buffer, int depth);
|
||||||
|
|
||||||
void free_huffman_tree(HuffmanNode* root);
|
void free_huffman_tree(HuffmanNode* root);
|
||||||
|
void serialize_tree(HuffmanNode* root, FILE* file);
|
||||||
HuffmanNode* deserialize_tree(FILE* file);
|
HuffmanNode* deserialize_tree(FILE* file);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user