]> git.llucax.com Git - z.facultad/75.06/jacu.git/blobdiff - src/jacu.c
retorques
[z.facultad/75.06/jacu.git] / src / jacu.c
index ee98a059412c87a1e3c7b66b2ee8b9fd5d5c0d15..aad39e267f1a4a145a9995b6624a4bed4d52e0f0 100644 (file)
@@ -4,6 +4,7 @@
 #include "zerogrouping/zerogrouping.h"
 #include "statichuff/statichuff.h"
 #include "vfile/vfile.h"
 #include "zerogrouping/zerogrouping.h"
 #include "statichuff/statichuff.h"
 #include "vfile/vfile.h"
+#include "vfile/common.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -105,8 +106,9 @@ int main(int argc, char* argv[])
                                        if ((len = zg_group(&zg, buff, mtf[j]))) fwrite(buff, 1, len, fp_out);
                        } else {
                                /* Guardo el PageSize */
                                        if ((len = zg_group(&zg, buff, mtf[j]))) fwrite(buff, 1, len, fp_out);
                        } else {
                                /* Guardo el PageSize */
-                               for(j=0; j<sizeof(Uint32); j++)
-                                       fputc(mtf[j], fp_out);
+                               //for(j=0; j<sizeof(Uint32); j++)
+                               //      fputc(mtf[j], fp_out);
+                               fwrite(mtf, sizeof(Uint32), 1, fp_out);
 
                                /* Guardo el Z len y el Z */
                                fwrite(&z_len, sizeof(int), 1, fp_out);
 
                                /* Guardo el Z len y el Z */
                                fwrite(&z_len, sizeof(int), 1, fp_out);
@@ -151,6 +153,7 @@ int main(int argc, char* argv[])
 
                while (!feof(fp_in)) {
                        block_size = 0;
 
                while (!feof(fp_in)) {
                        block_size = 0;
+                       PERR("Leo bloque");
                        fread(&block_size, sizeof(Uint32), 1, fp_in);
                        fread(&z_len, sizeof(int), 1, fp_in);
                        z = malloc(sizeof(char)*z_len);
                        fread(&block_size, sizeof(Uint32), 1, fp_in);
                        fread(&z_len, sizeof(int), 1, fp_in);
                        z = malloc(sizeof(char)*z_len);
@@ -161,8 +164,10 @@ int main(int argc, char* argv[])
                                orig = malloc(block_size*sizeof(char));
                                fread(block, block_size, sizeof(char), fp_in);
 
                                orig = malloc(block_size*sizeof(char));
                                fread(block, block_size, sizeof(char), fp_in);
 
+                               /* Hago el MTF inverso */
                                mtf = jacu_mtf_inv(z, block, block_size);
 
                                mtf = jacu_mtf_inv(z, block, block_size);
 
+                               /* Luego de hacer el MTF inverso ya puedo recuperar el k */
                                memcpy(&k, block, sizeof(Uint32));
 
                                bs_restore(orig, block+sizeof(Uint32), k, block_size);
                                memcpy(&k, block, sizeof(Uint32));
 
                                bs_restore(orig, block+sizeof(Uint32), k, block_size);