libcamera: software_isp: Add contrast control
This patch introduces support for applying runtime controls to software ISP. It enables the contrast control as the first control that can be used. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
9135aacff1
commit
3930b94021
8 changed files with 26 additions and 7 deletions
|
@ -46,7 +46,8 @@ LOG_DECLARE_CATEGORY(SoftwareIsp)
|
||||||
class SoftwareIsp
|
class SoftwareIsp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor);
|
SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,
|
||||||
|
ControlInfoMap *ipaControls);
|
||||||
~SoftwareIsp();
|
~SoftwareIsp();
|
||||||
|
|
||||||
int loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }
|
int loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface IPASoftInterface {
|
||||||
libcamera.SharedFD fdStats,
|
libcamera.SharedFD fdStats,
|
||||||
libcamera.SharedFD fdParams,
|
libcamera.SharedFD fdParams,
|
||||||
libcamera.ControlInfoMap sensorCtrlInfoMap)
|
libcamera.ControlInfoMap sensorCtrlInfoMap)
|
||||||
=> (int32 ret);
|
=> (int32 ret, libcamera.ControlInfoMap ipaControls);
|
||||||
start() => (int32 ret);
|
start() => (int32 ret);
|
||||||
stop();
|
stop();
|
||||||
configure(IPAConfigInfo configInfo)
|
configure(IPAConfigInfo configInfo)
|
||||||
|
|
|
@ -24,6 +24,13 @@ LOG_DEFINE_CATEGORY(IPASoftLut)
|
||||||
|
|
||||||
namespace ipa::soft::algorithms {
|
namespace ipa::soft::algorithms {
|
||||||
|
|
||||||
|
int Lut::init(IPAContext &context,
|
||||||
|
[[maybe_unused]] const YamlObject &tuningData)
|
||||||
|
{
|
||||||
|
context.ctrlMap[&controls::Contrast] = ControlInfo(0.0f, 2.0f, 1.0f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int Lut::configure(IPAContext &context,
|
int Lut::configure(IPAContext &context,
|
||||||
[[maybe_unused]] const IPAConfigInfo &configInfo)
|
[[maybe_unused]] const IPAConfigInfo &configInfo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
Lut() = default;
|
Lut() = default;
|
||||||
~Lut() = default;
|
~Lut() = default;
|
||||||
|
|
||||||
|
int init(IPAContext &context, const YamlObject &tuningData) override;
|
||||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||||
void queueRequest(typename Module::Context &context,
|
void queueRequest(typename Module::Context &context,
|
||||||
const uint32_t frame,
|
const uint32_t frame,
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct IPAContext {
|
||||||
IPASessionConfiguration configuration;
|
IPASessionConfiguration configuration;
|
||||||
IPAActiveState activeState;
|
IPAActiveState activeState;
|
||||||
FCQueue<IPAFrameContext> frameContexts;
|
FCQueue<IPAFrameContext> frameContexts;
|
||||||
|
ControlInfoMap::Map ctrlMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ipa::soft */
|
} /* namespace ipa::soft */
|
||||||
|
|
|
@ -50,7 +50,8 @@ public:
|
||||||
int init(const IPASettings &settings,
|
int init(const IPASettings &settings,
|
||||||
const SharedFD &fdStats,
|
const SharedFD &fdStats,
|
||||||
const SharedFD &fdParams,
|
const SharedFD &fdParams,
|
||||||
const ControlInfoMap &sensorInfoMap) override;
|
const ControlInfoMap &sensorInfoMap,
|
||||||
|
ControlInfoMap *ipaControls) override;
|
||||||
int configure(const IPAConfigInfo &configInfo) override;
|
int configure(const IPAConfigInfo &configInfo) override;
|
||||||
|
|
||||||
int start() override;
|
int start() override;
|
||||||
|
@ -87,7 +88,8 @@ IPASoftSimple::~IPASoftSimple()
|
||||||
int IPASoftSimple::init(const IPASettings &settings,
|
int IPASoftSimple::init(const IPASettings &settings,
|
||||||
const SharedFD &fdStats,
|
const SharedFD &fdStats,
|
||||||
const SharedFD &fdParams,
|
const SharedFD &fdParams,
|
||||||
const ControlInfoMap &sensorInfoMap)
|
const ControlInfoMap &sensorInfoMap,
|
||||||
|
ControlInfoMap *ipaControls)
|
||||||
{
|
{
|
||||||
camHelper_ = CameraSensorHelperFactoryBase::create(settings.sensorModel);
|
camHelper_ = CameraSensorHelperFactoryBase::create(settings.sensorModel);
|
||||||
if (!camHelper_) {
|
if (!camHelper_) {
|
||||||
|
@ -158,6 +160,9 @@ int IPASoftSimple::init(const IPASettings &settings,
|
||||||
stats_ = static_cast<SwIspStats *>(mem);
|
stats_ = static_cast<SwIspStats *>(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ControlInfoMap::Map ctrlMap = context_.ctrlMap;
|
||||||
|
*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the sensor driver supports the controls required by the
|
* Check if the sensor driver supports the controls required by the
|
||||||
* Soft IPA.
|
* Soft IPA.
|
||||||
|
|
|
@ -531,7 +531,7 @@ int SimpleCameraData::init()
|
||||||
* Instantiate Soft ISP if this is enabled for the given driver and no converter is used.
|
* Instantiate Soft ISP if this is enabled for the given driver and no converter is used.
|
||||||
*/
|
*/
|
||||||
if (!converter_ && pipe->swIspEnabled()) {
|
if (!converter_ && pipe->swIspEnabled()) {
|
||||||
swIsp_ = std::make_unique<SoftwareIsp>(pipe, sensor_.get());
|
swIsp_ = std::make_unique<SoftwareIsp>(pipe, sensor_.get(), &controlInfo_);
|
||||||
if (!swIsp_->isValid()) {
|
if (!swIsp_->isValid()) {
|
||||||
LOG(SimplePipeline, Warning)
|
LOG(SimplePipeline, Warning)
|
||||||
<< "Failed to create software ISP, disabling software debayering";
|
<< "Failed to create software ISP, disabling software debayering";
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <libcamera/controls.h>
|
||||||
#include <libcamera/formats.h>
|
#include <libcamera/formats.h>
|
||||||
#include <libcamera/stream.h>
|
#include <libcamera/stream.h>
|
||||||
|
|
||||||
|
@ -60,9 +61,11 @@ LOG_DEFINE_CATEGORY(SoftwareIsp)
|
||||||
* \brief Constructs SoftwareIsp object
|
* \brief Constructs SoftwareIsp object
|
||||||
* \param[in] pipe The pipeline handler in use
|
* \param[in] pipe The pipeline handler in use
|
||||||
* \param[in] sensor Pointer to the CameraSensor instance owned by the pipeline
|
* \param[in] sensor Pointer to the CameraSensor instance owned by the pipeline
|
||||||
|
* \param[out] ipaControls The IPA controls to update
|
||||||
* handler
|
* handler
|
||||||
*/
|
*/
|
||||||
SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)
|
SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,
|
||||||
|
ControlInfoMap *ipaControls)
|
||||||
: dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |
|
: dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |
|
||||||
DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |
|
DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |
|
||||||
DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)
|
DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)
|
||||||
|
@ -124,7 +127,8 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)
|
||||||
int ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },
|
int ret = ipa_->init(IPASettings{ ipaTuningFile, sensor->model() },
|
||||||
debayer_->getStatsFD(),
|
debayer_->getStatsFD(),
|
||||||
sharedParams_.fd(),
|
sharedParams_.fd(),
|
||||||
sensor->controls());
|
sensor->controls(),
|
||||||
|
ipaControls);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG(SoftwareIsp, Error) << "IPA init failed";
|
LOG(SoftwareIsp, Error) << "IPA init failed";
|
||||||
debayer_.reset();
|
debayer_.reset();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue