[cpia] Re: new cpia driver and camstream (fwd)

Nicolas Roussel nicolas.roussel@gmd.de
Sun, 26 Mar 2000 13:38:44 +0200 (CEST)


Talking about the RGB/BGR issue, Alan suggested:

> We should stick with BGR. This hasnt really come up before because
> TV overlay doesn't care and hardcore capture and process freaks all
> use YUVspace

Many video hardware can't produce RGB or BGR data directly, so drivers
usually have to convert from the "native" format (YUV or something
else). By supporting only BGR, you force anyone who wants or needs RGB
to convert once more between different formats.

> Its actually basically endianness accident I think. 

Well, I think something described as RGB24 in the API should really be
seen by the application as three bytes R-G-B, no matter the endianness
of the underlying system.

I think we should just add a few constants to videodev.h to fix this
once for all. Simply adding VIDEO_PALETTE_BGR24 to the existing
VIDEO_PALETTE_RGB24 would make a clear difference between the two
formats and all existing applications and drivers would still work,
provided that they now choose the right format name.

User-space code should be used to convert from what the driver can
produce to what the application wants. But this can work efficiently
only if the drivers are not already performing some
conversion. Ideally, they should be able to send "native" data to the
application in order to minimize the number of conversions.

Maybe we could have a VIDEO_PALETTE_NATIVE format that could be used
with VID_HARDWARE_* to allow fast user-space coding conversions?

Nicolas

P.S.: I also think an invalid format request should error. TV-like
applications can display RGB data even if it is BGR encoded because we
are the final destination of the images and we can understand them
even if people look like martians. Image processing applications are
usually not that smart. Chromakeying on the wrong format will never
work, so the next nearest format is not an option.

-- 
________________________________________________________________________

Nicolas Roussel                            mailto:nicolas.roussel@gmd.de
GMD - FIT.HCI, Schloss Birlinghoven      http://www-ihm.lri.fr/~roussel/
53754 St. Augustin, Germany       phone: +49 2241 14-2154 / fax: 14-2065
________________________________________________________________________