X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/f4f9947b91b6b8d3ec18eb66639c8f2825a8dc4c..HEAD:/src/mtf/mtf.h?ds=sidebyside diff --git a/src/mtf/mtf.h b/src/mtf/mtf.h index c6f46ce..8f76bed 100644 --- a/src/mtf/mtf.h +++ b/src/mtf/mtf.h @@ -1,13 +1,58 @@ +/*---------------------------------------------------------------------------- + * jacu - Just Another Compression Utility + *---------------------------------------------------------------------------- + * This file is part of jacu. + * + * jacu is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * jacu is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + *---------------------------------------------------------------------------- + */ + #ifndef _MFT_H_ #define _MFT_H_ #include #include #include -char *jacu_mtf(char *datos, int len, char **_z, int *z_len); +/** \file + * + * Implementación del Move To Front + * + */ + +/** Aplica el algoritmo MTF a un dato + * + * \param datos Array de entrada + * \param len Tamaño del array de entrada + * \param _z Puntero donde se retornará el z + * \param z_len Puntero donde se retornará el tamaño de Z + * \return El nuevo array luego de aplicar el algotirmo. + */ +unsigned char *jacu_mtf(unsigned char *datos, int len, unsigned char **_z, int *z_len); + +/** Aplica el algoritmo inverso de MTF + * + * \param z Vector Z retornado por jacu_mtf + * \param pos Vector retornado por jacu_mtf + * \param len Tamaño del vector + * \param Array de dato original + */ +unsigned char *jacu_mtf_inv(unsigned char *z, unsigned char *pos, int len); -char *jacu_mtf_inv(char *z, unsigned char *pos, int len); +/** Busca el vector Z en base a una entrada */ +unsigned char *jacu_buscar_z(unsigned char* datos, int len, int *size); -char *jacu_buscar_z(char* datos, int len, int *size); +void print_z(char *z, int len); #endif