On Sun, 2002-10-06 at 23:44, Affan Ahmed wrote:

>   I have a RH 7.2 linux (kernel 2.4.7-10) with me and ov511 driver ver
> 2.4.6. This driver is only supporting YUV420 format while capturing. I
> have to display this using GDK/GTK library which requires an rgb
> format, while the h.263 encoder requires it to be in yuv411 format. Is
> there any simple conversion code that is available, or better yet some
> way to simply capture in the required format. 
> 
> (NOTE: IOCTL calls like ioctl(cam->dev, VIDIOCSPICT,&cam->vid_pic )
> return invalid argument for anything other than  cam->vid_pic.palette =
> VIDEO_PALETTE_YUV420;.)

This is all correct.

To answer your main question, the conversion code can be found in xawtv
(which is one of most complete v4l clients), and in virtually any other
v4l application. Also, the simpler formulas can be found in many places,
such as this one: http://www.inforamp.net/~poynton/ColorFAQ.html

The drivers are not doing much of format conversion because it is
inefficient, at least, and bloats the driver. This conversion is to be
done in userspace. So your search for a library is the right way to do
it.

Some drivers return RGB, other drivers return YUV, or gray - whichever
the camera's datastream resembles the most. You should not depend on any
particular format returned by any specific driver. A good v4l app should
be chewing happily on any standard format that the driver returns.

Dmitri

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to