[{"id":21459,"web_url":"https://patchwork.libcamera.org/comment/21459/","msgid":"<20211130195938.cbav64v4pnez4vd4@uno.localdomain>","date":"2021-11-30T19:59:38","subject":"Re: [libcamera-devel] [PATCH v7 2/7] libcamera: Add ColorSpace\n\tfields to StreamConfiguration","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi David,\n\nOn Fri, Nov 26, 2021 at 10:40:40AM +0000, David Plowman wrote:\n> This is so that applications can choose appropriate color spaces which\n> will then be passed down to the V4L2 devices.\n>\n> The ColorSpace field is actually optional. If it is not set you will\n> get the driver's default color space.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  include/libcamera/stream.h |  3 +++\n>  src/libcamera/stream.cpp   | 19 +++++++++++++++++++\n>  2 files changed, 22 insertions(+)\n>\n> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> index 41ec02b1..f0ae7e62 100644\n> --- a/include/libcamera/stream.h\n> +++ b/include/libcamera/stream.h\n> @@ -12,6 +12,7 @@\n>  #include <string>\n>  #include <vector>\n>\n> +#include <libcamera/color_space.h>\n>  #include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/pixel_format.h>\n> @@ -47,6 +48,8 @@ struct StreamConfiguration {\n>\n>  \tunsigned int bufferCount;\n>\n> +\tstd::optional<ColorSpace> colorSpace;\n> +\n>  \tStream *stream() const { return stream_; }\n>  \tvoid setStream(Stream *stream) { stream_ = stream; }\n>  \tconst StreamFormats &formats() const { return formats_; }\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index b421e17e..b281c309 100644\n> --- a/src/libcamera/stream.cpp\n> +++ b/src/libcamera/stream.cpp\n> @@ -329,6 +329,25 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)\n>   * \\brief Requested number of buffers to allocate for the stream\n>   */\n>\n> +/**\n> + * \\var StreamConfiguration::colorSpace\n> + * \\brief The ColorSpace for this stream\n> + *\n> + * This field allows a ColorSpace to be selected for this Stream.\n> + *\n> + * The field is optional and an application can choose to leave it unset.\n> + * On some platforms, generateConfiguration() may provide default values\n\n\"On some platform\" might not be that helpful for application\ndevelopers. True, I've pushed for having ColorSpace optional, so you\ncan rightfully tell me to go look somewhere else :)\n\nLet's say that if a platform supports colorspaces (which I hope will\nsoon mean all platforms) then it is expected the field to be set after\na generateConfiguration().\n\n> + * here which the application can of course override.\n\ns/of course//\n\n> + *\n> + * If a specific ColorSpace is requested but the Camera cannot deliver it,\n> + * then the StreamConfiguration will be adjusted to a value that can be\n> + * delivered. In this case the validate() method will indicate via its\n> + * return value that the CameraConfiguration has been adjusted.\n> + *\n> + * Note that platforms will typically have different constraints on what\n> + * color spaces can be supported and in what combinations.\n> + */\n> +\n\nWith the above comments optionally considered\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n>  /**\n>   * \\fn StreamConfiguration::stream()\n>   * \\brief Retrieve the stream associated with the configuration\n> --\n> 2.30.2\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4E557BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 19:58:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 69DB360720;\n\tTue, 30 Nov 2021 20:58:50 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D4D0605C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 20:58:49 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 5ED8E20005;\n\tTue, 30 Nov 2021 19:58:46 +0000 (UTC)"],"Date":"Tue, 30 Nov 2021 20:59:38 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<20211130195938.cbav64v4pnez4vd4@uno.localdomain>","References":"<20211126104045.4756-1-david.plowman@raspberrypi.com>\n\t<20211126104045.4756-3-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211126104045.4756-3-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v7 2/7] libcamera: Add ColorSpace\n\tfields to StreamConfiguration","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>","Cc":"Tomasz Figa <tfiga@google.com>, libcamera-devel@lists.libcamera.org,\n\tHans Verkuil <hverkuil-cisco@xs4all.nl>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]