Re: Rapid gfx display Qs



Mike Williams wrote:
"Jim Mack" wrote...

I have a task that involves getting still image files to the
screen as quickly as possible (20ms max). These images
are all equal size . . . for testing all I have is my pedestrian
2gHz, single-core with IDE drive and older graphics.
To get a baseline, I timed just getting (LoadPicture) random
1280x720 BMP files into a picture box with autoredraw off.
The average load time was about 65ms, with almost no variation
To my surprise, turning autoredraw ON reduced this to 60ms
on average. Any ideas why this should be so?

I think with Autoredraw False you are effectively timing the total
time both of loading the picture from disk into memory (into the
PictureBox's Picture property) and also the time taken for the OS
to dump that picture to the screen. In contrast, with Autoredraw
True, you are timing only the time taken to load the picture from
disk into memory (into the PictureBox's Picture property) because
the VB Autoredraw system itself will dump the property to the
actual display just after your code has finished.

That makes sense, and it would account for some of the variation in
timings. However, if I do this for 2000 random images in a row, the
average is still lower: I don't seem to be paying all of the price of
transferring the data from memory to screen. What that tells me is
that VB is being more efficient in that scenario.


Anyway, on my
system which is a fairly old AMD 2.2 Ghz with a Radeon 9600 card
AGP graphics card and with no gdi32 hardware acceleration (because
the gdi32 hardware acceleration has been "knobbled" by Vista) I get
the following results (on a Autoredraw False PictureBox):

Picture1.Picture = LoadPicture("c:\settle.bmp") ' 39 msec

. . . and (where p1 is a StdPicture object):

Set p1 = LoadPicture("c:\settle.bmp") ' 25 msec

. . . and:

Set p1 = LoadPicture("c:\settle.bmp") ' a total time
Picture1.Picture = p1 ' of about 39 msec altogether

Your system is about the same as mine. Are those images 1280x720 or
equivalent (2.7MB)?

. . .and (on an Autoredraw True PictureBox)

Picture1.Picture = LoadPicture("c:\settle.bmp") ' 26 msec

' but the above 26 msec is simply because the timer is not
' taking account of the transfer from memory to screen, as
' mentioned in the above paragraph, which happens after
' the time is read

So it looks as though on my machine it is taking 25 msec to load
the image from disk into memory and a further 14 msec to transfer
it from memory to the display (in XP the second figure would
probably be less than 14 msec because gdi32 hardware acceleration
works in XP).

I'll be using XP, with a _very_ fast disk and top-end Nvidia card, so
I hope I can count on some help from them. Also, there will be some
predicitability in which images are "next", so I may be able to save
time by overlapping disk reads into memory with upcoming images
(look-ahead buffering).


So that leads
us to jpgs. If I do this:

Set p1 = LoadPicture("c:\settle.jpg")

I get a time of about 79 msecs (much longer than before) just to
load the picture into a StdPicture object

Yes, you save on the disk access but pay for the decode, which is why
I'm asking about GDI+ or third-party libs for decoding JPGs or other
compressed formats.

Having a fast dual-core will help, because in theory disk access and
JPG decoding can happen somewhat in parallel. I know VB is
single-threaded, but the OS (ergo disk access) isn't, so there should
be some benefit.

In the meantime, if you would tell us more about the
nature of these images it may give us some more clues as to how
best to proceed.

There's nothing special about them. They'll compress well, but that
might not matter since I don't know yet where the sweet spot is
between disk time and decode time.

I won't see the hardware for a week at least, so I may be jumping the
gun on actual times. I'm just looking now for the best bets in all
areas so I can get a head start.

Thanks.

--
Jim

.



Relevant Pages

  • Re: VB6 create image, save image to memory, send image to asp
    ... picture box, then save the picture (raw data? ... done in memory, nothing to disk. ... Dim base64 As String ... Dim memory As New System.IO.MemoryStream ...
    (microsoft.public.vb.winapi)
  • RE: working with images
    ... You can compress a picture by right click and the select format picture. ... a)Insert/picture/from file and the memory used is 31 KB ... Inserting a picture with VB tool bar. ... I'm creating a file where I have to add about 50 images. ...
    (microsoft.public.excel.programming)
  • Re: Garbage collect (or what?)
    ... No, I am doing them one at a time and saving to disk, so ... only one is in memory at any time. ... in between each image (or 10 images). ... my impression is that "garbage collection" is ...
    (microsoft.public.vb.winapi)
  • Re: Vista BSOD
    ... Nothing to take a picture of. ... My 20" intel iMac simply locked up, ... Crucial memory in, instead of Apple? ... written to disk, it would theoretically be stored in the dump file. ...
    (comp.sys.mac.advocacy)
  • Not enough memory to display pictures.
    ... I keep getting a error message saying there is not enough memory or disk ... space to display some picture in my document. ...
    (microsoft.public.word.docmanagement)