Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

USB Camera YUV format and WinCE50

77 views
Skip to first unread message

Kenny ODell

unread,
Dec 16, 2008, 4:34:03 PM12/16/08
to
I am working on a USB driver for a USB camera. It provides YUV video format
(4.2.2). The camera only provides this format. I have Doug Boiling's
example code for the WebCam (driver and test app) along with a Web Camera and
that works fine. How do you suggest I take this YUV format data and display
it? The test app only works with MJPEG files which are converted to JPEG
which are displayed in a picture box. Not sure where to start with this
"other" camera. By the way, just to make things interesting, this camera
does not adhear to the Video Standard that USB.org published.
Finally, I have source code for WindowsXP driver that works with the camera,
but it is based on AVStream.

Ideas?

Thanks in advance.

silver

unread,
Dec 19, 2008, 2:53:21 PM12/19/08
to
JPEG is YUV isn't it? Not that that helps you.

Do you already have a USB Class driver for hte device? If not then that is
the first port of call. MAkeit simple and offload the image processing to
the application. If you get the choice use a bulk endpoint as it makes
things simpler then isochromous.

Anyway, if you do not have hardware help or DirectDraw then it needs to be
done the hard way - get the DDCAPS struct and look for blitting
capabilities, specifically look for a YUV surface that you can draw to in
native YUV. (Have a look at the AlphaBlt function it might be helpful).

The hard way
-------------
From PB Help:

Converting 8-bit YUV to RGB888
The following coefficients are used in conversion process:

C = Y - 16
D = U - 128
E = V - 128
Using the previous coefficients and noting that clip() denotes clipping a
value to the range of 0 to 255, the following formulas provide the
conversion from YUV to RGB:

R = clip(( 298 * C + 409 * E + 128) >> 8)
G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8)
B = clip(( 298 * C + 516 * D + 128) >> 8)
These formulas use some coefficients that require more than 8 bits of
precision to produce each 8-bit result, and intermediate results require
more than 16 bits of precision.

Note All units range from 0 (zero) to 1.0 (one). In DirectDraw, they range
from 0 to 255. Overflow and underflow can (and does) occur, and the results
must be saturated.
To convert 4:2:0 or 4:2:2 YUV to RGB, convert the YUV data to 4:4:4 YUV, and
then convert from 4:4:4 YUV to RGB.

fourcc.org has a bunch of info too.

Regards,
Geoff
--

Beppe

unread,
Jan 21, 2009, 8:59:04 AM1/21/09
to
Hi Kenny

A few questions

You have develope usb driver in isochronous mode ?
which chip is the your target ? Empia ? Syntek ? Other ?

I have serius problem to receive all data from empia 2820 chip

maybe only DATA0 receive and other data remaining into the EMPIA
because wince not ping for the next part of microframe :(

Now i sniffing and testing for discovery the problem

problem in YUV2 conversion is the next problem :)

"Kenny ODell" <kenny dot odell at afltele dot com> ha scritto nel messaggio
news:307C7BD2-7FDB-458B...@microsoft.com...

0 new messages