Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread Ulrich Hertlein

Hi Francesco,

Quoting "Francesco Argese" :
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) 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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread Ulrich Hertlein

Hi Art,

Quoting "Art Tevs" :
Why would you read from disk into a RAM disk, then read from RAM  
disk into, err, RAM again?  Instead of reading straight from disk  
into your

RAM cache?

...
you mentioned exactly the same what I told by using RAM-disk and  
external application which will load the data into it. So, you agree  
that this is the way to go ;) ?


In general yes, but I don't see any benefit in reading frame of disk  
into a RAM disk in one thread and then reading them *again* from RAM  
disk into process memory in another thread (and then upload them to  
texture memory).


Cheers,
/ulrich

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread Ulrich Hertlein

Hi Francesco,

Quoting "Francesco Argese" :
Still: the resolution you mentioned (1440x1050) requires ~108 MB/s  
for 8-bit RGB @ 25 fps (and over 140 MB/s for 10-bit or RGBA).

You need a few drives to do that...


What do you mean with "You need a few drives to do that..."? That  
the majority of hard drives support a flow like that?


No, in the absolutely best case (start of the disk, no other I/O;  
basically a theoretical max) you get maybe 50 MB/s tops from a single  
desktop drive.  To get any more you need to use more disks and stripe  
them.


/ulrich

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread J.P. Delport

Hi,

maybe you can exercise the new ffmpeg plugin that Robert just comitted :)

Take your images and stick them into an avi file with mencoder, e.g.:

mencoder mf://*.jpg -ovc lavc -lavcopts vcodec=ljpeg:keyint=1 -mf fps=30 
-o mynewavi.avi


you can select other codec if you want. If you can tolerate compression, 
try mjpeg instead of lossless (ljpeg). You will have to balance disk 
speed vs uncompress time on cpu.


If the ffmpeg plugin or ffplay or mplayer can play your avi at 30fps 
then at least you know your hardware can handle the rate.


Playing in reverse at full rate might be more difficult. Not sure if the 
plugin supports single frame step either.


jp


Francesco Argese wrote:

J.P. Delport wrote:

Hi,

are you creating a new image every time using osgDB::readImageFile? If 
so, then you might be just plain running out of memory if you are not 
destroying old images.





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) 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 the installation of 
a driver that probably I cannot install on target PC of my application.

Thanks all for the useful answers (you are giving me new roads to follow)
Francesco Argese

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7514#7514





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread Francesco Argese

J.P. Delport wrote:
> Hi,
> 
> are you creating a new image every time using osgDB::readImageFile? If 
> so, then you might be just plain running out of memory if you are not 
> destroying old images.
> 


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) 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 the installation of 
a driver that probably I cannot install on target PC of my application.

Thanks all for the useful answers (you are giving me new roads to follow)
Francesco Argese

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7514#7514





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread Art Tevs
Hi Ulrich,


Ulrich Hertlein wrote:
> 
> Why would you read from disk into a RAM disk, then read from RAM disk into, 
> err, RAM 
> again?  Instead of reading straight from disk into your RAM cache?
> 
> ...
> 
> Set up a read thread that reads the images into RAM buffers and upload the 
> images from the 
> buffers as needed.  At least that way you have the I/O wait in another thread 
> and not your 
> draw thread.
> 


you mentioned exactly the same what I told by using RAM-disk and external 
application which will load the data into it. So, you agree that this is the 
way to go ;) ?

But nevertheless, as soon as coping the data from RAM into VRAM is faster than 
loading from HDD into RAM, you will always stuck after some time. It doesn't 
matter how much data you deliver into the RAM buffers from the HDD. After some 
time you will just reach the end of the buffered data and hence your draw 
thread will have to wait.

Maybe you could try out to stream from HDD to RAM compressed files and 
uncompress them on the CPU (some simple runtime length encoding or so). Hence 3 
threads, streaming, uncompressing and drawing threads. Each of them is working 
on some kind of RAM buffer.

cheers

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7467#7467





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread J.P. Delport

Hi,

are you creating a new image every time using osgDB::readImageFile? If 
so, then you might be just plain running out of memory if you are not 
destroying old images.


You can destroy the images manually or also search 
setUnRefImageDataAfterApply in texture classes.


I'm not sure how one reads data into the same image with 
osgDB::readImageFile.


jp

Francesco Argese wrote:

The bottleneck is still your disk I/O bandwidth and if that isn't
fast enough you're still out of luck.



Yes, the bottleneck is certainly I/O bandwidth: in fact the
application doesn't block until It work totally in ram. When RAM is
full the paging file  (on the hard disk) begin to grow and the
application go slow and crush.



Still: the resolution you mentioned (1440x1050) requires ~108 MB/s
for 8-bit RGB @ 25 fps (and over 140 MB/s for 10-bit or RGBA).  You
need a few drives to do that...



What do you mean with "You need a few drives to do that..."? That the
majority of hard drives support a flow like that?

I think so but probably the problem could be the loading process of
images and I hope that it could be resolved using other techniques
(probably customizing implementation of osgDB::readImageFile?
probably with ramdisk?). Is it possible or am i wrong?

What is the path (in terms of memory) that images follow before to be
displayed at video?

At the moment i'm already trying using quicktime (inserting images in
a .mov) while, as regards ive, there could it be a problem of size
because i have a lot of images to display.

Thanks all for the useful answers Francesco Argese

