Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Format80 RLE compression #5781

Merged
merged 1 commit into from Jul 3, 2014

Conversation

pavlos256
Copy link
Contributor

Makes the SHP writer a little smarter and the files produced a lot smaller.

This doesn't use all the encodings available but it's probably enough to close #5295.

@pchote
Copy link
Member

pchote commented Jul 1, 2014

This looks to write valid sprites, but I didn't compare file sizes.
Testcase:

  • Open the asset browser, and observe that everything in mods/ra/bits looks fine.
  • cd into the RA bits dir.
  • Re-encode shp -> png -> shp using for i in $(ls *.shp); do mono ../../../OpenRA.Utility.exe --png $i cursor.pal; mono ../../../OpenRA.Utility.exe --shp "${i%%.*}-*"; done
  • Check the asset browser again, and see that everything still looks fine.

// Write what we haven't written up to now
{
var blockLen = offset - blockStart;
WriteCopyBlocks(src, blockStart, blockLen, ms);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're only using blockLen once, so you can avoid the unnecessary scoping here and below by using offset - blockStart inline.

@pavlos256
Copy link
Contributor Author

Updated with the requested changes.

For future reference, @Cr0s on IRC gave a link to a full Format80 encoder implementation but it's in Java. What I've implemented here is command 0xfe (0x80 we had already). A port should be pretty easy if anyone is interested.

pchote added a commit that referenced this pull request Jul 3, 2014
Implement Format80 RLE compression
@pchote pchote merged commit 9e11e38 into OpenRA:bleed Jul 3, 2014
@pavlos256 pavlos256 deleted the format80-write-rle branch July 4, 2014 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenRA.Utility --shp does not compress output file
2 participants