What is the fastest way to display an image?

What is the fastest way to display an image?

Post by Luc » Fri, 21 Jun 2002 04:07:23


Hello,

I'm porting an application which interfaces to a video
grabbing device. The existing driver doesn't implement the
DirectShow interface - it simply places the video data in
memory, providing a pointer to the latest grabbed frame.

What would be the fastest way to display the image buffer?
Currently, I'm using a texture of 1024x1024, and I copy
the image, 720x576(PAL) using D3DXLoadSurfaceFromMemory().
The performance is poor: 20 ms for this operation, on a
Pentium3 700 Mhz, with a GeForce4 card.

Thank you,
-- Luc

 
 
 

What is the fastest way to display an image?

Post by Philip Taylor [ MS » Fri, 21 Jun 2002 05:47:58


you;d probably get better performance by creating your surfaces ahead of
time and hand-copying the bits ( you need to lock the surface, get the
pointer, and copy, and then unlock ).

--

Phil Taylor
PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers, and a
few more bits and bobs.
http://msdn.microsoft.com/directx
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:> Hello,

> I'm porting an application which interfaces to a video
> grabbing device. The existing driver doesn't implement the
> DirectShow interface - it simply places the video data in
> memory, providing a pointer to the latest grabbed frame.

> What would be the fastest way to display the image buffer?
> Currently, I'm using a texture of 1024x1024, and I copy
> the image, 720x576(PAL) using D3DXLoadSurfaceFromMemory().
> The performance is poor: 20 ms for this operation, on a
> Pentium3 700 Mhz, with a GeForce4 card.

> Thank you,
> -- Luc


 
 
 

What is the fastest way to display an image?

Post by Luc » Fri, 21 Jun 2002 07:47:45


Thank you for the tip.
Bu .how do I dynamically associate the pointer to the image, as returned by
the driver, to a surface?
Or do you mean that I should get a pointer to the surface of the texture and
hand-copy the bits? Isn't this what
IDirect3DTexture8::D3DXLoadSurfaceFromMemory is doing?

-- Luc



Quote:> you;d probably get better performance by creating your surfaces ahead of
> time and hand-copying the bits ( you need to lock the surface, get the
> pointer, and copy, and then unlock ).

 
 
 

What is the fastest way to display an image?

Post by Philip Taylor [ MS » Fri, 21 Jun 2002 09:19:27


sure. but I suspect that routine is also creating a surface every time you
call it, which is costly.

fastest is to do as much work up-front out of the main rendering.

--

Phil Taylor
PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers, and a
few more bits and bobs.
http://msdn.microsoft.com/directx
This posting is provided "AS IS" with no warranties, and confers no rights.


> Thank you for the tip.
> Bu .how do I dynamically associate the pointer to the image, as returned
by
> the driver, to a surface?
> Or do you mean that I should get a pointer to the surface of the texture
and
> hand-copy the bits? Isn't this what
> IDirect3DTexture8::D3DXLoadSurfaceFromMemory is doing?

> -- Luc



> > you;d probably get better performance by creating your surfaces ahead of
> > time and hand-copying the bits ( you need to lock the surface, get the
> > pointer, and copy, and then unlock ).

 
 
 

What is the fastest way to display an image?

Post by Luc » Fri, 21 Jun 2002 22:35:14


You were right!
.
I'm getting now a pointer to the surface bits with LockRect() and use
CopyMemory in a loop on each row to place the data into the texture.

D3DXLoadSurfaceFromMemory().: 20ms
CopyMemory: 4ms

May any further optimization be obtained, by eliminating the loop (so that
the driver could optimize the transfers to the video card)?
I'm looking for a version of CopyRects, using memory -> surface, instead of
surface -> surface.

Thank you,

-- Luc



> you;d probably get better performance by creating your surfaces ahead of
> time and hand-copying the bits ( you need to lock the surface, get the
> pointer, and copy, and then unlock ).

> --

> Phil Taylor
> PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers, and a
> few more bits and bobs.
> http://msdn.microsoft.com/directx
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > Hello,

> > I'm porting an application which interfaces to a video
> > grabbing device. The existing driver doesn't implement the
> > DirectShow interface - it simply places the video data in
> > memory, providing a pointer to the latest grabbed frame.

> > What would be the fastest way to display the image buffer?
> > Currently, I'm using a texture of 1024x1024, and I copy
> > the image, 720x576(PAL) using D3DXLoadSurfaceFromMemory().
> > The performance is poor: 20 ms for this operation, on a
> > Pentium3 700 Mhz, with a GeForce4 card.

> > Thank you,
> > -- Luc

 
 
 

What is the fastest way to display an image?

Post by John Chewte » Wed, 03 Jul 2002 19:38:22


I am trying to something very similar.
Trying to update a 3d texture from video..
Using BT848 and similar. DX81.
What would you recommend for this?
Is it (even) possible to use a 3d surface as a DS surface so bypassing
several steps?


> You were right!
> .
> I'm getting now a pointer to the surface bits with LockRect() and use
> CopyMemory in a loop on each row to place the data into the texture.

> D3DXLoadSurfaceFromMemory().: 20ms
> CopyMemory: 4ms

> May any further optimization be obtained, by eliminating the loop (so that
> the driver could optimize the transfers to the video card)?
> I'm looking for a version of CopyRects, using memory -> surface, instead
of
> surface -> surface.

> Thank you,

> -- Luc



> > you;d probably get better performance by creating your surfaces ahead of
> > time and hand-copying the bits ( you need to lock the surface, get the
> > pointer, and copy, and then unlock ).

> > --

> > Phil Taylor
> > PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers, and
a
> > few more bits and bobs.
> > http://msdn.microsoft.com/directx
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.


> > > Hello,

> > > I'm porting an application which interfaces to a video
> > > grabbing device. The existing driver doesn't implement the
> > > DirectShow interface - it simply places the video data in
> > > memory, providing a pointer to the latest grabbed frame.

> > > What would be the fastest way to display the image buffer?
> > > Currently, I'm using a texture of 1024x1024, and I copy
> > > the image, 720x576(PAL) using D3DXLoadSurfaceFromMemory().
> > > The performance is poor: 20 ms for this operation, on a
> > > Pentium3 700 Mhz, with a GeForce4 card.

> > > Thank you,
> > > -- Luc

 
 
 

What is the fastest way to display an image?

Post by Die Spammer! Die » Fri, 05 Jul 2002 11:58:44


Well, I suppose you could write a custom Render filter/allocator which locks
textures and passes the D3DLOCKED_RECT pBits value to upstream filters, thus
forcing them to write directly into the texture memory.  When you get them
back, unlock them to flush the changes to the video card.  I don't know if
you can pass a stride parameter as well.  You'd need to look into it.

K.


> I am trying to something very similar.
> Trying to update a 3d texture from video..
> Using BT848 and similar. DX81.
> What would you recommend for this?
> Is it (even) possible to use a 3d surface as a DS surface so bypassing
> several steps?


> > You were right!
> > .
> > I'm getting now a pointer to the surface bits with LockRect() and use
> > CopyMemory in a loop on each row to place the data into the texture.

> > D3DXLoadSurfaceFromMemory().: 20ms
> > CopyMemory: 4ms

> > May any further optimization be obtained, by eliminating the loop (so
that
> > the driver could optimize the transfers to the video card)?
> > I'm looking for a version of CopyRects, using memory -> surface, instead
> of
> > surface -> surface.

> > Thank you,

> > -- Luc



> > > you;d probably get better performance by creating your surfaces ahead
of
> > > time and hand-copying the bits ( you need to lock the surface, get the
> > > pointer, and copy, and then unlock ).

> > > --

> > > Phil Taylor
> > > PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers,
and
> a
> > > few more bits and bobs.
> > > http://msdn.microsoft.com/directx
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.


> > > > Hello,

> > > > I'm porting an application which interfaces to a video
> > > > grabbing device. The existing driver doesn't implement the
> > > > DirectShow interface - it simply places the video data in
> > > > memory, providing a pointer to the latest grabbed frame.

> > > > What would be the fastest way to display the image buffer?
> > > > Currently, I'm using a texture of 1024x1024, and I copy
> > > > the image, 720x576(PAL) using D3DXLoadSurfaceFromMemory().
> > > > The performance is poor: 20 ms for this operation, on a
> > > > Pentium3 700 Mhz, with a GeForce4 card.

> > > > Thank you,
> > > > -- Luc

 
 
 

What is the fastest way to display an image?

Post by Luc » Sat, 06 Jul 2002 22:45:52


I'm currently using "D3DXLoadSurfaceFromMemory()" to update the texture.
Since the texture is created in managed pool, I think that internally, a
memcpy is used to update a copy of the texture in sysmem, before
transferring to the video card. I would like to directly move the memory
bits to the video, as UpdateTexture presumably does - but there's no
UpdateTextureFromMemory, just from another texture

Actually, I've found out that the difference between
D3DXLoadSurfaceFromMemory() and CopyMemory() line by line originates from
the memory allocation in the driver (cached, or non cached). Fixing the
driver resulted in almost identical measurements.

What I would like to do now is fast deinterlacing, since my frame grabber
grabs fields, not frames.
Copying line-by-line, even and odd, is too slow. I'm thinking of using a
stencil buffer.

-- luc



> Well, I suppose you could write a custom Render filter/allocator which
locks
> textures and passes the D3DLOCKED_RECT pBits value to upstream filters,
thus
> forcing them to write directly into the texture memory.  When you get them
> back, unlock them to flush the changes to the video card.  I don't know if
> you can pass a stride parameter as well.  You'd need to look into it.

> K.



> > I am trying to something very similar.
> > Trying to update a 3d texture from video..
> > Using BT848 and similar. DX81.
> > What would you recommend for this?
> > Is it (even) possible to use a 3d surface as a DS surface so bypassing
> > several steps?




- Show quoted text -

> > > You were right!
> > > .
> > > I'm getting now a pointer to the surface bits with LockRect() and use
> > > CopyMemory in a loop on each row to place the data into the texture.

> > > D3DXLoadSurfaceFromMemory().: 20ms
> > > CopyMemory: 4ms

> > > May any further optimization be obtained, by eliminating the loop (so
> that
> > > the driver could optimize the transfers to the video card)?
> > > I'm looking for a version of CopyRects, using memory -> surface,
instead
> > of
> > > surface -> surface.

> > > Thank you,

> > > -- Luc



> > > > you;d probably get better performance by creating your surfaces
ahead
> of
> > > > time and hand-copying the bits ( you need to lock the surface, get
the
> > > > pointer, and copy, and then unlock ).

> > > > --

> > > > Phil Taylor
> > > > PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers,
> and
> > a
> > > > few more bits and bobs.
> > > > http://msdn.microsoft.com/directx
> > > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights.


> > > > > Hello,

> > > > > I'm porting an application which interfaces to a video
> > > > > grabbing device. The existing driver doesn't implement the
> > > > > DirectShow interface - it simply places the video data in
> > > > > memory, providing a pointer to the latest grabbed frame.

> > > > > What would be the fastest way to display the image buffer?
> > > > > Currently, I'm using a texture of 1024x1024, and I copy
> > > > > the image, 720x576(PAL) using D3DXLoadSurfaceFromMemory().
> > > > > The performance is poor: 20 ms for this operation, on a
> > > > > Pentium3 700 Mhz, with a GeForce4 card.

> > > > > Thank you,
> > > > > -- Luc

 
 
 

1. fast 2D image display

Hi,

    I need advice on the fastest way (in software)
to display large 2D arrays (512x1024) of 8 bit
integers on an Intel PII/Windows NT platform with
AGP Riva TNT graphics.  The raw data is acquired
on a fast PCI bus A/D board to local memory.  My
desire is to achieve at least 20 frames per
second, but 30 would be ideal.  I'd also like to
be able to specify custom colormaps.  I'm new to
this sort of programming problem, so I just need
some direction right now.  Thanks.

                            -Dustin

2. Rotation....

3. Fast Display of B&W Images

4. Modes above 320x200x256

5. Linux image display library: simple but very fast?

6. add-ins

7. Fast image display on a 9600

8. Can NURBS be used to describe simple polytopes?

9. GL/SGI Fast image file display technique

10. FAST X IMAGE DISPLAY

11. Fast image display on 24bit Sun

12. Fast display of images

13. fast image display and blending