[{"id":27228,"web_url":"https://patchwork.libcamera.org/comment/27228/","msgid":"<20230602154850.GL26944@pendragon.ideasonboard.com>","date":"2023-06-02T15:48:50","subject":"Re: [libcamera-devel] [PATCH v2 1/2] camera_sensor: ipa: core: Add\n\tCFA pattern to IPACameraSensorInfo","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Fri, Jun 02, 2023 at 02:23:57PM +0100, Naushir Patuck via libcamera-devel wrote:\n> Add a new cfaPattern field to the IPACameraSensorInfo to pass the\n> CFA/Bayer pattern for the current sensor configuration to the IPA.\n> This field takes a value from properties::draft::ColorFilterArrangementEnum.\n> \n> Populate cfaPattern in CameraSensor::sensorInfo(), called by the\n> pipeline handler before it calls ipa->init() and ipa->config().\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  include/libcamera/ipa/core.mojom | 10 ++++++++++\n>  src/libcamera/camera_sensor.cpp  |  3 +++\n>  2 files changed, 13 insertions(+)\n\nI like how we can do all this without touching any of the pipeline\nhandlers :-)\n\n> diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\n> index 5cef340d014c..af02efacf335 100644\n> --- a/include/libcamera/ipa/core.mojom\n> +++ b/include/libcamera/ipa/core.mojom\n> @@ -140,6 +140,15 @@ module libcamera;\n>   * image sensor\n>   */\n>  \n> +/**\n> + * \\var IPACameraSensorInfo::cfaPattern\n> + * \\brief The arrangement of colour filters on the image sensor\n> + *\n> + * This takes a value defined by properties::draft::ColorFilterArrangementEnum.\n> + * For non-Bayer colour sensors, the cfaPattern will be set to\n> + * properties::draft::ColorFilterArrangementEnum::RGB.\n\nThat's fine for now, but I think it would be nice to eventually add\nsupport for optional fields in mojom. Let's record this as a TODO:\n\n * \\todo Make this variable optional once mojom supports it, instead of using\n * RGB for sensors that don't have a CFA.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + */\n> +\n>  /**\n>   * \\var IPACameraSensorInfo::activeAreaSize\n>   * \\brief The size of the pixel array active area of the sensor\n> @@ -229,6 +238,7 @@ struct IPACameraSensorInfo {\n>  \tstring model;\n>  \n>  \tuint32 bitsPerPixel;\n> +\tuint32 cfaPattern;\n>  \n>  \tSize activeAreaSize;\n>  \tRectangle analogCrop;\n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 06f315210240..60bf87b49e6e 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -956,6 +956,9 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const\n>  \tinfo->bitsPerPixel = format.bitsPerPixel();\n>  \tinfo->outputSize = format.size;\n>  \n> +\tstd::optional<int32_t> cfa = properties_.get(properties::draft::ColorFilterArrangement);\n> +\tinfo->cfaPattern = cfa ? *cfa : properties::draft::RGB;\n> +\n>  \t/*\n>  \t * Retrieve the pixel rate, line length and minimum/maximum frame\n>  \t * duration through V4L2 controls. Support for the V4L2_CID_PIXEL_RATE,","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 5D8DDC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Jun 2023 15:48:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C63D5626FA;\n\tFri,  2 Jun 2023 17:48:54 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DEB9A61EA8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Jun 2023 17:48:52 +0200 (CEST)","from pendragon.ideasonboard.com (om126156168104.26.openmobile.ne.jp\n\t[126.156.168.104])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 45482844;\n\tFri,  2 Jun 2023 17:48:28 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685720934;\n\tbh=Dmz1aLrI0lVOZT2qwyMNbZvOsF4YVr37LueBLJEIcpw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=jUwAe8P6kR5IvQR49ouKV1TqOSCBvpO291EKTR25J4vNnGePTkoGAyNoHeWs2EQsh\n\tNs+Jn7KezSECL+e0ExIGUhJNEtA6qruu9Jx7O/Z5ibVsIeyPg8KXaVQzMxTSDli1do\n\tIjwlVUSPxFKlG3We8cuU7EmykQsezf++y2hClemWpFFxK/yCnJGe5rQYhtkAV/6SD8\n\tbdNboTbnFQVU95pcZFIiTZlSs4cHMV2tJAVoIbYgAeXoT1sx85fAQ2MYcvUrREqFL7\n\tlqXlUJr9IJC4yHjbxNLwdymEuDB8BK9TAtHiS9eF8c2qdpta7K2vre6pKMEEiAL84f\n\ttXp677oICTx1Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1685720910;\n\tbh=Dmz1aLrI0lVOZT2qwyMNbZvOsF4YVr37LueBLJEIcpw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=js4sA/V82jfY1gluPaoBl4hzWJpvw/qsNqGldUaEpPd3f7xS8RRm0hwUFWW7/H8zF\n\tXRV3vm+FCBgPEDE64InanaTnuXueLJQf2QSOZicQXsasKDjZNxLWM2p7LetccpCje0\n\t/gCtPju0b8vY4fjbkSEF3fBOQgULKNwoU1l3KvDY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"js4sA/V8\"; dkim-atps=neutral","Date":"Fri, 2 Jun 2023 18:48:50 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<20230602154850.GL26944@pendragon.ideasonboard.com>","References":"<20230602132358.16314-1-naush@raspberrypi.com>\n\t<20230602132358.16314-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230602132358.16314-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] camera_sensor: ipa: core: Add\n\tCFA pattern to IPACameraSensorInfo","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]