View Single Post
  #3  
Old 16-08-2023, 04:09
KaktoR's Avatar
KaktoR KaktoR is offline
Lame User
 
Join Date: Jan 2012
Location: From outer space
Posts: 4,689
Thanks: 1,106
Thanked 7,336 Times in 2,838 Posts
KaktoR is on a distinguished road
Oodle kraken with size byte difference

Introduction
Sometimes it could be the case that either CSize or DSize has a byte difference. In this case I will show you how to deal with such things.

Lets start
First lets take a look on the data we have.

https://i.imgur.com/pJAVOGK.png


We have a repetitive pattern (Signature) 7 bytes long, some unknown trash 10 bytes long, DSize 4 bytes, CSize 4 bytes and our kraken header 2 bytes.

Now lets look for the sizes. I can say here that DSize matches, but what happened to CSize?

https://i.imgur.com/THt7MkJ.png


Next stream, same thing.

https://i.imgur.com/0ZYM8ey.png


And again, same thing on the next stream.

https://i.imgur.com/Y1nEpCR.png


So the CSize does not match here. In fact on every stream you have a 12 byte difference. I cannot tell you how that comes, or what happened here technically, but we can fix it within the plugin configuration. All we have to do now is to subtract the 12 bytes from the CSize.

Code:
CompressedSize=CSize - 12
And here is the finished plugin:
Code:
[Stream1]
Name=kraken
Codec=kraken:l6
BigEndian=0
Signature=0x64657070617257
Structure=Signature(7),Unknown(10),CSize(4),DSize(4),OodleHdr(2),Stream
StreamOffset=-2
CompressedSize=CSize - 12
DecompressedSize=DSize
Condition1=OodleHdr = 0x068C
Testing:
Code:
xtool:kraken
Compressed 1 file, 233,487,310 => 714,300,604 bytes. Ratio 305.93%
Compression time: cpu 0.16 sec/real 30.54 sec = 1%. Speed 7.64 mB/s
All OK

xtool:testplugin
Compressed 1 file, 233,487,310 => 714,358,929 bytes. Ratio 305.95%
Compression time: cpu 0.14 sec/real 23.04 sec = 1%. Speed 11.14 mB/s
All OK
Fairly the ratio did not increase here (just 0.02%), but this example was just a showcase on what to do if you encounter byte differences.
__________________
Haters gonna hate

Last edited by KaktoR; 16-08-2023 at 04:17.
Reply With Quote
The Following 11 Users Say Thank You to KaktoR For This Useful Post:
Gehrman (18-08-2023), Junior53 (14-09-2023), kj911 (16-08-2023), L0v3craft (16-08-2023), Lord.Freddy (16-08-2023), mausschieber (16-08-2023), Pantsi (16-08-2023), rambohazard (21-08-2023), Razor12911 (16-08-2023), shazzla (16-08-2023), Wanterlude (16-08-2023)