summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/rkisp1/rkisp1.cpp
diff options
context:
space:
mode:
authorFlorian Sylvestre <fsylvestre@baylibre.com>2022-06-17 11:23:11 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-06-29 17:21:11 +0300
commit011a4668fb5e17026626b7abdfe86bccb2fdb743 (patch)
treea1ef82ac555e20ab3d16d09a0cf8e034c2da4292 /src/libcamera/pipeline/rkisp1/rkisp1.cpp
parente9c53ac4d8db5ae3a45d458f146044beb95f79d4 (diff)
pipeline: rkisp1: Support IPA tuning file
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@baylibre.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/rkisp1/rkisp1.cpp')
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 7cf36524..3dc0850c 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -321,7 +321,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;