Hi Sebastian, On Monday 01 August 2011 18:57:14 Sebastian Andrzej Siewior wrote: > * Laurent Pinchart | 2011-08-01 16:04:55 [+0200]: > >> IIUC, there's no way to avoid copying the data since it has to > >> processed before getting sent to userspace. > > > > Every UVC packet starts with a header that needs to be removed, so we > > unfortunately can't get rid of all memcpy() calls. > > So we have something like that: > +---------------+------------+-----------+ > | hdr-to-remove | jpeg header| jpeg-data | > +---------------+------------+-----------+ First of all, UVC devices don't stream MJPEG only. Uncompressed video formats are very common. > is it possible that you move the jpeg header to the front and tell it > that it is larger than it reall is? Or change the data offset point to > jpeg-data if there is one. Have no clue about the data format but a lot > of file formats have something like "size of header" field or an offset > to data fields within file. So if you can alter them you would get: > > +-------------+--------------+-----------+ > | jpeg-header | jpeg hdr ign | jpeg-data | > +-------------+--------------+-----------+ > > So you could move just the header alter it somehow so userland would > skip to the correct data and you could avoid the large memcpy. That won't work. UVC devices split the frame in small packets (between a couple tens of bytes to a bit less than 3kB) and prefix each of them with a header. That's why a memcpy() is required. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html