From f63b29b1ecde50618e92c069fb04d8e0ae6e63ae Mon Sep 17 00:00:00 2001 From: pixel Date: Mon, 6 Jun 2005 11:16:14 +0000 Subject: Updated zlib, adding hashing functions, and introducing first bits of a new sliding window generic algorithm. --- MSVC/Baltisot - generic/Baltisot - generic.vcproj | 56 +++++++++++++--------- .../PSX-Bundle - library.vcproj | 8 ++++ compile/linux/Makefile | 13 +++-- compile/win32/Makefile | 15 ++++-- includes/sliding-window.h | 54 +++++++++++++++++++++ lib/sliding-window.cpp | 37 ++++++++++++++ 6 files changed, 152 insertions(+), 31 deletions(-) create mode 100644 includes/sliding-window.h create mode 100644 lib/sliding-window.cpp diff --git a/MSVC/Baltisot - generic/Baltisot - generic.vcproj b/MSVC/Baltisot - generic/Baltisot - generic.vcproj index ffb170e..8ef7c15 100644 --- a/MSVC/Baltisot - generic/Baltisot - generic.vcproj +++ b/MSVC/Baltisot - generic/Baltisot - generic.vcproj @@ -40,7 +40,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include;..\dirent;..\regex" - PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC" + PreprocessorDefinitions="_WINDOWS;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -107,7 +107,7 @@ InlineFunctionExpansion="1" OmitFramePointers="TRUE" AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include;..\dirent;..\regex" - PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC" + PreprocessorDefinitions="_WINDOWS;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -672,14 +672,6 @@ RelativePath="..\..\generic\lib\zlib\src\gzio.c" > - - - - @@ -692,10 +684,6 @@ RelativePath="..\..\generic\lib\zlib\src\inftrees.c" > - - @@ -713,15 +701,11 @@ Name="Includes" > - - + + + + + + + + + + + + + + diff --git a/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj b/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj index 1015075..a414933 100644 --- a/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj +++ b/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj @@ -159,6 +159,14 @@ RelativePath="..\..\includes\lzss.h" > + + + + +#include + +class sliding_window : public Base { + public: + struct entry_tree_t; + struct d_list_t { + struct entry_t * p; + struct d_list_t * next; + }; + struct distance_t { + Uint32 d; + struct d_list_t * entries; + }; + struct entry_tree_t { + struct entry_tree_t * hash[256]; + struct distance_t * d; + }; + sliding_window(Uint32 max_window, Uint32 max_size); + virtual ~sliding_window(); + void push_byte(Uint8); + void push_bytes(Uint8 *, Uint32 size); + private: + struct entry_tree_t * root_entries[256]; + Uint8 * stack; + Uint32 max_window; + Uint32 max_size; + reroot * entries_recycle; + Uint32 current_size; +}; + +#endif diff --git a/lib/sliding-window.cpp b/lib/sliding-window.cpp new file mode 100644 index 0000000..88b616a --- /dev/null +++ b/lib/sliding-window.cpp @@ -0,0 +1,37 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2005 Nicolas "Pixel" Noble + * + * This program 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. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +sliding_window::sliding_window(Uint32 _max_window, Uint32 _max_size) : + stack((Uint8 *) malloc(_max_size)), max_window(_max_window), max_size(_max_size), entries_recycle(remkroot(sizeof(struct sliding_window::entry_tree_t))), current_size(0) { + memset(root_entries, 0, 256 * sizeof(struct entry_tree_t)); +} + +sliding_window::~sliding_window() { + refree(entries_recycle); +} + +void sliding_window::push_byte(Uint8 b) { + struct entry_tree_t * e = (struct entry_tree_t *) renewx(entries_recycle); + + memset(e->hash, 0, 256 * sizeof(struct entry_tree_t *)); + +// e->offset = current_size++; +} -- cgit v1.2.3