View Single Post
  #17  
Old 15-04-2016, 07:23
Razor12911's Avatar
Razor12911 Razor12911 is offline
Noob
 
Join Date: Jul 2012
Location: South Africa
Posts: 3,749
Thanks: 2,170
Thanked 11,206 Times in 2,307 Posts
Razor12911 is on a distinguished road
ChronoCross, quickbms? what are you on about?
Zlib is Zlib, I don't think quickbms is required.

Let me share what I know, I don't know how many times I've read the zlib documentation to know what I know so far, a lot of trial and errors and figured out how some things work.

Um, okay. Let's begin.

Firstly, invalid zlib streams, this doesn't really make sense at all.

The term invalid zlib stream I think defines whether the a stream is either zlib or not zlib, if it is invalid then it is not a zlib stream.
For example:
It's like Panker makes an algorithm called 1992, now you make a recompressor for all files that may have the 1992 algorithm then I come along and modify the 1992 algorithm for a certain archiver, I remove the headers the 1992 algorithm make and insert mine, do a couple of changes to the source so that is favours size. Now when you test your recompressor on my creation it doesn't work then comes along Ramiro, he makes recompressor like yours but that supports the recompression of my archiver and comes Felice and says your recompressor doesn't work on invalid zlib streams but the one by Ramiro handles them.

(Then it means they are not invalid but they are modified)

The term you used, "Invalid" is what I didn't understand at all because it only tells us whether it is zlib, or not.

If zlib streams used a modified zlib source, it's not that they can't be detected some can be detected and some can't, kinda like the GTAV scenario which is why precomp normally can't find anything on those game files, there is brute, precomp can detect them, just like reflate but the only difference is reflate is a tool that works does its detection using the zlib streams headers [Visit stackoverflow and look for this topic: structure - What does a zlib header look like?] + known file types that use zlib algorithm like pkzip archives, pdf, png and etc and precomp and fzr only rely on default zlib stream headers.

That's point number 1, detection.

Point number 2 is restoration.

You might think precomp can't achieve reflate's output size, but it can. This will explain why there is no such thing as processing invalid zlib streams. First if a stream cannot be decompressed then it is not a zlib stream but if it can be decompressed then it is a zlib stream.

Misconceptions with a lot of people is they think that recompressors like precomp and during processing is they think it's the compression process whereas its decompressing, reflate does the same. It's the opposite of what most people think. After decompression, the recompressor must check if it can compress the file (restore) and put it back the way it was before it was decompressed, CRC must match if it doesn't match, then the stream is discarded, the only superiority of reflate is it has a trick to overcome CRC because the creator carefully studied how the other file types that have zlib container operate which is why sometimes it's seen as faster but it knows how to restore the file without any CRC checkups.

I tried to summarize my knowledge as much as possible otherwise there are even more reasons but detection and restoration is what the difference is between precomp and reflate.

Now the difference between precomp and the fzr project (it's not frz by the way).
Maybe you missed the topic name, "Fast Zlib Recompressor", keyword, "Fast" it just offers speed. It just uses original zlib headers to detect zlib streams, the zlib length is quite small because what Panker and I picked up is most games have streams that are small so it doesn't make an unnecessary long length like precomp to detect streams.

The only difference between precomp and fzr is fzr is faster while precomp is slow, reason being fzr considers small zlib streams and precomp focuses on streams of certain length but which is more than fzr which is why precomp can perform better than fzr most of the time, not that fzr can't be adjusted so that it also gets the same size as precomp, it can be adjusted but I just decided to leave the option out. (The project itself was created in just a space of 4-5 hours) so you can imagine.

Can you explain how you think precomp and reflate variate, I wanna hear your version.
Reply With Quote
The Following 2 Users Say Thank You to Razor12911 For This Useful Post:
Lucas65 (19-04-2016), RamiroCruzo (15-04-2016)