Go Down

Topic: Pack24 (testing a micro library) (Read 401 times) previous topic - next topic

marcdraco

Oct 21, 2020, 02:55 pm Last Edit: Oct 21, 2020, 03:09 pm by marcdraco
RAM is very short on ATMegas and similar machines - and I've been developing a project which needs fairly large amounts of variables that need short ints (16 bits) but only just... think values that don't exceed 320 for example.

This micro-library broke out of that so I could compress both signed and unsigned integer (coordinate) pairs in this sort of range from 32 bits (X,Y) into 24 bits, so from four bytes into three. It's a 25% saving which could make all the difference, particularly if you have an array or are using a screen of 320x240 px or larger on the ATMega 328p or similar.

This is purely edge case stuff but I've uploaded it to Github (https://github.com/marcdraco/Pack24) and I believe it's clean (hard not to be in something that's only just over 100 [well-spaced] lines) and fairly free of obvious bugs. It's so short, it probably doesn't even need to be used as a library but that's entirely the developer's choice,

I expect it's not particularly performant but the idea wasn't to make it super-fast, more to make it as efficient as was practical within the definition of lossy compression.

I've never written a library before so this is largely me sharing some work that I've broken out a current (experimental) project that's nowhere near ready in the hope that it's useful to someone.

EDIT: the link above comes back to a 404 - which I can't really explain (I'm barely starting out with Git) but the repo is there. I'll post the code if anyone wants it here.


TheMemberFormerlyKnownAsAWOL

#1
Oct 21, 2020, 05:26 pm Last Edit: Oct 21, 2020, 05:28 pm by TheMemberFormerlyKnownAsAWOL
Here?

Does the AVR already have _int24_t and _uint24_t types?
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

Go Up