Rendering YUV in DirectDraw

Rendering YUV in DirectDraw

Post by Leese » Wed, 12 Jan 2005 10:43:06


1.
I have a YV12 output.
I could get the frame displayed correctly on one machine (Readeon 9200).
This works for various frame size.
But I could not get it displayed on an other machine (Intel(R) 82865G
Graphics Controller). The output is skewed for all the previous resolution I
tried.
Both display card supports YV12.
Please provide me some pointers to this case.
(Could I attach the screenshot here?)

2.
http://www.yqcomputer.com/

I used this fuction to convert YV12 to YVY2.
But this seems to only work on CIF (352x288) but not D1 (720x480).
The D1 output seems to be skewed. Both machines have the same situation.
Is it that I shouldn't pass 720 as the width?
Is there any sample code that uses this function?

Thanks
 
 
 

Rendering YUV in DirectDraw

Post by Thore Karl » Wed, 12 Jan 2005 11:26:52

On Tue, 11 Jan 2005 09:43:06 +0800, "Leesei" < XXXX@XXXXX.COM >



You're not saying exactly what you're doing, but it sounds like you're
not accounting for the fact that the width of the hardware surface can
be wider than your memory buffer. You need to get the width (stride) of
the surface and copy one line at a time.

--
New to newsgroups? Read: http://www.yqcomputer.com/

 
 
 

Rendering YUV in DirectDraw

Post by Leese » Wed, 12 Jan 2005 15:55:37

Sorry for missing the situation.
I have a YV12 output and want to display it on a DirectDraw surface.
I've tried converting the YUV to RGB and that worked for me.
I'm trying to improve the performance by using YUV surface.

I think you are right with the stride thingy.
How could I calculate the stride of hardware surface?
Is there any sample code/tutorial for displaying a YV12 or YVY2 surface?
The DX9 SDK doesn't have DirectDraw sample anymore.

Thanks.




resolution I
ium4/optimization/44009.htm
 
 
 

Rendering YUV in DirectDraw

Post by Iain » Wed, 12 Jan 2005 18:00:13


I replied to a similar question recently.

VMR9 will connect up with the resolution of your source, but during
allocator negotiation check if the upstream filter can connect with a
different format.

It will send the NEW format through in the first sample buffer. You need
to check for hte prescense of a Media Type in the sample buffer and adjust
accordingly. see 'Dynamic Format Changes'.

(One confusion here is that the term stride rather than width makes it seem
like there is a different process involved than just media type
negotiation. There is not [I believe!], but hte Dynamic Format Change
stuff isn't that easy to pick up on).

Iain
--
Iain Downs (DirectShow MVP)
Software Product Consultant
www.idcl.co.uk
 
 
 

Rendering YUV in DirectDraw

Post by Thore Karl » Thu, 13 Jan 2005 00:06:42

On Tue, 11 Jan 2005 14:55:37 +0800, "Leesei" < XXXX@XXXXX.COM >



I'm assuming that you are not using one of the renderers that come with
DirectShow, but instead are using DirectDraw directly?

In DirectDraw you can get the stride of the surface by getting the
surface description using e.g. IDirectDrawSurface7::GetSurfaceDesc(),
after you've created the surface:

DDSURFACEDESC2 surface_desc = { sizeof(surface_desc) };
pSurface->GetSurfaceDesc(&surface_desc);

Now you can find the stride of the surface in surface_desc.lPitch.

--
New to newsgroups? Read: http://www.yqcomputer.com/