Inferno #06
03 декабря 2004

Softinka - the benefits of packing algorithm Optimal LZH.

<b>Softinka</b> - the benefits of packing algorithm Optimal LZH.

>> Igor Pavlov has a project 7-zip, it at the conference, I
>> Learned about the algorithm optimal lzh - when you select
>> Really the best way to matching rows in the already
>> There are tree codes of lengths and distances.
DB> hachu this algorithm.
Take this!
This algorithm is really needed for each packer on the 
Spectrum. I had to implement it for all Hrum, crunches and 
lazerkompaktov three or four years ago. Ayyayyay in general. 
For "tightly" wired codes, as is done in most of the packers at 
Speke, the algorithm will bring about, I'm afraid to say 2-20%. 
On packer type RIP to about 1-10%. This is a snapshot. Of 
course, much to the memory on the package, will seriously 
hamper, but there are various options - On pieces of a length 
split the file and prochee.Da least on the PC can packing.


-------- ------- Hrum Igor Pavlov wrote in RU.COMPRESS in 1999.

Algorithm for optimal Lempel-Ziv-Huffman coding
-------------------------------------------------- -
1)
Search for matches in the dictionary is carried out for each 
shift. When looking for further collect information on the best 
(according to distance) match with lengths from 2 to maximum 
length match.


Offsets [] = Get_Longest_And_Other_Good_Matches ();

/ / Offsets.Size = length of longest match.
/ / Offsets [i] = back offset in dictionary for match with len 
= i. 

BYTE Get_Current_Literal ();
/ / Returns current byte

2)
We can always count how many bits will presumably
any option (match / literal) on the basis of information about 
previous huffman blocks:


int Get_Match_Huffman_Price (int Length, int Offset);

/ / Length = length of match
/ / Offset = offset of match;
/ / Result = number of bits for coding this match;

int Get_Literal_Huffman_Price (BYTE Literal);
/ / Result = number of bits for coding this Literal;

3)
We construct the optimal sequence of codes, many moves
forward.

There is a large array a []:
a [i] =
 {

   int Price; / / The price path in bits to get to the i-th 
byte. 

   struct

   {

     int Prev; / / position where we jump into the current (= 
i) position 

               / / For Literal: Prev = i - 1

              / / For Match'a with length Length: Prev = i - 
Length 



     int Offset; / / Offset. in buffer (dictionary) ago in the 
case Match'a 

                 / / Write Match'a Prev by up to i

  }
}

a)
For all elements of a [] set Price = infinity.

b)
for (int i = 0; i > In general, my attitude see above, but here there is another
>> Interesting thing - just support for LZMA decompressing
>> Spectrum. However, I think, would be inconvenient to use
>> LZMA unpacker for programs at the Spectrum.
DB> But you can apply for magazines or large directories.
DB> For example, Open Letters on one disc;)

>> PS. Re-read your letter and realized that the source you
>> Sent ...
DB> There's no pint not vedesh - 1021 file, 3.4 megabytes
DB> source. Recycle Bin.
Well, half a liter is not a problem:). There's a pint and not 
vedesh. You have not tried to study just a decoder, the one in 
the file SRC7zipCompressLZMA_Clzmadecode.c, there is only 23 
kb:). 




Other articles:

Inferno - Entered from the editor.

Interview - Interview with AIG - coder from the group MKHG.

Softinka - ACE 0.888: different from 0.666

Softinka - macro assembler debugger ALASM 4.47: difference from 4.44

For Coderz - Arithmetic coding.

Inferno - The authors of the magazine.

Softinka - BGE 4 graphical editor for ZX.

Events - The Compo 2: The results of the vote.

For Coderz - Decompiling programs - the revival of the old prog.

Inferno - Errors in the previous numbers.

For Coderz - Small programmers' tricks.

DIY - The scheme of my elektrofumigatora.

Gameland - about passed games: Imperia 2, Hexagonal Filler, From Beyond.

Iron - device extended keyboard (58 keys).

Gamedev - Gaming cycle - a cycle within which caused all the sub games.

Gameland - the passage of Lords of Time on Level 9.

For Coderz - Macros Part 2 - makes your life in programming.

Inferno - Letters to the Editor.

Gameland - passing a level playing Raven Black.

For Coderz - Description of the modular structure of programs.

Inferno - On the shell.

Softinka - the benefits of packing algorithm Optimal LZH.

Events - Serpukhov Festival ParaDiGMus party 2003. As it was.

Events - Serpukhov Festival ParaDiGMus party 2003. Afterparty.

Gameland - the passing game The Price of Magik by Level 9.

Iron - Description of a block of memory from the printer Robotron CM 6329.01 M. Part 1.

Iron - Description of a block of memory from the printer Robotron CM 6329.01 M. Part 2.

Advertising - advertising and announcements.

DIY - advice on repair hours, Dream Cast and joystick.

Interview - An Interview with Shaitan / Stars of Keladan: Interred Inferno.

Gameland - the passing game from the Level 9 Snowball.

Iron - Video GoldStar RN800AW Art vision. The history of repair.

Iron - Video GoldStar RN800AW Art vision. Tips on disassembly and repair.

Interview - an interview with musician Visual ^ Extreme (Sergei Agapov).

Gamedev - the assembly of the game Wolfenstein 2004. Part 1.

Gamedev - the assembly of the game Wolfenstein 2004. Part 2.

For Coderz - How to get the sound device more bits.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Project - the implementation of Russian spelling dictionary for ZX Spectrum for compiling crosswords.

В этот день...   21 November