[v4,27/49] ipa: libipa: agc: Use minimum line length
diff mbox series

Message ID 20260810103846.1075936-28-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • ipa: libipa: agc rework
Related show

Commit Message

Barnabás Pőcze Aug. 10, 2026, 10:38 a.m. UTC
`IPACameraSensorInfo::minLineLength` already contains the minimum
line length, taking the output format and minimum horizontal blanking
into account.

Furthermore, the `CameraSensor` implementations already set the horizontal
blanking to the minimum when initializing the sensor.

And finally the line duration is already calculated with the minimum
line length.

So use the minimum for the frame duration calculations as well.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/libipa/agc.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index 5fcfc6a9ba..3c95071259 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -250,10 +250,11 @@  int AgcAlgorithm::init(const ValueNode &tuningData)
 int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 			    const ConfigurationParams &config)
 {
+	const uint32_t lineLength = config.sensorInfo.minLineLength;
+
 	session = {};
 	session.autoAllowed = config.autoAllowed;
-	session.lineDuration =
-		config.sensorInfo.minLineLength * 1.0s / config.sensorInfo.pixelRate;
+	session.lineDuration = lineLength * 1.0s / config.sensorInfo.pixelRate;
 	session.sensor.outputSize = config.sensorInfo.outputSize;
 
 	const double lineDurationUs = session.lineDuration.get<std::micro>();
@@ -286,9 +287,6 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state,
 	 * The frame length is computed assuming a fixed line length combined
 	 * with the vertical frame sizes.
 	 */
-	const ControlInfo &v4l2HBlank = config.sensorControls.find(V4L2_CID_HBLANK)->second;
-	uint32_t hblank = v4l2HBlank.def().get<int32_t>();
-	uint32_t lineLength = config.sensorInfo.outputSize.width + hblank;
 
 	const ControlInfo &v4l2VBlank = config.sensorControls.find(V4L2_CID_VBLANK)->second;
 	std::array<uint32_t, 3> frameHeights{