YUV Overlay / hardware acceleration questions

I need some help with YUV overlays in SDL.

I have IYUV (4:2:0 planar) formatted images, and I want
to draw them to the screen using my graphics card for
the YUV->RGB conversion. When I use SDL_CreateYUVOverlay
to create an overlay surface, I apparently only get a video
surface located in system memory, and the images appear
as green/violet. I’m confused on a few points:

(a) Is there a graphics card that will support the hardware
accelerated YUV->RGB in Win2K (or even Red Hat Linux)?
I’ve tried this with an ATI Rage 128 Ultra (r128 driver in Linux),
and SDL claims the YUV overlay is created in software
(the hw_overlay member of the SDL_Overlay struct is set to 0).

(b) Why do I get green/violet images? I believe this implies
that SDL is not converting the color space, so I’m cramming
YUV pegs into RGB holes. However, only the chrominance
of the image is incorrect, so SDL appears to be correctly
up-subsamping the U and V planes.

What am I missing?

Thanks in advance,
Jim McGowan

(a) Is there a graphics card that will support the hardware
accelerated YUV->RGB in Win2K (or even Red Hat Linux)?
I’ve tried this with an ATI Rage 128 Ultra (r128 driver in Linux),
and SDL claims the YUV overlay is created in software
(the hw_overlay member of the SDL_Overlay struct is set to 0).

Many do support YUV overlays (including the Rage128?) … you might need
to load the XVideo extension in your Xserver. Without it, you definitely
won’t get YUV support.

(b) Why do I get green/violet images? I believe this implies
that SDL is not converting the color space, so I’m cramming
YUV pegs into RGB holes. However, only the chrominance
of the image is incorrect, so SDL appears to be correctly
up-subsamping the U and V planes.

It’s been awhile since I’ve played with YUV stuff, so someone else could
answer this better. (Maybe it’s an SDL bug? No idea off the top of my
head.)

–ryan.

(b) Why do I get green/violet images? I believe this implies
that SDL is not converting the color space, so I’m cramming
YUV pegs into RGB holes. However, only the chrominance
of the image is incorrect, so SDL appears to be correctly
up-subsamping the U and V planes.

I’m not sure how much IYUV has been tested. It’s possible that
either the SDL code has a color plane switched, or your data isn’t
really the canonical IYUV format. Take a look at src/video/SDL_yuv_sw.c
and make sure it’s doing the right thing for IYUV. Also, test it on
a card that supports that format as an accelerated format and see if
the hardware accelerated version is correct.

Note that some Windows driver / card combinations don’t convert some of
the rarer formats correctly, but you should only see this if you get a
hardware accelerated overlay.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment