{"id":16277,"url":"https://patchwork.libcamera.org/api/1.1/patches/16277/?format=json","web_url":"https://patchwork.libcamera.org/patch/16277/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220620014305.26778-8-laurent.pinchart@ideasonboard.com>","date":"2022-06-20T01:43:00","name":"[libcamera-devel,v4,07/12] pipeline: rkisp1: Support IPA tuning file","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"45ab94c37123354be00f65b30e971d016828673f","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16277/mbox/","series":[{"id":3191,"url":"https://patchwork.libcamera.org/api/1.1/series/3191/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3191","date":"2022-06-20T01:42:53","name":"Add tuning file support for the RkISP1 IPA module","version":4,"mbox":"https://patchwork.libcamera.org/series/3191/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16277/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16277/checks/","tags":{},"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 3CEE7BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jun 2022 01:43:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E7B4265659;\n\tMon, 20 Jun 2022 03:43:36 +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 422BF60471\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jun 2022 03:43:28 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C517E25E;\n\tMon, 20 Jun 2022 03:43:27 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655689416;\n\tbh=UPriGi3kAiPOyjE60UQB1y3ZwvSU/cinXkjFxXoNTh4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=efVL3AJMjPEIsmg9Om8lomKH0+oZdLXblLwQq9oTDhcmXXDhLcLFECGTtfY6p64en\n\tsuXVrzKcpmUWpv6SayGcWEEpnVTPSe2/o3CBgLrZQu2UAu06aL1cpHxLuHL/g39S4h\n\tR+1RrUxCA+RHqONkvRNiGgG+TvptKtFeCgBb8UXaFAe4D0Hh8mOI6QYbWuR3nvB0dE\n\tf7gae2zLKWu1SvnaV5w6WJxFliNCK8eF9enFDPllAzR8P6QMyNeq1VQVQzB+RZvEdc\n\tDBxB+3Rjlut/pcmwxHebsPZ4MZonOZ8HbZY/EW3aYS1bVqacx8+v7jB29oYp6m4Se1\n\teGFEuABssxW/g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655689408;\n\tbh=UPriGi3kAiPOyjE60UQB1y3ZwvSU/cinXkjFxXoNTh4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=PlO6ATYvwvO8tNNKtjn8h3sFJTpIFr/eTy5jZhfbvq7Lvdb5tNhSdY450atIrKoVs\n\tvKmLTHcpB8zo6AdcWCLhFkGCh3hY+RTf0HIdXkg6381u/YXPPMTBFQ6UMvVm8Fmfhp\n\tW2RgUdkAS1JveUP1T7mEFWyxK8HF/f1I0iLC/LZU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"PlO6ATYv\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 20 Jun 2022 04:43:00 +0300","Message-Id":"<20220620014305.26778-8-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220620014305.26778-1-laurent.pinchart@ideasonboard.com>","References":"<20220620014305.26778-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 07/12] pipeline: rkisp1: Support IPA\n\ttuning file","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Florian Sylvestre <fsylvestre@baylibre.com>\n\nPass the path name of the YAML IPA tuning file to the IPA module. The\nfile name is derived from the sensor name (\"${sensor_name}.yaml\"), with\na fallback to \"uncalibrated.yaml\".\n\nThe tuning file name can be manually overridden with the\nLIBCAMERA_RKISP1_TUNING_FILE environment variable.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v3:\n\n- Fix typo in ipaTuningFile\n- Fall back to \"uncalibrated.yaml\"\n---\n src/ipa/rkisp1/data/meson.build          |  8 ++++++++\n src/ipa/rkisp1/data/uncalibrated.yaml    |  8 ++++++++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 +++++++++++++++++++-\n 3 files changed, 35 insertions(+), 1 deletion(-)\n create mode 100644 src/ipa/rkisp1/data/meson.build\n create mode 100644 src/ipa/rkisp1/data/uncalibrated.yaml","diff":"diff --git a/src/ipa/rkisp1/data/meson.build b/src/ipa/rkisp1/data/meson.build\nnew file mode 100644\nindex 000000000000..e5b945966625\n--- /dev/null\n+++ b/src/ipa/rkisp1/data/meson.build\n@@ -0,0 +1,8 @@\n+# SPDX-License-Identifier: CC0-1.0\n+\n+conf_files = files([\n+    'uncalibrated.yaml',\n+])\n+\n+install_data(conf_files,\n+             install_dir : ipa_data_dir / 'rkisp1')\ndiff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\nnew file mode 100644\nindex 000000000000..bdbd5fda7eaf\n--- /dev/null\n+++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n@@ -0,0 +1,8 @@\n+# SPDX-License-Identifier: CC0-1.0\n+%YAML 1.2\n+---\n+version: 1\n+algorithms:\n+  - Agc:\n+  - Awb:\n+...\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 4b3d2cf77039..72689c8832eb 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -322,7 +322,25 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \tipa_->paramsBufferReady.connect(this, &RkISP1CameraData::paramFilled);\n \tipa_->metadataReady.connect(this, &RkISP1CameraData::metadataReady);\n \n-\tint ret = ipa_->init(IPASettings{ \"\", sensor_->model() }, hwRevision);\n+\t/*\n+\t * The API tuning file is made from the sensor name unless the\n+\t * environment variable overrides it. If\n+\t */\n+\tstd::string ipaTuningFile;\n+\tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RKISP1_TUNING_FILE\");\n+\tif (!configFromEnv || *configFromEnv == '\\0') {\n+\t\tipaTuningFile = ipa_->configurationFile(sensor_->model() + \".yaml\");\n+\t\t/*\n+\t\t * If the tuning file isn't found, fall back to the\n+\t\t * 'uncalibrated' configuration file.\n+\t\t */\n+\t\tif (ipaTuningFile.empty())\n+\t\t\tipaTuningFile = ipa_->configurationFile(\"uncalibrated.yaml\");\n+\t} else {\n+\t\tipaTuningFile = std::string(configFromEnv);\n+\t}\n+\n+\tint ret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision);\n \tif (ret < 0) {\n \t\tLOG(RkISP1, Error) << \"IPA initialization failure\";\n \t\treturn ret;\n","prefixes":["libcamera-devel","v4","07/12"]}