[{"id":3402,"web_url":"https://patchwork.libcamera.org/comment/3402/","msgid":"<20200110234052.GE4859@pendragon.ideasonboard.com>","date":"2020-01-10T23:40:52","subject":"Re: [libcamera-devel] [PATCH v3 07/33] libcamera: buffer: Add\n\tFrameMetadata container for metadata information","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Fri, Jan 10, 2020 at 08:37:42PM +0100, Niklas Söderlund wrote:\n> With the introduction of FrameBuffer objects, the metadata information\n> related to captured frames will not be stored directly in the frame\n> buffer object. Add a new FrameMetadata class to hold this information.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n> * Changes since v2\n> - Clarify documentation for values in enum FrameMetadata::Status members.\n> - Improved documentation.\n> - Added todo to improve FrameMetadata::timestamp descripton.\n> \n> * Changes since v1:\n> - Rename BufferInfo to FrameMetadata\n> - Rename prefix for BufferInfo::Status s/Buffer/Frame/\n> - Make FrameMetadata a struct with public data members instead of a\n>   class with accessors methods.\n> - Dropped FrameMetadata::update()\n> - Documentation updates\n> ---\n>  include/libcamera/buffer.h | 17 +++++++++\n>  src/libcamera/buffer.cpp   | 73 ++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 90 insertions(+)\n> \n> diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\n> index 80602124f24be4a0..0b95e41a2dd205b2 100644\n> --- a/include/libcamera/buffer.h\n> +++ b/include/libcamera/buffer.h\n> @@ -16,6 +16,23 @@ namespace libcamera {\n>  class Request;\n>  class Stream;\n>  \n> +struct FrameMetadata {\n> +\tenum Status {\n> +\t\tFrameSuccess,\n> +\t\tFrameError,\n> +\t\tFrameCancelled,\n> +\t};\n> +\n> +\tstruct Plane {\n> +\t\tunsigned int bytesused;\n> +\t};\n> +\n> +\tStatus status;\n> +\tunsigned int sequence;\n> +\tuint64_t timestamp;\n> +\tstd::vector<Plane> planes;\n> +};\n> +\n>  class Plane final\n>  {\n>  public:\n> diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\n> index 960eeb8f7d193ddd..b7bc948c80748b18 100644\n> --- a/src/libcamera/buffer.cpp\n> +++ b/src/libcamera/buffer.cpp\n> @@ -23,6 +23,79 @@ namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(Buffer)\n>  \n> +/**\n> + * \\struct FrameMetadata\n> + * \\brief Metadata related to a captured frame\n> + *\n> + * The FrameMetadata structure stores all metadata related to a captured frame,\n> + * as stored in a FrameBuffer, such as capture status, timestamp and bytesused.\n> + */\n> +\n> +/**\n> + * \\enum FrameMetadata::Status\n> + * \\brief Define the frame completion status\n> + * \\var FrameMetadata::FrameSuccess\n> + * The frame has been captured with success and contains valid data. All fields\n> + * of the FrameMetadata structure are valid.\n> + * \\var FrameMetadata::FrameError\n> + * An error occurred during capture of the frame. The frame data may be partly\n> + * or fully invalid. The sequence and timestamp fields of the FrameMetadata\n> + * structure is valid, the other fields may be invalid.\n> + * \\var FrameMetadata::FrameCancelled\n> + * Capture stopped before the frame completed. The frame data is not valid. All\n> + * fields of the FrameMetadata structure are invalid.\n\n\"all fields of the FrameMetadata structure but the status field are\ninvalid.\"\n\nPlease keep my tag.\n\n> + */\n> +\n> +/**\n> + * \\struct FrameMetadata::Plane\n> + * \\brief Per-plane frame metadata\n> + *\n> + * Frames are stored in memory in one or multiple planes. The\n> + * FrameMetadata::Plane structure stores per-plane metadata.\n> + */\n> +\n> +/**\n> + * \\var FrameMetadata::Plane::bytesused\n> + * \\brief Number of bytes occupied by the data in the plane, including line\n> + * padding\n> + *\n> + * This value may vary per frame for compressed formats. For uncompressed\n> + * formats it will be constant for all frames, but may be smaller than the\n> + * FrameBuffer size.\n> + */\n> +\n> +/**\n> + * \\var FrameMetadata::status\n> + * \\brief Status of the frame\n> + *\n> + * The validity of other fields of the FrameMetadata structure depends on the\n> + * status value.\n> + */\n> +\n> +/**\n> + * \\var FrameMetadata::sequence\n> + * \\brief Frame sequence number\n> + *\n> + * The sequence number is a monotonically increasing number assigned to the\n> + * frames captured by the stream. The value is increased by one for each frame.\n> + * Gaps in the sequence numbers indicate dropped frames.\n> + */\n> +\n> +/**\n> + * \\var FrameMetadata::timestamp\n> + * \\brief Time when the frame was captured\n> + *\n> + * The timestamp is expressed as a number of nanoseconds relative to the system\n> + * clock since an unspecified time point.\n> + *\n> + * \\todo Be more precise on what timestamps refer to.\n> + */\n> +\n> +/**\n> + * \\var FrameMetadata::planes\n> + * \\brief Array of per-plane metadata\n> + */\n> +\n>  /**\n>   * \\class Plane\n>   * \\brief A memory region to store a single plane of a frame","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 54DF26067C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 11 Jan 2020 00:41:07 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B5A8652F;\n\tSat, 11 Jan 2020 00:41:06 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578699666;\n\tbh=pCofJ5XDxoY0M2lShvPF1lA3w0BZ307agJMS0las3Kc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Q5ozZW77a8j9sdRXIEWNm7ElbXgQ0mWfIVz+3LtEnbFLWkpCfTx9mb1pGHzvOSaPe\n\tM4Sx6iNTESA06dC6UfwfAyJRXQxh3cXmWTlh1FFthhjpzpVfmLtRhV36CZg8Svz5M3\n\t47LR5Ah7YxEvNQf9osNWvuWRG65lRaoxmkKGk7NQ=","Date":"Sat, 11 Jan 2020 01:40:52 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org, Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200110234052.GE4859@pendragon.ideasonboard.com>","References":"<20200110193808.2266294-1-niklas.soderlund@ragnatech.se>\n\t<20200110193808.2266294-8-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200110193808.2266294-8-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 07/33] libcamera: buffer: Add\n\tFrameMetadata container for metadata information","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 10 Jan 2020 23:41:07 -0000"}}]