Message ID | 20221003083934.31629-7-naush@raspberrypi.com |
---|---|
State | Changes Requested |
Headers | show |
Series |
|
Related | show |
Hi Naush, Thank you for the patch. On Mon, Oct 03, 2022 at 09:39:32AM +0100, Naushir Patuck via libcamera-devel wrote: > Add a lineLength field to the DeviceStatus structure to store the line length > used for a particular frame. > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/ipa/raspberrypi/controller/device_status.cpp | 1 + > src/ipa/raspberrypi/controller/device_status.h | 4 +++- > src/ipa/raspberrypi/raspberrypi.cpp | 2 ++ > 3 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp > index 2360a77bf1ea..c907efdd7511 100644 > --- a/src/ipa/raspberrypi/controller/device_status.cpp > +++ b/src/ipa/raspberrypi/controller/device_status.cpp > @@ -12,6 +12,7 @@ std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) > { > out << "Exposure: " << d.shutterSpeed > << " Frame length: " << d.frameLength > + << " Line length: " << d.lineLength > << " Gain: " << d.analogueGain; > > if (d.aperture) > diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h > index 8f74e21b0c6e..4384c2149589 100644 > --- a/src/ipa/raspberrypi/controller/device_status.h > +++ b/src/ipa/raspberrypi/controller/device_status.h > @@ -19,7 +19,7 @@ > struct DeviceStatus { > DeviceStatus() > : shutterSpeed(std::chrono::seconds(0)), frameLength(0), > - analogueGain(0.0) > + lineLength(std::chrono::seconds(0)), analogueGain(0.0) > { > } > > @@ -29,6 +29,8 @@ struct DeviceStatus { > libcamera::utils::Duration shutterSpeed; > /* frame length given in number of lines */ > uint32_t frameLength; > + /* line length for the current frame */ > + libcamera::utils::Duration lineLength; > double analogueGain; > /* 1.0/distance-in-metres, or 0 if unknown */ > std::optional<double> lensPosition; > diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp > index b6289f151677..5d6b22ef6813 100644 > --- a/src/ipa/raspberrypi/raspberrypi.cpp > +++ b/src/ipa/raspberrypi/raspberrypi.cpp > @@ -1108,7 +1108,9 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls) > int32_t exposureLines = sensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>(); > int32_t gainCode = sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>(); > int32_t vblank = sensorControls.get(V4L2_CID_VBLANK).get<int32_t>(); > + int32_t hblank = sensorControls.get(V4L2_CID_HBLANK).get<int32_t>(); > > + deviceStatus.lineLength = (mode_.width + hblank) * (1.0s / mode_.pixelRate); > deviceStatus.shutterSpeed = helper_->exposure(exposureLines, mode_.minLineLength); > deviceStatus.analogueGain = helper_->gain(gainCode); > deviceStatus.frameLength = mode_.height + vblank;
diff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp index 2360a77bf1ea..c907efdd7511 100644 --- a/src/ipa/raspberrypi/controller/device_status.cpp +++ b/src/ipa/raspberrypi/controller/device_status.cpp @@ -12,6 +12,7 @@ std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) { out << "Exposure: " << d.shutterSpeed << " Frame length: " << d.frameLength + << " Line length: " << d.lineLength << " Gain: " << d.analogueGain; if (d.aperture) diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 8f74e21b0c6e..4384c2149589 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -19,7 +19,7 @@ struct DeviceStatus { DeviceStatus() : shutterSpeed(std::chrono::seconds(0)), frameLength(0), - analogueGain(0.0) + lineLength(std::chrono::seconds(0)), analogueGain(0.0) { } @@ -29,6 +29,8 @@ struct DeviceStatus { libcamera::utils::Duration shutterSpeed; /* frame length given in number of lines */ uint32_t frameLength; + /* line length for the current frame */ + libcamera::utils::Duration lineLength; double analogueGain; /* 1.0/distance-in-metres, or 0 if unknown */ std::optional<double> lensPosition; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index b6289f151677..5d6b22ef6813 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -1108,7 +1108,9 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls) int32_t exposureLines = sensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>(); int32_t gainCode = sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>(); int32_t vblank = sensorControls.get(V4L2_CID_VBLANK).get<int32_t>(); + int32_t hblank = sensorControls.get(V4L2_CID_HBLANK).get<int32_t>(); + deviceStatus.lineLength = (mode_.width + hblank) * (1.0s / mode_.pixelRate); deviceStatus.shutterSpeed = helper_->exposure(exposureLines, mode_.minLineLength); deviceStatus.analogueGain = helper_->gain(gainCode); deviceStatus.frameLength = mode_.height + vblank;
Add a lineLength field to the DeviceStatus structure to store the line length used for a particular frame. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> --- src/ipa/raspberrypi/controller/device_status.cpp | 1 + src/ipa/raspberrypi/controller/device_status.h | 4 +++- src/ipa/raspberrypi/raspberrypi.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)