[{"id":25308,"web_url":"https://patchwork.libcamera.org/comment/25308/","msgid":"<Yz186s7WVb6Tm2tC@pendragon.ideasonboard.com>","date":"2022-10-05T12:47:38","subject":"Re: [libcamera-devel] [PATCH] pipeline: raspberrypi: Update naming\n\tconvention for tuning files","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 Wed, Oct 05, 2022 at 12:31:45PM +0100, Naushir Patuck via libcamera-devel wrote:\n> Append \"_mono\" to the sensor name when generating the tuning filename for\n> monochrome sensor variants. So the new naming convention is as follows:\n> \n> <sensor_name>.json - Standard colour sensor variant\n> <sensor_name>_mono.json - Monochrom sensor variant\n\ns/Monochrom/Monochrome/\n\nI'll fix this small issue when applying.\n\n> Rename the existing imx296.json file to imx296_mono.json as this tuning file\n> is based on the monochrome variant of the IMX296.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  .../data/{imx296.json => imx296_mono.json}     |  0\n>  src/ipa/raspberrypi/data/meson.build           |  2 +-\n>  .../pipeline/raspberrypi/raspberrypi.cpp       | 18 +++++++++++++++---\n>  3 files changed, 16 insertions(+), 4 deletions(-)\n>  rename src/ipa/raspberrypi/data/{imx296.json => imx296_mono.json} (100%)\n> \n> diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296_mono.json\n> similarity index 100%\n> rename from src/ipa/raspberrypi/data/imx296.json\n> rename to src/ipa/raspberrypi/data/imx296_mono.json\n> diff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build\n> index 211811cfa915..465a7a17ce6f 100644\n> --- a/src/ipa/raspberrypi/data/meson.build\n> +++ b/src/ipa/raspberrypi/data/meson.build\n> @@ -4,7 +4,7 @@ conf_files = files([\n>      'imx219.json',\n>      'imx219_noir.json',\n>      'imx290.json',\n> -    'imx296.json',\n> +    'imx296_mono.json',\n>      'imx378.json',\n>      'imx477.json',\n>      'imx477_noir.json',\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index dcd81650c32d..5d77715f3448 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -67,6 +67,14 @@ SensorFormats populateSensorFormats(std::unique_ptr<CameraSensor> &sensor)\n>  \treturn formats;\n>  }\n>  \n> +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> +{\n> +\tunsigned int mbusCode = sensor->mbusCodes()[0];\n> +\tconst BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> +\n> +\treturn bayer.order == BayerFormat::Order::MONO;\n> +}\n> +\n>  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n>  \t\t\t\t  BayerFormat::Packing packingReq)\n>  {\n> @@ -1551,10 +1559,14 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n>  \t */\n>  \tstd::string configurationFile;\n>  \tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> -\tif (!configFromEnv || *configFromEnv == '\\0')\n> -\t\tconfigurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n> -\telse\n> +\tif (!configFromEnv || *configFromEnv == '\\0') {\n> +\t\tstd::string model = sensor_->model();\n> +\t\tif (isMonoSensor(sensor_))\n> +\t\t\tmodel += \"_mono\";\n> +\t\tconfigurationFile = ipa_->configurationFile(model + \".json\");\n> +\t} else {\n>  \t\tconfigurationFile = std::string(configFromEnv);\n> +\t}\n>  \n>  \tIPASettings settings(configurationFile, sensor_->model());\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 6C502BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 12:47:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B567C6236C;\n\tWed,  5 Oct 2022 14:47:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0593D601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 14:47:42 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F95E415;\n\tWed,  5 Oct 2022 14:47:41 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664974063;\n\tbh=tl2weGX/4nT56+paCoHnfYCKvuqrqHbCwCEHVPVygEw=;\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=elf7rEkFDboxELiDSZxZ7Ugr2F8rJU1gaMP7P/hZtfUNmqIgA3WUAzdH+OLsw9BDW\n\tBo59PqrrMiTkqLgsYfc2LG8WXYV5va2ZSCJ/azUbNcov8Y82OEplR3E0x9B0Y0JX6o\n\t+LBsPXomNVZ+JSuxLZYZBoEsMa996ZAu9B4JWGJxWD6N9j04B3atNSM4VLy7UyAFX/\n\t9vrWYQGKHfTcW3Mx6kgiqzrJV7gq/UAOtMdt7/0frwzEEQLdWdl08Ilk+FYHbWRlPu\n\tTUpa198HKujTUDgKhQxIc+OEp4hAxdZ3oJgAMSOgp1MKvIAl5vOUAgZId0qsJeqFBh\n\t/ugktwlV1DZUw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664974061;\n\tbh=tl2weGX/4nT56+paCoHnfYCKvuqrqHbCwCEHVPVygEw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Qk8vjwXzj92tuOdsm9q92jTb19b2MVtzPWnn7ocmdm6TZQuM/PFozhoy7TbWgGBIA\n\tcd5IUvx1nDX0w30/KaXjJ4u3qp0AxGLCPH1Ggjp5sDucXzDGP9we+6a6I7CHTe9LyM\n\tnBv+RTOw5tShC7D7Qa293gGqBO+J6smhJDVp+aok="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Qk8vjwXz\"; dkim-atps=neutral","Date":"Wed, 5 Oct 2022 15:47:38 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<Yz186s7WVb6Tm2tC@pendragon.ideasonboard.com>","References":"<20221003095558.1993-3-naush@raspberrypi.com>\n\t<20221005113145.9325-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221005113145.9325-1-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH] pipeline: raspberrypi: Update naming\n\tconvention for tuning files","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>"}}]