X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/ade05bc64de4853d99cdc1ea2657845728614f03..4c56e227e8a6bf6acb612b95a66f39b2abb7faca:/src/statichuff/statichuff.h?ds=sidebyside diff --git a/src/statichuff/statichuff.h b/src/statichuff/statichuff.h index 08da37e..97e8f4c 100644 --- a/src/statichuff/statichuff.h +++ b/src/statichuff/statichuff.h @@ -4,6 +4,7 @@ #include #include +#include "../vfile/vfile.h" typedef unsigned long int t_freq; @@ -20,21 +21,32 @@ typedef struct t_code { } SHUFFCODE; typedef struct t_huff { - FILE *tmpfp; /* filepointer al temporal para un shuff_bychunk */ + FILE *coderfp; /* fpointer usado en el coder de bychunk para el temp */ + VFILE *decoderfp; /* fpointer al archivo a descomrimir */ char *sourcefile; /* Nombre del archivo a comprimir */ char *targetfile; /* Nombre del archivo comprimido */ + long volsize; /* Tamanio de volumen para multivol */ + char bychunk; /* 0 works byfile, 1 works bychunk */ + char canonic; /* 1 Huffman Canonico con preloaded freqtable */ t_freq *freqtable; /* Tabla de frecuencias */ t_freq sumfreq; /* Frecuencia total acumulada */ - long volsize; /* Tamanio de volumen para multivol */ - char preloadfreq; /* 1 freqtable preloaded (bychunk|canonico) - 0 byfile */ - + SHUFFNODE *codetree; /* Puntero al arbol de codigos prefijos */ + unsigned long int bytesleft; /* Cuanto falta descomprimir en un bychunk */ + unsigned long int codebuffer; /* Buffer de descompresion para bychunk */ + int bitsleft; /* Posicion en el buffer de descompresion para bychunk */ } HUFF_STATE; -HUFF_STATE *shuff_init_static_byfile(char *inputfile, char *outputfile, long volsize); -HUFF_STATE *shuff_init_static_bychunk(char *outputfile, long volsize); -void shuff_deinit_static_byfile(HUFF_STATE *fshuff); -void shuff_deinit_static_bychunk(HUFF_STATE *cshuff); -int shuff_decode_file(HUFF_STATE *shuff); + +HUFF_STATE *shuff_init_encoder_byfile(char *inputfile, char *outputfile, long volsize); +HUFF_STATE *shuff_init_encoder_bychunk(char *outputfile, long volsize); +HUFF_STATE *shuff_init_decoder(char *inputfile, char *outputfile); +void shuff_deinit_encoder(HUFF_STATE *shuff); +void shuff_deinit_decoder(HUFF_STATE *shuff); int shuff_encode_file(HUFF_STATE *shuff); +int shuff_decode_file(HUFF_STATE *shuff); +int shuff_scanfreq_chunk(HUFF_STATE *chunkshuff, char* chunk, int chunksize); +int shuff_decode_chunk(HUFF_STATE *shuff, char *chunk, int chunksize, int *decodedbytes); +int shuff_savemodel(HUFF_STATE *shuff); +int shuff_loadmodel(HUFF_STATE *shuff, char *modelfile); #endif /* _STATICHUFF_H_ */