ipa: rpi: agc: Reorganise code for multi-channel AGC

This commit does the basic reorganisation of the code in order to
implement multi-channel AGC. The main changes are:

* The previous Agc class (in agc.cpp) has become the AgcChannel class
  in (agc_channel.cpp).

* A new Agc class is introduced which is a wrapper round a number of
  AgcChannels.

* The basic plumbing from ipa_base.cpp to Agc is updated to include a
  channel number. All the existing controls are hardwired to talk
  directly to channel 0.

There are a couple of limitations which we expect to apply to
multi-channel AGC. We're not allowing different frame durations to be
applied to the channels, nor are we allowing separate metering
modes. To be fair, supporting these things is not impossible, but
there are reasons why it may be tricky so they remain "TBD" for now.

This patch only includes the basic reorganisation and plumbing. It
does not yet update the important methods (switchMode, prepare and
process) to implement multi-channel AGC properly. This will appear in
a subsequent commit. For now, these functions are hard-coded just to
use channel 0, thereby preserving the existing behaviour.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
David Plowman
2023-09-15 16:58:41 +01:00
committed by Jacopo Mondi
parent cd940f7fd3
commit b2cb498a1a
7 changed files with 1235 additions and 932 deletions
+11 -8
View File
@@ -21,16 +21,19 @@ public:
/* An AGC algorithm must provide the following: */
virtual unsigned int getConvergenceFrames() const = 0;
virtual std::vector<double> const &getWeights() const = 0;
virtual void setEv(double ev) = 0;
virtual void setFlickerPeriod(libcamera::utils::Duration flickerPeriod) = 0;
virtual void setFixedShutter(libcamera::utils::Duration fixedShutter) = 0;
virtual void setEv(unsigned int channel, double ev) = 0;
virtual void setFlickerPeriod(unsigned int channel,
libcamera::utils::Duration flickerPeriod) = 0;
virtual void setFixedShutter(unsigned int channel,
libcamera::utils::Duration fixedShutter) = 0;
virtual void setMaxShutter(libcamera::utils::Duration maxShutter) = 0;
virtual void setFixedAnalogueGain(double fixedAnalogueGain) = 0;
virtual void setFixedAnalogueGain(unsigned int channel, double fixedAnalogueGain) = 0;
virtual void setMeteringMode(std::string const &meteringModeName) = 0;
virtual void setExposureMode(std::string const &exposureModeName) = 0;
virtual void setConstraintMode(std::string const &contraintModeName) = 0;
virtual void enableAuto() = 0;
virtual void disableAuto() = 0;
virtual void setExposureMode(unsigned int channel, std::string const &exposureModeName) = 0;
virtual void setConstraintMode(unsigned int channel, std::string const &contraintModeName) = 0;
virtual void enableAuto(unsigned int channel) = 0;
virtual void disableAuto(unsigned int channel) = 0;
virtual void setActiveChannels(const std::vector<unsigned int> &activeChannels) = 0;
};
} /* namespace RPiController */