[libcamera-devel] GSoC2022 application from yyang: Adding UVC hardware timestamp support

杨 洋 yyangoO at outlook.com
Thu Apr 14 14:40:21 CEST 2022


Hello everyone,

    My name is Y Yang. I'm a student at Shanghai Jiaotong University who want to be a contributor of open source community by participating libcamera's GSoC2022 project.

    I really hope to get some feedback from you on the project 'Adding UVC hardware timestamp support'.

    Currently I've build libcamera and finished a test application (https://github.com/yyangoO/libcamera-tests) which can print each request's timestamp and it's buffers' timestamp. I've read the linux kernel's document of V4L2 and the UVC timestamp conversion function in  linux kernel. Here is my thoughts of this project:

    The UVC timestamp conversion function in linux kernel convert UVC device' timestamp to host timestamp by using USB SOF clock as the 'bridge'. Since the relationship between device and SOF, SOF and host are linear, if we get the more detail of linear function, we can get more accurate timestamp.

    The linux kernel maintain some sample UVC clocks, every time it uses two sample clocks as the two ends to calculate linear function. Then use the linear function to finish the conversion. We can do this similarily in our project.

    By reading linux kernl's document, I found that we can get UVC payload header data by using `V4L2_META_FMT_UVC` of V4L2. From UVC payload header data, we can get the SOF, STC and PTS of each frame we need.

    In libcamera, we update the request's sensor timestamp in UVC video pipeline by using the timestamp sampled by the linux kernel when it completes the buffer. We can make request's sensor timestamp more accutate by using the conversion function.

   Here is my thought, add a function in v4l2_videodevice in libcamera so that we can get the UVC Payload Header Data. Maintain some sample clock in the UVC camera data of pipeline, and using the UVC Payload Header Data and conversion function to calculate more accurate timestamp.

    And I've finished my proposal in the email attachment, I really hope to get some feedback so that I can perfect my proposal.

Best wishes for everyone

Y Yang


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220414/1c1551ff/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcmaera-improving-uvc-timestamp-proposal-yyang.pdf
Type: application/pdf
Size: 98006 bytes
Desc: libcmaera-improving-uvc-timestamp-proposal-yyang.pdf
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220414/1c1551ff/attachment-0001.pdf>


More information about the libcamera-devel mailing list