Giter VIP home page Giter VIP logo

lz4gb's Introduction

Notice

Starting October 12th, 2023 GitHub is enforcing mandatory two-factor authentication on my account.
I'm not going to comply and move all my activity to GitLab instead.

Thanks and see you there!

lz4gb's People

Contributors

gitendo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

resonancellc

lz4gb's Issues

Possibly even smaller decompression func.

I just started doing GameBoy dev coming from NES dev. On my last project I used the lz4 code that came with cc65 and it worked brilliantly. My first project for GB was to implement lz4, and was pretty proud that I got it down to 120 bytes (much smaller than the 6502 version that ships with cc65). Then I actually bothered to Google if somebody had already done this, and found that yours was even smaller. (Gah!) After incorporating your optimizations I was able to get my version down to 77 bytes and still read vanilla lz4 streams. That version is here:
https://gist.github.com/slembcke/229ca5e17f78ecac1ade9c8efd5ff485

As I understand it, the modifications you made to the lz4 format were to use a 0 offset as a terminator. (Something I had also noticed all my files had. Related to this maybe? https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md#parsing-restrictions), and swapping the endian of the back ref offset (which was clever!).

With further format modifications, I think it's possible to get it even smaller. Specifically, moving the offset distance before the additional count increment bytes means that for both the literals and back ref, you could add the additional count bytes and copy in a single function call as well as remove some RAM accesses. My (untested) function is 64 bytes long and uses a single HRAM byte. I might try modifying your compressor to do this tomorrow.

At first I wasn't so sure about the GB CPU, but this is turning out to be kinda fun!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.