[libcamera-devel] [PATCH v4 07/12] pipeline: rkisp1: Support IPA tuning file
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Jun 20 03:43:00 CEST 2022
From: Florian Sylvestre <fsylvestre at baylibre.com>
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 <fsylvestre at baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
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;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list