<div dir="ltr"><div dir="ltr">Hi Kieran,<div><br></div><div>Thanks for the review (this + all the other patches as well)!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 1 Feb 2022 at 00:00, Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com">kieran.bingham@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 Naush,<br>
<br>
Quoting Naushir Patuck (2022-01-24 10:31:06)<br>
> Limit the gain code to the maximum value reported by the sensor controls when<br>
> sending to DelayedControls. The AGC algorithm will handle a lower gain used by<br>
> the sensor, provided provided it knows the actual gain used. This change ensures<br>
> that DelayedControls will never report an unclipped gain used.<br>
> <br>
> Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br>
> ---<br>
> src/ipa/raspberrypi/raspberrypi.cpp | 12 ++++++++++++<br>
> 1 file changed, 12 insertions(+)<br>
> <br>
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp<br>
> index 0ed41385018a..a72d516f84ee 100644<br>
> --- a/src/ipa/raspberrypi/raspberrypi.cpp<br>
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp<br>
> @@ -173,6 +173,9 @@ private:<br>
> /* Frame duration (1/fps) limits. */<br>
> Duration minFrameDuration_;<br>
> Duration maxFrameDuration_;<br>
> +<br>
> + /* Maximum gain code for the sensor. */<br>
> + uint32_t maxSensorGainCode_;<br>
<br>
Any risk of needing to clamp the minimum value too?<br></blockquote><div><br></div><div>This is a good point. </div><div>I made the assumption that a minimum gain of 1.0 is universal, but perhaps not...</div><div>David, what do you think? I recall you had played with devices where this may possible</div><div>not be true?</div><div> </div><div>Regards,</div><div>Naush</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
> };<br>
> <br>
> int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig)<br>
> @@ -357,6 +360,8 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,<br>
> return -1;<br>
> }<br>
> <br>
> + maxSensorGainCode_ = sensorCtrls_.at(V4L2_CID_ANALOGUE_GAIN).max().get<int32_t>();<br>
> +<br>
> /* Setup a metadata ControlList to output metadata. */<br>
> libcameraMetadata_ = ControlList(controls::controls);<br>
> <br>
> @@ -1113,6 +1118,13 @@ void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)<br>
> {<br>
> int32_t gainCode = helper_->GainCode(agcStatus->analogue_gain);<br>
> <br>
> + /*<br>
> + * Ensure anything larger than the max gain code will not be passed to<br>
> + * DelayedControls. The AGC will correctly handle a lower gain returned<br>
> + * by the sensor, provided it knows the actual gain used.<br>
> + */<br>
> + gainCode = std::min<int32_t>(gainCode, maxSensorGainCode_);<br>
> +<br>
<br>
Sounds ok to me though.<br>
<br>
Reviewed-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>><br>
<br>
> /* GetVBlanking might clip exposure time to the fps limits. */<br>
> Duration exposure = agcStatus->shutter_time;<br>
> int32_t vblanking = helper_->GetVBlanking(exposure, minFrameDuration_, maxFrameDuration_);<br>
> -- <br>
> 2.25.1<br>
><br>
</blockquote></div></div>