Hi Francesco,
Quoting "Francesco Argese" <[email protected]>:
Yes, I load a certain number of images (a lot of images, for example
20.000 at 1400x1050 resolution-jpg or tga) with readImageFile at the
initialization of the application and I load them in memory (inside
std::vector<osg::Image*>) at startup. To visualize all the images in
a smoothing way (like a movie) with play, forward, rewind,
skipToNextFrame, skipToPreviousFrame command I iterate the array
elements. My problem is that I can load inside the vector a little
number of images (about one hundred). Then I have not enough memory
error.
I suppose that this error is normal because I load all the
uncompressed images in memory (also with .jpg) and I'm looking for a
method to solve this problem.
I have already tried to destroy old images but in that case there is
the following problem: the process of loading images from my hard
disk to ram require about two times the time required for
visualization at 30 fps so it arrives a moment where the buffer is
full.
As regards ramdisk probably it could be a solution (implementing
parallel threads) but on Windows it has portability problems due to
You have two problems:
1) limited RAM and address space, which means you cannot load all the
frames at once.
To solve this you need a way to only keep the frames you currently
need in RAM and free them when they're no longer needed. For example
keep N frames ahead and N behind your current play position. When you
move the play position you can free some frames and load others.
however, you have another problem:
2) limited disk I/O bandwidth
If your I/O bandwidth can't supply the frames at least as fast as
you're playing them back you're simply out of luck.
You didn't mention how big the individual frames are but an
uncompressed 1440x1050 8-bit RGB frame needs a little over 4.3 MB. At
a playback rate of 30 fps that's over 129 MB/s!!! Let's say you have
jpeg compression of 50% then it's still way 60 MB/s.
If you can set aside a ramdisk to hold all your frames you would be
fine but for 20,000 frames I don't that's an option. (It would make
your RAM vendor very happy though! :-)
The only solution I see is to use a compressed file format instead,
like avi/mp4/h.264.
Sorry.
/ulrich
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org