[{"id":33742,"web_url":"https://patchwork.libcamera.org/comment/33742/","msgid":"<174302981145.1701483.11782761287184128091@ping.linuxembedded.co.uk>","date":"2025-03-26T22:56:51","subject":"Re: [PATCH v5 6/6] ipa: simple: Report exposure in metadata","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2025-03-26 12:48:55)\n> Report exposure and gain in metadata.\n> \n> This is more complicated than it could be expected because the exposure\n> value should be in microseconds but it's handled using V4L2_CID_EXPOSURE\n> control, which doesn't specify the unit, see\n> https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/control.html.\n> So the unit conversion is done in the way rkisp1 IPA uses.\n> \n> This requires getting and passing IPACameraSensorInfo around.  To avoid\n> naming confusion and to improve consistency with rkisp1 IPA,\n> sensorCtrlInfoMap parameter is renamed to sensorControls.\n\nGetting the lineDuration helps for handling things like\nFrameDuration/Framerate control later too - so this is already helpful.\n\nAnd it's working - I can see the results in camshark which is helpful\nalready.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  include/libcamera/ipa/soft.mojom            |  3 ++-\n>  src/ipa/simple/algorithms/agc.cpp           | 11 +++++++++--\n>  src/ipa/simple/ipa_context.h                |  6 +++++-\n>  src/ipa/simple/soft_simple.cpp              | 17 +++++++++++++----\n>  src/libcamera/software_isp/software_isp.cpp | 20 ++++++++++++++------\n>  5 files changed, 43 insertions(+), 14 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\n> index a8e6ecda..77328c5f 100644\n> --- a/include/libcamera/ipa/soft.mojom\n> +++ b/include/libcamera/ipa/soft.mojom\n> @@ -16,7 +16,8 @@ interface IPASoftInterface {\n>         init(libcamera.IPASettings settings,\n>              libcamera.SharedFD fdStats,\n>              libcamera.SharedFD fdParams,\n> -            libcamera.ControlInfoMap sensorCtrlInfoMap)\n> +            libcamera.IPACameraSensorInfo sensorInfo,\n> +            libcamera.ControlInfoMap sensorControls)\n>                 => (int32 ret, libcamera.ControlInfoMap ipaControls, bool ccmEnabled);\n>         start() => (int32 ret);\n>         stop();\n> diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp\n> index 72aade14..c46bb0eb 100644\n> --- a/src/ipa/simple/algorithms/agc.cpp\n> +++ b/src/ipa/simple/algorithms/agc.cpp\n> @@ -11,6 +11,8 @@\n>  \n>  #include <libcamera/base/log.h>\n>  \n> +#include \"control_ids.h\"\n> +\n>  namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(IPASoftExposure)\n> @@ -97,10 +99,15 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou\n>  \n>  void Agc::process(IPAContext &context,\n>                   [[maybe_unused]] const uint32_t frame,\n> -                 [[maybe_unused]] IPAFrameContext &frameContext,\n> +                 IPAFrameContext &frameContext,\n>                   const SwIspStats *stats,\n> -                 [[maybe_unused]] ControlList &metadata)\n> +                 ControlList &metadata)\n>  {\n> +       utils::Duration exposureTime =\n> +               context.configuration.agc.lineDuration * frameContext.sensor.exposure;\n> +       metadata.set(controls::ExposureTime, exposureTime.get<std::micro>());\n> +       metadata.set(controls::AnalogueGain, frameContext.sensor.gain);\n> +\n>         /*\n>          * Calculate Mean Sample Value (MSV) according to formula from:\n>          * https://www.araa.asn.au/acra/acra2007/papers/paper84final.pdf\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> index 10d539f5..7dc2cd7a 100644\n> --- a/src/ipa/simple/ipa_context.h\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -1,6 +1,6 @@\n>  /* SPDX-License-Identifier: LGPL-2.1-or-later */\n>  /*\n> - * Copyright (C) 2024 Red Hat, Inc.\n> + * Copyright (C) 2024-2025 Red Hat, Inc.\n>   *\n>   * Simple pipeline IPA Context\n>   */\n> @@ -18,6 +18,8 @@\n>  \n>  #include <libipa/fc_queue.h>\n>  \n> +#include \"core_ipa_interface.h\"\n> +\n>  namespace libcamera {\n>  \n>  namespace ipa::soft {\n> @@ -27,6 +29,7 @@ struct IPASessionConfiguration {\n>         struct {\n>                 int32_t exposureMin, exposureMax;\n>                 double againMin, againMax, againMinStep;\n> +               utils::Duration lineDuration;\n>         } agc;\n>         struct {\n>                 std::optional<uint8_t> level;\n> @@ -83,6 +86,7 @@ struct IPAContext {\n>         {\n>         }\n>  \n> +       IPACameraSensorInfo sensorInfo;\n>         IPASessionConfiguration configuration;\n>         IPAActiveState activeState;\n>         FCQueue<IPAFrameContext> frameContexts;\n> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> index 4ef67c43..c94c4cd5 100644\n> --- a/src/ipa/simple/soft_simple.cpp\n> +++ b/src/ipa/simple/soft_simple.cpp\n> @@ -5,6 +5,7 @@\n>   * Simple Software Image Processing Algorithm module\n>   */\n>  \n> +#include <chrono>\n>  #include <stdint.h>\n>  #include <sys/mman.h>\n>  \n> @@ -32,6 +33,8 @@\n>  namespace libcamera {\n>  LOG_DEFINE_CATEGORY(IPASoft)\n>  \n> +using namespace std::literals::chrono_literals;\n> +\n>  namespace ipa::soft {\n>  \n>  /* Maximum number of frame contexts to be held */\n> @@ -50,7 +53,8 @@ public:\n>         int init(const IPASettings &settings,\n>                  const SharedFD &fdStats,\n>                  const SharedFD &fdParams,\n> -                const ControlInfoMap &sensorInfoMap,\n> +                const IPACameraSensorInfo &sensorInfo,\n> +                const ControlInfoMap &sensorControls,\n>                  ControlInfoMap *ipaControls,\n>                  bool *ccmEnabled) override;\n>         int configure(const IPAConfigInfo &configInfo) override;\n> @@ -89,7 +93,8 @@ IPASoftSimple::~IPASoftSimple()\n>  int IPASoftSimple::init(const IPASettings &settings,\n>                         const SharedFD &fdStats,\n>                         const SharedFD &fdParams,\n> -                       const ControlInfoMap &sensorInfoMap,\n> +                       const IPACameraSensorInfo &sensorInfo,\n> +                       const ControlInfoMap &sensorControls,\n>                         ControlInfoMap *ipaControls,\n>                         bool *ccmEnabled)\n>  {\n> @@ -100,6 +105,8 @@ int IPASoftSimple::init(const IPASettings &settings,\n>                         << settings.sensorModel;\n>         }\n>  \n> +       context_.sensorInfo = sensorInfo;\n> +\n>         /* Load the tuning data file */\n>         File file(settings.configurationFile);\n>         if (!file.open(File::OpenModeFlag::ReadOnly)) {\n> @@ -173,12 +180,12 @@ int IPASoftSimple::init(const IPASettings &settings,\n>          * Don't save the min and max control values yet, as e.g. the limits\n>          * for V4L2_CID_EXPOSURE depend on the configured sensor resolution.\n>          */\n> -       if (sensorInfoMap.find(V4L2_CID_EXPOSURE) == sensorInfoMap.end()) {\n> +       if (sensorControls.find(V4L2_CID_EXPOSURE) == sensorControls.end()) {\n>                 LOG(IPASoft, Error) << \"Don't have exposure control\";\n>                 return -EINVAL;\n>         }\n>  \n> -       if (sensorInfoMap.find(V4L2_CID_ANALOGUE_GAIN) == sensorInfoMap.end()) {\n> +       if (sensorControls.find(V4L2_CID_ANALOGUE_GAIN) == sensorControls.end()) {\n>                 LOG(IPASoft, Error) << \"Don't have gain control\";\n>                 return -EINVAL;\n>         }\n> @@ -198,6 +205,8 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n>         context_.activeState = {};\n>         context_.frameContexts.clear();\n>  \n> +       context_.configuration.agc.lineDuration =\n> +               context_.sensorInfo.minLineLength * 1.0s / context_.sensorInfo.pixelRate;\n>         context_.configuration.agc.exposureMin = exposureInfo.min().get<int32_t>();\n>         context_.configuration.agc.exposureMax = exposureInfo.max().get<int32_t>();\n>         if (!context_.configuration.agc.exposureMin) {\n> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> index 6baa3fec..28e2a360 100644\n> --- a/src/libcamera/software_isp/software_isp.cpp\n> +++ b/src/libcamera/software_isp/software_isp.cpp\n> @@ -133,12 +133,20 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n>         std::string ipaTuningFile =\n>                 ipa_->configurationFile(sensor->model() + \".yaml\", \"uncalibrated.yaml\");\n>  \n> -       int ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },\n> -                            debayer_->getStatsFD(),\n> -                            sharedParams_.fd(),\n> -                            sensor->controls(),\n> -                            ipaControls,\n> -                            &ccmEnabled_);\n> +       IPACameraSensorInfo sensorInfo{};\n> +       int ret = sensor->sensorInfo(&sensorInfo);\n> +       if (ret) {\n> +               LOG(SoftwareIsp, Error) << \"Camera sensor information not available\";\n> +               return;\n> +       }\n> +\n> +       ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },\n> +                        debayer_->getStatsFD(),\n> +                        sharedParams_.fd(),\n> +                        sensorInfo,\n> +                        sensor->controls(),\n> +                        ipaControls,\n> +                        &ccmEnabled_);\n>         if (ret) {\n>                 LOG(SoftwareIsp, Error) << \"IPA init failed\";\n>                 debayer_.reset();\n> -- \n> 2.49.0\n>","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 D8EBAC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 22:56:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A9A486896B;\n\tWed, 26 Mar 2025 23:56:55 +0100 (CET)","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 AD63568950\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 23:56:54 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6B5423A4;\n\tWed, 26 Mar 2025 23:55:06 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"eP5Rq1jR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743029706;\n\tbh=Ov1pl6pDP9H505x26NtWBPmqnmoqzFG+FtI7GlV2lqQ=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=eP5Rq1jRbZ3a68dhe9HUKxFfI7a2CPkJdm4Djsg4ddeU6/X5HnUBmjbPmrWaaHvBm\n\tQm4/ypi24BHc6kH031qzmM5m4xClZOwCntbo7iU0dSg8SA4y/MMzOOTtLrW1itjcuT\n\tcUk6UfamK1KRHrv3MiBK5DJdpgSJVxdsHAfofHSg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250326124856.75709-7-mzamazal@redhat.com>","References":"<20250326124856.75709-1-mzamazal@redhat.com>\n\t<20250326124856.75709-7-mzamazal@redhat.com>","Subject":"Re: [PATCH v5 6/6] ipa: simple: Report exposure in metadata","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Wed, 26 Mar 2025 22:56:51 +0000","Message-ID":"<174302981145.1701483.11782761287184128091@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33746,"web_url":"https://patchwork.libcamera.org/comment/33746/","msgid":"<20250326235135.GF21053@pendragon.ideasonboard.com>","date":"2025-03-26T23:51:35","subject":"Re: [PATCH v5 6/6] ipa: simple: Report exposure in metadata","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Mar 26, 2025 at 10:56:51PM +0000, Kieran Bingham wrote:\n> Quoting Milan Zamazal (2025-03-26 12:48:55)\n> > Report exposure and gain in metadata.\n> > \n> > This is more complicated than it could be expected because the exposure\n> > value should be in microseconds but it's handled using V4L2_CID_EXPOSURE\n> > control, which doesn't specify the unit, see\n> > https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/control.html.\n> > So the unit conversion is done in the way rkisp1 IPA uses.\n> > \n> > This requires getting and passing IPACameraSensorInfo around.  To avoid\n> > naming confusion and to improve consistency with rkisp1 IPA,\n> > sensorCtrlInfoMap parameter is renamed to sensorControls.\n> \n> Getting the lineDuration helps for handling things like\n> FrameDuration/Framerate control later too - so this is already helpful.\n> \n> And it's working - I can see the results in camshark which is helpful\n> already.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> > Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> > ---\n> >  include/libcamera/ipa/soft.mojom            |  3 ++-\n> >  src/ipa/simple/algorithms/agc.cpp           | 11 +++++++++--\n> >  src/ipa/simple/ipa_context.h                |  6 +++++-\n> >  src/ipa/simple/soft_simple.cpp              | 17 +++++++++++++----\n> >  src/libcamera/software_isp/software_isp.cpp | 20 ++++++++++++++------\n> >  5 files changed, 43 insertions(+), 14 deletions(-)\n> > \n> > diff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\n> > index a8e6ecda..77328c5f 100644\n> > --- a/include/libcamera/ipa/soft.mojom\n> > +++ b/include/libcamera/ipa/soft.mojom\n> > @@ -16,7 +16,8 @@ interface IPASoftInterface {\n> >         init(libcamera.IPASettings settings,\n> >              libcamera.SharedFD fdStats,\n> >              libcamera.SharedFD fdParams,\n> > -            libcamera.ControlInfoMap sensorCtrlInfoMap)\n> > +            libcamera.IPACameraSensorInfo sensorInfo,\n> > +            libcamera.ControlInfoMap sensorControls)\n> >                 => (int32 ret, libcamera.ControlInfoMap ipaControls, bool ccmEnabled);\n> >         start() => (int32 ret);\n> >         stop();\n> > diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp\n> > index 72aade14..c46bb0eb 100644\n> > --- a/src/ipa/simple/algorithms/agc.cpp\n> > +++ b/src/ipa/simple/algorithms/agc.cpp\n> > @@ -11,6 +11,8 @@\n> >  \n> >  #include <libcamera/base/log.h>\n> >  \n> > +#include \"control_ids.h\"\n> > +\n> >  namespace libcamera {\n> >  \n> >  LOG_DEFINE_CATEGORY(IPASoftExposure)\n> > @@ -97,10 +99,15 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou\n> >  \n> >  void Agc::process(IPAContext &context,\n> >                   [[maybe_unused]] const uint32_t frame,\n> > -                 [[maybe_unused]] IPAFrameContext &frameContext,\n> > +                 IPAFrameContext &frameContext,\n> >                   const SwIspStats *stats,\n> > -                 [[maybe_unused]] ControlList &metadata)\n> > +                 ControlList &metadata)\n> >  {\n> > +       utils::Duration exposureTime =\n> > +               context.configuration.agc.lineDuration * frameContext.sensor.exposure;\n> > +       metadata.set(controls::ExposureTime, exposureTime.get<std::micro>());\n> > +       metadata.set(controls::AnalogueGain, frameContext.sensor.gain);\n> > +\n> >         /*\n> >          * Calculate Mean Sample Value (MSV) according to formula from:\n> >          * https://www.araa.asn.au/acra/acra2007/papers/paper84final.pdf\n> > diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> > index 10d539f5..7dc2cd7a 100644\n> > --- a/src/ipa/simple/ipa_context.h\n> > +++ b/src/ipa/simple/ipa_context.h\n> > @@ -1,6 +1,6 @@\n> >  /* SPDX-License-Identifier: LGPL-2.1-or-later */\n> >  /*\n> > - * Copyright (C) 2024 Red Hat, Inc.\n> > + * Copyright (C) 2024-2025 Red Hat, Inc.\n> >   *\n> >   * Simple pipeline IPA Context\n> >   */\n> > @@ -18,6 +18,8 @@\n> >  \n> >  #include <libipa/fc_queue.h>\n> >  \n> > +#include \"core_ipa_interface.h\"\n> > +\n> >  namespace libcamera {\n> >  \n> >  namespace ipa::soft {\n> > @@ -27,6 +29,7 @@ struct IPASessionConfiguration {\n> >         struct {\n> >                 int32_t exposureMin, exposureMax;\n> >                 double againMin, againMax, againMinStep;\n> > +               utils::Duration lineDuration;\n> >         } agc;\n> >         struct {\n> >                 std::optional<uint8_t> level;\n> > @@ -83,6 +86,7 @@ struct IPAContext {\n> >         {\n> >         }\n> >  \n> > +       IPACameraSensorInfo sensorInfo;\n> >         IPASessionConfiguration configuration;\n> >         IPAActiveState activeState;\n> >         FCQueue<IPAFrameContext> frameContexts;\n> > diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> > index 4ef67c43..c94c4cd5 100644\n> > --- a/src/ipa/simple/soft_simple.cpp\n> > +++ b/src/ipa/simple/soft_simple.cpp\n> > @@ -5,6 +5,7 @@\n> >   * Simple Software Image Processing Algorithm module\n> >   */\n> >  \n> > +#include <chrono>\n> >  #include <stdint.h>\n> >  #include <sys/mman.h>\n> >  \n> > @@ -32,6 +33,8 @@\n> >  namespace libcamera {\n> >  LOG_DEFINE_CATEGORY(IPASoft)\n> >  \n> > +using namespace std::literals::chrono_literals;\n> > +\n> >  namespace ipa::soft {\n> >  \n> >  /* Maximum number of frame contexts to be held */\n> > @@ -50,7 +53,8 @@ public:\n> >         int init(const IPASettings &settings,\n> >                  const SharedFD &fdStats,\n> >                  const SharedFD &fdParams,\n> > -                const ControlInfoMap &sensorInfoMap,\n> > +                const IPACameraSensorInfo &sensorInfo,\n> > +                const ControlInfoMap &sensorControls,\n> >                  ControlInfoMap *ipaControls,\n> >                  bool *ccmEnabled) override;\n> >         int configure(const IPAConfigInfo &configInfo) override;\n> > @@ -89,7 +93,8 @@ IPASoftSimple::~IPASoftSimple()\n> >  int IPASoftSimple::init(const IPASettings &settings,\n> >                         const SharedFD &fdStats,\n> >                         const SharedFD &fdParams,\n> > -                       const ControlInfoMap &sensorInfoMap,\n> > +                       const IPACameraSensorInfo &sensorInfo,\n> > +                       const ControlInfoMap &sensorControls,\n> >                         ControlInfoMap *ipaControls,\n> >                         bool *ccmEnabled)\n> >  {\n> > @@ -100,6 +105,8 @@ int IPASoftSimple::init(const IPASettings &settings,\n> >                         << settings.sensorModel;\n> >         }\n> >  \n> > +       context_.sensorInfo = sensorInfo;\n> > +\n> >         /* Load the tuning data file */\n> >         File file(settings.configurationFile);\n> >         if (!file.open(File::OpenModeFlag::ReadOnly)) {\n> > @@ -173,12 +180,12 @@ int IPASoftSimple::init(const IPASettings &settings,\n> >          * Don't save the min and max control values yet, as e.g. the limits\n> >          * for V4L2_CID_EXPOSURE depend on the configured sensor resolution.\n> >          */\n> > -       if (sensorInfoMap.find(V4L2_CID_EXPOSURE) == sensorInfoMap.end()) {\n> > +       if (sensorControls.find(V4L2_CID_EXPOSURE) == sensorControls.end()) {\n> >                 LOG(IPASoft, Error) << \"Don't have exposure control\";\n> >                 return -EINVAL;\n> >         }\n> >  \n> > -       if (sensorInfoMap.find(V4L2_CID_ANALOGUE_GAIN) == sensorInfoMap.end()) {\n> > +       if (sensorControls.find(V4L2_CID_ANALOGUE_GAIN) == sensorControls.end()) {\n> >                 LOG(IPASoft, Error) << \"Don't have gain control\";\n> >                 return -EINVAL;\n> >         }\n> > @@ -198,6 +205,8 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n> >         context_.activeState = {};\n> >         context_.frameContexts.clear();\n> >  \n> > +       context_.configuration.agc.lineDuration =\n> > +               context_.sensorInfo.minLineLength * 1.0s / context_.sensorInfo.pixelRate;\n> >         context_.configuration.agc.exposureMin = exposureInfo.min().get<int32_t>();\n> >         context_.configuration.agc.exposureMax = exposureInfo.max().get<int32_t>();\n> >         if (!context_.configuration.agc.exposureMin) {\n> > diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> > index 6baa3fec..28e2a360 100644\n> > --- a/src/libcamera/software_isp/software_isp.cpp\n> > +++ b/src/libcamera/software_isp/software_isp.cpp\n> > @@ -133,12 +133,20 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n> >         std::string ipaTuningFile =\n> >                 ipa_->configurationFile(sensor->model() + \".yaml\", \"uncalibrated.yaml\");\n> >  \n> > -       int ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },\n> > -                            debayer_->getStatsFD(),\n> > -                            sharedParams_.fd(),\n> > -                            sensor->controls(),\n> > -                            ipaControls,\n> > -                            &ccmEnabled_);\n> > +       IPACameraSensorInfo sensorInfo{};\n> > +       int ret = sensor->sensorInfo(&sensorInfo);\n> > +       if (ret) {\n> > +               LOG(SoftwareIsp, Error) << \"Camera sensor information not available\";\n> > +               return;\n> > +       }\n> > +\n> > +       ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },\n> > +                        debayer_->getStatsFD(),\n> > +                        sharedParams_.fd(),\n> > +                        sensorInfo,\n> > +                        sensor->controls(),\n> > +                        ipaControls,\n> > +                        &ccmEnabled_);\n> >         if (ret) {\n> >                 LOG(SoftwareIsp, Error) << \"IPA init failed\";\n> >                 debayer_.reset();","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 551E8C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 23:52:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6FB07614E8;\n\tThu, 27 Mar 2025 00:52:00 +0100 (CET)","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 CA3F8614E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Mar 2025 00:51:58 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 40B891D5;\n\tThu, 27 Mar 2025 00:50:10 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QlkwA0HO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743033010;\n\tbh=cqAaKGE5yLRg9CwBIqira8w/OAtY6j2eNEOTfaCsjD8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QlkwA0HOgnnIX/ma305xpjf/Vrc+U8jFqCvK4rk/3kQGg0XWDTZ1TKuEpVkmvaVUp\n\txI2/XiYdQA5Epf8dGfMgONLaDCJQNLzfxhh7cCG5nEfLWltZ1lBpBX/Ti4Tv0bFoi5\n\tkFjkdui9c+oew65D2IAp4ZZ4QkjMGqgirBiCGSM0=","Date":"Thu, 27 Mar 2025 01:51:35 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v5 6/6] ipa: simple: Report exposure in metadata","Message-ID":"<20250326235135.GF21053@pendragon.ideasonboard.com>","References":"<20250326124856.75709-1-mzamazal@redhat.com>\n\t<20250326124856.75709-7-mzamazal@redhat.com>\n\t<174302981145.1701483.11782761287184128091@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<174302981145.1701483.11782761287184128091@ping.linuxembedded.co.uk>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]