[libcamera-devel] [PATCH v3 13/16] libcamera: raspberry: Report sensor timestamp

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Apr 26 07:04:37 CEST 2021


Hi Jacopo,

Thank you for the patch.

On Wed, Apr 21, 2021 at 06:03:16PM +0200, Jacopo Mondi wrote:
> Report the sensor's timestamp in the Request metadata by using the
> Unicam::Image buffer timestamp as an initial approximation.
> 
> The buffer's timestamp is recorded at DMA-transfer time, and it does not
> theoretically matches the 'start of exposure' definition, but when used
> to compare two consecutive frames it gives an acceptable estimation of
> the sensor frame period duration.
> 
> Reviewed-by: Naushir Patuck <naush at raspberrypi.com>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 6c6d31f78c88..ac135f95de12 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1414,6 +1414,18 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)
>  			<< ", timestamp: " << buffer->metadata().timestamp;
>  
>  	if (stream == &unicam_[Unicam::Image]) {
> +		/*
> +		 * Record the sensor timestamp in the Request.
> +		 *
> +		 * \todo Do not assume the request in the front of the queue
> +		 * is the correct one
> +		 */
> +		Request *request = requestQueue_.front();
> +		ASSERT(request);
> +
> +		request->metadata().set(controls::SensorTimestamp,
> +					buffer->metadata().timestamp);
> +
>  		/*
>  		 * Lookup the sensor controls used for this frame sequence from
>  		 * DelayedControl and queue them along with the frame buffer.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list