Skip to contentSkip to conversation

media: uvcvideo: Fix annotation for uvc_video_clock_update()

PATCH In review Jun Chen 2 participants 2 messages Dec 25, 2019 – Jan 1, 2020

Subsystems (2)
lore
Share & tools
lore

Jun Chen

author
#0 lore raw

PATCH 1/1 media: uvcvideo: Fix annotation for uvc_video_clock_update()

From: Jun Chen <[email protected]>

The formula (2) is to convert from SOF to host clock,
it should be fix as
"TS = ((TS2 - TS1) * SOF + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)"

---
 drivers/media/usb/uvc/uvc_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_video.c +1 -1
index 8fa77a8..a3150da 100644
@@ -622,7 +622,7 @@ static u16 uvc_video_clock_host_sof(const struct uvc_clock_sample *sample)
  * to avoid losing precision in the division. Similarly, the host timestamp is
  * computed with
  *
- * TS = ((TS2 - TS1) * PTS + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)	     (2)
+ * TS = ((TS2 - TS1) * SOF + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)	     (2)
  *
  * SOF values are coded on 11 bits by USB. We extend their precision with 16
  * decimal bits, leading to a 11.16 coding.
Signature · 1 line
1.9.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hello Jun,

Thank you for the patch.

Quoted 7 lines · Jun Chen

From: Jun Chen <[email protected]>

The formula (2) is to convert from SOF to host clock,
it should be fix as
"TS = ((TS2 - TS1) * SOF + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)"

and applied to my tree.

Quoted 17 lines
---
 drivers/media/usb/uvc/uvc_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_video.c +1 -1
index 8fa77a8..a3150da 100644
@@ -622,7 +622,7 @@ static u16 uvc_video_clock_host_sof(const struct uvc_clock_sample *sample)
  * to avoid losing precision in the division. Similarly, the host timestamp is
  * computed with
  *
- * TS = ((TS2 - TS1) * PTS + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)	     (2)
+ * TS = ((TS2 - TS1) * SOF + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)	     (2)
  *
  * SOF values are coded on 11 bits by USB. We extend their precision with 16
  * decimal bits, leading to a 11.16 coding.
Signature · 3 lines
Regards,

Laurent Pinchart