Typically, you create overlay (read: a bitmap in YUV format) with a given
size and a specific YUV subtype (planar, packed, 420, 421 …) that usually
is dictated by the source of data (most webcams spit out planar 420).
overlay = SDL_CreateYUVOverlay( video_width, video_height,
SDL_IYUV_OVERLAY, screen );
Everytime you want to display a new image, you must lock the overlay and
fill the data in the overlay from your source.
SDL_LockYUVOverlay( overlay );
memcpy( overlay->pixels[0], Yplane, video_width*video_height );
memcpy( overlay->pixels[1], Uplane, video_width*video_height/4 );
memcpy( overlay->pixels[2], Vplane, video_width*video_height/4 );
Finally you unlock and display the overlay (or part of it depending on given
rectangle):
SDL_UnlockYUVOverlay( overlay );
SDL_DisplayYUVOverlay( overlay, &rect );
If you want I can send you codesnippets for playing mpeg frames (via
libmpeg3 on Linux) or capturing from v4l device.
Regards,
Jacek
BTW Of course you know, the conversion really happens in the video card and
therefore you cannot access the resulting RGB values, don’t you? So it isn’t
srictly speaking ‘transformation’, rather ‘displaying’. In other case I have
also snippets for software YUV->RGB conversion (and the SDL source probably
contains better ones if you know where to look for).On Wed, Nov 20, 2002 at 01:27:54PM +0100, kien hung ong wrote:
hello there,
does anybody know if and how one can make yuv to rgb colorspace
transformation by using
the local graphic card?
i was told that it’s possible with yuv-overlay. since i’ve never worked
with sdl before the short
description @ http://sdldoc.csn.ul.ie/sdlcreateyuvoverlay.php doesn’t mean
a lot to me.
i’m glad to have further hints, suggestions, tutorials to get me further.
–
±------------------------------------+
|from: J.C.Wojdel |
| J.C.Wojdel at cs.tudelft.nl |
±------------------------------------+