<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for your patch.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 24 Mar 2021 at 11:44, David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.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">If the sensor exposes V4L2_CID_RED_BALANCE and V4L2_CID_BLUE_BALANCE<br>
controls, assume it wants to be told the colour gains. We will need to<br>
add these to the list of delayed controls we can apply.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br>
---<br>
src/ipa/raspberrypi/raspberrypi.cpp | 17 ++++++++++++++---<br>
.../pipeline/raspberrypi/raspberrypi.cpp | 9 +++++++++<br>
2 files changed, 23 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp<br>
index 1c928b72..7437a77e 100644<br>
--- a/src/ipa/raspberrypi/raspberrypi.cpp<br>
+++ b/src/ipa/raspberrypi/raspberrypi.cpp<br>
@@ -1030,13 +1030,24 @@ void IPARPi::processStats(unsigned int bufferId)<br>
RPiController::StatisticsPtr statistics = std::make_shared<bcm2835_isp_stats>(*stats);<br>
controller_.Process(statistics, &rpiMetadata_);<br>
<br>
+ ControlList ctrls(sensorCtrls_);<br>
+<br>
struct AgcStatus agcStatus;<br>
- if (rpiMetadata_.Get("agc.status", agcStatus) == 0) {<br>
- ControlList ctrls(sensorCtrls_);<br>
+ if (rpiMetadata_.Get("agc.status", agcStatus) == 0)<br>
applyAGC(&agcStatus, ctrls);<br>
<br>
- setDelayedControls.emit(ctrls);<br>
+ struct AwbStatus awbStatus;<br>
+ if (rpiMetadata_.Get("awb.status", awbStatus) == 0 &&<br>
+ sensorCtrls_.find(V4L2_CID_RED_BALANCE) != sensorCtrls_.end() &&<br>
+ sensorCtrls_.find(V4L2_CID_BLUE_BALANCE) != sensorCtrls_.end()) {<br>
+ ctrls.set(V4L2_CID_RED_BALANCE,<br>
+ static_cast<int32_t>(awbStatus.gain_r * 256));<br>
+ ctrls.set(V4L2_CID_BLUE_BALANCE,<br>
+ static_cast<int32_t>(awbStatus.gain_b * 256));<br></blockquote><div><br></div><div>The 256 const bothers me slightly. Is this FP multiplier going to be true for all sensors?</div><div>Any way we can deduce this (perhaps from the min value)?</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>
+<br>
+ if (!ctrls.empty())<br>
+ setDelayedControls.emit(ctrls);<br>
}<br>
<br>
void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls)<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index 2cac802c..7bac1503 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -1027,6 +1027,15 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)<br>
{ V4L2_CID_EXPOSURE, { sensorConfig.exposureDelay, false } },<br>
{ V4L2_CID_VBLANK, { sensorConfig.vblankDelay, true } }<br>
};<br>
+<br>
+ /* If the sensor exposes red/blue balance controls, we will update them. */<br>
+ const ControlInfoMap &sensorControls = data->unicam_[Unicam::Image].dev()->controls();<br>
+ if (sensorControls.find(V4L2_CID_RED_BALANCE) != sensorControls.end() &&<br>
+ sensorControls.find(V4L2_CID_BLUE_BALANCE) != sensorControls.end()) {<br>
+ params[V4L2_CID_RED_BALANCE] = { sensorConfig.vblankDelay, false };<br>
+ params[V4L2_CID_BLUE_BALANCE] = { sensorConfig.vblankDelay, false };<br></blockquote><div><br></div><div>Should the delay value be 1 here, as the change likely happens on the very next frame?</div><div><br></div><div>Regards,</div><div>Naush</div><div><br></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>
+<br>
data->delayedCtrls_ = std::make_unique<DelayedControls>(data->unicam_[Unicam::Image].dev(), params);<br>
data->sensorMetadata_ = sensorConfig.sensorMetadata;<br>
<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div>