-- Read this topic online here: 
http://forum.openscenegraph.org/viewtopic.php?p=7461#7461






___ osg-users mailing
list osg-users@lists.openscenegraph.org 
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-26 Thread Francesco Argese

> The bottleneck is still your disk I/O bandwidth and if that isn't fast enough 
> you're still 
> out of luck.


Yes, the bottleneck is certainly I/O bandwidth: in fact the application doesn't 
block until It work totally in ram. When RAM is full the paging file  (on the 
hard disk) begin to grow and the application go slow and crush. 


> Still: the resolution you mentioned (1440x1050) requires ~108 MB/s for 8-bit 
> RGB @ 25 fps 
> (and over 140 MB/s for 10-bit or RGBA).  You need a few drives to do that...


What do you mean with "You need a few drives to do that..."? That the majority 
of hard drives support a flow like that?

I think so but probably the problem could be the loading process of images and 
I hope that it could be resolved using other techniques (probably customizing 
implementation of osgDB::readImageFile? probably with ramdisk?). Is it possible 
or am i wrong?

What is the path (in terms of memory) that images follow before to be displayed 
at video?

At the moment i'm already trying using quicktime (inserting images in a .mov) 
while, as regards ive, there could it be a problem of size because i have a lot 
of images to display.

Thanks all for the useful answers
Francesco Argese

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7461#7461





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-24 Thread Ulrich Hertlein

On 25/2/09 1:35 AM, Art Tevs wrote:

you can even stream from a RAM disk, which will increase the performance as 
well. An
external application could stream from the hdd to the ram disk in parallel to 
your
application. For a multicore cpu this shouldn't be a big problem. So you will 
use the


Why would you read from disk into a RAM disk, then read from RAM disk into, err, RAM 
again?  Instead of reading straight from disk into your RAM cache?


The bottleneck is still your disk I/O bandwidth and if that isn't fast enough you're still 
out of luck.


Set up a read thread that reads the images into RAM buffers and upload the images from the 
buffers as needed.  At least that way you have the I/O wait in another thread and not your 
draw thread.


Still: the resolution you mentioned (1440x1050) requires ~108 MB/s for 8-bit RGB @ 25 fps 
(and over 140 MB/s for 10-bit or RGBA).  You need a few drives to do that...


Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-24 Thread Art Tevs
Hi all,

you can even stream from a RAM disk, which will increase the performance as 
well. An external application could stream from the hdd to the ram disk in 
parallel to your application. For a multicore cpu this shouldn't be a big 
problem. So you will use the ram disk as a cache for your data.
I've used similar technique couple of times already in Linux. However, I have 
no idea how to do so in windows.

cheers,
art

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7306#7306





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-24 Thread Eric Sokolowsky
Francesco Argese wrote:
> Hi all,
> 
> I'm trying to stream high resolution images in real-time. My problem is that 
> performance degenerate after some time; this is due to the complete 
> occupation of the ram and to the slow process of loading an image in memory 
> that is slower than the visualization frequency needed by my application.
> 
> In which classes is this process handled? Is there a manner to avoid (or to 
> mitigate) this problem using a different approach?
> 
> I remember that i have already seen this same argument in mailing list but, 
> doing a search, I have not found what I'm searching for.
> 

It is faster to use texture compression and save the compressed textures
as .ive files, then load those. This requires either a preprocessing
step to compress the textures or a caching mechanism to use compressed
textures once they've been generated. I use the second technique in my
application with pretty good results.


-Eric
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-24 Thread Francesco Argese

> How are you streaming these images?  What resolution and format are they?
> 
> When you're talking about streaming I suppose you're using some kind of 
> compression? 


I'm not using any form of compression at this moment: I have a set of .tga 
image at a resolution of 1440x1050 and I have tried to read them both with 
osgDB::readImageFile  function (loading the images at the initialization of 
application) and using osgimagesequence example.


>  On 
> Linux this would most likely be handled by the xine plugin, on OS X possibly 
> the quicktime 
> plugin.


I have read something about this but i have not understood if both quicktime or 
xine introduce some form of compression.

Thanks
Hi
Francesco Argese

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7288#7288





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Streaming of high resolution images

2009-02-24 Thread Ulrich Hertlein

Hi Francesco,

On 24/2/09 8:48 PM, Francesco Argese wrote:

I'm trying to stream high resolution images in real-time. My problem is that

> performance degenerate after some time; this is due to the complete 
occupation of the
> ram and to the slow process of loading an image in memory that is slower than 
the
> visualization frequency needed by my application.

How are you streaming these images?  What resolution and format are they?

When you're talking about streaming I suppose you're using some kind of compression?  On 
Linux this would most likely be handled by the xine plugin, on OS X possibly the quicktime 
plugin.  They streaming mode determines where to look for a problem.


Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Streaming of high resolution images

2009-02-24 Thread Francesco Argese
Hi all,

I'm trying to stream high resolution images in real-time. My problem is that 
performance degenerate after some time; this is due to the complete occupation 
of the ram and to the slow process of loading an image in memory that is slower 
than the visualization frequency needed by my application.

In which classes is this process handled? Is there a manner to avoid (or to 
mitigate) this problem using a different approach?

I remember that i have already seen this same argument in mailing list but, 
doing a search, I have not found what I'm searching for.

Thanks in advance
Francesco Argese

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=7280#7280





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org