News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Compression  (Read 602 times)

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 43
  • Anything is possible :)
    • View Profile
Compression
« on: May 18, 2020, 11:22:15 am »
I'm looking far into the future, but I am interested in compressing a SNES image file...  I work with bytes. How can I make 32 bytes (a SNES Tile) be equal to 16 bytes?
Anything is possible :)

nesrocks

  • Hero Member
  • *****
  • Posts: 685
    • View Profile
    • nesrocks.com
Re: Compression
« Reply #1 on: May 18, 2020, 11:47:56 am »
Image compression depends a lot on the type of image (or any data really) you're trying to compress. If it's a fuzzy completely random image it might not be very compressible at all, but if the entire image is all a single flat color then it will be highly compressible.

Bregalad

  • Hero Member
  • *****
  • Posts: 2752
    • View Profile
Re: Compression
« Reply #2 on: May 18, 2020, 12:33:28 pm »
I'm looking far into the future, but I am interested in compressing a SNES image file...  I work with bytes. How can I make 32 bytes (a SNES Tile) be equal to 16 bytes?
If you want a fixed compression rate like that, the easiest would be to work with 2BP tiles, so that each tile is 16 bytes. This can be done either by using the appropriate screen mode/BG layer, or by extending tiles on the fly from 2BP to 4BP by software, the latter option still use 32-bytes per tile in VRAM though.

If you're aiming at lossless compression of 4BP tiles, you're never going to have a fixed ratio like you mention, and various algorithms exist, any general purpose compression algorithm will work but many of those can be optimized to work better with tile graphics somehow.