- v. 1.0.0 (05/06/20) initial release
- v. 1.0.1 (05/23/20) fixed bug in GLOAD2 where copy transparent flag failed if image array was empty.
GSAVE2
Root / Submissions / [.]
MZ952Created:
Download:CKXNNXLFVersion:Size:
Alternative GSAVE/GLOAD combo meant to reduce the large memory usage constraint associated with GSAVE.
Instead of storing raw pixel data, an algorithm searches the graphics page for rectangles of like-color, however large or small. It then stores the end points of the rectangles along with their associated colors. For average case images, such as drawings made from a palette of colors, this can reduce array sizes from hundreds or millions of bytes down to several thousand.
File also contains some fast-ish functions for drawing blocky lines with thickness.
Changelog
Yeah, definitely.
It's good for mainly drawings. While you can fit maybe 10 or 12 GSAVEs of the graphics screen into memory before it fills up, with this--compressing drawings with common colors and relatively low complexity--you can easily fit hundreds or thousands.
Actually, the colors have relatively little to do with how much memory is used. Color data are stored only once as a list at the beginning of the array. It's mainly complexity that's the issue.
Er, you must mean in terms of saving an image. To be honest, I didn't really care how long it took to save the image (doesn't mean I didn't optimize it as best I could though), my focus was mostly on the return array size, shrinking it as much as practical while maintaining fast redraw times.
But, it is complexity that kills speed.
Yeah
Drawing an image is still slow enough to admire. It's so cool how it's drawn and how it looks. Even then it only takes a few seconds.
But yes, saving is super slow.
Here's a question: What if you have a graphic full of random colors? Assuming no color repeats itself, you could be looking at 4-5x the side of original GSAVE. Just something to consider maybe
You must be using an O3DS.
Here is the code running on the Switch:
https://youtu.be/xItO9ZhLZPk
On N3DS, you could maybe pull a 10-12 fps redraw framerate with the test image. The Switch on the other hand, ho-boy, it gets up past the 30-40 fps mark with even some terribly complex images. I'd reckon it draws the test image here easily at near 60 fps.
Replying to:MasterR3C0RD
Here's a question: What if you have a graphic full of random colors? Assuming no color repeats itself, you could be looking at 4-5x the side of original GSAVE. Just something to consider maybe
Well, yeah, I mean, it would approach 3x the size of GSAVE. That would be a very unwise use of this algorithm.
I mean, the best I could do is have the algorithm recognize that it's gone over the memory threshold for a regular GSAVE of that size and just GSAVE the image with a special flag to tell the loading counterpart about how it's given up lol
No I use a N3DS.
It draws fast enough that I can see how it draws, but not incredibly slow.
This is... strange. I remember envisioning something related to compressing something, based off of the same principals as this (write down the coordinates of the colors, for each color).
I don't know if it was anything related to coding -- I really don't remember much at all what it was... but some file format somewhere was very open to being compressed in this way and I one day thought about that concept.
...Interesting.
Replying to:Amoura
This is... strange. I remember envisioning something related to compressing something, based off of the same principals as this (write down the coordinates of the colors, for each color).
I don't know if it was anything related to coding -- I really don't remember much at all what it was... but some file format somewhere was very open to being compressed in this way and I one day thought about that concept.
...Interesting.
Huh, interesting. I probably didn't have anything to do with it lol
I came up with this more or less independently while searching for a solution to stowing away frames in my animation app, given the low memory cap problem with SB. (8 mb can actually store a heck of a lot when data is compressed properly, but otherwise...)
I wouldn't be surprised if it's applied elsewhere for different applications though, it's a pretty simple idea