Open attilaz opened 9 years ago
The current STBI_MALLOC in stb_image v2.0 is good enough for me. Thanks for adding it. So If you don't plan to modify the interface to add a preallocated buffer for output this issue can be closed.
I still want to add that.
Great. Thanks.
I mentioned this in #435 but I'll repeat it here for prosperity
Providing a row stride with the buffer would then be very nice addition for the APIs that require aligned rows.
I'm also interested in this, for reasons already mentioned in #435 (namely non-trivial row stride). Is this still on the todo list, or maybe available in a fork already somewhere?
I'd be interested in this addition, too.
I'm also interested in this. My game engine uses custom allocators everywhere and while I've done some hacks to STB image in order to accommodate, I think it would be nicer if it was exposed as part of the header by default.
Adding my voice to the "I'm interested in this" as well. Really interested!
This feature would be nice in Vulkan so that you may decode directly to the ppData
parameter in vkMapMemory for a VkBuffer. This would reduce the amount of processing required. Otherwise the end-user will be forced to copy all data themselves to the mapped memory.
Would like this too 👍
You never ever want to decode directly to a mapped buffer. Those are usually write-combined (uncached) memory and several of the stb_image decoders rely on reading from the decompression buffer. Reading from uncached memory is ballpark ~50-200x slower than reading from cached memory. Trust me, the extra copy is way cheaper than the alternative.
Well, in our case we have an already allocated buffer (not mapped). I found this issue because I was looking if it was possible to direct the output directly to this buffer. Would reduce some additional memory use and the extra copy.
Is there any progress on this feature? I'm basically storing seperated channels in a single heap allocated memory for my purposes and I have to use memcpy to put channels in place after loading them to different buffers.
It would be nice to have this feature. At least any estimations on when this feature will be implemented, so I may choose to dig code and try to implement myself, if it's not soon
I mean, I last commented on it in 2014, so as you might imagine, there has been no effort to implement it in that time, and no estimates for when it might get done.
It could be implemented to output into a preallocated buffer like in stb_image_resize or with the ability to set a custom allocator for output buffer alloc/free. I am not interested in using custom allocator for internal, temporary buffers but others might find that useful too.