Jump to content
IGNORED

Req: Stac compression technique enhancement


Recommended Posts

Hi!  I have my own version of the Stac technique at c65 additions - Manage /compress at SourceForge.net and am wondering how I can enhance it.  I added code to the compressor to make sure lz77 gets best usage.  It worked.  I tried other ideas, including MTF and some of my own strategies.  The best I got was to break even.  I could try Adaptive Huffman Code, but the version I have is buggy.  :(  Does anybody out there have any ideas on how to better the Stac technique?

Link to comment
Share on other sites

look over there, you will find links to decompressors in 6502.

 

 

I recommend getting interested in ZX0

 

the last few files in ATR from this thread are compressed in ZX0 with on-the-fly decompression by the loader:

 

Link to comment
Share on other sites

3 hours ago, Harry Potter said:

I got the technique to work, but it worked worse than Stac.  :(  I didn't try the quick-LZ77 technique, though.

Stac = LZS? if so, could you make an example, because I checked before and LZS is much worse, so there must be an error somewhere - probably in my test - so make the test and put the result here.

Link to comment
Share on other sites

I have my version of Stac at c65 additions - Manage /compress at SourceForge.net, but it requires cc65 and a CBM emulator.  To compress a file, open the file as #10, call CompStac, close file #10 and save the contents of OutBuffer len. OutPos to the destination file.  To decompress, load the file to InBuffer, open the output as file #10, run DecoStac and close file #10.

Link to comment
Share on other sites

5 minutes ago, Harry Potter said:

I have my version of Stac at c65 additions - Manage /compress at SourceForge.net, but it requires cc65 and a CBM emulator.  To compress a file, open the file as #10, call CompStac, close file #10 and save the contents of OutBuffer len. OutPos to the destination file.  To decompress, load the file to InBuffer, open the output as file #10, run DecoStac and close file #10.

unfortunately, I can't handle c64, so clean data is enough: file, source length, compressed length for your STAC and ZX0 versions - it will be decisive.

Link to comment
Share on other sites

I attached the test file I'm using here.  Your technique gave me 31 blocks.  Stac gives me 28 blocks.  I enhanced Stac using a quick LZ77 variant where the last LZ77 block was shortened further and got 25 blocks.  I admit I didn't use the quick-LZ77 technique in ZX0.

trim.sh.prg

Edited by Harry Potter
Forgot the attachment! :(
Link to comment
Share on other sites

14 minutes ago, Harry Potter said:

I attached the test file I'm using here.  Your technique gave me 31 blocks.  Stac gives me 28 blocks.  I enhanced Stac using a quick LZ77 variant where the last LZ77 block was shortened further and got 25 blocks.  I admit I didn't use the quick-LZ77 technique in ZX0.

trim.sh.prg 16.04 kB · 0 downloads

I think I wrote it not clearly: put the source file and write how many bytes has after your Stac compression. otherwise we won't get anywhere.

Link to comment
Share on other sites

2 hours ago, Harry Potter said:

I gave the example test file I'm using and the compressed sizes using the different compression techniques.  I don't understand your latest comment.  BTW, the test input file is worth 65 blocks.  If you want the size in bytes, I have to do more to get them, as I killed some of the information while enhancing Stac.  :(

so this file is 16 425 bytes long

you packed it into 25 blocks that is 6 350 bytes

ZX0 pack it to 22 blocks that is 5 750 bytes

 

so the ZX0 is better. are these calculations wrong? Are you getting different results? weird.

Link to comment
Share on other sites

2 hours ago, Harry Potter said:

I increased the sliding LZ77 dictionary to 3k and got 22 blocks.  I tried other ways to improve ZX0, including MTF and techniques I wouldn't mind revealing too much and at best broke even.

great, compress this file ( https://atariage.com/forums/applications/core/interface/file/attachment.php?id=807550 ) so that you can compare the results with other compressors - give the result in bytes, not blocks.

Link to comment
Share on other sites

On 9/23/2021 at 4:35 PM, Harry Potter said:

I'm also writing the bit stream in the wrong direction, i.e. starting at bit 0, not 7.  How do I do the latter correctly?

Shift out your bits at the other end of the byte?

 

In 6502 assembly it's either ASL or LSR to shift out bits to the carry bit, which can the be shifted into the output stream with LSR or ASL respectively.

 

You can do similar things in C, like bit=byte&1; byte >>=1; output<<=1; output|=bit; and loop. Or the reverse with &0x80 and reversed shifts, depending on if you want LE or BE output.

 

 

Edited by ivop
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...