From patchwork Mon Jun 20 01:43:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16277 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3CEE7BE173 for ; Mon, 20 Jun 2022 01:43:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E7B4265659; Mon, 20 Jun 2022 03:43:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655689416; bh=UPriGi3kAiPOyjE60UQB1y3ZwvSU/cinXkjFxXoNTh4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=efVL3AJMjPEIsmg9Om8lomKH0+oZdLXblLwQq9oTDhcmXXDhLcLFECGTtfY6p64en suXVrzKcpmUWpv6SayGcWEEpnVTPSe2/o3CBgLrZQu2UAu06aL1cpHxLuHL/g39S4h R+1RrUxCA+RHqONkvRNiGgG+TvptKtFeCgBb8UXaFAe4D0Hh8mOI6QYbWuR3nvB0dE f7gae2zLKWu1SvnaV5w6WJxFliNCK8eF9enFDPllAzR8P6QMyNeq1VQVQzB+RZvEdc DBxB+3Rjlut/pcmwxHebsPZ4MZonOZ8HbZY/EW3aYS1bVqacx8+v7jB29oYp6m4Se1 eGFEuABssxW/g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 422BF60471 for ; Mon, 20 Jun 2022 03:43:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PlO6ATYv"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C517E25E; Mon, 20 Jun 2022 03:43:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655689408; bh=UPriGi3kAiPOyjE60UQB1y3ZwvSU/cinXkjFxXoNTh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlO6ATYvwvO8tNNKtjn8h3sFJTpIFr/eTy5jZhfbvq7Lvdb5tNhSdY450atIrKoVs vKmLTHcpB8zo6AdcWCLhFkGCh3hY+RTf0HIdXkg6381u/YXPPMTBFQ6UMvVm8Fmfhp W2RgUdkAS1JveUP1T7mEFWyxK8HF/f1I0iLC/LZU= 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 Subject: [libcamera-devel] [PATCH v4 07/12] pipeline: rkisp1: Support IPA tuning file X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Florian Sylvestre Pass the path name of the YAML IPA tuning file to the IPA module. The file name is derived from the sensor name ("${sensor_name}.yaml"), with a fallback to "uncalibrated.yaml". The tuning file name can be manually overridden with the LIBCAMERA_RKISP1_TUNING_FILE environment variable. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Laurent Pinchart --- Changes since v3: - Fix typo in ipaTuningFile - Fall back to "uncalibrated.yaml" --- src/ipa/rkisp1/data/meson.build | 8 ++++++++ src/ipa/rkisp1/data/uncalibrated.yaml | 8 ++++++++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 +++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/ipa/rkisp1/data/meson.build create mode 100644 src/ipa/rkisp1/data/uncalibrated.yaml diff --git a/src/ipa/rkisp1/data/meson.build b/src/ipa/rkisp1/data/meson.build new file mode 100644 index 000000000000..e5b945966625 --- /dev/null +++ b/src/ipa/rkisp1/data/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: CC0-1.0 + +conf_files = files([ + 'uncalibrated.yaml', +]) + +install_data(conf_files, + install_dir : ipa_data_dir / 'rkisp1') diff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml new file mode 100644 index 000000000000..bdbd5fda7eaf --- /dev/null +++ b/src/ipa/rkisp1/data/uncalibrated.yaml @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: CC0-1.0 +%YAML 1.2 +--- +version: 1 +algorithms: + - Agc: + - Awb: +... diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 4b3d2cf77039..72689c8832eb 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -322,7 +322,25 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision) ipa_->paramsBufferReady.connect(this, &RkISP1CameraData::paramFilled); ipa_->metadataReady.connect(this, &RkISP1CameraData::metadataReady); - int ret = ipa_->init(IPASettings{ "", sensor_->model() }, hwRevision); + /* + * The API tuning file is made from the sensor name unless the + * environment variable overrides it. If + */ + std::string ipaTuningFile; + char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RKISP1_TUNING_FILE"); + if (!configFromEnv || *configFromEnv == '\0') { + ipaTuningFile = ipa_->configurationFile(sensor_->model() + ".yaml"); + /* + * If the tuning file isn't found, fall back to the + * 'uncalibrated' configuration file. + */ + if (ipaTuningFile.empty()) + ipaTuningFile = ipa_->configurationFile("uncalibrated.yaml"); + } else { + ipaTuningFile = std::string(configFromEnv); + } + + int ret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision); if (ret < 0) { LOG(RkISP1, Error) << "IPA initialization failure"; return ret;