<div dir="ltr"><div dir="ltr">Hi Umang,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 27, 2022 at 4:55 PM Umang Jain <<a href="mailto:umang.jain@ideasonboard.com" target="_blank">umang.jain@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Harvey,<br>
<br>
On 6/29/22 16:00, Harvey Yang via libcamera-devel wrote:<br>
> From: Harvey Yang <<a href="mailto:chenghaoyang@chromium.org" target="_blank">chenghaoyang@chromium.org</a>><br>
><br>
> This patch updates the ipa interface |IPAIPU3Interface::fillParamsBuffer|<br>
> with additional |captureBufferId| to fill the param buffer for the<br>
> StillCapture stream as well.<br>
<br>
<br>
Whenever the IPAIPU3 Interface is updated,<br>
<br>
     <a href="https://git.libcamera.org/libcamera/ipu3-ipa.git/tree/" rel="noreferrer" target="_blank">https://git.libcamera.org/libcamera/ipu3-ipa.git/tree/</a> (closed <br>
source IPA IPU3 wrapper)<br>
<br>
will need corresponding updates as well (Just mentioning for the records)<br>
<br></blockquote><div><br></div><div>Will try later.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
><br>
> Signed-off-by: Harvey Yang <<a href="mailto:chenghaoyang@chromium.org" target="_blank">chenghaoyang@chromium.org</a>><br>
> ---<br>
>   include/libcamera/ipa/ipu3.mojom     |  2 +-<br>
>   src/ipa/ipu3/ipu3.cpp                | 21 ++++++++++++++++++---<br>
>   src/libcamera/pipeline/ipu3/ipu3.cpp |  3 ++-<br>
>   3 files changed, 21 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom<br>
> index d1b1c6b8..d94c344e 100644<br>
> --- a/include/libcamera/ipa/ipu3.mojom<br>
> +++ b/include/libcamera/ipa/ipu3.mojom<br>
> @@ -31,7 +31,7 @@ interface IPAIPU3Interface {<br>
>       unmapBuffers(array<uint32> ids);<br>
>   <br>
>       [async] queueRequest(uint32 frame, libcamera.ControlList controls);<br>
> -     [async] fillParamsBuffer(uint32 frame, uint32 bufferId);<br>
> +     [async] fillParamsBuffer(uint32 frame, uint32 bufferId, uint32 captureBufferId);<br>
>       [async] processStatsBuffer(uint32 frame, int64 frameTimestamp,<br>
>                                  uint32 bufferId, libcamera.ControlList sensorControls);<br>
>   };<br>
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp<br>
> index dd6cfd79..149a3958 100644<br>
> --- a/src/ipa/ipu3/ipu3.cpp<br>
> +++ b/src/ipa/ipu3/ipu3.cpp<br>
> @@ -146,7 +146,8 @@ public:<br>
>       void unmapBuffers(const std::vector<unsigned int> &ids) override;<br>
>   <br>
>       void queueRequest(const uint32_t frame, const ControlList &controls) override;<br>
> -     void fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) override;<br>
> +     void fillParamsBuffer(const uint32_t frame, const uint32_t bufferId,<br>
> +                           const uint32_t captureBufferId) override;<br>
>       void processStatsBuffer(const uint32_t frame, const int64_t frameTimestamp,<br>
>                               const uint32_t bufferId,<br>
>                               const ControlList &sensorControls) override;<br>
> @@ -508,12 +509,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)<br>
>   /**<br>
>    * \brief Fill and return a buffer with ISP processing parameters for a frame<br>
>    * \param[in] frame The frame number<br>
> - * \param[in] bufferId ID of the parameter buffer to fill<br>
> + * \param[in] bufferId ID of the video parameter buffer to fill<br>
> + * \param[in] captureBufferId ID of the capture parameter buffer to fill<br>
>    *<br>
>    * Algorithms are expected to fill the IPU3 parameter buffer for the next<br>
>    * frame given their most recent processing of the ImgU statistics.<br>
>    */<br>
> -void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)<br>
> +void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId,<br>
<br>
<br>
Since now there are couple of parameter buffers to fill, this can be <br>
renamed to depict plural buffers:<br>
<br>
     IPAIPU3::fillParamsBuffers(const uint32_t frame, const uint32_t <br>
bufferId,<br>
<br></blockquote><div><br></div><div>Right, thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +                            const uint32_t captureBufferId)<br>
>   {<br>
>       auto it = buffers_.find(bufferId);<br>
>       if (it == buffers_.end()) {<br>
> @@ -536,6 +539,18 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)<br>
>        */<br>
>       params->use = {};<br>
>   <br>
> +     for (auto const &algo : algorithms_)<br>
> +             algo->prepare(context_, params);<br>
> +<br>
> +     // TODO: use different algorithms to set StillCapture params.<br>
<br>
<br>
Can you provide a brief summary here, specific to algorithms targetting <br>
StillCapture use-case? How would they differ (and I wonder if they <br>
work/need statistics from Imgu1).<br>
<br></blockquote><div><br></div><div>Hi Han-lin,</div><div>Can you help clarify this? I'm also not sure how the algorithms should be different for YUV/StillCapture use cases, with the same statistics from the YUV.</div><div>Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +     it = buffers_.find(captureBufferId);<br>
> +     if (it == buffers_.end()) {<br>
> +             LOG(IPAIPU3, Error) << "Could not find capture param buffer!";<br>
> +             return;<br>
> +     }<br>
> +     mem = it->second.planes()[0];<br>
> +     params = reinterpret_cast<ipu3_uapi_params *>(mem.data());<br>
> +     params->use = {};<br>
>       for (auto const &algo : algorithms_)<br>
>               algo->prepare(context_, params);<br>
>   <br>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
> index a201c5ca..a13fb881 100644<br>
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
> @@ -1424,7 +1424,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)<br>
>       if (request->findBuffer(&rawStream_))<br>
>               pipe()->completeBuffer(request, buffer);<br>
>   <br>
> -     ipa_->fillParamsBuffer(info->id, info->paramBuffer->cookie());<br>
> +     ipa_->fillParamsBuffer(info->id, info->paramBuffer->cookie(),<br>
> +                            info->captureParamBuffer->cookie());<br>
>   }<br>
>   <br>
>   void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)<br>
</blockquote></div></div>