[{"id":20857,"web_url":"https://patchwork.libcamera.org/comment/20857/","msgid":"<163663688644.2258438.3775633565277753971@Monstersaurus>","date":"2021-11-11T13:21:26","subject":"Re: [libcamera-devel] [PATCH v3 12/14] ipa: ipu3: Cache line\n\tduration at configure call","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jean-Michel Hautbois (2021-11-11 11:06:03)\n> We use the line duration several times in the IPAIPU3. Instead of\n> recalculating it each time, cache the value as a utils::Duration. When\n> the value is needed in double, cast it to a std::micro value.\n\nThe value isn't needed in a double. It's needed to calculate the\nexposure in microseconds... It's just that it returns a double. It could\nbe an int for all the calculation cares...\n\n\n\n> \n> As sensorInfo is no longer used in updateSessionConfiguration remove the\n> reference to it.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/ipu3.cpp | 29 +++++++++++++----------------\n>  1 file changed, 13 insertions(+), 16 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 7762c5ec..3c1aa5ad 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -148,8 +148,7 @@ private:\n>         void updateControls(const IPACameraSensorInfo &sensorInfo,\n>                             const ControlInfoMap &sensorControls,\n>                             ControlInfoMap *ipaControls);\n> -       void updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n> -                                       const ControlInfoMap &sensorControls);\n> +       void updateSessionConfiguration(const ControlInfoMap &sensorControls);\n>         void processControls(unsigned int frame, const ControlList &controls);\n>         void fillParams(unsigned int frame, ipu3_uapi_params *params);\n>         void parseStatistics(unsigned int frame,\n> @@ -174,6 +173,8 @@ private:\n>         uint32_t minGain_;\n>         uint32_t maxGain_;\n>  \n> +       utils::Duration lineDuration_;\n> +\n>         /* Interface to the Camera Helper */\n>         std::unique_ptr<CameraSensorHelper> camHelper_;\n>  \n> @@ -188,16 +189,12 @@ private:\n>   * \\brief Compute IPASessionConfiguration using the sensor information and the\n>   * sensor V4L2 controls\n>   */\n> -void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n> -                                        const ControlInfoMap &sensorControls)\n> +void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n>  {\n>         const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n>         int32_t minExposure = v4l2Exposure.min().get<int32_t>();\n>         int32_t maxExposure = v4l2Exposure.max().get<int32_t>();\n>  \n> -       utils::Duration lineDuration = sensorInfo.lineLength * 1.0s\n> -                                    / sensorInfo.pixelRate;\n> -\n>         const ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n>         int32_t minGain = v4l2Gain.min().get<int32_t>();\n>         int32_t maxGain = v4l2Gain.max().get<int32_t>();\n> @@ -209,8 +206,8 @@ void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n>          *\n>          * \\todo take VBLANK into account for maximum shutter speed\n>          */\n> -       context_.configuration.agc.minShutterSpeed = minExposure * lineDuration;\n> -       context_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration;\n> +       context_.configuration.agc.minShutterSpeed = minExposure * lineDuration_;\n> +       context_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration_;\n>         context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);\n>         context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n>  }\n> @@ -239,11 +236,10 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n>          * exposure min, max and default and convert it from lines to\n>          * microseconds.\n>          */\n> -       double lineDuration = sensorInfo.lineLength / (sensorInfo.pixelRate / 1e6);\n>         const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n> -       int32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration;\n> -       int32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration;\n> -       int32_t defExposure = v4l2Exposure.def().get<int32_t>() * lineDuration;\n> +       int32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration_.get<std::micro>();\n> +       int32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration_.get<std::micro>();\n> +       int32_t defExposure = v4l2Exposure.def().get<int32_t>() * lineDuration_.get<std::micro>();\n>         controls[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure,\n>                                                         defExposure);\n>  \n> @@ -463,11 +459,13 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>  \n>         calculateBdsGrid(configInfo.bdsOutputSize);\n>  \n> +       lineDuration_ = sensorInfo_.lineLength * 1.0s / sensorInfo_.pixelRate;\n> +\n>         /* Update the camera controls using the new sensor settings. */\n>         updateControls(sensorInfo_, ctrls_, ipaControls);\n>  \n>         /* Update the IPASessionConfiguration using the sensor settings. */\n> -       updateSessionConfiguration(sensorInfo_, ctrls_);\n> +       updateSessionConfiguration(ctrls_);\n>  \n>         for (auto const &algo : algorithms_) {\n>                 int ret = algo->configure(context_, configInfo);\n> @@ -628,8 +626,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n>         setControls(frame);\n>  \n>         /* \\todo Use VBlank value calculated from each frame exposure. */\n> -       int64_t frameDuration = sensorInfo_.lineLength * (defVBlank_ + sensorInfo_.outputSize.height) /\n> -                               (sensorInfo_.pixelRate / 1e6);\n> +       int64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration_.get<std::micro>();\n\nPerhaps could make that\n\tint64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height)\n\t\t\t      * lineDuration_.get<std::micro>();\n\nto shorten the line, but that's optional.\n\nWith the commit message update:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>         ctrls.set(controls::FrameDuration, frameDuration);\n>  \n>         ctrls.set(controls::ColourTemperature, context_.frameContext.awb.temperatureK);\n> -- \n> 2.32.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 97F5BBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Nov 2021 13:21:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 021BD6035D;\n\tThu, 11 Nov 2021 14:21:31 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EBCF560345\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 14:21:28 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F2C94A0;\n\tThu, 11 Nov 2021 14:21:28 +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=\"EbZTPs09\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636636888;\n\tbh=AZysMXWBzBit2wuRsmVaG02RmnKNeNAVKSSPEqB3A9o=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=EbZTPs094Twu+dwgOpWxcU1rtVFz4YzxahW0R/otgHr2ss0jZ1+rzBp68A7jboMvL\n\tA5JfM5ywYGUmAAWhwyBTPmMqF84Nsgz+4mfYbb55SgTQAygxreC7i1Yivc9WAOPxNx\n\t2p01PCZgi5Pe71TtwGnNdRsnyuzcSbQ/hBgAuCCM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211111110605.105202-13-jeanmichel.hautbois@ideasonboard.com>","References":"<20211111110605.105202-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211111110605.105202-13-jeanmichel.hautbois@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 11 Nov 2021 13:21:26 +0000","Message-ID":"<163663688644.2258438.3775633565277753971@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH v3 12/14] ipa: ipu3: Cache line\n\tduration at configure call","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":20860,"web_url":"https://patchwork.libcamera.org/comment/20860/","msgid":"<7e8fddd8-7b71-a0da-7c1f-1edae85051cf@ideasonboard.com>","date":"2021-11-11T13:58:57","subject":"Re: [libcamera-devel] [PATCH v3 12/14] ipa: ipu3: Cache line\n\tduration at configure call","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"On 11/11/2021 14:21, Kieran Bingham wrote:\n> Quoting Jean-Michel Hautbois (2021-11-11 11:06:03)\n>> We use the line duration several times in the IPAIPU3. Instead of\n>> recalculating it each time, cache the value as a utils::Duration. When\n>> the value is needed in double, cast it to a std::micro value.\n> \n> The value isn't needed in a double. It's needed to calculate the\n> exposure in microseconds... It's just that it returns a double. It could\n> be an int for all the calculation cares...\n\nOK, I made the message:\ns/the value is needed in double, cast it/the value is needed, cast it/\n\n> \n> \n> \n>>\n>> As sensorInfo is no longer used in updateSessionConfiguration remove the\n>> reference to it.\n>>\n>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>> ---\n>>   src/ipa/ipu3/ipu3.cpp | 29 +++++++++++++----------------\n>>   1 file changed, 13 insertions(+), 16 deletions(-)\n>>\n>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n>> index 7762c5ec..3c1aa5ad 100644\n>> --- a/src/ipa/ipu3/ipu3.cpp\n>> +++ b/src/ipa/ipu3/ipu3.cpp\n>> @@ -148,8 +148,7 @@ private:\n>>          void updateControls(const IPACameraSensorInfo &sensorInfo,\n>>                              const ControlInfoMap &sensorControls,\n>>                              ControlInfoMap *ipaControls);\n>> -       void updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n>> -                                       const ControlInfoMap &sensorControls);\n>> +       void updateSessionConfiguration(const ControlInfoMap &sensorControls);\n>>          void processControls(unsigned int frame, const ControlList &controls);\n>>          void fillParams(unsigned int frame, ipu3_uapi_params *params);\n>>          void parseStatistics(unsigned int frame,\n>> @@ -174,6 +173,8 @@ private:\n>>          uint32_t minGain_;\n>>          uint32_t maxGain_;\n>>   \n>> +       utils::Duration lineDuration_;\n>> +\n>>          /* Interface to the Camera Helper */\n>>          std::unique_ptr<CameraSensorHelper> camHelper_;\n>>   \n>> @@ -188,16 +189,12 @@ private:\n>>    * \\brief Compute IPASessionConfiguration using the sensor information and the\n>>    * sensor V4L2 controls\n>>    */\n>> -void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n>> -                                        const ControlInfoMap &sensorControls)\n>> +void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n>>   {\n>>          const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n>>          int32_t minExposure = v4l2Exposure.min().get<int32_t>();\n>>          int32_t maxExposure = v4l2Exposure.max().get<int32_t>();\n>>   \n>> -       utils::Duration lineDuration = sensorInfo.lineLength * 1.0s\n>> -                                    / sensorInfo.pixelRate;\n>> -\n>>          const ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n>>          int32_t minGain = v4l2Gain.min().get<int32_t>();\n>>          int32_t maxGain = v4l2Gain.max().get<int32_t>();\n>> @@ -209,8 +206,8 @@ void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n>>           *\n>>           * \\todo take VBLANK into account for maximum shutter speed\n>>           */\n>> -       context_.configuration.agc.minShutterSpeed = minExposure * lineDuration;\n>> -       context_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration;\n>> +       context_.configuration.agc.minShutterSpeed = minExposure * lineDuration_;\n>> +       context_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration_;\n>>          context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);\n>>          context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n>>   }\n>> @@ -239,11 +236,10 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n>>           * exposure min, max and default and convert it from lines to\n>>           * microseconds.\n>>           */\n>> -       double lineDuration = sensorInfo.lineLength / (sensorInfo.pixelRate / 1e6);\n>>          const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n>> -       int32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration;\n>> -       int32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration;\n>> -       int32_t defExposure = v4l2Exposure.def().get<int32_t>() * lineDuration;\n>> +       int32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration_.get<std::micro>();\n>> +       int32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration_.get<std::micro>();\n>> +       int32_t defExposure = v4l2Exposure.def().get<int32_t>() * lineDuration_.get<std::micro>();\n>>          controls[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure,\n>>                                                          defExposure);\n>>   \n>> @@ -463,11 +459,13 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n>>   \n>>          calculateBdsGrid(configInfo.bdsOutputSize);\n>>   \n>> +       lineDuration_ = sensorInfo_.lineLength * 1.0s / sensorInfo_.pixelRate;\n>> +\n>>          /* Update the camera controls using the new sensor settings. */\n>>          updateControls(sensorInfo_, ctrls_, ipaControls);\n>>   \n>>          /* Update the IPASessionConfiguration using the sensor settings. */\n>> -       updateSessionConfiguration(sensorInfo_, ctrls_);\n>> +       updateSessionConfiguration(ctrls_);\n>>   \n>>          for (auto const &algo : algorithms_) {\n>>                  int ret = algo->configure(context_, configInfo);\n>> @@ -628,8 +626,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n>>          setControls(frame);\n>>   \n>>          /* \\todo Use VBlank value calculated from each frame exposure. */\n>> -       int64_t frameDuration = sensorInfo_.lineLength * (defVBlank_ + sensorInfo_.outputSize.height) /\n>> -                               (sensorInfo_.pixelRate / 1e6);\n>> +       int64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration_.get<std::micro>();\n> \n> Perhaps could make that\n> \tint64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height)\n> \t\t\t      * lineDuration_.get<std::micro>();\n> \n> to shorten the line, but that's optional.\n\nAnd checkstyle is not happy... ;-)\n\n> \n> With the commit message update:\n> \n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n>>          ctrls.set(controls::FrameDuration, frameDuration);\n>>   \n>>          ctrls.set(controls::ColourTemperature, context_.frameContext.awb.temperatureK);\n>> -- \n>> 2.32.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 41C37BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Nov 2021 13:59:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 792516035A;\n\tThu, 11 Nov 2021 14:59:01 +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 C8021600B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 14:59:00 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:e627:8337:a781:d98] (unknown\n\t[IPv6:2a01:e0a:169:7140:e627:8337:a781:d98])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C728DEE;\n\tThu, 11 Nov 2021 14:59:00 +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=\"oVmRQ16k\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636639140;\n\tbh=Ab5nglhV2Rtb8zLD1gA+KLO+pM5FX/FPfmWbDq4FFI8=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=oVmRQ16kFMPJitLwi7dJoPxlyh8xJrKIEhJaKZReYiseufYpprY+lWLhLGQG2MJpA\n\taLj8v9Wt9d3twKt6J04l+LYxDIP+eVePh3pJcF84002pMp4ZYpUmGTU7uy1ffkPnl5\n\tmj9LYTx9n8dqFhYzfQhqKlgy9SxH4OleHFBsHaO0=","Message-ID":"<7e8fddd8-7b71-a0da-7c1f-1edae85051cf@ideasonboard.com>","Date":"Thu, 11 Nov 2021 14:58:57 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.2.1","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20211111110605.105202-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211111110605.105202-13-jeanmichel.hautbois@ideasonboard.com>\n\t<163663688644.2258438.3775633565277753971@Monstersaurus>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<163663688644.2258438.3775633565277753971@Monstersaurus>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 12/14] ipa: ipu3: Cache line\n\tduration at configure call","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":20913,"web_url":"https://patchwork.libcamera.org/comment/20913/","msgid":"<163672313061.2714420.14291355431464055795@Monstersaurus>","date":"2021-11-12T13:18:50","subject":"Re: [libcamera-devel] [PATCH v3 12/14] ipa: ipu3: Cache line\n\tduration at configure call","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jean-Michel Hautbois (2021-11-11 13:58:57)\n> \n> \n> On 11/11/2021 14:21, Kieran Bingham wrote:\n> > Quoting Jean-Michel Hautbois (2021-11-11 11:06:03)\n> >> We use the line duration several times in the IPAIPU3. Instead of\n> >> recalculating it each time, cache the value as a utils::Duration. When\n> >> the value is needed in double, cast it to a std::micro value.\n> > \n> > The value isn't needed in a double. It's needed to calculate the\n> > exposure in microseconds... It's just that it returns a double. It could\n> > be an int for all the calculation cares...\n> \n> OK, I made the message:\n> s/the value is needed in double, cast it/the value is needed, cast it/\n\nI'll check in v4...\n\n> >> As sensorInfo is no longer used in updateSessionConfiguration remove the\n> >> reference to it.\n> >>\n> >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> >> ---\n> >> +       int64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration_.get<std::micro>();\n> > \n> > Perhaps could make that\n> >       int64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height)\n> >                             * lineDuration_.get<std::micro>();\n> > \n> > to shorten the line, but that's optional.\n> \n> And checkstyle is not happy... ;-)\n\nUnfortuantely, checkstyle is still fallable. We have to decide for\nourselves in some cases.\n\nIf we could tell clang-format \"Prefer less than 80, but it's acceptable\nto go to 120 in some/extreme cases\" and it to know what those extreme\ncases were - then maybe it would do different... but it's just not so\neasy :-(\n\nAnyway, it's optional for me ;-)\n\n> > \n> > With the commit message update:\n> > \n> > \n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > \n> >>          ctrls.set(controls::FrameDuration, frameDuration);\n> >>   \n> >>          ctrls.set(controls::ColourTemperature, context_.frameContext.awb.temperatureK);\n> >> -- \n> >> 2.32.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 EB811BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Nov 2021 13:18:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A5A66034D;\n\tFri, 12 Nov 2021 14:18:55 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F1B06032C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Nov 2021 14:18:53 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 259E774C;\n\tFri, 12 Nov 2021 14:18:53 +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=\"d4P2Kw/S\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636723133;\n\tbh=cF6wAtXrrY0EYao53FNHqaOCMBCKFuoZ4vn5ol9r43g=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=d4P2Kw/SY7D1o91blrR8iYS9SfSbFmsr3UDWmWSBwlNmZEcO3NPWGHlpcOuXVpA7D\n\to4kap4VLOwUlEELLtR0eg6hWQSgDnkiPl6CjdCb/nyttowrm2LIg52P1+VJmfQUwg6\n\tnEbPzX+WCdx7ujjpLmhq3M9vujFXy9iQkjt/evfY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<7e8fddd8-7b71-a0da-7c1f-1edae85051cf@ideasonboard.com>","References":"<20211111110605.105202-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211111110605.105202-13-jeanmichel.hautbois@ideasonboard.com>\n\t<163663688644.2258438.3775633565277753971@Monstersaurus>\n\t<7e8fddd8-7b71-a0da-7c1f-1edae85051cf@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 12 Nov 2021 13:18:50 +0000","Message-ID":"<163672313061.2714420.14291355431464055795@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v3 12/14] ipa: ipu3: Cache line\n\tduration at configure call","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>"}}]