Files
external_libcamera/src/ipa/ipu3/algorithms/agc.h
T
Jean-Michel Hautbois 4fdf1e4f5e ipa: ipu3: agc: Compute the gain for each frame
Now that we have the real exposure applied at each frame, remove the
early return based on a frame counter and compute the gain for each
frame.

Introduce a number of startup frames during which the filter speed is
1.0, meaning we apply instantly the exposure value calculated and not a
slower filtered one. This is used to have a faster convergence, and
those frames may be dropped in a future development to hide the
convergance process from the viewer.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-11-15 11:00:05 +01:00

62 lines
1.3 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2021, Ideas On Board
*
* agc.h - IPU3 AGC/AEC mean-based control algorithm
*/
#ifndef __LIBCAMERA_IPU3_ALGORITHMS_AGC_H__
#define __LIBCAMERA_IPU3_ALGORITHMS_AGC_H__
#include <linux/intel-ipu3.h>
#include <libcamera/base/utils.h>
#include <libcamera/geometry.h>
#include "algorithm.h"
namespace libcamera {
struct IPACameraSensorInfo;
namespace ipa::ipu3::algorithms {
class Agc : public Algorithm
{
public:
Agc();
~Agc() = default;
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
private:
void measureBrightness(const ipu3_uapi_stats_3a *stats,
const ipu3_uapi_grid_config &grid);
void filterExposure();
void computeExposure(IPAFrameContext &frameContext);
uint64_t frameCount_;
double iqMean_;
utils::Duration lineDuration_;
uint32_t minExposureLines_;
uint32_t maxExposureLines_;
double minAnalogueGain_;
double maxAnalogueGain_;
utils::Duration filteredExposure_;
utils::Duration currentExposure_;
utils::Duration prevExposureValue_;
uint32_t stride_;
};
} /* namespace ipa::ipu3::algorithms */
} /* namespace libcamera */
#endif /* __LIBCAMERA_IPU3_ALGORITHMS_AGC_H__ */