mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-15 16:35:06 +03:00
libcamera: ipa_interface: Add support for custom IPA data to configure()
Add two new parameters, ipaConfig and result, to the IPAInterface::configure() function to allow pipeline handlers to pass custom data to their IPA, and receive data back. Wire this through the code base. The C API interface will be addressed separately, likely through automation of the C <-> C++ translation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
f1a48f96af
commit
72263c5203
13 changed files with 61 additions and 18 deletions
|
@ -24,7 +24,9 @@ public:
|
|||
void stop() override;
|
||||
void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override;
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result) override;
|
||||
|
||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
|
||||
void unmapBuffers(const std::vector<unsigned int> &ids) override;
|
||||
|
|
|
@ -158,7 +158,9 @@ public:
|
|||
|
||||
virtual void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) = 0;
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result) = 0;
|
||||
|
||||
virtual void mapBuffers(const std::vector<IPABuffer> &buffers) = 0;
|
||||
virtual void unmapBuffers(const std::vector<unsigned int> &ids) = 0;
|
||||
|
|
|
@ -166,7 +166,10 @@ void IPAInterfaceWrapper::configure(struct ipa_context *_ctx,
|
|||
entityControls.emplace(id, infoMaps[id]);
|
||||
}
|
||||
|
||||
ctx->ipa_->configure(sensorInfo, ipaStreams, entityControls);
|
||||
/* \todo Translate the ipaConfig and result. */
|
||||
IPAOperationData ipaConfig;
|
||||
ctx->ipa_->configure(sensorInfo, ipaStreams, entityControls, ipaConfig,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void IPAInterfaceWrapper::map_buffers(struct ipa_context *_ctx,
|
||||
|
|
|
@ -79,7 +79,9 @@ public:
|
|||
|
||||
void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override;
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &data,
|
||||
IPAOperationData *response) override;
|
||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
|
||||
void unmapBuffers(const std::vector<unsigned int> &ids) override;
|
||||
void processEvent(const IPAOperationData &event) override;
|
||||
|
@ -187,7 +189,9 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo)
|
|||
|
||||
void IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls)
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result)
|
||||
{
|
||||
if (entityControls.empty())
|
||||
return;
|
||||
|
|
|
@ -39,7 +39,9 @@ public:
|
|||
|
||||
void configure(const CameraSensorInfo &info,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override;
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *response) override;
|
||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
|
||||
void unmapBuffers(const std::vector<unsigned int> &ids) override;
|
||||
void processEvent(const IPAOperationData &event) override;
|
||||
|
@ -76,7 +78,9 @@ private:
|
|||
*/
|
||||
void IPARkISP1::configure(const CameraSensorInfo &info,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls)
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result)
|
||||
{
|
||||
if (entityControls.empty())
|
||||
return;
|
||||
|
|
|
@ -39,7 +39,9 @@ public:
|
|||
|
||||
void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override {}
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result) override {}
|
||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override {}
|
||||
void unmapBuffers(const std::vector<unsigned int> &ids) override {}
|
||||
void processEvent(const IPAOperationData &event) override {}
|
||||
|
|
|
@ -110,10 +110,13 @@ void IPAContextWrapper::stop()
|
|||
|
||||
void IPAContextWrapper::configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls)
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result)
|
||||
{
|
||||
if (intf_)
|
||||
return intf_->configure(sensorInfo, streamConfig, entityControls);
|
||||
return intf_->configure(sensorInfo, streamConfig,
|
||||
entityControls, ipaConfig, result);
|
||||
|
||||
if (!ctx_)
|
||||
return;
|
||||
|
@ -174,6 +177,7 @@ void IPAContextWrapper::configure(const CameraSensorInfo &sensorInfo,
|
|||
++i;
|
||||
}
|
||||
|
||||
/* \todo Translate the ipaConfig and reponse */
|
||||
ctx_->ops->configure(ctx_, &sensor_info, c_streams, streamConfig.size(),
|
||||
c_info_maps, entityControls.size());
|
||||
}
|
||||
|
|
|
@ -557,6 +557,8 @@ namespace libcamera {
|
|||
* \param[in] sensorInfo Camera sensor information
|
||||
* \param[in] streamConfig Configuration of all active streams
|
||||
* \param[in] entityControls Controls provided by the pipeline entities
|
||||
* \param[in] ipaConfig Pipeline-handler-specific configuration data
|
||||
* \param[out] result Pipeline-handler-specific configuration result
|
||||
*
|
||||
* This method shall be called when the camera is started to inform the IPA of
|
||||
* the camera's streams and the sensor settings. The meaning of the numerical
|
||||
|
@ -566,6 +568,11 @@ namespace libcamera {
|
|||
* The \a sensorInfo conveys information about the camera sensor settings that
|
||||
* the pipeline handler has selected for the configuration. The IPA may use
|
||||
* that information to tune its algorithms.
|
||||
*
|
||||
* The \a ipaConfig and \a result parameters carry custom data passed by the
|
||||
* pipeline handler to the IPA and back. The pipeline handler may set the \a
|
||||
* result parameter to null if the IPA protocol doesn't need to pass a result
|
||||
* back through the configure() function.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1034,7 +1034,9 @@ int PipelineHandlerRPi::configureIPA(Camera *camera)
|
|||
}
|
||||
|
||||
/* Ready the IPA - it must know about the sensor resolution. */
|
||||
data->ipa_->configure(sensorInfo, streamConfig, entityControls);
|
||||
IPAOperationData ipaConfig;
|
||||
data->ipa_->configure(sensorInfo, streamConfig, entityControls,
|
||||
ipaConfig, nullptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -855,7 +855,9 @@ int PipelineHandlerRkISP1::start(Camera *camera)
|
|||
std::map<unsigned int, const ControlInfoMap &> entityControls;
|
||||
entityControls.emplace(0, data->sensor_->controls());
|
||||
|
||||
data->ipa_->configure(sensorInfo, streamConfig, entityControls);
|
||||
IPAOperationData ipaConfig;
|
||||
data->ipa_->configure(sensorInfo, streamConfig, entityControls,
|
||||
ipaConfig, nullptr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ public:
|
|||
void stop() override {}
|
||||
void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override {}
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result) override {}
|
||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override {}
|
||||
void unmapBuffers(const std::vector<unsigned int> &ids) override {}
|
||||
void processEvent(const IPAOperationData &event) override {}
|
||||
|
|
|
@ -31,7 +31,9 @@ public:
|
|||
|
||||
void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override;
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result) override;
|
||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
|
||||
void unmapBuffers(const std::vector<unsigned int> &ids) override;
|
||||
void processEvent(const IPAOperationData &event) override;
|
||||
|
@ -129,9 +131,12 @@ void IPAProxyThread::stop()
|
|||
|
||||
void IPAProxyThread::configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls)
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result)
|
||||
{
|
||||
ipa_->configure(sensorInfo, streamConfig, entityControls);
|
||||
ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,
|
||||
result);
|
||||
}
|
||||
|
||||
void IPAProxyThread::mapBuffers(const std::vector<IPABuffer> &buffers)
|
||||
|
|
|
@ -69,7 +69,9 @@ public:
|
|||
|
||||
void configure(const CameraSensorInfo &sensorInfo,
|
||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override
|
||||
const std::map<unsigned int, const ControlInfoMap &> &entityControls,
|
||||
const IPAOperationData &ipaConfig,
|
||||
IPAOperationData *result) override
|
||||
{
|
||||
/* Verify sensorInfo. */
|
||||
if (sensorInfo.outputSize.width != 2560 ||
|
||||
|
@ -317,7 +319,9 @@ protected:
|
|||
};
|
||||
std::map<unsigned int, const ControlInfoMap &> controlInfo;
|
||||
controlInfo.emplace(42, subdev_->controls());
|
||||
ret = INVOKE(configure, sensorInfo, config, controlInfo);
|
||||
IPAOperationData ipaConfig;
|
||||
ret = INVOKE(configure, sensorInfo, config, controlInfo,
|
||||
ipaConfig, nullptr);
|
||||
if (ret == TestFail)
|
||||
return TestFail;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue