libcamera v0.7.2+1-aebe4861-nvm
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
libcamera::ipa::AgcAlgorithm Class Reference

libIPA LSC algorithm algorithm More...

Classes

struct  ConfigurationParams
 Parameters for AgcAlgorithm::configure() More...
 
struct  ProcessParams
 Parameters for AgcAlgorithm::process() More...
 

Public Member Functions

int init (const ValueNode &tuningData, CameraSensorHelper *sensor, const ConfigurationParams &config)
 Load tuning data and configure.
 
int configure (agc::Session &session, agc::ActiveState &state, const ConfigurationParams &config)
 Initialize the session configuration and active state.
 
void queueRequest (const agc::Session &session, agc::ActiveState &state, agc::FrameContext &frameContext, const ControlList &controls)
 Queue a request.
 
void prepare (agc::ActiveState &state, agc::FrameContext &frameContext)
 Prepare a frame.
 
void process (const agc::Session &session, agc::ActiveState &state, agc::FrameContext &frameContext, std::optional< ProcessParams > &&params, ControlList &metadata)
 Process frame statistics.
 

Detailed Description

libIPA LSC algorithm algorithm

The AgcAlgorithm class can be used to implement automatic exposure/gain control in an IPA module, conforming to the prescribed Algorithm interface. Internally AgcMeanLuminance or AgcMSV is used, this class merely concerns itself with processing the sensor properties, establishing limits, managing controls, and providing the resulting metadata.

Users should compose agc::Session, agc::ActiveState, and agc::FrameContext into their platform-specific session configuration, active state, and frame contexts, respectively. Furthermore, in their implementation of the Algorithm virtual function, they should simply call the identically named member function of AgcAlgorithm.

Todo:

DigitalGain, DigitalGainMode

Expand documentation

Member Function Documentation

◆ configure()

int libcamera::ipa::AgcAlgorithm::configure ( agc::Session session,
agc::ActiveState state,
const ConfigurationParams config 
)

Initialize the session configuration and active state.

Parameters
[in]sessionThe agc session configuration
[in]stateThe agc active state
[in]configThe algorithm configuration

This function initializes session and state based on the tuning data loaded by init() and the configuration in config.

It also updates ConfigurationParams::ctrlMap with the limits of the various agc-related controls. Users are expected to propagate these controls to the camera.

Returns
0 on success, or a negative error code
See also
Algorithm::configure()

◆ init()

int libcamera::ipa::AgcAlgorithm::init ( const ValueNode tuningData,
CameraSensorHelper sensor,
const ConfigurationParams config 
)

Load tuning data and configure.

Parameters
[in]tuningDataThe tuning data
[in]sensorThe camera sensor helper
[in]configThe algorithm configuration

This function loads the tuning data and configures the algorithm as if by a call to configure(), in order to provide the available controls in ConfigurationParams::ctrlMap.

If a CameraSensorHelper is provided in sensor, an instance of AgcMeanLuminance is instantiated and the tuning data is loaded by calling AgcMeanLuminance::parseTuningData(). Otherwise an instance of AgcMSV is instantiated, and in this case the tuning data is ignored.

Returns
0 on success, or a negative error code
See also
Algorithm::init()

◆ prepare()

void libcamera::ipa::AgcAlgorithm::prepare ( agc::ActiveState state,
agc::FrameContext frameContext 
)

Prepare a frame.

Parameters
[in]stateThe agc active state
[in]frameContextThe agc frame context

This function prepares the parameters for the frame denoted by frameContext. After a call to this function, the values of frameContext.exposure and frameContext.gain will be finalized and may be used by the caller (see agc::prepareControls()).

Todo:
Finalize frameContext.vblank as well
See also
Algorithm::prepare()

◆ process()

void libcamera::ipa::AgcAlgorithm::process ( const agc::Session session,
agc::ActiveState state,
agc::FrameContext frameContext,
std::optional< ProcessParams > &&  params,
ControlList metadata 
)

Process frame statistics.

Parameters
[in]sessionThe agc session configuration
[in]stateThe agc active state
[in]frameContextThe agc frame context
[in]paramsThe algorithm parameters
[in]metadataThe list of metadata

This function processes the statistics for the completed frame denoted by frameContext, runs the AGC implementation, updates state appropriately, and also populates metadata for the completed frame.

params must be omitted if the session was configured without "autoAllowed", and it may be omitted even if auto control is enabled, for example, if the statistics could not be delivered due to some ephemeral error. This ensures that the algorithm state will not go out of sync, and that metadata is produced as expected.

Care must be taken to convert the platform specific statistics to the format expected in params. See ProcessParams for the details.

See also
Algorithm::process()

◆ queueRequest()

void libcamera::ipa::AgcAlgorithm::queueRequest ( const agc::Session session,
agc::ActiveState state,
agc::FrameContext frameContext,
const ControlList controls 
)

Queue a request.

Parameters
[in]sessionThe agc session configuration
[in]stateThe agc active state
[in]frameContextThe agc frame context
[in]controlsThe list of controls associated with a Request

This functions processes the agc-related controls in controls for the frame denoted by frameContext, and updates state and frameContext accordingly.

See also
Algorithm::queueRequest()

The documentation for this class was generated from the following files: