On Thursday 10 January 2002 10:04 am, Dmitri wrote: > Rescaling of the image (to compensate for non-square pixels) would involve > "throwing" one of your pixels onto a grid of "regular" pixels and adding > the covered portions of pixels to them. I can think of a large table that > controls the process, or a fast formula instead. But you definitely may > want floating point for that... do it in userspace somehow? I think you are describing a box resampling filter. They aren't too difficult to write, but the results tend to come out looking soft or slightly fuzzy and out of focus. Using "nearest neighbor" resampling seems to give more pleasing-to-the-eye rescaled images (I think it's called nearest neighbor anyway). In any case, I don't want to use either one in kernel code. > YUV-related conversions generally require matrix transformations using > real coefficients. But you can not have floating point operations in > kernel (because, at very least, not all CPUs have FPU). This means that if > you do the conversion you do it in integers, and that is not very precise, > and you can not use CPU-specific instructions (MMX etc.) that are easily > available to userland apps. Uh oh. This could be a problem. I thought that since the kernel had an "emulate fpu if one isn't present" option that I could use floating point code regardless. I suppose I could do the conversion using 16.16 or 32.32 fixed point arithmetic, but it will incur a performance hit (which nobody wants to see in kernel code). > Generally, you should use the usbvideo module (if you can) because it > already contains 2000+ lines of v4l code that you most certainly don't > want to duplicate. You need to write a "minidriver" that only deals with > your device and nothing but your device, and leave the rest to the shared > code. It's time to put an end to cut-and-paste practices :-) We already > have thousands of lines of "similar-but-slightly-different" code that > has to be maintained individually; that hurts. My biggest reason for asking in here was fear of writing duplicate code. I've ripped a new one in enough junior engineers for re-writing what was already available I'd be embarrassed if I did it myself :) > Examples of minidrivers that use usbvideo are ibmcam, webcamgo, > ultradrv. If you need to add something to usbvideo to support your class > of cameras, patches are welcomed! I'll give all that a thorough looking over. -Joe