Re: RFC: Where to store camera properties (upside down, needs sw whitebalance, etc). ?
Adam Baker wrote: On Friday 16 January 2009, Olivier Lorin wrote: The use of the buffer flags makes the life easier as this flag is read for every image. So we can solve for the flip/rotation issues with the help of two new buffer flags: V4L2_BUF_FLAG_NEEDS_HFLIP and V4L2_BUF_FLAG_NEEDS_VFLIP. A driver has to set them properly. Does the rotation or flip(s) apply to every image (e.g. sensor upside down) or change with frames (e.g. Genesys webcams), that no more matters . I can do the patch these days. I do not remember if there is h/v flip functions in the libv4l, maybe they have to be added. Regards, Nol That sounds like a sensible approach. The flip code is already in libv4l but is currently controlled by a static table (v4lconvert_flags) of cameras that need it. It doesn't address the issue of whether libv4l should also provide gamma adjustment, auto white balance and auto gain for cameras that could benefit from it. Again that could be done with a static table but keeping the knowledge in libv4l in step with the list of supported cameras in the kernel won't be easy. Ack, but keeping a list in the kernel, just to be able to query it from userspace also seems silly. So atleast for "static" upside down info for UVC cams it was decided it would be best to just put the table in userspace. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: RFC: Where to store camera properties (upside down, needs sw whitebalance, etc). ?
kilg...@banach.math.auburn.edu wrote: On Fri, 16 Jan 2009, Olivier Lorin wrote: Post gamma or white balance correction seemed to be more part of the webcam capabilities than the image state so that the new API to get these features is quite logical. Hmmm. While one is in the process of planning ahead, it it good to think of everything. You have not yet seen any code for the sq905c cameras in webcam mode, yet. Well, actually, you can if you want to. The needed sequence of operations is used in the support for "gphoto2 --capture-preview" in libgphoto2/camlibs/digigr8/library.c. What happens with this camera is, the frame data has been compressed and therefore it is needed to know how much data is present for a frame before downloading the rest of the frame. The length of the frame header is set at 0x50 bytes, so one downloads that first. Here is a sample of one such frame header: ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0010 ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0020 ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0030 ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0040 e0 5a 00 00 3b 3e 50 3b-36 00 ff 00 ff 00 ff 00 .Z..;>P;6... Now, most of this is just filler. The data size for the frame is to be found in bytes 0x40 and 0x41 and it says that 0x5ae0 bytes must be downloaded for this frame. I have never seen the next two bytes with anything in them, so my reasonable conjecture is that they are similarly used, as part of the data size field. It is just that in practice one never sees a frame with so much data in it. Now, my comment here is directed toward bytes 0x44 through 0x48. I do not claim to know exactly what they mean. However, I would strongly suspect that they have something to do with contrast, color balance, intensity, and so on. Really, logic would seem to indicate that there is no other point to providing those entries, which certainly do vary from one frame to another and the readings in them do seem in some vague sense to have something to do with the local light conditions, and sucn. Therefore, confronted with my experience with these cameras, I would tend to suspect that "Post gamma or white balance correction seemed to be more part of the webcam capabilities than the image state" may not always be the case. For, here, with this camera, it appears that some kind of related information is being passed with each individual frame. Yes, we've seen that more often. In this case the solution is simple, since we need to do decompression in userspace anyways, just pass the entire frame including the header (with the potential interesting bytes) to userspace in the frame buffer, then userspace can get that info if it needs to. A bigger problem is when this happens and the cam generates a standard format like jpeg (with an additional header), but we haven't encountered cams like this yet, so lets not worry about that for now. Regards, Hans ' -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: RFC: Where to store camera properties (upside down, needs sw whitebalance, etc). ?
On Fri, 16 Jan 2009, Olivier Lorin wrote: Post gamma or white balance correction seemed to be more part of the webcam capabilities than the image state so that the new API to get these features is quite logical. Hmmm. While one is in the process of planning ahead, it it good to think of everything. You have not yet seen any code for the sq905c cameras in webcam mode, yet. Well, actually, you can if you want to. The needed sequence of operations is used in the support for "gphoto2 --capture-preview" in libgphoto2/camlibs/digigr8/library.c. What happens with this camera is, the frame data has been compressed and therefore it is needed to know how much data is present for a frame before downloading the rest of the frame. The length of the frame header is set at 0x50 bytes, so one downloads that first. Here is a sample of one such frame header: ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0010 ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0020 ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0030 ff 00 ff 00 ff 00 ff 00-ff 00 ff 00 ff 00 ff 00 0040 e0 5a 00 00 3b 3e 50 3b-36 00 ff 00 ff 00 ff 00 .Z..;>P;6... Now, most of this is just filler. The data size for the frame is to be found in bytes 0x40 and 0x41 and it says that 0x5ae0 bytes must be downloaded for this frame. I have never seen the next two bytes with anything in them, so my reasonable conjecture is that they are similarly used, as part of the data size field. It is just that in practice one never sees a frame with so much data in it. Now, my comment here is directed toward bytes 0x44 through 0x48. I do not claim to know exactly what they mean. However, I would strongly suspect that they have something to do with contrast, color balance, intensity, and so on. Really, logic would seem to indicate that there is no other point to providing those entries, which certainly do vary from one frame to another and the readings in them do seem in some vague sense to have something to do with the local light conditions, and sucn. Therefore, confronted with my experience with these cameras, I would tend to suspect that "Post gamma or white balance correction seemed to be more part of the webcam capabilities than the image state" may not always be the case. For, here, with this camera, it appears that some kind of related information is being passed with each individual frame. It is also more certainly the case that the camera has no other way to pass such information. In particular, there is no long initialization sequence. One just turns on the stream. Theodore Kilgore -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: RFC: Where to store camera properties (upside down, needs sw whitebalance, etc). ?
On Friday 16 January 2009, Olivier Lorin wrote: > The use of the buffer flags makes the life easier as this flag > is read for every image. So we can solve for the flip/rotation > issues with the help of two new buffer flags: V4L2_BUF_FLAG_NEEDS_HFLIP > and V4L2_BUF_FLAG_NEEDS_VFLIP. > > A driver has to set them properly. Does the rotation or flip(s) > apply to every image (e.g. sensor upside down) or change with frames > (e.g. Genesys webcams), that no more matters . > I can do the patch these days. > I do not remember if there is h/v flip functions in the libv4l, > maybe they have to be added. > > Regards, > Nol That sounds like a sensible approach. The flip code is already in libv4l but is currently controlled by a static table (v4lconvert_flags) of cameras that need it. It doesn't address the issue of whether libv4l should also provide gamma adjustment, auto white balance and auto gain for cameras that could benefit from it. Again that could be done with a static table but keeping the knowledge in libv4l in step with the list of supported cameras in the kernel won't be easy. Adam -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html