.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $5.00

   







Go Back   .com.unity Forums > The Camo Workshop > WinSPWW2 > Campaigns, Scenarios & Maps
Notices


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old April 8th, 2020, 05:37 PM
MarkSheppard's Avatar

MarkSheppard MarkSheppard is offline
Lieutenant Colonel
 
Join Date: Jun 2005
Posts: 1,407
Thanks: 103
Thanked 641 Times in 427 Posts
MarkSheppard is on a distinguished road
Default Re: Blitzkrieg Banzai? (SP1 Conversion)

A compressed section is made up of multiple interspersed compressed and uncompressed run-length encoded data blocks.

Each run-length coded data block consists of:

[N] a run-length coding byte (RLB)
[b] one or more data bytes.

The Run Length Coding Byte (RLB) is the trigger that tells us what type of data block it is:

If the RLB is equal to or less than 127, it's a uncompressed run-length coded (URLC) data block, which is used for sequences with mixed values:

[N] The RLB indicates the number of data bytes that follow, which can be from 1 to 127 bytes.
[b] Individual Data Bytes that can be copied/edited as/is.

If the RLB is equal to or greater than 128, it's a compressed run-length coded (CRLC) data block, which is used for large sequences of identical data bytes to save space.

[N] The RLB indicates the number of identical data bytes that follow from 1 to 127 bytes.

BIG IMPORTANT NOTE:
To get the true RLB for a CRLC block, you need to subtract 128 from the initial RLB. For example, if your CRLC has a RLB of 250, it's true length is actually: 250 – 128 = 122 Byte RLB. (This is what tripped me up; I was assuming 250, 0 meant 250 bytes of identical 0 value.)

[b] Data Value for All the Bytes in this block. The decompressed data is the sequence of N times the data byte B.

A visual representation of the typical sequence of a compressed data block is attached.

RED: Section Header. 4-byte Header Marker (37 0 0 0) followed by compressed size (33 0 0 0) and the compressed flag (1).

GREEN (Uncompressed) and BLUE (Compressed) Blocks You can see how the RLB says 16 bytes, followed by 16 bytes, then you have a compressed block of 86 bytes (214 - 128 = 86) with a value of zero; and so on so on.
Attached Thumbnails
Click image for larger version

Name:	SP_Compression_Encoding.png
Views:	375
Size:	2.6 KB
ID:	15971  

Last edited by MarkSheppard; April 8th, 2020 at 05:44 PM..
Reply With Quote
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:27 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.