📄 spcatools.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with LaTeX2HTML 99.2beta8 (1.43)original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>SpcaView & SpcaTools Howto</TITLE><META NAME="description" CONTENT="SpcaView & SpcaTools Howto"><META NAME="keywords" CONTENT="Spcatools"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="Spcatools.css"></HEAD><BODY ><!--Navigation Panel--><IMG WIDTH="81" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next_inactive" SRC="file:/usr/lib/latex2html/icons/nx_grp_g.png"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/lib/latex2html/icons/up_g.png"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/lib/latex2html/icons/prev_g.png"> <BR><BR><BR><!--End of Navigation Panel--><P><P><P><P><H1 ALIGN="CENTER">SpcaView & SpcaTools Howto</H1><P ALIGN="CENTER"><STRONG>Michel Xhaard</STRONG></P><P ALIGN="CENTER"><STRONG>01 March 2004</STRONG></P><BR><H2><A NAME="SECTION00010000000000000000">Contents</A></H2><!--Table of Contents--><UL><LI><A NAME="tex2html35" HREF="Spcatools.html">Contents</A><LI><A NAME="tex2html36" HREF="Spcatools.html#SECTION00020000000000000000">1 Overview:</A><UL><LI><A NAME="tex2html37" HREF="Spcatools.html#SECTION00021000000000000000">1.1 Camera Type</A><LI><A NAME="tex2html38" HREF="Spcatools.html#SECTION00022000000000000000">1.2 Probing the Camera</A><LI><A NAME="tex2html39" HREF="Spcatools.html#SECTION00023000000000000000">1.3 What the driver do ? </A></UL><LI><A NAME="tex2html40" HREF="Spcatools.html#SECTION00030000000000000000">2 Spcaview Grabber</A><UL><LI><A NAME="tex2html41" HREF="Spcatools.html#SECTION00031000000000000000">2.1 Why a new grabber in Linux World ?</A><LI><A NAME="tex2html42" HREF="Spcatools.html#SECTION00032000000000000000">2.2 What Spcaview Grabber can do ?</A><LI><A NAME="tex2html43" HREF="Spcatools.html#SECTION00033000000000000000">2.3 Picture Grabbing</A><LI><A NAME="tex2html44" HREF="Spcatools.html#SECTION00034000000000000000">2.4 Can i record video Stream ?</A></UL><LI><A NAME="tex2html45" HREF="Spcatools.html#SECTION00040000000000000000">3 Spcaview Player</A><UL><LI><A NAME="tex2html46" HREF="Spcatools.html#SECTION00041000000000000000">3.1 Why a new player in Linux world?</A><LI><A NAME="tex2html47" HREF="Spcatools.html#SECTION00042000000000000000">3.2 What Spcaview Player can do ?</A></UL><LI><A NAME="tex2html48" HREF="Spcatools.html#SECTION00050000000000000000">4 How Spcaview can be installed ?</A><LI><A NAME="tex2html49" HREF="Spcatools.html#SECTION00060000000000000000">5 Spcatools </A><UL><LI><A NAME="tex2html50" HREF="Spcatools.html#SECTION00061000000000000000">5.1 Spcatools extract</A><LI><A NAME="tex2html51" HREF="Spcatools.html#SECTION00062000000000000000">5.2 Spcatools Edit</A><LI><A NAME="tex2html52" HREF="Spcatools.html#SECTION00063000000000000000">5.3 Spcatools Picture</A><LI><A NAME="tex2html53" HREF="Spcatools.html#SECTION00064000000000000000">5.4 Spcatools more ?</A></UL><LI><A NAME="tex2html54" HREF="Spcatools.html#SECTION00070000000000000000">About this document ...</A></UL><!--End of Table of Contents--><P><H1><A NAME="SECTION00020000000000000000">1 Overview:</A></H1><P>This set of tools are provide to test WebCam under Linux. Especiallycamera based on Sunplus chips, but that should work with some otherscameras too.You need knowledge of Linux to use these tools and wedon't provide any GUI interface for a large public area. These toolsare design to: test, improve, perform our Kernel module in a lot ofsituations and provide usefull API for developer . As others projectsin the Linux World we don't have any help, documentation from SunPluscompagny. All that great work use Reverse Engeneering to provide interoperabilitiesof our WebCam device. At this times, we support up to 40 Webcams froma lot of compagnies: (Aiptek, Mustek, Intel, Grandtec, Maxell, Genius,Dlink, Kodak, Creative, Logitech, Benq, ViewQuest.. ) and only onedriver can deal with all, strange Linux World :)<P>Our kernel module spca50x or spca5xx is developed outside the kerneltree. that way provide a more reactive stuff according our supportproduct life, we are more free, to develop here part of code likespecific decompressor .<P>Why spca50x ,spca5xx ? spca50x was originally developed by Joel Cripon the Omnivision OV511 code.it is the official branch .spca5xx isan experimental stuff, i have begin in january 2003, i don't needto start another project with the same objective, so when that stuffis know to be stable, it will be integrate in the spca50x CVS tree.I did not have any responsabilities if that stuff, become or not ina release, ask the maintener Miah Gregory for that. At the momentspca50x is know to be very ``static'' and spca5xx very ``reactive''.<P>Also if your distro clearelly patch the kernel and become uncompatiblewith the others Linux stuff.we cannot offer support . The best wayget a vanilla kernel from http://www.kernel.org it should work withour module.<P><H2><A NAME="SECTION00021000000000000000">1.1 Camera Type</A></H2><P>Our webcams are all USB and can be managed in three familly of chipswho stream nativelly in :<P><TABLE CELLPADDING=3 BORDER="1"><TR><TD ALIGN="CENTER">Jpeg</TD><TD ALIGN="CENTER">Yuv</TD><TD ALIGN="CENTER">Bayer</TD></TR><TR><TD ALIGN="CENTER">Spca500</TD><TD ALIGN="CENTER">Spca501</TD><TD ALIGN="CENTER">Spca561a</TD></TR><TR><TD ALIGN="CENTER">Spca504a</TD><TD ALIGN="CENTER">Spca505</TD><TD ALIGN="CENTER"> </TD></TR><TR><TD ALIGN="CENTER">Spca504b</TD><TD ALIGN="CENTER">Spca506</TD><TD ALIGN="CENTER"> </TD></TR><TR><TD ALIGN="CENTER">Spca533a</TD><TD ALIGN="CENTER">Spca508</TD><TD ALIGN="CENTER"> </TD></TR></TABLE><P>Yuv and Bayer can be encoded with specific compressor from Sunplus.As we don't know that proprietary stuff ,we cannot provide any supportof the compressed mode, we use instead uncompressed stream.<P>Jpeg is more atractive that we know how the stream is encoded . Apeace of code from the bootsplash project as be rewrite to supportour raw jpeg stream ( Michael Shroeder (Suse), Till Adam, Michel Xhaard).<P><H2><A NAME="SECTION00022000000000000000">1.2 Probing the Camera</A></H2><P>At the USB probe function ,Webcam device is registered and the structprovide :<P><UL><LI>spca50x->bridge the know chip</LI><LI>spca50x->desc camera modele identifier</LI><LI>spca50x->cameratype what stream we are in use</LI></UL>Some Webcam have a know sensor we can access trought i2c bus the structregister in <P><UL><LI>spca50x-sensor the know sensor chip</LI></UL>Spca50x->sensor = SENSOR_INTERNAL mean we don't care about sensor(unknow or didn't have any know command) <P>Each Webcam is now registered and should work with the driver. <P><H2><A NAME="SECTION00023000000000000000">1.3 What the driver do ? </A></H2><P><H3><A NAME="SECTION00023100000000000000">1.3.1 V4L layer</A></H3><P>The first step provide a V4L layer to the userspace software .Thatmean Ioctl will be implemented to provide different kind of choice: Palette ,Capture Size, Picture setting.<P>All that chips didn't have the same capabilities:<P>Palette setting we courrently support for all cameras :<P><UL><LI>VIDEO_PALETTE_RGB565 16 Bits Video palette</LI><LI>VIDEO_PALETTE_RGB24 24 Bits Video palette</LI><LI>VIDEO_PALETTE_RGB32 32 Bits Video palette ( Not really a good idea)</LI><LI>VIDEO_PALETTE_YUV420P Planar yuv 4.2.0 palette (Best performanceaccording Bandwith)</LI><LI>VIDEO_PALETTE_RAWJPEG 8 Bits raw stream ( Not really a good ideasome webcam are not jpeg and can be use in raw mode )</LI></UL><P><H3><A NAME="SECTION00023200000000000000">1.3.2 Capture Size:</A></H3><P>All camera didn't support nativelly the whole set of picture sizesetting .Because Kernel space is not a good place to provide upscalingwe have only developed a peace of code to provide intermediate resolution.These intermediate setting are get by crop the first available hardwaremode also we only decode the surface need by the application software.VIDIOCGCAPIoctl will get the capabilities of your cam . <P>Maximum expected size:<P>``Vga'' size 640x480 is provide by :<P><UL><LI>Spca500 Spca501 Spca504a Spca504b</LI></UL>``Sif'' size 352x288 is provide by:<P><UL><LI>Spca505 Spca506 Spca508 Spca561</LI></UL>Spca533 is weird and can do 464x480 that need to upscale on 640x480<P>Default Maxsize is set to 352x288<P>Minimum expected Size:<P>``QCif'' size 160x120 is provide by:<P><UL><LI>Spca501 Spca505 Spca506 Spca508 Spca561</LI></UL>``QSif'' size 176x144 is provide by:<P><UL><LI>Spca504a Spca504b Spca533 (Jpeg decoding need Height and Width modulosize of MacroBlock 16x16)</LI></UL><P><H3><A NAME="SECTION00023300000000000000">1.3.3 Pictures setting:</A></H3><P>Unfortunatelly all Webcams didn't have an easy way to perform adjustementof Contrast, Brightness, Colors but exept some model we have implentedthose features via VIDIOCSPICT and VIDIOCGPICT Ioctl. <P><H3><A NAME="SECTION00023400000000000000">1.3.4 Asking Data from the Drivers</A></H3><P>The driver implement VIDIOCMCAPTURE and VIDIOCSYNC to provide a goodway for asking a frame and wait until that frame will be ready.Atthe moment our driver use four frames in the framebuffer get troughtVIDIOCGMBUF Ioctl .<P>Read and Mmap method can be use to get video data from kernel spaceto usersland.<P><H3><A NAME="SECTION00023500000000000000">1.3.5 Usb Isochronous</A></H3><P>As soon as the open function will be ask, driver allocate the wholememory ressource need by the grabbing stuff and install the callbackfunction of the Interrupt Handler then the Urb is submitted to theusb host controller .If all are right with the initialize of the camerathe isochronous stream become and, for each iso packet the driverwill consume the data until a video frame start is found. A startof frame is a least the end of preceding frame, a new buffer for grabbingis asked and a tasklet will be schedule to perform the video decoding.If something goes wrong in the iso stuff the tasklet will not be scheduleand the wrong frame will be recycled for a new one .<P>All that stuff are in interrupt context and need more attention toprevent Kernel ``crash''.<P>at the end of the process close function will stop the iso streamand remove all the grabbing memory in use.<P><H3><A NAME="SECTION00023600000000000000">1.3.6 Video Decoding</A></H3><P>When the tasklet was schedule a whole frame is grabbing and is presentin the frame temporary buffer.Also all the camera setting are setin the frame struct . the outpicture function first test what camerafamilly are responsive of that stream then the good decoding functionare ask .Because proprietary stuff are always strange we have to dealwith a lot pixels arrangement for exemple yuv become yuyv yyuv yuvy.<P>Tasklet work in safe times and so didn't corrupt the iso interrupthandler stuff. <P>A gamma set of tables are available to correct some sensor settingThat need to experiment and choice the good setting for your cam ifnecessary. Spcatools is design to help you for that work.<P><H3><A NAME="SECTION00023700000000000000">1.3.7 Miscaneallus function</A></H3><P>A set of usefull functions are implemented to get right parametersfor:<P>frame size, picture setting , The setting of those parameters willfind the good parameters for the usb stuff: pipe size Alternate settingaccording to frame size <P><H1><A NAME="SECTION00030000000000000000">2 Spcaview Grabber</A></H1><P><H2><A NAME="SECTION00031000000000000000">2.1 Why a new grabber in Linux World ?</A></H2><P>Our spca50x spca5xx have specific feature that was not supported withothers userspace apps .for example rawjpeg stream .We need a grabberto test our module in that way also able to ask our set of palettesize and so on. Tha's not really a good idea to merge bugs or unsupportedfeature from: xawtv, gnomemeeting and the pwlib, gqcam, vic, camstreamand so on and our module. a lot of confusing will be result that wayand we don't want to spend times with that. At least, if our moduleworks fine with spcaview it should work with the others apps. Spcaviewwas developed with that objective so it cannot do what gnomemeetinggstreamer mplayer xawtv ...do :)<P><H2><A NAME="SECTION00032000000000000000">2.2 What Spcaview Grabber can do ?</A></H2><P>Grab of course, in all supported palettes and sizes of our moduleno more no less. The resulting video stream are decoded and appearsin a SDL window ( That mean you need the great libsdl to compile,but now all serious distro will offer libsdl from Loki just don'tforget to install devel package too).<P>When the stream are displayed you can change the picture setting bypressing some key:<P><UL><LI>'n' brightness up</LI><LI>'b' brightness down</LI><LI>'v' color up</LI><LI>'c' color down</LI><LI>'x' contrast up</LI><LI>'w' contrast down</LI></UL><P><H2><A NAME="SECTION00033000000000000000">2.3 Picture Grabbing</A></H2><P>Of course you can ask for a picture when grabbing spcaview will builda picture name according the frame number and freeze the picture .jpgfor jpeg grabbing and pnm for all the others palettes.That mean if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -