[libcamera-devel] [PATCH] libcamera: raspberrypi: Allow the tuning file to be set by an environment variable
Naushir Patuck
naush at raspberrypi.com
Thu Jul 8 11:25:07 CEST 2021
Hi David,
Thank you for your work.
On Wed, 7 Jul 2021 at 14:40, David Plowman <david.plowman at raspberrypi.com>
wrote:
> The configuration (camera tuning) file used by the Raspberry Pi comes
> by default from the sensor name. However, we now allow this to be
> overridden by the LIBCAMERA_RPI_TUNING_FILE environment variable.
>
> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
>
Reviewed-by: Naushir Patuck <naush at raspberrypi.com>
> ---
> src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 082eb1ee..a738770a 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -1232,8 +1232,18 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig
> *sensorConfig)
> ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);
> ipa_->setDelayedControls.connect(this,
> &RPiCameraData::setDelayedControls);
>
> - IPASettings settings(ipa_->configurationFile(sensor_->model() +
> ".json"),
> - sensor_->model());
> + /*
> + * The configuration (tuning file) is made from the sensor name
> unless
> + * the environment variable overrides it.
> + */
> + std::string configurationFile;
> + char const *configFromEnv =
> utils::secure_getenv("LIBCAMERA_RPI_TUNING_FILE");
> + if (!configFromEnv || *configFromEnv == '\0')
> + configurationFile =
> ipa_->configurationFile(sensor_->model() + ".json");
> + else
> + configurationFile = std::string(configFromEnv);
> +
> + IPASettings settings(configurationFile, sensor_->model());
>
> return ipa_->init(settings, sensorConfig);
> }
> --
> 2.20.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20210708/61f1b12f/attachment.htm>
More information about the libcamera-devel
mailing list