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
Is your feature request related to a problem? Please describe.
When stb_image loads .gif files, it creates a buffer for the entire file. This can get troublesome for big files, as the memory allocated grows very large. This is very noticeable as in some cases it can take up to a few seconds just to allocate the memory.
Describe the solution you'd like
I suggest adding an alternative method to load the files and show how it can be used. the library could take a buffer that it will use to fill the data for the current frame. This way, we only need to allocate a buffer for one frame, thus reducing memory allocations.
Pseudocode of the API:
gif = stbi_load_gif_v2("filename.gif", ...);
unsignedchar buffer[...];
while (stbi_gif_has_frame(gif)) {
error = stbi_gif_decode_frame(gif, buffer);
// do something with buffer if no error occurredstbi_gif_advance_frame(gif);
}
Let me know what you think!
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
gif = stbi_load_gif_v2("filename.gif", ...);
unsigned char buffer[...];
while (stbi_gif_has_frame(gif)) {
error = stbi_gif_decode_frame(gif, buffer);
// do something with buffer if no error occurred
stbi_gif_advance_frame(gif);
}
The plan is to remove all support for animated gifs from stb_image and fork them into a separate library (which I personally will not be maintaing), because this has just been a source of headaches and it's really outside the original intent of stb_image.
Is your feature request related to a problem? Please describe.
When stb_image loads
.gif
files, it creates a buffer for the entire file. This can get troublesome for big files, as the memory allocated grows very large. This is very noticeable as in some cases it can take up to a few seconds just to allocate the memory.Describe the solution you'd like
I suggest adding an alternative method to load the files and show how it can be used. the library could take a buffer that it will use to fill the data for the current frame. This way, we only need to allocate a buffer for one frame, thus reducing memory allocations.
Pseudocode of the API:
Let me know what you think!
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: