[{"id":25235,"web_url":"https://patchwork.libcamera.org/comment/25235/","msgid":"<CAHW6GYKqeuy9TFY0bTLJxuNYCFFSXeyhJO8-3tO-+Qi6XsBoAQ@mail.gmail.com>","date":"2022-10-03T09:57:54","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention for tuning files","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for fixing the typo!\n\nOn Mon, 3 Oct 2022 at 10:56, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\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>\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\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\n> ---\n>  .../data/{imx296.json => imx296_mono.json}    |  0\n>  src/ipa/raspberrypi/data/meson.build          |  2 +-\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++++++++----\n>  3 files changed, 17 insertions(+), 5 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..39a1c798df2e 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>         return formats;\n>  }\n>\n> +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> +{\n> +       unsigned int mbusCode = sensor->mbusCodes()[0];\n> +       const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> +\n> +       return bayer.order == BayerFormat::Order::MONO;\n> +}\n> +\n>  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n>                                   BayerFormat::Packing packingReq)\n>  {\n> @@ -1551,12 +1559,16 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n>          */\n>         std::string configurationFile;\n>         char const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> -       if (!configFromEnv || *configFromEnv == '\\0')\n> -               configurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n> -       else\n> +       std::string model = sensor_->model();\n> +       if (!configFromEnv || *configFromEnv == '\\0') {\n> +               if (isMonoSensor(sensor_))\n> +                       model += \"_mono\";\n> +               configurationFile = ipa_->configurationFile(model + \".json\");\n> +       } else {\n>                 configurationFile = std::string(configFromEnv);\n> +       }\n>\n> -       IPASettings settings(configurationFile, sensor_->model());\n> +       IPASettings settings(configurationFile, model);\n>\n>         return ipa_->init(settings, result);\n>  }\n> --\n> 2.25.1\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 4B0F2BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Oct 2022 09:58:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D95EB62CEC;\n\tMon,  3 Oct 2022 11:58:07 +0200 (CEST)","from mail-pl1-x633.google.com (mail-pl1-x633.google.com\n\t[IPv6:2607:f8b0:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC82D62CE4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Oct 2022 11:58:06 +0200 (CEST)","by mail-pl1-x633.google.com with SMTP id 10so5628874pli.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 03 Oct 2022 02:58:06 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664791087;\n\tbh=KQkcuY8DJpICKkq03c9KZ+zej+v0FUYSc+F0XS7ybpQ=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=rC5lFeH2VvDR7TZL6M6ADPU3zKGxdDMfZ1pJ68WCrc8o1cEkXk6npFHzHBcK7D+ek\n\tN47IKLPU75FR2B3Vi0Ie860eL9QJpMZqpDBdZA7MPDWzdz2IXctoBKTM1DDejN+wj7\n\tBeo3NRUQLpN+W+oGoD1TycA2CJiqbMWfKzwAQc9ojMjXRoaPkZwFGJgMWzKOElEo2P\n\tyqAbNuBO5LC4LCXFoZBb45u300t+cnWjII8nT4HLQfnuzP/1f0JGPA8GQZwCiPKDUy\n\tdU8iXJYsQrRQGQ52SrQgN5+MvgjqFu/0Pe9bhrkkjyAuBimg+sCpWwxJdx6wa3OR9m\n\tE5VEFKzKa6rFg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=+c29yYEkY1N2k8OT2scjIW9BG+/YHWJkEN05gYYwudk=;\n\tb=tEbU5BgHnuELJ8OGJXbi18tdi5PEmvdQiQJhhVrkpmvpVd1cSdqVb007rgUZLwBHL/\n\t1je/WQyqq3IYoe7nZwRZfT6D/FneCyMf7S+7piV24fPZRr33gS8FTVgLrt0QBJEJNB/c\n\tXyJpMut8EQYjvoWOaZhvvOts2FMWU0OtaBPBeq4rg4IPeVGddiSZrNJcqmathho028Yn\n\tfjMsMGHlEhQYpuH1Bf7gR/cnLI2M6a5ZPwONOw66gpa3xPU1oeBWHwvk1Me3Ya+U4Osz\n\tQE+qzDNjVxDX03/J4Msox2Y6lBbzhMuOWqqdpJ9iXNj28qarnst5xt2wdBgREFjVYF7r\n\tgE4Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"tEbU5BgH\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=+c29yYEkY1N2k8OT2scjIW9BG+/YHWJkEN05gYYwudk=;\n\tb=l36dv0/UDaM7JNFTonpF3Er0wP0qImlKbGcTRtXweAO4PD4+wCOlsn0U0GHyCzMbKw\n\t8nkIPgMvAf0kgg8zsNlliUrYeYseaMi79v98pOTnDGbfsFVopvUI7UMrlIX+ZqGyKwlc\n\t9hf+yK+0J0DM9MG6vaX5jf5DlNBTKAAuecf/sFnVCSsShwzTKxGrQ6esjR34UFBWLucI\n\tA5n57cFgalkThOHAiWczklp6VQeXOLez84WOmJ6wtZS95d8oPkx9jl8MHwFkG0dKn0/n\n\tmHGGIZWDKVOWsJdEqjecDhRIRGBpDfRPqTajxdq65RnzrKT8HPbdFbvdPOiB8mRTJdXU\n\tu7yw==","X-Gm-Message-State":"ACrzQf3mb5xn9Ik8REOZPnNu3Uv+yeDop+0YMbvN33bcj80EfTtpHfoV\n\tN0HxQ94I2L/bJxkSl8RGNpN0xJILY1MH6pF0OdXtr+p2ye4=","X-Google-Smtp-Source":"AMsMyM54+OkzQwUYMcHPxWrrh1KbULa934SOg4leY1eM+MJQCKyQ/e0aXG9LhDDK28njhn8cQUgKQt4PKqaUP8ax4cA=","X-Received":"by 2002:a17:902:ce81:b0:178:8e0a:5615 with SMTP id\n\tf1-20020a170902ce8100b001788e0a5615mr21786949plg.109.1664791085529;\n\tMon, 03 Oct 2022 02:58:05 -0700 (PDT)","MIME-Version":"1.0","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>","In-Reply-To":"<20221003095558.1993-3-naush@raspberrypi.com>","Date":"Mon, 3 Oct 2022 10:57:54 +0100","Message-ID":"<CAHW6GYKqeuy9TFY0bTLJxuNYCFFSXeyhJO8-3tO-+Qi6XsBoAQ@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25277,"web_url":"https://patchwork.libcamera.org/comment/25277/","msgid":"<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>","date":"2022-10-04T19:43:01","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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 Mon, Oct 03, 2022 at 10:55:56AM +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> \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\nWe'll still have to figure out how to identify camera module, but that's\nfine, we don't have to solve all issues in one go.\n\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  .../data/{imx296.json => imx296_mono.json}    |  0\n>  src/ipa/raspberrypi/data/meson.build          |  2 +-\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++++++++----\n>  3 files changed, 17 insertions(+), 5 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..39a1c798df2e 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,12 +1559,16 @@ 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> +\tstd::string model = sensor_->model();\n> +\tif (!configFromEnv || *configFromEnv == '\\0') {\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> +\tIPASettings settings(configurationFile, model);\n\nThe model will be suffixed by \"_mono\" only when the\nLIBCAMERA_RPI_TUNING_FILE environment variable isn't set. Is that on\npurpose ?\n\n>  \n>  \treturn ipa_->init(settings, result);\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 782D5BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Oct 2022 19:43:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 424B460AB7;\n\tTue,  4 Oct 2022 21:43:06 +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 1957E601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Oct 2022 21:43:05 +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 990AC2D9;\n\tTue,  4 Oct 2022 21:43:04 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664912586;\n\tbh=Lsnumg5pgnbTXhUUh7x4+DeIkKr3oD1HiHOaZxMRBe4=;\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=4WMN5MuJ9zhuh6uUboVjyoCnh5dtzkxMGRpHD3/TBwJLnq70uvaYPqjnT/JDOTLgQ\n\tV1mDHPhtbiFo+i4kVxlssxZgsbU2xWNmVCDwksKyxq8X9fLq4bhlIl89m7G4JDHMSx\n\t1bF3XtnhJxt//Yd/iYTUnDUcQuQDr1h/OFtVbluKK1kV7F5iJLJeGSw73DW+1wHWDB\n\trAjrP6lDeVgxdpr6K5cDY0/mEo769776GWQ9RKkccOcXdwvXKZUFJtT2AE/yLtRM/G\n\t3zTECtJzGpHj8ZbeINHzjMV10pQoMtQW3/yrMrpKrk7m6CLwXS4Hh1wvnhtfmNrXfI\n\tx4PuK8WLUOWZQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664912584;\n\tbh=Lsnumg5pgnbTXhUUh7x4+DeIkKr3oD1HiHOaZxMRBe4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aCyJ4aDo+RGBfO5rsuKDLhWxclaDUUyUNTWtuvQzwMdoH46p22IsPfuVSzuWrdUJv\n\t4H8RvgjzR4fKAjS1YTbZC0mGq+eNiPAbHup0Le8dEftvzig8aJjkTPR5uHVbraGyTp\n\tMgLzaZ860Kn5PsS+4dqTABn69jmhNs8iRhHdv48Y="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aCyJ4aDo\"; dkim-atps=neutral","Date":"Tue, 4 Oct 2022 22:43:01 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221003095558.1993-3-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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>"}},{"id":25288,"web_url":"https://patchwork.libcamera.org/comment/25288/","msgid":"<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>","date":"2022-10-05T09:50:19","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention for tuning files","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nThanks for all the reviews!\n\nOn Tue, 4 Oct 2022 at 20:43, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> Thank you for the patch.\n>\n> On Mon, Oct 03, 2022 at 10:55:56AM +0100, Naushir Patuck via\n> 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> >\n> > Rename the existing imx296.json file to imx296_mono.json as this tuning\n> file\n> > is based on the monochrome variant of the IMX296.\n>\n> We'll still have to figure out how to identify camera module, but that's\n> fine, we don't have to solve all issues in one go.\n>\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  .../data/{imx296.json => imx296_mono.json}    |  0\n> >  src/ipa/raspberrypi/data/meson.build          |  2 +-\n> >  .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++++++++----\n> >  3 files changed, 17 insertions(+), 5 deletions(-)\n> >  rename src/ipa/raspberrypi/data/{imx296.json => imx296_mono.json} (100%)\n> >\n> > diff --git a/src/ipa/raspberrypi/data/imx296.json\n> 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\n> 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\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index dcd81650c32d..39a1c798df2e 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -67,6 +67,14 @@ SensorFormats\n> populateSensorFormats(std::unique_ptr<CameraSensor> &sensor)\n> >       return formats;\n> >  }\n> >\n> > +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> > +{\n> > +     unsigned int mbusCode = sensor->mbusCodes()[0];\n> > +     const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> > +\n> > +     return bayer.order == BayerFormat::Order::MONO;\n> > +}\n> > +\n> >  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n> >                                 BayerFormat::Packing packingReq)\n> >  {\n> > @@ -1551,12 +1559,16 @@ int\n> RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n> >        */\n> >       std::string configurationFile;\n> >       char const *configFromEnv =\n> utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> > -     if (!configFromEnv || *configFromEnv == '\\0')\n> > -             configurationFile =\n> ipa_->configurationFile(sensor_->model() + \".json\");\n> > -     else\n> > +     std::string model = sensor_->model();\n> > +     if (!configFromEnv || *configFromEnv == '\\0') {\n> > +             if (isMonoSensor(sensor_))\n> > +                     model += \"_mono\";\n> > +             configurationFile = ipa_->configurationFile(model +\n> \".json\");\n> > +     } else {\n> >               configurationFile = std::string(configFromEnv);\n> > +     }\n> >\n> > -     IPASettings settings(configurationFile, sensor_->model());\n> > +     IPASettings settings(configurationFile, model);\n>\n> The model will be suffixed by \"_mono\" only when the\n> LIBCAMERA_RPI_TUNING_FILE environment variable isn't set. Is that on\n> purpose ?\n>\n\nYes, this is intentional, Jacopo queried the same thing :)\n\nIf a user specifies the LIBCAMERA_RPI_TUNING_FILE env argument,\nwe expect them to provide the exact filename that must be used including\npath and all. This user provided filename may have not resemblance to the\nsensor model either.  So it will never be modified with variant suffixes.\n\nRegards,\nNaush\n\n\n>\n> >\n> >       return ipa_->init(settings, result);\n> >  }\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 73EFDBD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 09:50:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ACC8F621BC;\n\tWed,  5 Oct 2022 11:50:37 +0200 (CEST)","from mail-lj1-x232.google.com (mail-lj1-x232.google.com\n\t[IPv6:2a00:1450:4864:20::232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5491F60A88\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 11:50:36 +0200 (CEST)","by mail-lj1-x232.google.com with SMTP id t16so18127568ljh.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 05 Oct 2022 02:50:36 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664963437;\n\tbh=/slm+Z/sBd5JDwfJICu7ug2Z3A07KXE6s+xnCcm23nI=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=xO2RQ+rtpfjSuBT15a5Rn213j+svlEA0/qjHShgY8msUYx0fNuWzqAZZY4YbzMOJC\n\tj+QoX/YoBOc2UZsmZDdgrzT1KPMMTaB/1QJo6un/cyIlQtHXdVk1sTTmx/J7Biu1Tn\n\tKH9cHbKWxx9Jtqlx0IALxeIjkPlH/62DJuLwgISaLX+zu/iwavK6nQj3s+9HD0ScgL\n\tMPllYwOF0Lsz0+lqwwy7pWirDMGyQmYFiKxsUsGQYV3C6KIZ6oJaQVaz8S9Db8J5PS\n\tvsUy4qCaFmiJgjycPGMbK4TzUsI/XBpOkh7rXxrhytgmy2iOXg0saQBaUvuqPay8qQ\n\t+FkUf4E8lTFig==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=h7/T74BPWBV+wxsrI/3cmR4c/64hakfpmlDwpxvyZ70=;\n\tb=EU2KsOSNi62CQpzkp6dHqsqlib+XU/Dmgyh/TM6mvDCUf4MLxX97tzDwEyw4H54sLe\n\t/NhRnGk7s9Xj7dI8bf6vtFTpuxronyIsgeZ/5KkU4bPfwhOJqGi4F64Gu7GegFqIbQZR\n\tlf1VQqBzDdgTlZs8ZXZGpEk5knvminA3zMcn5AtJOcaVsA1oJaDsBXfnFPZ0N04uRgNv\n\tMReKES/PBLNXqz7PACcbHtCybWsc8bQDEZ8Q7HJgfLKcjSpigQo2BVrLXR4USgJSo/Lq\n\tENCLyA74ubsFaq9+KOUA3W2QY7ZmPuI82yhRXrYoLvrzv5tSZd65V/ulbCJAXiiS6UC1\n\tyc9Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"EU2KsOSN\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=h7/T74BPWBV+wxsrI/3cmR4c/64hakfpmlDwpxvyZ70=;\n\tb=RPRuWvqxkKCUtkreabva+hubY0FVs0HVtR0JP77e6kOpz9FylIgBuXxP0QEnMTWy1m\n\txCTcQPEEl3kcdTh/teQsnvNV+OuF13+Uv/5a8ieTgE+JEfj+UVq1duFoD5VxTNLcUPNC\n\tjJYJmI1j4z1K16fBe7H7KKGkEvgDXz3S8NFJu9qvUqIeMOqatHf2DH02UQHqZCIuQSWE\n\toaEgZMPUkznkEeWid5lT6igSLFYeCOtJ3kPmp3/R34fpx81jQDfQ2ut6M0eiIZHxWofh\n\t7xpaD6+ZPWrLIHx3DLUkCRbRBQ4gyDf0OwS2wsc+q9AXxnmPsJ2gzz98dCtZuGJd+NjK\n\tFcog==","X-Gm-Message-State":"ACrzQf0BLGQwsV0Lu2BVc4u3sO40WF0kXe68kVs7/ypJHaprbua6XTqI\n\tK0hCH9V74aXrrmD/KmF1mHADd/ZWUIEh6TRkS2pHHvjoPUJMzA==","X-Google-Smtp-Source":"AMsMyM4MAIrgwzJFLMFPh18X0K8xEYTiP9RXy99iELKlrjtvZ2LeSS8I3BG0w2RVWj5TCcvbzKyhFf/Xn+5MW4rAoYg=","X-Received":"by 2002:a05:651c:198a:b0:26c:27a:c504 with SMTP id\n\tbx10-20020a05651c198a00b0026c027ac504mr9514164ljb.443.1664963435660;\n\tWed, 05 Oct 2022 02:50:35 -0700 (PDT)","MIME-Version":"1.0","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>\n\t<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>","In-Reply-To":"<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>","Date":"Wed, 5 Oct 2022 10:50:19 +0100","Message-ID":"<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000259e4405ea46829d\"","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25289,"web_url":"https://patchwork.libcamera.org/comment/25289/","msgid":"<Yz1XSU6i1yQrUxu+@pendragon.ideasonboard.com>","date":"2022-10-05T10:07:05","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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\nOn Wed, Oct 05, 2022 at 10:50:19AM +0100, Naushir Patuck wrote:\n> On Tue, 4 Oct 2022 at 20:43, Laurent Pinchart wrote:\n> > On Mon, Oct 03, 2022 at 10:55:56AM +0100, Naushir Patuck 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> > >\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> > We'll still have to figure out how to identify camera module, but that's\n> > fine, we don't have to solve all issues in one go.\n> >\n> > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > ---\n> > >  .../data/{imx296.json => imx296_mono.json}    |  0\n> > >  src/ipa/raspberrypi/data/meson.build          |  2 +-\n> > >  .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++++++++----\n> > >  3 files changed, 17 insertions(+), 5 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..39a1c798df2e 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> > >       return formats;\n> > >  }\n> > >\n> > > +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> > > +{\n> > > +     unsigned int mbusCode = sensor->mbusCodes()[0];\n> > > +     const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> > > +\n> > > +     return bayer.order == BayerFormat::Order::MONO;\n> > > +}\n> > > +\n> > >  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n> > >                                 BayerFormat::Packing packingReq)\n> > >  {\n> > > @@ -1551,12 +1559,16 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n> > >        */\n> > >       std::string configurationFile;\n> > >       char const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> > > -     if (!configFromEnv || *configFromEnv == '\\0')\n> > > -             configurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n> > > -     else\n> > > +     std::string model = sensor_->model();\n> > > +     if (!configFromEnv || *configFromEnv == '\\0') {\n> > > +             if (isMonoSensor(sensor_))\n> > > +                     model += \"_mono\";\n> > > +             configurationFile = ipa_->configurationFile(model + \".json\");\n> > > +     } else {\n> > >               configurationFile = std::string(configFromEnv);\n> > > +     }\n> > >\n> > > -     IPASettings settings(configurationFile, sensor_->model());\n> > > +     IPASettings settings(configurationFile, model);\n> >\n> > The model will be suffixed by \"_mono\" only when the\n> > LIBCAMERA_RPI_TUNING_FILE environment variable isn't set. Is that on\n> > purpose ?\n> \n> Yes, this is intentional, Jacopo queried the same thing :)\n> \n> If a user specifies the LIBCAMERA_RPI_TUNING_FILE env argument,\n> we expect them to provide the exact filename that must be used including\n> path and all. This user provided filename may have not resemblance to the\n> sensor model either.  So it will never be modified with variant suffixes.\n\nFor the configuration file name, that's fine, but note how the model is\npassed as the second argument to the IPASettings constructor. It's\ncurrently used by the IPA module to instantiate the camera sensor\nhelper. If a custom configuration file is specified, the sensor model\nwon't get the \"_mono\" suffix. It should work fine for now I think, as\nthe helper matching logic performs a partial string match, but it seems\na bit inconsistent. Shouldn't the IPA module get the \"_mono\" model name,\neven if a custom tuning file is used ?\n\n> > >\n> > >       return ipa_->init(settings, result);\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 C83A1C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 10:07:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4D59160AC4;\n\tWed,  5 Oct 2022 12:07:11 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96D1C601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 12:07:09 +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 0039D415;\n\tWed,  5 Oct 2022 12:07:08 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664964431;\n\tbh=DZWZiD0RZ1Hw/LUUd9O02mkNZuVDyfRV9WqlBZN5X+0=;\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=UvsBdpv1jczFP1Zq/SLZwwzeeAbn9mwyZ8k35+VmWQA1raBm1FZOZWOF0lQd/LHcg\n\tExSTeF4YlQPJ/UJAmgjZViiNpArXy+v1zQ65eCbWm1PVxf8IiozZbBJ2Ku5mwJHGEN\n\tJ2S0gDgvSiOxRpN04QIiYMoS2u4Eyr9hrvhrd8ihBJ/uZbCLOHYVCOOdkrfH9wh8yy\n\tLFBrQkbM7i6bC/WSc6g83Ao2C15Li98WOxu0Cad27uH65KPj41ZmClnYCXR1Z0dZxG\n\tDE1yeNZTSBloLXYTX3zmVJs29N9HdhAOfykEk0pjdu79Ex8UVqcheuu5Yu7NjveHk2\n\tvn4uFR6ZShaqQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664964429;\n\tbh=DZWZiD0RZ1Hw/LUUd9O02mkNZuVDyfRV9WqlBZN5X+0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wO7sXhyd9FszqgoKVWkWVkEk74l2Z7RSaiQyIP5uAxEWJJhBkrNXg8OnyH4HeDvUH\n\t7vZnwyUn/gMKF2jQMiuKEo6M7b+SvxQeEleg/QFt4Cn9BuMfkvwxK2nsSnLlwUdH6A\n\tO3hzj0PoaiPhCUbbKmOTSxqjFOYKw2JSEu/L57HU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"wO7sXhyd\"; dkim-atps=neutral","Date":"Wed, 5 Oct 2022 13:07:05 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<Yz1XSU6i1yQrUxu+@pendragon.ideasonboard.com>","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>\n\t<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>\n\t<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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>"}},{"id":25290,"web_url":"https://patchwork.libcamera.org/comment/25290/","msgid":"<CAEmqJPpC_3TwXtnrJ3w9hc0+wtqdkC4v_Stii1qBuFYNEFJ2sg@mail.gmail.com>","date":"2022-10-05T10:17:20","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention for tuning files","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\n(cc David)\n\n\nOn Wed, 5 Oct 2022 at 11:07, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> On Wed, Oct 05, 2022 at 10:50:19AM +0100, Naushir Patuck wrote:\n> > On Tue, 4 Oct 2022 at 20:43, Laurent Pinchart wrote:\n> > > On Mon, Oct 03, 2022 at 10:55:56AM +0100, Naushir Patuck wrote:\n> > > > Append \"_mono\" to the sensor name when generating the tuning\n> filename for\n> > > > monochrome sensor variants. So the new naming convention is as\n> follows:\n> > > >\n> > > > <sensor_name>.json - Standard colour sensor variant\n> > > > <sensor_name>_mono.json - Monochrom sensor variant\n> > > >\n> > > > Rename the existing imx296.json file to imx296_mono.json as this\n> tuning file\n> > > > is based on the monochrome variant of the IMX296.\n> > >\n> > > We'll still have to figure out how to identify camera module, but\n> that's\n> > > fine, we don't have to solve all issues in one go.\n> > >\n> > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > ---\n> > > >  .../data/{imx296.json => imx296_mono.json}    |  0\n> > > >  src/ipa/raspberrypi/data/meson.build          |  2 +-\n> > > >  .../pipeline/raspberrypi/raspberrypi.cpp      | 20\n> +++++++++++++++----\n> > > >  3 files changed, 17 insertions(+), 5 deletions(-)\n> > > >  rename src/ipa/raspberrypi/data/{imx296.json => imx296_mono.json}\n> (100%)\n> > > >\n> > > > diff --git a/src/ipa/raspberrypi/data/imx296.json\n> 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\n> 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\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > index dcd81650c32d..39a1c798df2e 100644\n> > > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > @@ -67,6 +67,14 @@ SensorFormats\n> populateSensorFormats(std::unique_ptr<CameraSensor> &sensor)\n> > > >       return formats;\n> > > >  }\n> > > >\n> > > > +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> > > > +{\n> > > > +     unsigned int mbusCode = sensor->mbusCodes()[0];\n> > > > +     const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> > > > +\n> > > > +     return bayer.order == BayerFormat::Order::MONO;\n> > > > +}\n> > > > +\n> > > >  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n> > > >                                 BayerFormat::Packing packingReq)\n> > > >  {\n> > > > @@ -1551,12 +1559,16 @@ int\n> RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n> > > >        */\n> > > >       std::string configurationFile;\n> > > >       char const *configFromEnv =\n> utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> > > > -     if (!configFromEnv || *configFromEnv == '\\0')\n> > > > -             configurationFile =\n> ipa_->configurationFile(sensor_->model() + \".json\");\n> > > > -     else\n> > > > +     std::string model = sensor_->model();\n> > > > +     if (!configFromEnv || *configFromEnv == '\\0') {\n> > > > +             if (isMonoSensor(sensor_))\n> > > > +                     model += \"_mono\";\n> > > > +             configurationFile = ipa_->configurationFile(model +\n> \".json\");\n> > > > +     } else {\n> > > >               configurationFile = std::string(configFromEnv);\n> > > > +     }\n> > > >\n> > > > -     IPASettings settings(configurationFile, sensor_->model());\n> > > > +     IPASettings settings(configurationFile, model);\n> > >\n> > > The model will be suffixed by \"_mono\" only when the\n> > > LIBCAMERA_RPI_TUNING_FILE environment variable isn't set. Is that on\n> > > purpose ?\n> >\n> > Yes, this is intentional, Jacopo queried the same thing :)\n> >\n> > If a user specifies the LIBCAMERA_RPI_TUNING_FILE env argument,\n> > we expect them to provide the exact filename that must be used including\n> > path and all. This user provided filename may have not resemblance to the\n> > sensor model either.  So it will never be modified with variant suffixes.\n>\n> For the configuration file name, that's fine, but note how the model is\n> passed as the second argument to the IPASettings constructor. It's\n> currently used by the IPA module to instantiate the camera sensor\n> helper. If a custom configuration file is specified, the sensor model\n> won't get the \"_mono\" suffix. It should work fine for now I think, as\n> the helper matching logic performs a partial string match, but it seems\n> a bit inconsistent. Shouldn't the IPA module get the \"_mono\" model name,\n> even if a custom tuning file is used ?\n>\n\nSorry, I misunderstood your point!\n\nYes, you are right, sensor model will not get the _mono suffix in the\nenv variable case.  But by luck, the cam helper does a partial match\nand it all works.\n\nIMHO sensor model should not get the _mono suffix as the model\nstring is only needed to match the CamHelper instance.  Apart from\nthe config file itself, the IPA does not need to know about sensor variant\ndifferences.\n\nWhat do you and David think?\n\nNaush\n\n\n\n>\n> > > >\n> > > >       return ipa_->init(settings, result);\n> > > >  }\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 2AC7DBD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 10:17:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 86C50621F8;\n\tWed,  5 Oct 2022 12:17:39 +0200 (CEST)","from mail-lf1-x135.google.com (mail-lf1-x135.google.com\n\t[IPv6:2a00:1450:4864:20::135])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DE5A601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 12:17:37 +0200 (CEST)","by mail-lf1-x135.google.com with SMTP id d18so11819832lfb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 05 Oct 2022 03:17:37 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664965059;\n\tbh=7edGRLf4uR/0jr4kxwTNBV3ixXtld2XtU72VBK/kdMo=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=2IgDg77s4wSyPh/s7fWYzZXtWJiIDtTuS3gZjjbQ5K7hrHuXbkEdmsL1FCkga/hyy\n\tRHKZ2341l5e1UicHK1nx1+aRAkFJrECAyCFMB9s6p/j6cq1ktX3A/iJza6zFUV2kDa\n\thJSNmMGqmdpxqyz4x5bM0zt2GW4U4gGsw9MED2CARxbcNJrLVip1WChj0EFPc2lvjk\n\tYV8sFu3rLCHQXVEbYrNkinGL8I8FGWx6h74PMR//SDwn/S4eCd5UdwGcjkOIug0cDq\n\tqGfVZ5eVGSjyV0gtJtA9+R+D7cjm1p3Ml9fVUhPKwcPLJYxXN8eVUZHpUT8Ox9yrQg\n\t34yu9lhx/GHbQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=QfKDDdWi5TRvII0CtdjnScDCrpne6o23y9wGQRYcD/I=;\n\tb=AVzDm26m8mXjMB55AQW3ZE7tYBaa480S0RQTvg+84muvBoKBlnKbK0x+HXjMjjYBwB\n\tbmJsieWyjA0qfyH+y8ccr6hiS+zOeMLjaHcGpEkvOAqpwfC+yaa15qTKRTQRqoAPHfyD\n\t6idem+mfYtC43yA/Zlobo5ETLogIbt+j4gsN1Llem60/EU3LWYGSZuVVdOYAl5eASw51\n\tXXnciWZeLj101OBh6ml4L4Pu5mRC8ceX8NAAwP1QQsyTowC3L4YAAENoUqmqJB40KLkt\n\tPk5kjDBi6PXngv+q3vv/VB44E5f95tpUGRZaenecxhLfrtoUgpTKP8F9s40ZYHrb1cv+\n\tWMbw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"AVzDm26m\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=QfKDDdWi5TRvII0CtdjnScDCrpne6o23y9wGQRYcD/I=;\n\tb=RmY4cfJ6kBotncrdD+Jo4EqixcGw0/jVgFNriAj9wMqS47vq/B3cCXtq/AYJFOIG2v\n\t1XxlWQVUJgJ5ZkrJhUXTv3h3nqdh1ZhbLZv8UnIHhhv5PTiHKmVq5hG3hGf2CQTj0y5d\n\t2Im2m8iy5uAJNMg1lsA4Zl4e9iSgCxzg+UUoTJkuHSJj4SvJCymRAOXfoYVzclKFlk3a\n\t1qMtMlq5T52Ob1Tp6ckky6h5cO+exGWSaS+yGsjOJyeYZAEwQHE29D57QxzNPIgxte6g\n\t7s2IqDkRnz8L8oKobWcQC6aydwY5DF273o5JJ0vTcl+Y/dfmsyrGif5tAH5ZsFx8vGK2\n\tw3mQ==","X-Gm-Message-State":"ACrzQf3ceeQR5fZfkMKR0DYwNJ4UkS/Z7FRal5LYJ3Fx6YhcWujjHwLJ\n\txFHN5AUTHl0mfUQSWtVgV6I83OLZtCZivjqaQm+FQA==","X-Google-Smtp-Source":"AMsMyM7/zozTLi/qaGR8w1/4Zt/mYJD4/4sM2IC3cF88SNs7xpJ+zKDIXnQCPK7Y/T08Rslk9LnyUYSWi3CIlhVkswk=","X-Received":"by 2002:a05:6512:2616:b0:4a2:1723:cf40 with SMTP id\n\tbt22-20020a056512261600b004a21723cf40mr8151404lfb.354.1664965056436;\n\tWed, 05 Oct 2022 03:17:36 -0700 (PDT)","MIME-Version":"1.0","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>\n\t<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>\n\t<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>\n\t<Yz1XSU6i1yQrUxu+@pendragon.ideasonboard.com>","In-Reply-To":"<Yz1XSU6i1yQrUxu+@pendragon.ideasonboard.com>","Date":"Wed, 5 Oct 2022 11:17:20 +0100","Message-ID":"<CAEmqJPpC_3TwXtnrJ3w9hc0+wtqdkC4v_Stii1qBuFYNEFJ2sg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\tDavid Plowman <david.plowman@raspberrypi.com>","Content-Type":"multipart/alternative; boundary=\"000000000000c0b56c05ea46e262\"","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25291,"web_url":"https://patchwork.libcamera.org/comment/25291/","msgid":"<Yz1epHS7vbXf0/Ww@pendragon.ideasonboard.com>","date":"2022-10-05T10:38:28","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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\nOn Wed, Oct 05, 2022 at 11:17:20AM +0100, Naushir Patuck wrote:\n> On Wed, 5 Oct 2022 at 11:07, Laurent Pinchart wrote:\n> > On Wed, Oct 05, 2022 at 10:50:19AM +0100, Naushir Patuck wrote:\n> > > On Tue, 4 Oct 2022 at 20:43, Laurent Pinchart wrote:\n> > > > On Mon, Oct 03, 2022 at 10:55:56AM +0100, Naushir Patuck 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> > > > >\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> > > > We'll still have to figure out how to identify camera module, but that's\n> > > > fine, we don't have to solve all issues in one go.\n> > > >\n> > > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > > ---\n> > > > >  .../data/{imx296.json => imx296_mono.json}    |  0\n> > > > >  src/ipa/raspberrypi/data/meson.build          |  2 +-\n> > > > >  .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++++++++----\n> > > > >  3 files changed, 17 insertions(+), 5 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..39a1c798df2e 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> > > > >       return formats;\n> > > > >  }\n> > > > >\n> > > > > +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> > > > > +{\n> > > > > +     unsigned int mbusCode = sensor->mbusCodes()[0];\n> > > > > +     const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> > > > > +\n> > > > > +     return bayer.order == BayerFormat::Order::MONO;\n> > > > > +}\n> > > > > +\n> > > > >  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n> > > > >                                 BayerFormat::Packing packingReq)\n> > > > >  {\n> > > > > @@ -1551,12 +1559,16 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n> > > > >        */\n> > > > >       std::string configurationFile;\n> > > > >       char const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> > > > > -     if (!configFromEnv || *configFromEnv == '\\0')\n> > > > > -             configurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n> > > > > -     else\n> > > > > +     std::string model = sensor_->model();\n> > > > > +     if (!configFromEnv || *configFromEnv == '\\0') {\n> > > > > +             if (isMonoSensor(sensor_))\n> > > > > +                     model += \"_mono\";\n> > > > > +             configurationFile = ipa_->configurationFile(model + \".json\");\n> > > > > +     } else {\n> > > > >               configurationFile = std::string(configFromEnv);\n> > > > > +     }\n> > > > >\n> > > > > -     IPASettings settings(configurationFile, sensor_->model());\n> > > > > +     IPASettings settings(configurationFile, model);\n> > > >\n> > > > The model will be suffixed by \"_mono\" only when the\n> > > > LIBCAMERA_RPI_TUNING_FILE environment variable isn't set. Is that on\n> > > > purpose ?\n> > >\n> > > Yes, this is intentional, Jacopo queried the same thing :)\n> > >\n> > > If a user specifies the LIBCAMERA_RPI_TUNING_FILE env argument,\n> > > we expect them to provide the exact filename that must be used including\n> > > path and all. This user provided filename may have not resemblance to the\n> > > sensor model either.  So it will never be modified with variant suffixes.\n> >\n> > For the configuration file name, that's fine, but note how the model is\n> > passed as the second argument to the IPASettings constructor. It's\n> > currently used by the IPA module to instantiate the camera sensor\n> > helper. If a custom configuration file is specified, the sensor model\n> > won't get the \"_mono\" suffix. It should work fine for now I think, as\n> > the helper matching logic performs a partial string match, but it seems\n> > a bit inconsistent. Shouldn't the IPA module get the \"_mono\" model name,\n> > even if a custom tuning file is used ?\n> \n> Sorry, I misunderstood your point!\n> \n> Yes, you are right, sensor model will not get the _mono suffix in the\n> env variable case.  But by luck, the cam helper does a partial match\n> and it all works.\n> \n> IMHO sensor model should not get the _mono suffix as the model\n> string is only needed to match the CamHelper instance.  Apart from\n> the config file itself, the IPA does not need to know about sensor variant\n> differences.\n> \n> What do you and David think?\n\nThe IPA module should be able to detect that the sensor is monochrome\nfrom the pixel format, so I'm fine not adding a \"_mono\" suffix to the\nmodel here. I'm equally fine adding it :-) My only concern is that we\nshould be consistent and do the same in both cases.\n\n> > > > >\n> > > > >       return ipa_->init(settings, result);\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 41379C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 10:38:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 996EF621F8;\n\tWed,  5 Oct 2022 12:38:34 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 125C2601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 12:38:33 +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 68A37415;\n\tWed,  5 Oct 2022 12:38:32 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664966314;\n\tbh=uSRSudxrgIWbwqLMIZI2rckOnZ84Kyq4570hio6oTIg=;\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=xr4CzhO0FrboGmJz3V5xmpc7GTcO6rr/4cS0ZY3pPmvESRbYBzfhfuahGJ3uUJ/HF\n\tz+j61WJW+nSOLDMKZe42S8z3t70uR7c9OXvbDhGhJj5DfqY8U2DaKi0jSVYA7OvtUf\n\tMgEHjZYs5GNZZ2xKOZb4XIyU7tz+8YKIBWyevrn9e5kRmFMEtnqkn5ITg/K+7wJIb+\n\tnjRUqCe7+yNkjrtHkgHzGLzG1pc6/zEdWzYC8mlqZqVl20nEiHbEuTBb7TeOIj2E93\n\tv7WBq9iO/4ES2ckRPx6R1OzkFbh7WPwwDxrScMq+ryqlElShgWRNddc9NgCCTwICat\n\t1KVeVyIS3V5ow==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664966312;\n\tbh=uSRSudxrgIWbwqLMIZI2rckOnZ84Kyq4570hio6oTIg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lhjLO+iU+MorRFrgpmLuIpgUzj4GZym50NIXG50JYt8wuR6xTJUeK9O753esQTMSe\n\tkA1V5S2leFsVXTyS+GZ2sgeMXNZrK7eJR5CJfqRGey2ULhYAB9EgO88eBQR8/kExaL\n\t81syrsMwmfMNVoQvv2BYYJnb1cmw2YzpHnUUTs6Y="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"lhjLO+iU\"; dkim-atps=neutral","Date":"Wed, 5 Oct 2022 13:38:28 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<Yz1epHS7vbXf0/Ww@pendragon.ideasonboard.com>","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>\n\t<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>\n\t<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>\n\t<Yz1XSU6i1yQrUxu+@pendragon.ideasonboard.com>\n\t<CAEmqJPpC_3TwXtnrJ3w9hc0+wtqdkC4v_Stii1qBuFYNEFJ2sg@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPpC_3TwXtnrJ3w9hc0+wtqdkC4v_Stii1qBuFYNEFJ2sg@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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>"}},{"id":25293,"web_url":"https://patchwork.libcamera.org/comment/25293/","msgid":"<CAHW6GYJJSEijgwBuy-3+2vFdfjcLZNDqEkUn7ywnW2aC0NsOSA@mail.gmail.com>","date":"2022-10-05T10:57:27","subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention for tuning files","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi everyone!\n\nOn Wed, 5 Oct 2022 at 11:38, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Naush,\n>\n> On Wed, Oct 05, 2022 at 11:17:20AM +0100, Naushir Patuck wrote:\n> > On Wed, 5 Oct 2022 at 11:07, Laurent Pinchart wrote:\n> > > On Wed, Oct 05, 2022 at 10:50:19AM +0100, Naushir Patuck wrote:\n> > > > On Tue, 4 Oct 2022 at 20:43, Laurent Pinchart wrote:\n> > > > > On Mon, Oct 03, 2022 at 10:55:56AM +0100, Naushir Patuck 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> > > > > >\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> > > > > We'll still have to figure out how to identify camera module, but that's\n> > > > > fine, we don't have to solve all issues in one go.\n> > > > >\n> > > > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > > > ---\n> > > > > >  .../data/{imx296.json => imx296_mono.json}    |  0\n> > > > > >  src/ipa/raspberrypi/data/meson.build          |  2 +-\n> > > > > >  .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++++++++----\n> > > > > >  3 files changed, 17 insertions(+), 5 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..39a1c798df2e 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> > > > > >       return formats;\n> > > > > >  }\n> > > > > >\n> > > > > > +bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n> > > > > > +{\n> > > > > > +     unsigned int mbusCode = sensor->mbusCodes()[0];\n> > > > > > +     const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n> > > > > > +\n> > > > > > +     return bayer.order == BayerFormat::Order::MONO;\n> > > > > > +}\n> > > > > > +\n> > > > > >  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n> > > > > >                                 BayerFormat::Packing packingReq)\n> > > > > >  {\n> > > > > > @@ -1551,12 +1559,16 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n> > > > > >        */\n> > > > > >       std::string configurationFile;\n> > > > > >       char const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n> > > > > > -     if (!configFromEnv || *configFromEnv == '\\0')\n> > > > > > -             configurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n> > > > > > -     else\n> > > > > > +     std::string model = sensor_->model();\n> > > > > > +     if (!configFromEnv || *configFromEnv == '\\0') {\n> > > > > > +             if (isMonoSensor(sensor_))\n> > > > > > +                     model += \"_mono\";\n> > > > > > +             configurationFile = ipa_->configurationFile(model + \".json\");\n> > > > > > +     } else {\n> > > > > >               configurationFile = std::string(configFromEnv);\n> > > > > > +     }\n> > > > > >\n> > > > > > -     IPASettings settings(configurationFile, sensor_->model());\n> > > > > > +     IPASettings settings(configurationFile, model);\n> > > > >\n> > > > > The model will be suffixed by \"_mono\" only when the\n> > > > > LIBCAMERA_RPI_TUNING_FILE environment variable isn't set. Is that on\n> > > > > purpose ?\n> > > >\n> > > > Yes, this is intentional, Jacopo queried the same thing :)\n> > > >\n> > > > If a user specifies the LIBCAMERA_RPI_TUNING_FILE env argument,\n> > > > we expect them to provide the exact filename that must be used including\n> > > > path and all. This user provided filename may have not resemblance to the\n> > > > sensor model either.  So it will never be modified with variant suffixes.\n> > >\n> > > For the configuration file name, that's fine, but note how the model is\n> > > passed as the second argument to the IPASettings constructor. It's\n> > > currently used by the IPA module to instantiate the camera sensor\n> > > helper. If a custom configuration file is specified, the sensor model\n> > > won't get the \"_mono\" suffix. It should work fine for now I think, as\n> > > the helper matching logic performs a partial string match, but it seems\n> > > a bit inconsistent. Shouldn't the IPA module get the \"_mono\" model name,\n> > > even if a custom tuning file is used ?\n> >\n> > Sorry, I misunderstood your point!\n> >\n> > Yes, you are right, sensor model will not get the _mono suffix in the\n> > env variable case.  But by luck, the cam helper does a partial match\n> > and it all works.\n> >\n> > IMHO sensor model should not get the _mono suffix as the model\n> > string is only needed to match the CamHelper instance.  Apart from\n> > the config file itself, the IPA does not need to know about sensor variant\n> > differences.\n> >\n> > What do you and David think?\n\nTo be honest, I'm struggling to get too excited about this! I think if\nthe CamHelper really doesn't need anything other than the sensor name,\nand has no dependencies on other things (like \"mono-ness\"), then we\nshouldn't add anything. If we later on discover something that does\nmatter... well then maybe we need to change our minds!\n\nDavid\n\n>\n> The IPA module should be able to detect that the sensor is monochrome\n> from the pixel format, so I'm fine not adding a \"_mono\" suffix to the\n> model here. I'm equally fine adding it :-) My only concern is that we\n> should be consistent and do the same in both cases.\n>\n> > > > > >\n> > > > > >       return ipa_->init(settings, result);\n> > > > > >  }\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 31611BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 10:57:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E0020622E4;\n\tWed,  5 Oct 2022 12:57:40 +0200 (CEST)","from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com\n\t[IPv6:2607:f8b0:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E33AB621BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 12:57:39 +0200 (CEST)","by mail-pl1-x62f.google.com with SMTP id x1so15089712plv.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 05 Oct 2022 03:57:39 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664967460;\n\tbh=aRXB3GeC81P3an/3dPr1C00DxbtEj9CUD+YcZjyD2Qg=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=aAXrXPL/u7iFwRUiiprlSixocG1xkcRk3TS0QFFbTPy7W80+5MAgEom6Ke2FFdwc9\n\tajBk7NNkV64OUDdLurnHmQGNzMSFZNAhM64SeK7HBmzg168nq6iCMOQI6Jy5/od862\n\tHYfqZML6SOTHQxnKlofUyZIPfnBws0y1ztqR04Jisz2yJ/MdbhdICAyNspFoiWX/4u\n\tjIZj6CU+Db0yndHVYk51uegG+ovscnDvomaCUN+EuSTdLPApsFjuiBfZceqdTINIpc\n\t2KpMCDyQ/YaiwLZ+2LFmiFnXoBI34PF1tClvyNwoFI9M5myFfOWYRbQK5S+6PXI0yz\n\tprQQ5lemNZOog==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=R6rvp1Ahxd15MK25S5KZTda+1L0oEAY1ANmFPompdAg=;\n\tb=NncKet7m0LSJVTrkh7wjj1oTQTfYJ0MO7VVkSx7mhAMDBLG7SC6NtC3UJcij3EX+3R\n\tT3BH/+b7+vNKRNrvoDOOSR2hvmcH3dmILzA6Svkr/UQ8A12c328NDISoeVxkBF3P1FX7\n\tKwkwGEqE2wIpbKmbddwBDB04S08Wsrk9NdKE0Dq8TZ5FR5HlNRIZ/AA7jPiRH7gOU0AL\n\tfmZPfBKL7ReB2QIPaSuJ5AF7ymHXm7OppXM51f/kXZ6o2IDL3OaRa51wWINZMZ0M5OKu\n\tc9b1fB8ea9mGetKvMKJ18+msSlU8Kb1HQK3Yek092WLkGobYxcP9qNyCTN25xuUCmpMZ\n\tHhWQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"NncKet7m\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=R6rvp1Ahxd15MK25S5KZTda+1L0oEAY1ANmFPompdAg=;\n\tb=E52rr3lHXDrExaTFAma6LEcBEJACF/fqeYvoMfTdCQfMml7CUZLK8GscipbMhMsMot\n\ts6snTUh5P9Q0ddQVPK/I95iV4MLAylGTl8r8oMEQeIEOPr0E3jTJOoAwXlagiHc73dG4\n\tk1PJtSjazfYdse+gDszLhOqHH5yI3heEWtWQWwbDvtcGjx52zF3/g5jNd0TH+GdsjLuD\n\tLONS0CkmhTVs8QWP8FdiPiHGgZhqNbsfpXwQpbzIgdSYEQ1etfNgXTH17+oQpn6apIVk\n\tVBciHd0cWN+WULD25BtOfQdF7lpu+RMZ2vss+EFzoOJnsKj3JQNm41Z4J45k03Kkb6WF\n\twK9Q==","X-Gm-Message-State":"ACrzQf1c51RPAtFqxl+hP9oLBo+MpI156hRM8Tkrjgfs8yO7b33FtjEq\n\tCi2WIlyQsrfVgS0oPTl+VNapNJ1iuJlSwxdwjtgOsg==","X-Google-Smtp-Source":"AMsMyM4w4TXKwELCsAfSPdTd21/wMIByujyxd9Axsb/vP6pftOFzyvFAuREg1W5IwHhiCo9F5WvK0xktRG/cxMgvJpM=","X-Received":"by 2002:a17:90b:3a90:b0:202:d341:bf81 with SMTP id\n\tom16-20020a17090b3a9000b00202d341bf81mr4458493pjb.179.1664967458537;\n\tWed, 05 Oct 2022 03:57:38 -0700 (PDT)","MIME-Version":"1.0","References":"<20221003095558.1993-1-naush@raspberrypi.com>\n\t<20221003095558.1993-3-naush@raspberrypi.com>\n\t<YzyMxQYT4Xpbypr1@pendragon.ideasonboard.com>\n\t<CAEmqJPrnPfbxRtVT4DrafaWiiPeVeT1uhXpyBq+RTiOnpipGEQ@mail.gmail.com>\n\t<Yz1XSU6i1yQrUxu+@pendragon.ideasonboard.com>\n\t<CAEmqJPpC_3TwXtnrJ3w9hc0+wtqdkC4v_Stii1qBuFYNEFJ2sg@mail.gmail.com>\n\t<Yz1epHS7vbXf0/Ww@pendragon.ideasonboard.com>","In-Reply-To":"<Yz1epHS7vbXf0/Ww@pendragon.ideasonboard.com>","Date":"Wed, 5 Oct 2022 11:57:27 +0100","Message-ID":"<CAHW6GYJJSEijgwBuy-3+2vFdfjcLZNDqEkUn7ywnW2aC0NsOSA@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Update\n\tnaming convention 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":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]