[libcamera-devel] [PATCH v1 0/6] Raspberry Pi AGC digial gain fixes

Naushir Patuck naush at raspberrypi.com
Fri Sep 2 14:08:02 CEST 2022


Hi,

This patch series fixes a long standing problem with our AGC where when using
manual controls, the digital gain applied to the frame is not calculated correctly.
The reason for this is that the AGC needs to know the state of the algorithm when
it sent the manual shutter/gain to the sensor, and not use the state information
when the frame eventually turns up.

This series fixes the issue by having the IPA maintain an array of RPiController::Metadata
objects that get cycled through every frame.  So historical metadata objects that
hold the algorithm state are available to inspect when needed.  This is a bit similar
to the ongoing work that is going on for IPA frame context queues.

Patches 1, 2, 3 update DelayedControls to take and return a user cookie when setting a ControlList.
Patches 4 and 5 pass the context index between the pipeline handler and IPA.
Patch 6 uses the historical AGC state to correctly calculate the digital gain.

Thanks,
Naush

Naushir Patuck (6):
  delayed_controls: Template the ControlRingBuffer class
  delayed_controls: Add user cookie to DelayedControls
  tests: delayed_controls: Add cookie value test
  ipa: raspberrypi: Use an array of RPiController::Metadata objects
  pipeline: ipa: raspberrypi: Use IPA cookies
  ipa: raspberrypi: agc: Fix digital gain calculation for manual mode

 include/libcamera/internal/delayed_controls.h | 21 +++--
 include/libcamera/ipa/raspberrypi.mojom       |  3 +-
 src/ipa/raspberrypi/controller/rpi/agc.cpp    | 10 ++-
 src/ipa/raspberrypi/raspberrypi.cpp           | 82 ++++++++++++-------
 src/libcamera/delayed_controls.cpp            | 17 ++--
 src/libcamera/pipeline/ipu3/ipu3.cpp          |  3 +-
 .../pipeline/raspberrypi/raspberrypi.cpp      | 12 +--
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  3 +-
 test/delayed_controls.cpp                     | 52 +++++++++++-
 9 files changed, 144 insertions(+), 59 deletions(-)

-- 
2.25.1



More information about the libcamera-devel mailing list