[{"id":11528,"web_url":"https://patchwork.libcamera.org/comment/11528/","msgid":"<20200724003846.GH21353@pendragon.ideasonboard.com>","date":"2020-07-24T00:38:46","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: raspberrypi: Add\n\tColourCorrectionMatrix control","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Sat, Jul 04, 2020 at 10:59:13AM +0100, David Plowman wrote:\n> Implements, for the Raspberry Pi platform, the returning of the CCM\n> (Colour Correction Matrix) used by the pipeline in the libcamera\n> metadata.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  include/libcamera/ipa/raspberrypi.h | 1 +\n>  src/ipa/raspberrypi/raspberrypi.cpp | 9 +++++++++\n>  2 files changed, 10 insertions(+)\n> \n> diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\n> index a18ce9a..2682319 100644\n> --- a/include/libcamera/ipa/raspberrypi.h\n> +++ b/include/libcamera/ipa/raspberrypi.h\n> @@ -52,6 +52,7 @@ static const ControlInfoMap RPiControls = {\n>  \t{ &controls::Contrast, ControlInfo(0.0f, 32.0f) },\n>  \t{ &controls::Saturation, ControlInfo(0.0f, 32.0f) },\n>  \t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n> +\t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index bc89ab5..592bb04 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -404,6 +404,15 @@ void IPARPi::reportMetadata()\n>  \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n>  \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n>  \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_b) });\n> +\n> +\tCcmStatus *ccmStatus = rpiMetadata_.GetLocked<CcmStatus>(\"ccm.status\");\n> +\tif (ccmStatus) {\n> +\t\tfloat m[9];\n> +\t\tint i;\n> +\t\tfor (i = 0; i < 9; i++)\n\n\t\tfor (unsigned int i = 0; i < 9; i++)\n\n> +\t\t\tm[i] = ccmStatus->matrix[i];\n\nor now that I think about it, may\n\n\t\tfor (double v : ccmStatus->matrix)\n\t\t\tm[i++] = v;\n\nor\n\n\t\tstd::transform(std::begin(ccmStatus->matrix),\n\t\t\t       std::end(ccmStatus->matrix), std::begin(m),\n\t\t\t       [](double v) { return static_cast<float>(v); });\n\nif you think any of those two would be better.\n\nWhich option do you like best ?\n\n> +\t\tlibcameraMetadata_.set(controls::ColourCorrectionMatrix, m);\n> +\t}\n>  }\n>  \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 94006BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Jul 2020 00:38:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F1D461167;\n\tFri, 24 Jul 2020 02:38:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 28BAD60539\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jul 2020 02:38:53 +0200 (CEST)","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 8B4F1279;\n\tFri, 24 Jul 2020 02:38:52 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pPTM40T/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1595551132;\n\tbh=tiTQZbp7ug2+czBDlfQaTCK4PvkC9ZBDP/4q+VvtuT0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pPTM40T/AOrbRuiuDPoS2GWMhvw+ObW5mwePfnnRoFJaC0PUShQu5f0HEdw0aVQsI\n\t6jhg12Vhmn0GsJHx9fotGvO3XNS1xrgZmR2uTsOQd84iQ+LMZ7qK2qoeD1H8p5Sq1S\n\tV2ugBTPEkop2uJ1xhlWjIpTYX89bevLB/yuVDGlQ=","Date":"Fri, 24 Jul 2020 03:38:46 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<20200724003846.GH21353@pendragon.ideasonboard.com>","References":"<20200704095914.17344-1-david.plowman@raspberrypi.com>\n\t<20200704095914.17344-3-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200704095914.17344-3-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: raspberrypi: Add\n\tColourCorrectionMatrix control","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":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]