[{"id":39496,"web_url":"https://patchwork.libcamera.org/comment/39496/","msgid":"<178272721147.36676.13520624317285922777@ping.linuxembedded.co.uk>","date":"2026-06-29T10:00:11","subject":"Re: [PATCH v2 11/12] ipa: ipu3: Add IPACameraSensorInfo to\n\tIPAContext","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Daniel Scally (2026-06-26 14:05:58)\n> Add an instance of IPACameraSensorInfo to the IPAContext and fill it\n> during IPAIPU3::init(). This will allow us to pass sensor information\n> to algorithms at init time. This means that IPAIPU3::sensorInfo_ is\n> no longer needed, as the instance stored in the context is accessible\n> everywhere that that was previously used. Drop it.\n\naha, this kind of superceeds my comment/worries on the previous patch\nand means that's just a preparatory - and it's fine.\n\nAnd yes, this looks like how I would expect to store it.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n> Changes in v2:\n> \n>         - Dropped the sensorInfo_ class member, since this replaces it\n> ---\n>  src/ipa/ipu3/ipa_context.cpp |  3 +++\n>  src/ipa/ipu3/ipa_context.h   |  3 +++\n>  src/ipa/ipu3/ipu3.cpp        | 20 +++++++++-----------\n>  3 files changed, 15 insertions(+), 11 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\n> index d3bcd7a81fe010d17d1437bf7f6cedce83a9be5c..9537802ceca5018118bdf4c71ef361c20fc44bfb 100644\n> --- a/src/ipa/ipu3/ipa_context.cpp\n> +++ b/src/ipa/ipu3/ipa_context.cpp\n> @@ -54,6 +54,9 @@ namespace libcamera::ipa::ipu3 {\n>   *\n>   * \\var IPAContext::ctrlMap\n>   * \\brief A ControlInfoMap::Map of controls populated by the algorithms\n> + *\n> + * \\var IPAContext::sensorInfo\n> + * \\brief An IPACameraSensorInfo instance holding information about the sensor\n>   */\n>  \n>  /**\n> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\n> index ce496ed477f4cbe2653aedada3381258396d92c8..d650f2fe1ad8eab91b7128a47c9690e42b1595f1 100644\n> --- a/src/ipa/ipu3/ipa_context.h\n> +++ b/src/ipa/ipu3/ipa_context.h\n> @@ -15,6 +15,8 @@\n>  #include <libcamera/controls.h>\n>  #include <libcamera/geometry.h>\n>  \n> +#include <libcamera/ipa/core_ipa_interface.h>\n> +\n>  #include <libipa/awb.h>\n>  #include <libipa/ccm.h>\n>  #include <libipa/fc_queue.h>\n> @@ -91,6 +93,7 @@ struct IPAContext {\n>         FCQueue<IPAFrameContext> frameContexts;\n>  \n>         ControlInfoMap::Map ctrlMap;\n> +       IPACameraSensorInfo sensorInfo;\n>  };\n>  \n>  } /* namespace ipa::ipu3 */\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index b1c176e68098b24d8fd37e7a0e278cabf0e1c3b2..c2d3e62d12f4aba9e3d008025c8922a71d45d36f 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -177,8 +177,6 @@ private:\n>         ControlInfoMap sensorCtrls_;\n>         ControlInfoMap lensCtrls_;\n>  \n> -       IPACameraSensorInfo sensorInfo_;\n> -\n>         /* Interface to the Camera Helper */\n>         std::unique_ptr<CameraSensorHelper> camHelper_;\n>  \n> @@ -265,19 +263,19 @@ void IPAIPU3::updateControls(const ControlInfoMap &sensorControls,\n>          */\n>         const ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second;\n>         uint32_t hblank = v4l2HBlank.def().get<int32_t>();\n> -       uint32_t lineLength = sensorInfo_.outputSize.width + hblank;\n> +       uint32_t lineLength = context_.sensorInfo.outputSize.width + hblank;\n>  \n>         const ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\n>         std::array<uint32_t, 3> frameHeights{\n> -               v4l2VBlank.min().get<int32_t>() + sensorInfo_.outputSize.height,\n> -               v4l2VBlank.max().get<int32_t>() + sensorInfo_.outputSize.height,\n> -               v4l2VBlank.def().get<int32_t>() + sensorInfo_.outputSize.height,\n> +               v4l2VBlank.min().get<int32_t>() + context_.sensorInfo.outputSize.height,\n> +               v4l2VBlank.max().get<int32_t>() + context_.sensorInfo.outputSize.height,\n> +               v4l2VBlank.def().get<int32_t>() + context_.sensorInfo.outputSize.height,\n>         };\n>  \n>         std::array<int64_t, 3> frameDurations;\n>         for (unsigned int i = 0; i < frameHeights.size(); ++i) {\n>                 uint64_t frameSize = lineLength * frameHeights[i];\n> -               frameDurations[i] = frameSize / (sensorInfo_.pixelRate / 1000000U);\n> +               frameDurations[i] = frameSize / (context_.sensorInfo.pixelRate / 1000000U);\n>         }\n>         controls[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n>                                                                frameDurations[1],\n> @@ -311,7 +309,7 @@ int IPAIPU3::init(const IPASettings &settings,\n>         context_.configuration = {};\n>         context_.configuration.sensor.lineDuration =\n>                 sensorInfo.minLineLength * 1.0s / sensorInfo.pixelRate;\n> -       sensorInfo_ = sensorInfo;\n> +       context_.sensorInfo = sensorInfo;\n>  \n>         /* Load the tuning data file. */\n>         File file(settings.configurationFile);\n> @@ -464,7 +462,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>                 return -ENODATA;\n>         }\n>  \n> -       sensorInfo_ = configInfo.sensorInfo;\n> +       context_.sensorInfo = configInfo.sensorInfo;\n>  \n>         lensCtrls_ = configInfo.lensControls;\n>  \n> @@ -475,8 +473,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>  \n>         /* Initialise the sensor configuration. */\n>         context_.configuration.sensor.lineDuration =\n> -               sensorInfo_.minLineLength * 1.0s / sensorInfo_.pixelRate;\n> -       context_.configuration.sensor.size = sensorInfo_.outputSize;\n> +               context_.sensorInfo.minLineLength * 1.0s / context_.sensorInfo.pixelRate;\n> +       context_.configuration.sensor.size = context_.sensorInfo.outputSize;\n>  \n>         /*\n>          * Compute the sensor V4L2 controls to be used by the algorithms and\n> \n> -- \n> 2.43.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 4D369C3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2026 10:00:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F24AF65F19;\n\tMon, 29 Jun 2026 12:00:15 +0200 (CEST)","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 73F1965F04\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 12:00:14 +0200 (CEST)","from monstersaurus.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 6586834;\n\tMon, 29 Jun 2026 11:59:31 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tvQ+fH7k\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782727171;\n\tbh=REoNgcHh8gbrhzLIbeossreq00l9vB+8dnfWzv2fjHg=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=tvQ+fH7kjE+iRUh0dtFyVSVBTdboAVy4uF/1vu1cw0NuZ+nV1IHT64nEBTY+V7/8Y\n\tiEnuYozTeVr7gnO1GqKeG1KVPogCwWgO4suYGG1eCYIScXKBSgOkfzamiGFqaeY/6p\n\t8PkT+n5v8jxndKuUfCeOXZ43B9vNO6AYUrX8f3Hk=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260626-ipu3-libipa-rework-v2-11-41546e23de3e@ideasonboard.com>","References":"<20260626-ipu3-libipa-rework-v2-0-41546e23de3e@ideasonboard.com>\n\t<20260626-ipu3-libipa-rework-v2-11-41546e23de3e@ideasonboard.com>","Subject":"Re: [PATCH v2 11/12] ipa: ipu3: Add IPACameraSensorInfo to\n\tIPAContext","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 29 Jun 2026 11:00:11 +0100","Message-ID":"<178272721147.36676.13520624317285922777@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":39527,"web_url":"https://patchwork.libcamera.org/comment/39527/","msgid":"<50e14c03-919d-4333-a19d-e5ac689573e5@ideasonboard.com>","date":"2026-06-30T11:36:27","subject":"Re: [PATCH v2 11/12] ipa: ipu3: Add IPACameraSensorInfo to\n\tIPAContext","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 06. 26. 15:05 keltezéssel, Daniel Scally írta:\n> Add an instance of IPACameraSensorInfo to the IPAContext and fill it\n> during IPAIPU3::init(). This will allow us to pass sensor information\n> to algorithms at init time. This means that IPAIPU3::sensorInfo_ is\n> no longer needed, as the instance stored in the context is accessible\n> everywhere that that was previously used. Drop it.\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n> Changes in v2:\n> \n>          - Dropped the sensorInfo_ class member, since this replaces it\n> ---\n\nLooks ok to me.\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>   src/ipa/ipu3/ipa_context.cpp |  3 +++\n>   src/ipa/ipu3/ipa_context.h   |  3 +++\n>   src/ipa/ipu3/ipu3.cpp        | 20 +++++++++-----------\n>   3 files changed, 15 insertions(+), 11 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\n> index d3bcd7a81fe010d17d1437bf7f6cedce83a9be5c..9537802ceca5018118bdf4c71ef361c20fc44bfb 100644\n> --- a/src/ipa/ipu3/ipa_context.cpp\n> +++ b/src/ipa/ipu3/ipa_context.cpp\n> @@ -54,6 +54,9 @@ namespace libcamera::ipa::ipu3 {\n>    *\n>    * \\var IPAContext::ctrlMap\n>    * \\brief A ControlInfoMap::Map of controls populated by the algorithms\n> + *\n> + * \\var IPAContext::sensorInfo\n> + * \\brief An IPACameraSensorInfo instance holding information about the sensor\n>    */\n>   \n>   /**\n> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\n> index ce496ed477f4cbe2653aedada3381258396d92c8..d650f2fe1ad8eab91b7128a47c9690e42b1595f1 100644\n> --- a/src/ipa/ipu3/ipa_context.h\n> +++ b/src/ipa/ipu3/ipa_context.h\n> @@ -15,6 +15,8 @@\n>   #include <libcamera/controls.h>\n>   #include <libcamera/geometry.h>\n>   \n> +#include <libcamera/ipa/core_ipa_interface.h>\n> +\n>   #include <libipa/awb.h>\n>   #include <libipa/ccm.h>\n>   #include <libipa/fc_queue.h>\n> @@ -91,6 +93,7 @@ struct IPAContext {\n>   \tFCQueue<IPAFrameContext> frameContexts;\n>   \n>   \tControlInfoMap::Map ctrlMap;\n> +\tIPACameraSensorInfo sensorInfo;\n>   };\n>   \n>   } /* namespace ipa::ipu3 */\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index b1c176e68098b24d8fd37e7a0e278cabf0e1c3b2..c2d3e62d12f4aba9e3d008025c8922a71d45d36f 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -177,8 +177,6 @@ private:\n>   \tControlInfoMap sensorCtrls_;\n>   \tControlInfoMap lensCtrls_;\n>   \n> -\tIPACameraSensorInfo sensorInfo_;\n> -\n>   \t/* Interface to the Camera Helper */\n>   \tstd::unique_ptr<CameraSensorHelper> camHelper_;\n>   \n> @@ -265,19 +263,19 @@ void IPAIPU3::updateControls(const ControlInfoMap &sensorControls,\n>   \t */\n>   \tconst ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second;\n>   \tuint32_t hblank = v4l2HBlank.def().get<int32_t>();\n> -\tuint32_t lineLength = sensorInfo_.outputSize.width + hblank;\n> +\tuint32_t lineLength = context_.sensorInfo.outputSize.width + hblank;\n>   \n>   \tconst ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\n>   \tstd::array<uint32_t, 3> frameHeights{\n> -\t\tv4l2VBlank.min().get<int32_t>() + sensorInfo_.outputSize.height,\n> -\t\tv4l2VBlank.max().get<int32_t>() + sensorInfo_.outputSize.height,\n> -\t\tv4l2VBlank.def().get<int32_t>() + sensorInfo_.outputSize.height,\n> +\t\tv4l2VBlank.min().get<int32_t>() + context_.sensorInfo.outputSize.height,\n> +\t\tv4l2VBlank.max().get<int32_t>() + context_.sensorInfo.outputSize.height,\n> +\t\tv4l2VBlank.def().get<int32_t>() + context_.sensorInfo.outputSize.height,\n>   \t};\n>   \n>   \tstd::array<int64_t, 3> frameDurations;\n>   \tfor (unsigned int i = 0; i < frameHeights.size(); ++i) {\n>   \t\tuint64_t frameSize = lineLength * frameHeights[i];\n> -\t\tframeDurations[i] = frameSize / (sensorInfo_.pixelRate / 1000000U);\n> +\t\tframeDurations[i] = frameSize / (context_.sensorInfo.pixelRate / 1000000U);\n>   \t}\n>   \tcontrols[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n>   \t\t\t\t\t\t\t       frameDurations[1],\n> @@ -311,7 +309,7 @@ int IPAIPU3::init(const IPASettings &settings,\n>   \tcontext_.configuration = {};\n>   \tcontext_.configuration.sensor.lineDuration =\n>   \t\tsensorInfo.minLineLength * 1.0s / sensorInfo.pixelRate;\n> -\tsensorInfo_ = sensorInfo;\n> +\tcontext_.sensorInfo = sensorInfo;\n>   \n>   \t/* Load the tuning data file. */\n>   \tFile file(settings.configurationFile);\n> @@ -464,7 +462,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>   \t\treturn -ENODATA;\n>   \t}\n>   \n> -\tsensorInfo_ = configInfo.sensorInfo;\n> +\tcontext_.sensorInfo = configInfo.sensorInfo;\n>   \n>   \tlensCtrls_ = configInfo.lensControls;\n>   \n> @@ -475,8 +473,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>   \n>   \t/* Initialise the sensor configuration. */\n>   \tcontext_.configuration.sensor.lineDuration =\n> -\t\tsensorInfo_.minLineLength * 1.0s / sensorInfo_.pixelRate;\n> -\tcontext_.configuration.sensor.size = sensorInfo_.outputSize;\n> +\t\tcontext_.sensorInfo.minLineLength * 1.0s / context_.sensorInfo.pixelRate;\n> +\tcontext_.configuration.sensor.size = context_.sensorInfo.outputSize;\n>   \n>   \t/*\n>   \t * Compute the sensor V4L2 controls to be used by the algorithms and\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 93699C3303\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Jun 2026 11:36:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 49A9765F69;\n\tTue, 30 Jun 2026 13:36:30 +0200 (CEST)","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 34B3B65F66\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Jun 2026 13:36:28 +0200 (CEST)","from [192.168.33.31] (185.221.140.128.nat.pool.zt.hu\n\t[185.221.140.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1641D22B;\n\tTue, 30 Jun 2026 13:35:44 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"T+63TqvL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782819344;\n\tbh=nCfcXFJ6aguTPi4i0zz7ZcKD7jDfBz7R/TOiqUCi+n0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=T+63TqvL6z006aGSv1eKNEgcU5yPmmRmd6dEw60UjiGa3taMo3eY19GDyRMiaVTqa\n\twaLvod22hUAgi/YO89fY5zOpPEviKgBJ8ZPmQNxcgsBHyKptgUuJOoSc8URS9Wl617\n\tz1z1KHM9WeHd5Z7PSd0SvWyq7akavWs/Oc5S/VpM=","Message-ID":"<50e14c03-919d-4333-a19d-e5ac689573e5@ideasonboard.com>","Date":"Tue, 30 Jun 2026 13:36:27 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2 11/12] ipa: ipu3: Add IPACameraSensorInfo to\n\tIPAContext","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20260626-ipu3-libipa-rework-v2-0-41546e23de3e@ideasonboard.com>\n\t<20260626-ipu3-libipa-rework-v2-11-41546e23de3e@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260626-ipu3-libipa-rework-v2-11-41546e23de3e@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>"}}]