X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/fecff0df7697f3fa9351eee19c4cd30711c2b68e..eb5347f4df35aaa5266fcbd04112ae4cc1cf41b1:/src/jacu.c?ds=sidebyside diff --git a/src/jacu.c b/src/jacu.c index f0c3444..baf28da 100644 --- a/src/jacu.c +++ b/src/jacu.c @@ -1,4 +1,5 @@ +/* Jacu Team - GPL */ #include "blocksorting/bs.h" #include "mtf/mtf.h" #include "zerogrouping/zerogrouping.h" @@ -99,9 +100,9 @@ int main(int argc, char* argv[]) /* Comprimo */ FILE *fp; Uint32 i, j, total, k; - char *mtf; - char *salida, *data; - char *z; + unsigned char *mtf; + unsigned char *salida, *data; + unsigned char *z; int z_len; /* Preparo el compresor huffman */ @@ -109,8 +110,8 @@ int main(int argc, char* argv[]) if (mflag == 1) shuff_loadmodel(shuff,staticmodel); /* Preparo el BS alocando mem para el K, el Block y su Size */ - data = malloc(sizeof(char)*pagesize); - salida = malloc(sizeof(char)*pagesize+sizeof(Uint32)*2); + data = malloc(sizeof(unsigned char)*pagesize); + salida = malloc(sizeof(unsigned char)*pagesize+sizeof(Uint32)*2); bs = bs_create(pagesize); /* Abrimos el archivo a comprimir y encodeamos bloques */ @@ -130,28 +131,9 @@ int main(int argc, char* argv[]) /* Aplico el BlockSorting */ bs_solve(data, salida, bs, &k, i); - /*printf("BS k=%ld\n", *(Uint32 *)(salida+sizeof(Uint32))); - printf("PageSize = %ld\n", *(Uint32 *)salida); - - printf("Antes de MTF = %ld [", i); - { - int ii; - for(ii=0; ii<(i+sizeof(Uint32)); ii++) - printf("(%c)", salida[ii+sizeof(Uint32)]); - printf("]\n"); - }*/ - /* Le aplico el MTF, salteo el tamaƱo del bloque para que no se pierda. */ mtf = jacu_mtf(salida+sizeof(Uint32), i+sizeof(Uint32), &z, &z_len); -/* - printf("MTF Z (len=%d) = [", z_len); - { - int ii; - for(ii=0; ii 0) { - fread(&z_len, sizeof(int), 1, fp_in); - z = malloc(sizeof(char)*z_len); - fread(z, z_len, sizeof(char), fp_in); + moredata = shuff_decode_chunk(shuff,(char*)&z_len,sizeof(int),&decoded); + z = malloc(sizeof(unsigned char)*z_len); + moredata = shuff_decode_chunk(shuff,z,z_len,&decoded); - /*printf("MTF Z (len=%d) = [", z_len); - { - int ii; - for(ii=0; ii