You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when using a sprite as frame buffer and pushing it to the display using .pushSprite() the performance is quite low.
I'm currently using a 320x240 24-bit color display and a 16-bit color sprite as a frame buffer and I get ~15fps when just pushing the empty frame buffer sprite to the display.
I have a proposal that should speed up this push by quite a bit while not consuming that much memory.
Create a frame buffer option on the sprite class that can be enabled either via constructor or via setter method.
If the frame buffer is enabled, a change detection buffer is added with 1 bit for every 16 pixels (or maybe 8 or 32, and probably user-configurable). So each line is split into 16-pixel-slices. For my 320x240px display, that would cost 432 bytes (compared to ~108kb for the sprite's pixel buffer).
Whenever anything that is written to the sprite that affects one of the pixels in a 16-pixel-slice, the bit corresponding to that slice will be set to 1.
Whenever .pushSprite() is called on that framebuffer sprite, only the 16-pixel-slices with changes in them will be pushed.
The best amount of pixels in a slice will probably need to be determined by actual testing, since I don't know how many cycles are used by the .setWindow() method, which will be required to be called once for each slice.
Another optimisation would be to figure out beforehand how many contiguous slices need to be pushed and only calling .setWindow() once for all contiguous slices.
The text was updated successfully, but these errors were encountered:
Currently, when using a sprite as frame buffer and pushing it to the display using .pushSprite() the performance is quite low.
I'm currently using a 320x240 24-bit color display and a 16-bit color sprite as a frame buffer and I get ~15fps when just pushing the empty frame buffer sprite to the display.
I have a proposal that should speed up this push by quite a bit while not consuming that much memory.
The best amount of pixels in a slice will probably need to be determined by actual testing, since I don't know how many cycles are used by the .setWindow() method, which will be required to be called once for each slice.
Another optimisation would be to figure out beforehand how many contiguous slices need to be pushed and only calling .setWindow() once for all contiguous slices.
The text was updated successfully, but these errors were encountered: