Seeking advice for rewrite of dlls/quartz/videorenderer.c using DirectDraw

Alex Villací­s Lasso a_villacis at
Tue Jun 12 17:15:45 CDT 2007

 From a time till now, I am using a test application in Visual Basic in 
order to test progress in quartz. The code for the application (along 
with a precompiled EXE) can be found at the following address:

One of the things I dislike about the current quartz implementation is 
that when a large AVI video file (say, 640x480) is played with the test 
application, the sound stutters (in both ALSA and OSS) while the frames 
are being updated. This occurs with the builtin quartz.dll, but not with 
native (WinXP) quartz. From what I can deduce from 
WINEDEBUG=+tid,+quartz , it seems that builtin feeds video and audio in 
the same thread. In addition, dlls/quartz/videorenderer.c uses 
StretchDIBits() in order to write one frame of video into the output 
window. Apparently StretchDIBits() is slow enough in my machine that it 
cannot complete by the next sound sample. Therefore the stuttering.

I made a little patch to move the video rendering in videorender.c into 
a separate thread, in order to allow it to drop frames. However this 
does not completely eliminate the stuttering audio. I am now thinking 
about rewriting the video rendering with DirectDraw. It seems that 
native quartz.dll uses DirectDraw, not GDI, to display video frames into 
the output window.

One thing I am worried about is the pixel format of the surfaces. The 
video data is 32bpp, but the output window uses my X config at 16bpp. 
However, nowhere in the ddraw trace of native quartz I can find any 
reference to a CreateSurface with 32bpp. It seems that native quartz 
does the depth conversion itself. The question is this: if I create a 32 
bpp surface (in order to lock it and write the 32 bpp frame data into 
it), can I then blit it into a 16 bpp output window and somehow let 
DirectDraw take care of the depth conversion? If so, can this be any 
faster than writing the depth conversion myself?

Alex Villacís Lasso

perl -e '$x=2.4;print sprintf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'

More information about the wine-devel mailing list