Re: [PATCH v9 4/6] media: uvcvideo: Allow hw clock updates with buffers not full
From: Sergey Senozhatsky
Date: Wed Mar 15 2023 - 23:09:24 EST
On (23/03/15 14:30), Ricardo Ribalda wrote:
> With UVC 1.5 we get as little as one clock sample per frame. Which means
> that it takes 32 frames to move from the software timestamp to the
> hardware timestamp method.
>
> This results in abrupt changes in the timestamping after 32 frames (~1
> second), resulting in noticeable artifacts when used for encoding.
>
> With this patch we modify the update algorithm to work with whatever
> amount of values are available.
>
> Tested-by: HungNien Chen <hn.chen@xxxxxxxxxxxxx>
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> + * Have at least 1/4 of a second of timestamps before we
> + * try to do any calculation. Otherwise we do not have enough
> + * precision. This value was determined by running Android CTS
> + * on different devices.
> + * Dev_sof runs at 1KHz, and we have a fixed point precision of
> + * 16 bits.
> + */
> + if ((y2 - y1) < ( (1000 / 4) << 16))
A minor nit: extra space `( (` :)