Ok, so here's the first update.
Converting the JPG to a data file, took around 0.536 seconds, created an 8mb file. So it's big - let's see how long it takes to read it back in...
.
.
.
So reading the data back in took 0.566 seconds
Converting to an image took 0.0076 seconds
So how does this compare?
Loading a single JPG directly took 0.157 seconds - however during this load time the system is frozen. Converting the memblock to an image took 0.0076 seconds - so this is WHOPPING 20.6 times faster. So why would we use this? Maths.
If the image is 1920x1080 pixels, then it is 2,073,600 (+12) bytes. Loading as an image means we have to load this all in one go.....however loading from the data file means we can load it in "chunks" in between frames for as long as we want.
So in practice, my need is to load 9-10 images in the background of my game moving - though this could in theory be a constant load. So, it takes half a second, roughly, to load an image from data - so I will need 5 seconds to "stream" in the data in total.
One frame (at 60 fps) is equal to around 0.016 seconds...so what I know is that converting the memblocks to an image takes around 47% of a frame. My game renders (during a jump) at less than half a frame....so this render and conversion
should be invisible to the user.
My jump sequence takes 8 seconds currently to transition between backgrounds (though I planned up to 10 to be acceptable while movement is on screen) so I will in theory have room to spare. But.....lets put that to a real world (ish) test....
In a demo (giving each "chunk" 0.008 seconds to load, or half a frame) it took 66 "half" frames to load, around 0.55 seconds.
On the face of it, seems to be a success, and (albeit very slowly) the code is "streaming" graphics in the back of rendering, and as long as the render takes less than half a frame, should run at 60fps. Of course, we could simply set it up to run at 60fps, or 30 or whatever, then simply give the loading code whatever is left of a frame to load...so if the frame took 25% of a second, we'd load images 33% faster.
Tomorrow I shall try this in the real world and see how Star Captain fares - and of course also when NOT loading from an SSD.
If it works as expected, I shall share the code once it's tidied up - in the meantime any idea's would be appreciated.