[SDL] A couple questions on SDL

Peter Mulholland darkmatter at freeuk.com
Wed Jul 12 18:56:21 PDT 2006


Lilith Calbridge wrote:

> I'm getting my feet wet with SDL and, in a great sense, video graphics
> in general.  In looking for functions or combination of functions to do
> what I need I've come across some things that it would help me to
> understand better. 
> 
> First, what is YUV?  More explicitly what is the purpose of a YUV
> overlay?

YUV is a colour space format, as is RGB, but instead of storing the 
amounts of red, green and blue per pixel, it stores the brightness and 
then the blue and red amounts in relation to the brightness. It more 
accurately models the human perception of colour and is mostly used in 
realtime video, for example in MPEG.

http://en.wikipedia.org/wiki/YUV

A YUV overlay is a hardware method of displaying this data. Typically 
conversion from YUV->RGB is handled in hardware, although SDL can if 
neccesary do this in software.

>  I've tried to find information through Google but pretty much
> anything that discussed it did so from the view point that the reader
> knew what it was.

In all honesty, YUV is only really used for motion video compression 
such as MPEG, DIVX, etc. If you're not playing back movies then it's not 
really of any relevance.

> Second, does SDL provide a function that I'm overlooking that will copy
> the pixels of a small rectangle of a large surface into the pixels of a
> smaller storage surface.  My purpose is to restore the background under
> a blitted surface to it's original content before redrawing the object
> at a displaced position.  I don't mind doing the coding myself but if
> SDL supports this functionality it's probably more efficient than what
> I'd come up with.

Yes, SDL_Blit() will do this given the appropriate rect's.

Pete.




More information about the SDL mailing list